关于读取应用程序版本号的问题
目前应用程序的版本号为8.3.2.66871,我用下面的代码读取来却出错,得出的值的十六进制为8.3.2.0537.最后一个的值应该是10537,读出来却是0537,把前面一个1给丢了,因为一个WORD最大支持FFFF,也就是65535。请高手指点。
typedef struct tagVersionInfo
{
BYTE btOSImgVer1; //bit15-8
BYTE btOSImgVer2; //bit0-7
BYTE btReserved1;
BYTE btReserved2;
DWORD dwProductVersoion1;
DWORD dwProductVersoion2;
DWORD dwProductVersoion3;
DWORD dwProductVersoion4;
}VERSIONINFO,*LPVERSIONINFO;
typedef struct tagAPPVERSION
{
DWORD dwFileVersion1;
DWORD dwFileVersion2;
DWORD dwFileVersion3;
DWORD dwFileVersion4;
DWORD dwProductVersion1;
DWORD dwProductVersion2;
DWORD dwProductVersion3;
DWORD dwProductVersion4;
}APPVERSION;
VERSIONINFO vi = {0};
DWORD dwVersionInfoSize;
DWORD dwHandle;
VS_FIXEDFILEINFO *ffi = NULL;
APPVERSION AppVersion;
APPVERSION* lpAppVersion=&AppVersion;
VOID GetVersion()
{
dwVersionInfoSize = GetFileVersionInfoSize(IGO_AP, &dwHandle);
if(dwVersionInfoSize>0)
{
pbyBuffer = new char[dwVersionInfoSize];
if(GetFileVersionInfo(IGO_AP,NULL, dwVersionInfoSize,pbyBuffer))
{
int bReturn = VerQueryValue(pbyBuffer, _T("\\"), reinterpret_cast<void**>(&ffi), &nVersionInfoLen);
lpAppVersion->dwFileVersion1 = HIWORD(ffi->dwFileVersionMS);
lpAppVersion->dwFileVersion2 = LOWORD(ffi->dwFileVersionMS);
lpAppVersion->dwFileVersion3 = HIWORD(ffi->dwFileVersionLS);
lpAppVersion->dwFileVersion4 = LOWORD(ffi->dwFileVersionLS);
lpAppVersion->dwProductVersion1 = HIWORD(ffi->dwProductVersionMS);
lpAppVersion->dwProductVersion2 = LOWORD(ffi->dwProductVersionMS);
lpAppVersion->dwProductVersion3 = HIWORD(ffi->dwProductVersionLS);
lpAppVersion->dwProductVersion4 = LOWORD(ffi->dwProductVersionLS);
}
delete [] pbyBuffer;
}
vi.dwProductVersoion1 = lpAppVersion->dwProductVersion1;
vi.dwProductVersoion2 = lpAppVersion->dwProductVersion2;
vi.dwProductVersoion3 = lpAppVersion->dwProductVersion3;
vi.dwProductVersoion4 = lpAppVersion->dwProductVersion4;
}