| Код | function GetExeInfo(sAppName:string):STRING; type PTransBuffer = ^TTransBuffer; TTransBuffer = array[1..4] of smallint; var iAppSize, iLenOfValue : DWord; pcBuf,pcValue : PChar; VerSize : DWord; pTrans : PTransBuffer; TransStr : string; fvip : pointer; ft : TFileTime; st : TSystemTime; i:Integer; const tmp : array [0..9] of string = ('CompanyName','FileDescription','FileVersion', 'InternalName','LegalCopyright', 'LegalTradeMarks', 'OriginalFileName','ProductName', 'ProductVersion','Comments' );
begin // get version information values iAppSize:= GetFileVersionInfoSize(PChar(sAppName),// pointer to filename string iAppSize); // pointer to variable to receive zero // if GetFileVersionInfoSize is successful if iAppSize > 0 then begin pcBuf := AllocMem(iAppSize); GetFileVersionInfo(PChar(sAppName), // pointer to filename string 0, // ignored iAppSize, // size of buffer pcBuf); // pointer to buffer to receive file-version info.
VerQueryValue(pcBuf, '\', fvip, iLenOfValue); VerQueryValue(pcBuf, PChar('\VarFileInfo\Translation'),pointer(ptrans), verSize); TransStr:= IntToHex(ptrans^[1], 4) + IntToHex(ptrans^[2], 4);
for i:=0 to 9 do begin if VerQueryValue(pcBuf,PChar('StringFileInfo\' + TransStr + '\' + tmp[i] ), Pointer(pcValue),iLenOfValue) then if length(pcValue) > 0 then Result := Result + tmp[i] + ': '+ pcValue + #13+#10; end; FreeMem(pcBuf,iAppSize); end; end;
|
|