0

I have an application compiled for Compact Framework which I need to find the version number for using Delphi 2006. I am using the code below.

function VersionNumber(ExeFile: string): string;
var
  Size: Longint;
  Dummy: Cardinal;
  Buffer: Pointer;
  FileInfo: Pointer;
begin
  Size := GetFileVersionInfoSize(PChar(ExeFile), Dummy);
  GetMem(Buffer, Size);
  if (GetFileVersionInfo(PChar(ExeFile), Dummy, Size, Buffer)) then begin
   //VerQueryValue(Buffer, '\\', FileInfo, Dummy);
    //with PVSFixedFileInfo(FileInfo)^ do
      //Result := IntToStr(dwFileVersionMS div $10000) + '.' +
      //  IntToStr(dwFileVersionMS mod $10000) + '.' +
      //  IntToStr(dwFileVersionLS div $10000) + ' (' +
      //  IntToStr(dwFileVersionLS mod $10000) + ')';
  end
  else begin
    Result := 'No version info available.';
  end;
  FreeMem(Buffer, Size);
end;

If I view the file details using Windows 7 I cannot see the version number there either, so it's not surprising that I cannot get it from Delphi.

Just on the off chance someone knows a way to get the version number it would be greatly appreciated.

UPDATE

This code was written more then a decade ago by an ex staff member. Up until now, it has worked fine, but has never been tried on an executable compiled for Compact Framework.

The GetFileVersionInfo function is returning false, so I am getting 'No version info available.' result.

energ1ser
  • 2,703
  • 4
  • 24
  • 31
  • Take a look at this question http://stackoverflow.com/questions/1981297/version-information-missing-from-net-assembly-compact-framework-3-5-vs2008 – Graymatter Jun 10 '14 at 05:13
  • What does your code output – David Heffernan Jun 10 '14 at 06:06
  • It's pointless looking for a resource that isn't there. I think you should remove all that needless code and show us what you are looking for. If it isn't the version resource what is it? Some .net meta data. But what? – David Heffernan Jun 10 '14 at 07:39
  • This might be useful: http://oncoding.blogspot.co.uk/2012/04/net-assembly-version-numbers.html Essentially my belief is that before you go any further you need to work out exactly what it is you are looking for. – David Heffernan Jun 10 '14 at 07:59

1 Answers1

1

CF does not put C/C++ FileVersionInfo into exe or DLL files. The AssemblyInfo is something different from the FileVersionInfo resource you are looking for with your code sample.

ctacke has a usefull post about this at http://blog.opennetcf.com/2014/01/03/howto-add-the-win32-file-version-to-your-net-compact-framework-assemblies/ which can be found via Version information missing from .NET assembly (Compact Framework 3.5/VS2008), what graymatter already posted.

Community
  • 1
  • 1
josef
  • 5,951
  • 1
  • 13
  • 24