//to get file version number
Unsigned AMajor AMinor, ARelease ABuild;
DWORD InfoSize;
Unsigned int uiLen;
UnicodeString ucsTmp=ParamStr (0);
VS_FIXEDFILEINFO * pstFix=new VS_FIXEDFILEINFO;
BYTE * pBye=new BYTE [InfoSize];
InfoSize=GetFileVersionInfoSize (ucsTmp w_str (), NULL);
Bool bRet=GetFileVersionInfo (ucsTmp w_str (), NULL, InfoSize, (LPVOID) pBye);
If (bRet) {
UcsTmp="\ ";
BRet=VerQueryValue ((LPVOID) pBye, ucsTmp w_str (), (LPVOID *) (& amp; PstFix), PUINT (& amp; UiLen));
If (bRet) {
UnVersion unV;
UnV. DwVersion=pstFix - & gt; DwFileVersionMS;
AMinor=unV. St. plans;
AMajor=unV. St. usLo;
UnV. DwVersion=pstFix - & gt; DwFileVersionLS;
ABuild=unV. St. plans;
ARelease=unV. St. usLo;
LbVersion - & gt; Caption=Format (" product version: % d, % d, % d, % d ", ARRAYOFCONST ((AMajor AMinor, ARelease, ABuild)));
}
}
//delete pstFix;
The delete [] pBye;
Question:
The penultimate line, releasing structure pstFix error, error image is as follows:
CodePudding user response:
Your line 6 and line 7 will also change the position errorCodePudding user response:
Tried to make a mistake, and it is the same mistake!!!!!!CodePudding user response:
Have no attention? Your top...CodePudding user response:
I think you want to delete, it should be "VS_FIXEDFILEINFO * pstFix=new VS_FIXEDFILEINFO;" In this new VS_FIXEDFILEINFO, want to consider, when performing "bRet=VerQueryValue ((LPVOID) pBye, ucsTmp w_str (), (LPVOID *) (& amp; PstFix), PUINT (& amp; UiLen));" After pstFix value (address) or new VS_FIXEDFILEINFO get the address of the original value? Here pstFix should not need to allocate memory, perform VerQueryValue function after pstFix is pointing to a structure with VS_FIXEDFILEINFO address, and, in the "BYTE * pBye=new BYTE [InfoSize];" , InfoSize haven't get the initial value,