Article View: borland.public.cppbuilder.nativeapi
Article #3226Problem extracting version information from EXE
From: Kris
Date: Sun, 06 Aug 2006 11:04
Date: Sun, 06 Aug 2006 11:04
77 lines
3151 bytes
3151 bytes
Following version information is built with my EXE :
FileVersion : 51.62.73.84
ProductVersion : 3.4.5.6
Right-clicking in Explorer on the EXE and selecting the 2nd tab
(Version-tab) confirms that both these values are indeed present in
the EXE.
However, when I'm trying to retrieve this information myself I get
this output :
dwFileVersionMS...=0x33003e
dwFileVersionLS...=0x490055
dwProductVersionMS=0x33003e
dwProductVersionLS=0x490055
FileVersion=[51.62.73.85]
ProductVersion=[51.62.73.85]
For some strange reason my code results in ProductVersion having the
same value as FileVersion. Does anybody have any ideas on why this is
happening ?
//--------------------------------------------------------------------------
-
String Test::GetVersionInformationResourceField(String FilePathName) {
String FileVersion,ProductVersion;
DWORD Dummy;
DWORD InfoSize=GetFileVersionInfoSize(FilePathName.c_str(),&Dummy);
char *Buffer=new char[InfoSize];
if (GetFileVersionInfo(FilePathName.c_str(),0,InfoSize,Buffer))
{
unsigned int BufferLength;
VS_FIXEDFILEINFO *VersionInfo;
if (VerQueryValue(Buffer,"\\",(void**)&VersionInfo,&BufferLength))
{
Form1->DText("dwFileVersionMS...=0x%04x",VersionInfo->dwFileVersionMS);
Form1->DText("dwFileVersionLS...=0x%04x",VersionInfo->dwFileVersionLS);
Form1->DText(" ");
Form1->DText("dwProductVersionMS=0x%04x",VersionInfo->dwProductVersionMS
Form1->);
Form1->DText("dwProductVersionLS=0x%04x",VersionInfo->dwProductVersionLS
Form1->);
Form1->DText(" ");
FileVersion.printf("%d.%d.%d.%d",
HIWORD(VersionInfo->dwFileVersionMS),LOWORD(VersionInfo->dwFileVersionMS),
HIWORD(VersionInfo->dwFileVersionLS),LOWORD(VersionInfo->dwFileVersionLS));
Form1->DText("FileVersion=[%s]",FileVersion);
ProductVersion.printf("%d.%d.%d.%d",
HIWORD(VersionInfo->dwProductVersionMS),LOWORD(VersionInfo->dwProductVersion
MS),
HIWORD(VersionInfo->dwProductVersionLS),LOWORD(VersionInfo->dwProductVersion
LS));
Form1->DText("ProductVersion=[%s]",FileVersion);
Form1->DText(" ");
}
}
delete[] Buffer;
// return FileVersion;
return ProductVersion;
}
//--------------------------------------------------------------------------
-
Technical Details
Message-ID:
<23jbd29tqg0vjln1uve2kpjacpd4kkk4el@4ax.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,959957ffa3cd8000,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: Kris <test@test.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Problem extracting version information from EXE Date: Sun, 06 Aug 2006 13:04:34 +0200 Message-ID: <23jbd29tqg0vjln1uve2kpjacpd4kkk4el@4ax.com> X-Newsreader: Forte Free Agent 3.3/32.846 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 83.134.84.165 X-Trace: newsgroups.borland.com 1154862259 83.134.84.165 (6 Aug 2006 04:04:19 -0700) Lines: 77 Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail