🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.nativeapi
Article #157

Re: File Information. Urgent!!!

#157
From: Carlos Azevedo
Date: Wed, 21 Jan 2004 12:27
57 lines
2977 bytes
Ok.

Thanks;

"Ronaldo Souza" <nospam@nospam.org.zz> escreveu na mensagem
news:400C47AB.8000600@nospam.org.zz...
> Try this:
> function GetProgramDescription(FName : string) : string;
> var
>    W1,W2                          : Word;
>    Dummy,VerInfoSize,VerValueSize : DWORD;
>    VerInfo                        : Pointer;
>    VerValue                       : PVSFixedFileInfo;
>    s,TranlationStr                : string;
> begin
>    Result := StrDescriptionNotAvailable; //const declared elsewere
>    if (FName <> '')
>      then begin
>             VerInfoSize := GetFileVersionInfoSize(PChar(FName),Dummy);
>             GetMem(VerInfo,VerInfoSize);
>             GetFileVersionInfo(PChar(FName),0,VerInfoSize,VerInfo);
>             if
>
VerQueryValue(VerInfo,'\VarFileInfo\Translation',Pointer(VerValue),VerValueS
ize)
>               then begin   //swap words
>                      Dummy := DWord(Pointer(VerValue)^);
>                      W1 := Dummy shr 16;
>                      W2 := Dummy and $FFFF;
>                      Dummy := (DWord(W2) shl 16)+W1;
>                      TranlationStr := IntToHex(Dummy,8);
>                    end
>               else TranlationStr := '040904E4';
>             if
>
VerQueryValue(VerInfo,PChar('StringFileInfo\'+TranlationStr+'\FileDescriptio
n'),Pointer(VerValue),VerValueSize)
>               then s := PChar(VerValue)
>               else if
>
VerQueryValue(VerInfo,'StringFileInfo\040904E4\FileDescription',Pointer(VerV
alue),VerValueSize)
>                      then s := PChar(VerValue)
>                      else if
>
VerQueryValue(VerInfo,'StringFileInfo\041604E4\FileDescription',Pointer(VerV
alue),VerValueSize)
>                             then s := PChar(VerValue)
>                             else s := '';
>             s := Trim(s);
>             if (s = '')
>               then s := StrDescriptionNotAvailable;
>             Result := s;
>             FreeMem(VerInfo,VerInfoSize);
>           end;
> end;
>
Technical Details
Message-ID: <400e702d$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40083038@newsgroups.borland.com> <400C47AB.8000600@nospam.org.zz>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f94dd,974bc11036385e32
X-Google-Attributes: gidf94dd,public
X-Google-ArrivalTime: 2004-01-21 04:39:46 PST
From: "Carlos Azevedo" <carlos@sector.com.br>
Newsgroups: borland.public.delphi.nativeapi
References: <40083038@newsgroups.borland.com> <400C47AB.8000600@nospam.org.zz>
Subject: Re: File Information. Urgent!!!
Date: Wed, 21 Jan 2004 10:27:38 -0200
Lines: 59
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 200.179.213.86
Message-ID: <400e702d$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1074688045 200.179.213.86 (21 Jan 2004 04:27:25 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail