mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-20 14:47:39 +00:00
* Keyman for Windows 10.0 Open Source * Squashed 'windows/src/ext/jedi/jedi/' content from commit f444ad2 git-subtree-dir: windows/src/ext/jedi/jedi git-subtree-split: f444ad2da4693851e523f1ea6bd541f701904c24 * Squashed 'windows/src/ext/jedi/jcl/' content from commit d63d3c9fd git-subtree-dir: windows/src/ext/jedi/jcl git-subtree-split: d63d3c9fd9ff84efdd8159084ec6a60313644243 * Squashed 'windows/src/ext/jedi/jvcl/' content from commit bee19f3b4 git-subtree-dir: windows/src/ext/jedi/jvcl git-subtree-split: bee19f3b46909fde2fa92c06cd2706f41d99f6c3 * Add required .res files * Add required .res files * Add docbook files (forced) * Add required libxslt * Add required jedi files * Add installation files * Tweak .gitignore for open * CI * Remove KMW from Developer source (#122) * Remove KMW from Developer source (copies during build) * Remove KMW from Developer source (copies during build) * Remove KMW from Developer source (copies during build) * Fixup release build and copy license, readme from kmw during build * Remove obsolete build help documentation * Keyman Engine 10 on Windows regression for shift states (#129) * Improve #128 -- cleaner debug messages * Fixes #127, shift state now resets correctly; and more work for #128 * Fixes #130 (#131)
87 lines
1.9 KiB
ObjectPascal
87 lines
1.9 KiB
ObjectPascal
(*
|
|
Name: fileversioninfo
|
|
Copyright: Copyright (C) SIL International.
|
|
Documentation: km4.1
|
|
Description: Get file version information from a dll or exe
|
|
Create Date: 13 May 2005
|
|
|
|
Modified Date: 13 May 2005
|
|
Authors: mcdurdin
|
|
Related Files:
|
|
Dependencies:
|
|
|
|
Bugs:
|
|
Todo:
|
|
Notes:
|
|
History: 13 May 2005 - mcdurdin - Integrated into kmshell from tsysinfo
|
|
*)
|
|
unit fileversioninfo;
|
|
|
|
interface
|
|
|
|
uses Windows, SysUtils;
|
|
|
|
type
|
|
TFileVersionInfo = class
|
|
private
|
|
FFileName: string;
|
|
pbuf: PChar;
|
|
public
|
|
constructor Create(const AFileName: string);
|
|
destructor Destroy; override;
|
|
function StringValue(const Name: string): string;
|
|
property FileName: string read FFileName;
|
|
end;
|
|
|
|
implementation
|
|
|
|
{ TFileVersionInfo }
|
|
|
|
constructor TFileVersionInfo.Create(const AFileName: string);
|
|
var
|
|
dw, dwHandle: DWord;
|
|
begin
|
|
FFileName := AFileName;
|
|
dw := GetFileVersionInfoSize(PChar(AFileName), dwHandle);
|
|
if dw = 0 then Exit;
|
|
|
|
pbuf := AllocMem(dw);
|
|
GetFileVersionInfo(PChar(AFileName), dwHandle, dw, pbuf);
|
|
end;
|
|
|
|
destructor TFileVersionInfo.Destroy;
|
|
begin
|
|
FreeMem(pbuf);
|
|
inherited Destroy;
|
|
end;
|
|
|
|
function TFileVersionInfo.StringValue(const Name: string): string;
|
|
var
|
|
lpTranslate, lpBuffer: Pointer;
|
|
cbTRanslate, dwBytes: DWord;
|
|
pdw: PDWord;
|
|
s: string;
|
|
begin
|
|
Result := '';
|
|
try
|
|
if not Assigned(pbuf) then Result := ''
|
|
else
|
|
begin
|
|
if VerQueryValue(pbuf,'\VarFileInfo\Translation', lpTranslate, cbTranslate) then
|
|
begin
|
|
pdw := lpTranslate;
|
|
if cbTranslate >= 4 then
|
|
begin
|
|
s := Format('\StringFileInfo\%.04x%.04x\'+Name, [LOWORD(pdw^), HIWORD(pdw^)]);
|
|
if VerQueryValue(pbuf, PChar(s), lpBuffer, dwBytes) then
|
|
Result := PChar(lpBuffer);
|
|
end;
|
|
end;
|
|
end;
|
|
except
|
|
on E:Exception do Result := E.Message;
|
|
end;
|
|
end;
|
|
|
|
end.
|
|
|