ok, its my Format function which isnt working, any idea how to fix it? i need this one working cause im trying to avoid large exe size, thx
function ____Format(sFormat: String; Args: Array of const): String;
var
i: Integer;
pArgs1, pArgs2: PDWORD;
lpBuffer: PChar;
begin
pArgs1 := nil;
if Length(Args) > 0 then
GetMem(pArgs1, Length(Args) * sizeof(Pointer));
pArgs2 := pArgs1;
for i := 0 to High(Args) do
begin
pArgs2^ := DWORD(PDWORD(@Args[i])^);
inc(pArgs2);
end;
GetMem(lpBuffer, 1024);
try
SetString(Result, lpBuffer, wvsprintf(lpBuffer, PChar(sFormat), PChar(pArgs1)));
except
Result := '';
end;
if pArgs1 <> nil then
FreeMem(pArgs1);
if lpBuffer <> nil then
FreeMem(lpBuffer);
end;
function GetFileInfo(const FileName, BlockName: String): String;
var
dwSize, lpdwHandle: DWORD;
lpData, lpTranslation, lplpBuffer: Pointer;
outt: PAnsiChar;
const
VarFileInfoTraslation = '\\VarFileInfo\\Translation';
VarStringFileInfo = '\\StringFileInfo\\%.4x%.4x\\%s';
begin
try
Result := '';
dwSize := GetFileVersionInfoSize(PAnsiChar(FileName), lpdwHandle);
if dwSize <> 0 then
begin
GetMem(lpData, dwSize);
GetFileVersionInfo(PAnsiChar(FileName), 0, dwSize, lpData);
if lpData <> nil then
begin
VerQueryValue(lpData, VarFileInfoTraslation, lpTranslation, dwSize);
if lpTranslation <> nil then
begin
VerQueryValue(lpData, PAnsiChar(____Format(VarStringFileInfo, [LOWORD(LongInt(lpTranslation^)), HIWORD(LongInt(lpTranslation^)), BlockName])), lplpBuffer, dwSize);
Messagebox(0, PAnsiChar(____Format(VarStringFileInfo, [LOWORD(LongInt(lpTranslation^)), HIWORD(LongInt(lpTranslation^)), BlockName])), 'Sub', 0);
if lplpBuffer <> nil then
Begin
SetString(Result, PAnsiChar(lplpBuffer), dwSize -1);
Result := PAnsiChar(Result);
end;
end;
end;
FreeMem(lpData, dwSize);
end;
except
Result := '';
end;
end;