I have the Version Info in resources declared:
100 VERSIONINFO
FILEVERSION 1,0,0,2
PRODUCTVERSION 1,0,0,2
FILEOS VOS_NT
FILETYPE VFT_APP
{
BLOCK "StringFileInfo"
{
BLOCK "000004b0"
{
VALUE "FileDescription", "My application"
VALUE "FileVersion", "1.0.0.2"
VALUE "InternalName", "app.exe"
VALUE "LegalCopyright", "Copyright ? 2012 by David."
VALUE "OriginalFilename", "app.exe"
VALUE "ProductName", "app"
VALUE "ProductVersion", "1.0.0.2"
VALUE "Assembly Version", "1.0.0.2"
}
}
BLOCK "VarFileInfo"
{
VALUE "Translation", 0x0000 0x04B0
}
}
I am getting Version Info this way:
HRSRC hResInfo;
HGLOBAL hResData;
LPCVOID pRes;
UINT uLen;
VS_FIXEDFILEINFO *lpFfi;
hResInfo = FindResource(hInst, MAKEINTRESOURCE(100), RT_VERSION);
MessageBox(0, "FindResource", 0,0);
hResData = LoadResource(hInst, hResInfo);
MessageBox(0, "LoadResource", 0,0);
pRes = LockResource(hResData);
MessageBox(0, "LockResource", 0,0);
VerQueryValue(pRes, "" ,(LPVOID*)&lpFfi, &uLen);
MessageBox(0, "VerQueryValue", 0,0);
FreeResource(hResData);
DWORD dwFileVersionMS = lpFfi->dwFileVersionMS;
DWORD dwFileVersionLS = lpFfi->dwFileVersionLS;
DWORD dwLeftMost = HIWORD(dwFileVersionMS);
DWORD dwSecondLeft = LOWORD(dwFileVersionMS);
DWORD dwSecondRight = HIWORD(dwFileVersionLS);
DWORD dwRightMost = LOWORD(dwFileVersionLS);
In function VerQueryValue is an error, because program breaks (MessageBox with text "VerQueryValue" doesn't show) and Visual C++ shows me the following message:
First-chance exception at 0x77bf15a5 in ProxyCU.exe: 0xC0000005:
Access violation writing location 0x00483192.
How to repair this code?
Regards, David
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…