当前位置:网站首页>获取文件版权信息
获取文件版权信息
2022-07-02 09:45:00 【如鹿渴慕泉水】
BOOL lsGetFileLegalCopyright(LPCTSTR lptstrFilename, CString& strData)
{
if (lptstrFilename == NULL)
return FALSE;
DWORD dwHandle;
UINT dwBytesNeeded = GetFileVersionInfoSize(lptstrFilename, &dwHandle);
if (dwBytesNeeded > 0)
{
BYTE* lpVersionBlock = new BYTE[dwBytesNeeded];
if (lpVersionBlock == NULL)
return FALSE;
if (GetFileVersionInfo(lptstrFilename, 0, dwBytesNeeded, lpVersionBlock))
{
BYTE* lpTranslate = NULL;
if (VerQueryValue(lpVersionBlock, TEXT("\\VarFileInfo\\Translation"), (LPVOID*)&lpTranslate, &dwBytesNeeded) &&
(lpTranslate != NULL))
{
CString strSubBlock = TEXT(""), strTranslate = TEXT(""), strTranslation = TEXT("");
strTranslate.Format(TEXT("000%x"), *((unsigned short int*)lpTranslate));
strTranslation = strTranslate.Right(4);
strTranslate.Format(TEXT("000%x"), *((unsigned short int*) & lpTranslate[2]));
strTranslation += strTranslate.Right(4);
strSubBlock.Format(TEXT("\\StringFileInfo\\%s\\LegalCopyright"), strTranslation.GetBuffer(0));
if (VerQueryValue(lpVersionBlock, strSubBlock.GetBuffer(0), (LPVOID*)&lpTranslate, &dwBytesNeeded) &&
(lpTranslate != NULL))
{
strData.Format(TEXT("%s"), lpTranslate);
//LPTSTR lpszData = new TCHAR [dwBytesNeeded + 1];//强制多添加几个
//memset(lpszData, 0, sizeof(TCHAR)*(dwBytesNeeded + 1));
//memcpy(lpszData, lpTranslate, dwBytesNeeded);
//lpszData[dwBytesNeeded] = '\0'; //强制结尾
//strData.Format(TEXT("%s"), lpszData);
//delete [] lpszData;
}
delete[] lpVersionBlock;
return TRUE;
}
}
delete[] lpVersionBlock;
}
return FALSE;
}
边栏推荐
- drools执行指定的规则
- Docker-compose配置Mysql,Redis,MongoDB
- Win10 system OmniPeek wireless packet capturing network card driver failed to install due to digital signature problem solution
- Enhance network security of kubernetes with cilium
- 浏览器node事件循环
- LeetCode—剑指 Offer 51. 数组中的逆序对
- Use sqoop to export ads layer data to MySQL
- 线性DP AcWing 899. 编辑距离
- Programmers can't find jobs after the age of 35? After reading this article, you may be able to find the answer
- ArrayList与LinkedList效率的对比
猜你喜欢
Go学习笔记—多线程
Direct control PTZ PTZ PTZ PTZ camera debugging (c)
哈希表 AcWing 841. 字符串哈希
寻找二叉树中任意两个数的公共祖先
kubenetes中port、targetPort、nodePort、containerPort的区别与联系
Docker compose configuration mysql, redis, mongodb
The programmer and the female nurse went on a blind date and spent 360. He packed leftovers and was stunned when he received wechat at night
AI mid stage technology research
arcgis js 4. Add pictures to x map
JS8day(滚动事件(scroll家族),offset家族,client家族,轮播图案例(待做))
随机推荐
Programmers can't find jobs after the age of 35? After reading this article, you may be able to find the answer
Calculate the maximum path sum of binary tree
IPhone 6 plus is listed in Apple's "retro products" list
Shuttle encapsulated AppBar
String palindrome hash template question o (1) judge whether the string is palindrome
Why do programmers have the idea that code can run without moving? Is it poisonous? Or what?
堆 AcWing 839. 模拟堆
Input box assembly of the shutter package
Openssh remote enumeration username vulnerability (cve-2018-15473)
VLAN experiment
Sparkcontext: error initializing sparkcontext solution
Anti shake throttle
Day12 control flow if switch while do While guessing numbers game
区间DP AcWing 282. 石子合并
1380. Lucky numbers in the matrix [two-dimensional array, matrix]
About asp Net MVC project in local vs running response time is too long to access, the solution!
drools执行完某个规则后终止别的规则执行
考研英语二大作文模板/图表作文,英语图表作文这一篇就够了
基于STM32的OLED 屏幕驱动
When uploading a file, the server reports an error: iofileuploadexception: processing of multipart / form data request failed There is no space on the device