获取文件版本信息
2011-11-04 12:05
253 查看
mark一下
char* szFileName = "C:\\windows\\system32\\cmd.exe"; DWORD dwSize = GetFileVersionInfoSize(szFileName,NULL); LPVOID pBlock = malloc(dwSize); GetFileVersionInfo(szFileName,0,dwSize,pBlock); char* pVerValue = NULL; UINT nSize = 0; VerQueryValue(pBlock,TEXT( "\\VarFileInfo\\Translation"), (LPVOID*)&pVerValue,&nSize); CString strSubBlock,strTranslation,strTemp; strTemp.Format( "000%x",*((unsigned short int *)pVerValue)); strTranslation = strTemp.Right(4); strTemp.Format( "000%x",*((unsigned short int *)&pVerValue[2])); strTranslation += strTemp.Right(4); //080404b0为中文,040904E4为英文 MessageBox(strTranslation); //文件描述 strSubBlock.Format("\\StringFileInfo\\%s\\FileDescription",strTranslation); VerQueryValue(pBlock,strSubBlock.GetBufferSetLength(256),(LPVOID*)&pVerValue,&nSize); strSubBlock.ReleaseBuffer(); strTemp.Format( "文件描述: %s ",pVerValue); AfxMessageBox(strTemp); //内部名称 strSubBlock.Format("\\StringFileInfo\\%s\\InternalName",strTranslation); VerQueryValue(pBlock,strSubBlock.GetBufferSetLength(256),(LPVOID*)&pVerValue,&nSize); strSubBlock.ReleaseBuffer(); strTemp.Format( "内部名称: %s ",pVerValue); AfxMessageBox(strTemp); //合法版权 strSubBlock.Format("\\StringFileInfo\\%s\\LegalTradeMarks",strTranslation); VerQueryValue(pBlock,strSubBlock.GetBufferSetLength(256),(LPVOID*)&pVerValue,&nSize); strSubBlock.ReleaseBuffer(); strTemp.Format( "合法版权: %s ",pVerValue); AfxMessageBox(strTemp); //原始文件名 strSubBlock.Format("\\StringFileInfo\\%s\\OriginalFileName",strTranslation); VerQueryValue(pBlock,strSubBlock.GetBufferSetLength(256),(LPVOID*)&pVerValue,&nSize); strSubBlock.ReleaseBuffer(); strTemp.Format( "原始文件名: %s ",pVerValue); AfxMessageBox(strTemp); //产品名称 strSubBlock.Format("\\StringFileInfo\\%s\\ProductName",strTranslation); VerQueryValue(pBlock,strSubBlock.GetBufferSetLength(256),(LPVOID*)&pVerValue,&nSize); strSubBlock.ReleaseBuffer(); strTemp.Format("产品名称: %s ",pVerValue); AfxMessageBox(strTemp); //产品版本 strSubBlock.Format("\\StringFileInfo\\%s\\ProductVersion",strTranslation); VerQueryValue(pBlock,strSubBlock.GetBufferSetLength(256),(LPVOID*)&pVerValue,&nSize); strSubBlock.ReleaseBuffer(); strTemp.Format("产品版本: %s ",pVerValue); AfxMessageBox(strTemp); //版权 strSubBlock.Format("\\StringFileInfo\\%s\\LegalCopyright",strTranslation); VerQueryValue(pBlock,strSubBlock.GetBufferSetLength(256),(LPVOID*)&pVerValue,&nSize); strSubBlock.ReleaseBuffer(); strTemp.Format("版权: %s ",pVerValue); AfxMessageBox(strTemp); //公司名 strSubBlock.Format("\\StringFileInfo\\%s\\CompanyName",strTranslation); VerQueryValue(pBlock,strSubBlock.GetBufferSetLength(256),(LPVOID*)&pVerValue,&nSize); strSubBlock.ReleaseBuffer(); strTemp.Format("公司名: %s ",pVerValue); AfxMessageBox(strTemp); free(pBlock);
相关文章推荐
- python获取文件版本信息、公司名和产品名的方法
- 获取文件的版本信息
- VS2010 C++ 通过CLR获取文件版本信息
- FileInfo 0.0.0004--masm32写的获取文件属性、版本、时间、MD5值等信息的小程序
- 对一个apk文件获取相应的版本信息和其他信息
- 获取文件版本信息
- vc代码获取文件版本信息
- 从资源文件中获取版本信息
- 利用WinAPI(GetFileVersionInfo)获取文件版本信息
- 获取Exe文件版本信息的函数(拷贝收藏)
- FileInfo 0.0.0003--masm32写的获取文件属性、版本、时间、MD5值等信息的小程序
- Android笔记之获取apk文件包名、版本信息
- 获取文件或者动态库版本信息
- Powershell 获取文件版本信息
- 获取Exe文件版本信息的函数(使用GetFileVersionInfo得到TFileVersionInfo结构体,包含12项内容)
- 获取手机上apk文件信息类,主要是判断是否安装再手机上了,安装的版本比较现有apk版本信息
- C#获取文件版本、文件大小等信息
- Android Studio获取release版本文件的SHA-1信息
- java通过解析文件获取apk版本等信息
- python版本、文件信息及时间获取函数实例