Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Loosing debug symbols after calling GetFileVersionInfoSize

6 views
Skip to first unread message

Roger Briggen

unread,
Nov 4, 2008, 5:55:02 AM11/4/08
to
I can debug my application with symbols support without any problems.
As soon as I call GetFileVersionInfoSize where the filename is my current
application, I loose the debug symbols in VS 2005. (In the output window I
can see, that VS 2005 is loading and unloading the application for reading
the version information). So, after this line, I can only debug with the
assembly window, which is very annoying.
I am debugging without activesync over ethernet, and my VS 2005 is in German.

Is this a common bug? Is there a fix forit?

PaulH

unread,
Nov 4, 2008, 10:19:56 AM11/4/08
to
On Nov 4, 4:55 am, Roger Briggen

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

Roger Briggen

unread,
Nov 4, 2008, 10:28:01 AM11/4/08
to
Thanks for your reply.

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.

tomelfers

unread,
Oct 8, 2009, 9:54:06 AM10/8/09
to
Did you ever find a solution to this? I'm having the same problem now, exactly the same problem. Anyone else?
Tom E.

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

0 new messages