Home > Windows API > Extracting version information of modules!

Extracting version information of modules!

Use GetFileVersionInfoSize, GetFileVersionInfo and VerQueryValue.

DWORD dwHandle = 0;

// Get version size
const DWORD dwSize = GetFileVersionInfoSize( lptszFileName, &dwHandle );

// Is size valid
if( !dwSize )
    return false;

// Allocate version data buffer
PUCHAR* pVersionData = new UCHAR[ dwSize ];
if( !pVersionData )
    return false;

if( !GetFileVersionInfo( lptszFileName, dwHandle, dwSize, pVersionData ))
    delete [] pVersionData;
    return false;

// Get product version from version block
VerQueryValue( pVersionData, 
               _T( \StringFileInfo40904B0\ProductVersion" ),
               &uVersionDataLength );
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: