求一類似 GetFileVersionInfo 的函數,返回Exe文件開發的公司名稱 Delphi / Windows SDK/APIhttp://www.delphi2007.net/DelphiAPI/html/delphi_20061202120619132.html
如題:
一個Exe文件一般除了版本信息外還有其它的信息。請教其它信息怎麼獲得。
比如 產品名稱,公司名稱,語言 等等。這些信息用代碼怎麼獲得。
http://www.tapor.uvic.ca/~mholmes/source_code/Delphi2005/GenFunctions/GenFunctions.pas
老大,里面没有我要的啊,我不要查版本信息的.
查看下 pe格式...
具体写在什么位置 也不清楚
不行就自己分析下 用winhex ...
有点乱,你自己改一下:
procedure TForm1.GetVersionInfo;
const
SNotAvailable = 'Value Not Available';
var
LanguageID: string;
CodePage: string;
TranslationLength: Cardinal;
TranslationTable: Pointer;
InfoSize, Temp, Len: DWord;
InfoBuf: Pointer;
CompanyName, FileDescription, FileVersion, InternalName, LegalCopyright: string;
LegalTradeMarks, OriginalFilename, ProductName, ProductVersion, Comments: string;
Value: PChar;
LookupString,FilePath: string;
FVersionInfoAvailable: Boolean;
begin
FilePath := 'c:\windows\Regedit.exe';
InfoSize := GetFileVersionInfoSize( PChar(FilePath ), Temp );
FVersionInfoAvailable := InfoSize > 0;
if FVersionInfoAvailable then
begin
InfoBuf := AllocMem( InfoSize );
try
GetFileVersionInfo( PChar( FilePath ), 0, InfoSize, InfoBuf );
if VerQueryValue( InfoBuf, '\VarFileInfo\Translation', TranslationTable, TranslationLength ) then
begin
CodePage := Format( '%.4x', [ HiWord( PLongInt( TranslationTable )^ ) ] );
LanguageID := Format( '%.4x', [ LoWord( PLongInt( TranslationTable )^ ) ] );
end;
LookupString := 'StringFileInfo\' + LanguageID + CodePage + '\';
if VerQueryValue( InfoBuf, PChar( LookupString + 'CompanyName' ), Pointer( Value ), Len ) then
CompanyName := Value;
if VerQueryValue( InfoBuf, PChar( LookupString + 'FileDescription' ), Pointer( Value ), Len ) then
FileDescription := Value;
if VerQueryValue( InfoBuf, PChar( LookupString + 'FileVersion' ), Pointer( Value ), Len ) then
FileVersion := Value;
if VerQueryValue( InfoBuf, PChar( LookupString + 'InternalName' ), Pointer( Value ), Len ) then
InternalName := Value;
if VerQueryValue( InfoBuf, PChar( LookupString + 'LegalCopyright' ), Pointer( Value ), Len ) then
LegalCopyright := Value;
if VerQueryValue( InfoBuf, PChar( LookupString + 'LegalTrademarks' ), Pointer( Value ), Len ) then
LegalTradeMarks := Value;
if VerQueryValue( InfoBuf, PChar( LookupString + 'OriginalFilename' ), Pointer( Value ), Len ) then
OriginalFilename := Value;
if VerQueryValue( InfoBuf, PChar( LookupString + 'ProductName' ), Pointer( Value ), Len ) then
ProductName := Value;
if VerQueryValue( InfoBuf, PChar( LookupString + 'ProductVersion' ), Pointer( Value ), Len ) then
ProductVersion := Value;
if VerQueryValue( InfoBuf, PChar( LookupString + 'Comments' ), Pointer( Value ), Len ) then
Comments := Value;
finally
FreeMem( InfoBuf, InfoSize );
end;
end
else
begin
CompanyName := SNotAvailable;
FileDescription := SNotAvailable;
FileVersion := SNotAvailable;
InternalName := SNotAvailable;
LegalCopyright := SNotAvailable;
LegalTrademarks := SNotAvailable;
OriginalFilename := SNotAvailable;
ProductName := SNotAvailable;
ProductVersion := SNotAvailable;
Comments := SNotAvailable;
end;
Memo1.Lines.Clear;
Memo1.Lines.Add( CompanyName );
Memo1.Lines.Add( FileDescription );
Memo1.Lines.Add( FileVersion );
Memo1.Lines.Add( InternalName );
Memo1.Lines.Add( LegalCopyright );
Memo1.Lines.Add( LegalTrademarks );
Memo1.Lines.Add( OriginalFilename );
Memo1.Lines.Add( ProductName );
Memo1.Lines.Add( ProductVersion );
Memo1.Lines.Add( Comments );
end;
哈哈,俺要的就是這個!謝謝老之!
跪倒!叩拜!:)