当前位置:网站首页>Obtain file copyright information
Obtain file copyright information
2022-07-02 12:46:00 【As the deer 】
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];// Force to add more
//memset(lpszData, 0, sizeof(TCHAR)*(dwBytesNeeded + 1));
//memcpy(lpszData, lpTranslate, dwBytesNeeded);
//lpszData[dwBytesNeeded] = '\0'; // Forced ending
//strData.Format(TEXT("%s"), lpszData);
//delete [] lpszData;
}
delete[] lpVersionBlock;
return TRUE;
}
}
delete[] lpVersionBlock;
}
return FALSE;
}
边栏推荐
- spfa AcWing 851. SPFA finding the shortest path
- Leetcode - < dynamic planning special> Jianzhi offer 19, 49, 60
- 架构师必须了解的 5 种最佳软件架构模式
- JS6day(DOM结点的查找、增加、删除。实例化时间,时间戳,时间戳的案例,重绘和回流)
- In development, why do you find someone who is paid more than you but doesn't write any code?
- 哈希表 AcWing 840. 模拟散列表
- Direct control PTZ PTZ PTZ PTZ camera debugging (c)
- . Net wechat message template push
- Typora+docsify quick start
- Js1day (syntaxe d'entrée / sortie, type de données, conversion de type de données, Var et let différenciés)
猜你喜欢
Browser node event loop
Direct control PTZ PTZ PTZ PTZ camera debugging (c)
AI mid stage technology research
Heap acwing 838 Heap sort
Floyd AcWing 854. Floyd finds the shortest path
js4day(DOM开始:获取DOM元素内容,修改元素样式,修改表单元素属性,setInterval定时器,轮播图案例)
Win10 system OmniPeek wireless packet capturing network card driver failed to install due to digital signature problem solution
3 A VTT端接 稳压器 NCP51200MNTXG资料
[ybtoj advanced training guidance] judgment overflow [error]
趣味 面试题
随机推荐
腾讯三面:进程写文件过程中,进程崩溃了,文件数据会丢吗?
High performance erasure code coding
How to write a pleasing English mathematical paper
Why do programmers have the idea that code can run without moving? Is it poisonous? Or what?
Execute any method of any class through reflection
8A 同步降压稳压器 TPS568230RJER_规格信息
About wechat enterprise payment to change x509certificate2 read certificate information, publish to the server can not access the solution
Does C language srand need to reseed? Should srand be placed in the loop? Pseudo random function Rand
What is the relationship between NFT and metauniverse? How to view the market? The future market trend of NFT
Anxiety of a 211 programmer: working for 3 years with a monthly salary of less than 30000, worried about being replaced by fresh students
Interesting interview questions
百款拿来就能用的网页特效,不来看看吗?
Redis introduction, scenario and data type
AI mid stage technology research
Use sqoop to export ads layer data to MySQL
架构师必须了解的 5 种最佳软件架构模式
About asp Net MVC project in local vs running response time is too long to access, the solution!
spfa AcWing 852. spfa判断负环
Heap acwing 839 Simulated reactor
[ybtoj advanced training guidance] judgment overflow [error]