当前位置:网站首页>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;
}
边栏推荐
- C#运算符
- 浏览器node事件循环
- Leetcode - Sword finger offer 51 Reverse pairs in an array
- Why do programmers have the idea that code can run without moving? Is it poisonous? Or what?
- 移动式布局(流式布局)
- js2day(又是i++和++i,if语句,三元运算符,switch、while语句,for循环语句)
- About the loading of layer web spring layer components, the position of the layer is centered
- Enhance network security of kubernetes with cilium
- Redis introduction, scenario and data type
- [ybtoj advanced training guide] similar string [string] [simulation]
猜你喜欢

Hash table acwing 840 Simulated hash table
![JDBC prevent SQL injection problems and solutions [preparedstatement]](/img/32/f71f5a31cdf710704267ff100b85d7.png)
JDBC prevent SQL injection problems and solutions [preparedstatement]

Floyd AcWing 854. Floyd求最短路

浏览器存储方案

js3day(数组操作,js冒泡排序,函数,调试窗口,作用域及作用域链,匿名函数,对象,Math对象)

Direct control PTZ PTZ PTZ PTZ camera debugging (c)

"As a junior college student, I found out how difficult it is to counter attack after graduation."

High performance erasure code coding

面渣逆袭:MySQL六十六问,两万字+五十图详解!有点六
![[ybtoj advanced training guidance] judgment overflow [error]](/img/be/bbe357ac2f2a8839afc5af47db88d0.jpg)
[ybtoj advanced training guidance] judgment overflow [error]
随机推荐
ArrayList与LinkedList效率的对比
Hash table acwing 840 Simulated hash table
1380. Lucky numbers in the matrix [two-dimensional array, matrix]
Linear DP acwing 898 Number triangle
面渣逆袭:MySQL六十六问,两万字+五十图详解!有点六
Does C language srand need to reseed? Should srand be placed in the loop? Pseudo random function Rand
趣味 面试题
spfa AcWing 852. SPFA judgement negative ring
bellman-ford AcWing 853. Shortest path with side limit
Why do programmers have the idea that code can run without moving? Is it poisonous? Or what?
Interview questions for software testing - a collection of interview questions for large factories in 2022
Mongodb redis differences
js5day(事件监听,函数赋值给变量,回调函数,环境对象this,全选反选案例,tab栏案例)
JDBC 预防sql注入问题与解决方法[PreparedStatement]
Visual studio efficient and practical extension tools and plug-ins
软件测试面试题-2022年大厂面试题合集
染色法判定二分图 AcWing 860. 染色法判定二分图
In development, why do you find someone who is paid more than you but doesn't write any code?
JSON serialization and parsing
绕过ObRegisterCallbacks需要驱动签名方法