Subject Re: [IBO] Retrieve fbclient.dll version
Author Andreas Filsinger
####
a) here comes my "e_r_fbClientVersion"

uses
IB_Session;

function FileVersion(const FName: string): string;
var
aFileName: array[0..MAX_PATH] of Char;
pdwHandle: DWORD;
nInfoSize: DWORD;
pFileInfo: Pointer;
pFixFInfo: PVSFixedFileInfo;
nFixFInfo: DWORD;
// pVarFInfo: PChar;
// nVarFInfo: DWORD;
// nVarTrans: DWORD;
// aVarFPath: array[0..MAX_PATH] of Char;
begin

// Gibt Versionsnummer zurück
StrPCopy(aFileName, FName);
pdwHandle := 0;
nInfoSize := GetFileVersionInfoSize(aFileName, pdwHandle);
result := '0';
if nInfoSize <> 0 then
pFileInfo := GetMemory(nInfoSize)
else
pFileInfo := nil;
if Assigned(pFileInfo) then
try
if GetFileVersionInfo(aFileName, pdwHandle, nInfoSize, pFileInfo)
then
begin
pFixFInfo := nil;
nFixFInfo := 0;
if VerQueryValue(pFileInfo, '\', Pointer(pFixFInfo), nFixFInfo)
then
begin
result := Format('%d.%d.%d.%d', [HiWord
(pFixFInfo^.dwFileVersionMS),
LoWord(pFixFInfo^.dwFileVersionMS), HiWord
(pFixFInfo^.dwFileVersionLS),
LoWord(pFixFInfo^.dwFileVersionLS)]);
end;
end;
finally
FreeMemory(pFileInfo);
end;
end;


function e_r_fbClientVersion: string;
var
TheModuleName: array[0..1023] of char;
s: string;
begin
// welcher Client wird verwendet
GetModuleFileName(FGDS_Handle, TheModuleName, sizeof
(TheModuleName));
s := TheModuleName;
result := s + ' ' + FileVersion(TheModuleName);
end;


####
b) detect, if Renamed fbembed (DANGER: suggested HACK):

isfbembed := (FileSize(TheModuleName)>512 KByte)

--
Andreas Filsinger
IT-Freiberufler
Stettfelder Strasse 44
76698 Ubstadt
GERMANY

Tel. +49(0)7251/966100
Mob. +49(0)175/5913758

http://www.OrgaMon.org