Hi ed,
use this..
if you want exe please let me know
void PrintFileVersion(DWORD Major,DWORD Minor)
{
DWORD Tup= Major&0xffff0000, Tdn=
Minor&0xffff0000;
Tup= Tup>>16; Tdn=Tdn>>16;
printf("File Version = %d.%d.%d.%d\n",Tup,
(0x0000ffff & Major ) ,Tdn,(0x0000ffff & Minor) );
}
void PrintProductVersion(DWORD Major,DWORD Minor)
{
DWORD Tup= Major&0xffff0000, Tdn=
Minor&0xffff0000;
Tup= Tup>>16; Tdn=Tdn>>16;
printf("Product Version = %d.%d.%d.%d\n",Tup,
(0x0000ffff & Major ) ,Tdn,(0x0000ffff & Minor) );
}
// DLLinfo.cpp : Defines the entry point for the console
application.
//
#include <shlwapi.h>
#include <tchar.h>
#include <windows.h>
#include <stdio.h>
#include "stdafx.h"
struct TRANSLATION {
WORD langID; // language ID
WORD charset; // character set (code page)
} translation;
#ifndef DLLVERSIONINFO
// following is from shlwapi.h, in November 1997 release
of the Windows SDK
typedef struct _DllVersionInfo
{
DWORD cbSize;
DWORD dwMajorVersion; // Major
version
DWORD dwMinorVersion; // Minor
version
DWORD dwBuildNumber; // Build number
DWORD dwPlatformID; //
DLLVER_PLATFORM_*
} DLLVERSIONINFO;
// Platform IDs for DLLVERSIONINFO
#define DLLVER_PLATFORM_WINDOWS 0x00000001 //
Windows 95
#define DLLVER_PLATFORM_NT 0x00000002 //
Windows NT
#endif // DLLVERSIONINFO
// typedef for DllGetVersion proc
typedef HRESULT (CALLBACK* DLLGETVERSIONPROC)
(DLLVERSIONINFO *);
int main(int argc, char* argv[])
{
int len = 0;
BYTE *pVersionInfo =NULL;
VS_FIXEDFILEINFO *lpvi;
UINT iLen;
DLLVERSIONINFO dvi;
if(argc<2)
{
printf("\t\t*****Usage*******
\nDLLinfo.exe DLL File name\n") ;
printf("\n\nComments & any additions can
be sent to \n\n\tshrinidhi.kulkarni\n");
return 0;
}
TCHAR filename[MAX_PATH+1];
MultiByteToWideChar(CP_OEMCP, 0,argv[1],
MAX_PATH+1,filename, MAX_PATH+1);
// read file version info
DWORD dwDummyHandle=0; // will always be set to zero
len = GetFileVersionInfoSize(filename, &dwDummyHandle);
if (len <= 0)
return FALSE;
pVersionInfo = new BYTE[len]; // allocate version info
if (!::GetFileVersionInfo(filename, 0, len,
pVersionInfo))
return FALSE;
if (!VerQueryValue(pVersionInfo, _T("\\"), (LPVOID *)
&lpvi, &iLen))
return FALSE;
// copy fixed info to myself, which am derived from
VS_FIXEDFILEINFO
//PrintFileSubtype(lpvi->dwFileSubtype );
// PrintDwFileOS(lpvi->dwFileOS);
//PrintDwFileFlags(lpvi->dwFileFlags);
PrintFileVersion(lpvi->dwFileVersionMS,lpvi-
PrintProductVersion(lpvi->dwProductVersionMS ,lpvi-
// Get translation info
/*if (VerQueryValue(pVersionInfo,
_T("\\VarFileInfo\\Translation"), (LPVOID *)&lpvi,
&iLen) && iLen >= 4)
{
translation = *(TRANSLATION*)lpvi;
PrintTranslationInfo
(translation.charset , translation.langID );
}
*/
delete [] pVersionInfo ;
return 0;
}
HTH,
--
With Thanks & Regards,
Shrinidhi.Kulkarni
5732293x5244
-----Original Message-----
what is an easy way to retrieve the Private Build Description on an exe?
This exe is not part of the program I'm building.
thanks in advance,
ed
.