当前位置:网站首页>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;
}
边栏推荐
- Sweetheart leader: Wang Xinling
- 获取文件版权信息
- Redis bloom filter
- 线性DP AcWing 895. 最长上升子序列
- Bom Dom
- H5 to app
- . Net, C # basic knowledge
- Win10 system OmniPeek wireless packet capturing network card driver failed to install due to digital signature problem solution
- Interesting interview questions
- 一些突然迸发出的程序思想(模块化处理)
猜你喜欢

深拷贝 事件总线

Js7day (event object, event flow, event capture and bubble, prevent event flow, event delegation, student information table cases)

染色法判定二分图 AcWing 860. 染色法判定二分图

Why do programmers have the idea that code can run without moving? Is it poisonous? Or what?

PR 2021 quick start tutorial, learn about the and functions of the timeline panel

Js1day (syntaxe d'entrée / sortie, type de données, conversion de type de données, Var et let différenciés)

线性DP AcWing 902. 最短编辑距离

Linear DP acwing 899 Edit distance

JSON序列化 与 解析

Browser storage scheme
随机推荐
线性DP AcWing 902. 最短编辑距离
JS iterator generator asynchronous code processing promise+ generator - > await/async
Oracle从入门到精通(第4版)
Window10 upgrade encountered a big hole error code: 0xc000000e perfect solution
线性DP AcWing 899. 编辑距离
防抖 节流
spfa AcWing 851. spfa求最短路
Dijkstra AcWing 850. Dijkstra求最短路 II
Browser storage scheme
JDBC 预防sql注入问题与解决方法[PreparedStatement]
区间DP AcWing 282. 石子合并
Heap acwing 838 Heap sort
Interview with meituan, a 34 year old programmer, was rejected: only those under the age of 30 who work hard and earn little overtime
Enhance network security of kubernetes with cilium
线性DP AcWing 896. 最长上升子序列 II
Counting class DP acwing 900 Integer partition
This "little routine" is set on the dough cake of instant noodles. No wonder programmers are always hungry
js1day(輸入輸出語法,數據類型,數據類型轉換,var和let區別)
Docsify deploy IIS
Browser node event loop