Returns the name of the company opened in the Exe file.

Source: Internet
Author: User
Calculate the number of functions similar to GetFileVersionInfo, and return the company name developed by the Exe file: Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiAPI/html/delphi_20061202120619132.html
Topic:
An Exe file generally contains version information and other information. How to obtain other information.
Such as product name, company name, and statement. How can I obtain such information on behalf of others.

Http://www.tapor.uvic.ca /~ Mholmes/source_code/Delphi2005/GenFunctions. pas

Boss, I don't want to check the version information.

View the pe format...
I am not sure where to write it.
If not, use winhex for analysis...

A little messy. You can change it yourself:

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 + 'ininalfilename '), 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;

Haha, what I want is this! Too old!
Kneel down! Thank you! :)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.