J
jpshortstuff
Hi, not sure if this is the right place for this but it was definitely the
closest I could find.
I am having trouble with the GetFileVersionInformation/VerQueryValue
functions and was wondering if anyone could help.
All I am trying to do is obtain a string representation of a Version Info
value for a given file. Currently, I am only getting strange unicode
characters, so not sure if my problem is in the understanding of the
functions or of the syntax surrounding char sequences/pointers. I am not
totally at ease with the information in the Win32 API about VerQueryValue to
be honest with you.
Here is the code I am currently using:
LPDWORD temp; //dummy value for GetFileVersionInfoSize function
DWORD size = GetFileVersionInfoSize((char*)name.c_str(), temp); //Store size
of version info
delete temp; //delete dummy value
char* fvBuf = new char[size]; //buffer to hold version info
GetFileVersionInfo((char*)name.c_str(), 0, size, fvBuf); //get version info
UINT bufLen; //buffer to hold length of version info string
char* tempBuf = new char[size];//buffer to hold version info string
VerQueryValue(fvBuf, TEXT("\\StringFileInfo\\040904E4\\FileDescription"),
(LPVOID*)(&tempBuf), &bufLen); //supposedly get version info string and store
in tempBuf
out << tempBuf << "\n"; //output version info string to my output stream.
Thanks in advance for any info/assistance with this little issue, sorry if I
am way off course here.
Cheers.
closest I could find.
I am having trouble with the GetFileVersionInformation/VerQueryValue
functions and was wondering if anyone could help.
All I am trying to do is obtain a string representation of a Version Info
value for a given file. Currently, I am only getting strange unicode
characters, so not sure if my problem is in the understanding of the
functions or of the syntax surrounding char sequences/pointers. I am not
totally at ease with the information in the Win32 API about VerQueryValue to
be honest with you.
Here is the code I am currently using:
LPDWORD temp; //dummy value for GetFileVersionInfoSize function
DWORD size = GetFileVersionInfoSize((char*)name.c_str(), temp); //Store size
of version info
delete temp; //delete dummy value
char* fvBuf = new char[size]; //buffer to hold version info
GetFileVersionInfo((char*)name.c_str(), 0, size, fvBuf); //get version info
UINT bufLen; //buffer to hold length of version info string
char* tempBuf = new char[size];//buffer to hold version info string
VerQueryValue(fvBuf, TEXT("\\StringFileInfo\\040904E4\\FileDescription"),
(LPVOID*)(&tempBuf), &bufLen); //supposedly get version info string and store
in tempBuf
out << tempBuf << "\n"; //output version info string to my output stream.
Thanks in advance for any info/assistance with this little issue, sorry if I
am way off course here.
Cheers.