Is this a common bug? Is there a fix forit?
I don't think I've ever had a problem like that with
GetFileVersionInfoSize() and I use it pretty often. It's hard to say
what may be wrong without seeing your code, but I'll post the way I
usually call it. Maybe that will help.
/*static*/ BOOL GetAppVersion( DWORD* MSB, DWORD* LSB )
{
TCHAR pcEXE[ MAX_PATH ] = { 0 };
if( !GetModuleFileName( NULL, pcEXE, MAX_PATH - 1 ) )
return FALSE;
DWORD dwZero = 0;
DWORD dwSize = ::GetFileVersionInfoSize( pcEXE, &dwZero );
if( dwSize <= 0 )
return FALSE;
std::vector< DWORD > version( dwSize );
if( !GetFileVersionInfo( pcEXE, 0, dwSize, &version.front() ) )
return FALSE;
UINT len = 0;
VS_FIXEDFILEINFO *pInfo = NULL;
VerQueryValue( &version.front(),
_T( "\\" ),
reinterpret_cast< LPVOID* >( &pInfo ),
&len );
if( pInfo == NULL )
return FALSE;
*LSB = pInfo->dwFileVersionLS;
*MSB = pInfo->dwFileVersionMS;
return TRUE;
}
DWORD MSB = 0,
LSB = 0;
if( GetAppVersion( &MSB, &LSB ) )
{
TCHAR szVer[ 50 ] = { 0 };
_stprintf_s( szVer,
#ifdef _DEBUG
_T( "MyApp v%u.%u.%uD" ),
#else
_T( "MyApp v%u.%u.%u" ),
#endif
HIWORD( MSB ),
LOWORD( MSB ),
HIWORD( LSB ) );
//...
}
-PaulH
I call it the same way, like this:
// read file version info
DWORD dwDummyHandle = 0; // will always be set to zero
DWORD len = ::GetFileVersionInfoSize( p_pszFilePath, &dwDummyHandle);
The Filename including the path is a input parameter from the function.
Also, the function is working correct, len has the correct value and also
all other calls are working properly and returning the correct values. Only
the debugger (VS 2005, SP1) comes with a message, that there are no more
debug symbols available (which seems actually true). It also works fine, if I
get the VersionInformation of a different file because then the current
module isn't loaded twice and unloaded.
RogerBrigge wrote:
Loosing debug symbols after calling GetFileVersionInfoSize
04-Nov-08
EggHeadCafe - Software Developer Portal of Choice
Excel Macros - Create And Run in C# at Runtime
http://www.eggheadcafe.com/tutorials/aspnet/fc339e7c-ce0f-4a1e-96fc-5ef649a032b9/excel-macros--create-and.aspx