 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
nick Guest
|
Posted: Tue Jan 11, 2005 3:27 pm Post subject: How to verify a files version number |
|
|
how can I write some code that will verify a files version number before it
is downloaded from a remote server.
|
|
| Back to top |
|
 |
Dodgy Guest
|
Posted: Tue Jan 11, 2005 4:38 pm Post subject: Re: How to verify a files version number |
|
|
On Tue, 11 Jan 2005 15:27:57 -0000, "nick" <madmurg (AT) btinternet (DOT) com>
waffled on about something:
| Quote: | how can I write some code that will verify a files version number before it
is downloaded from a remote server.
|
A bit vague Nick. Do you control the server? (I'll assume yes). Is it
a webserver of a network fileserver? (I'll assume web).
If this file is an exe, the version number should be held at the end
of the file along with all the other info like copyright (assuming
you've set that when you compiled). If it's one of your own custom
file type, then it's where ever you put it. (If anywhere).
If the server is running http 1.1, you could just ask for the last bit
of the file and then dig it out yourself, but that's a bit messy.
I would be tempted to knock up some kind of server side script, perl,
ISAPI, ASP or whatever which your application can call on the server,
and ask for the version number of a specific file.
Dodgy.
--
MUSHROOMS ARE THE OPIATE OF THE MOOSES
|
|
| Back to top |
|
 |
AlanGLLoyd Guest
|
Posted: Wed Feb 02, 2005 9:14 am Post subject: Re: How to verify a files version number |
|
|
In article <41e3f083$0$326$cc9e4d1f (AT) news (DOT) dial.pipex.com>, "nick"
<madmurg (AT) btinternet (DOT) com> writes:
| Quote: | how can I write some code that will verify a files version number before it
is downloaded from a remote server.
|
Smarty-pants answer <g>
Open Delphi, type on the keyboard into a function which returns the version
number.
Helpful answer ...
You'd have to get the file drive path name to access the file then you can use
....
function GetVersionInfo(FileName, InfoName : string) : string;
{gets information from the version resource
InfoName can be :-
CompanyName FileDescription FileVersion InternalName
LegalCopyright OriginalFilename ProductName ProductVersion}
const
EngBrit = '080904E4'; // LocaleId
var BufSize, Len : Integer;
Buf, Info : PChar;
SubBlock : string;
begin
Result := '';
BufSize := 0;
BufSize := GetFileVersionInfoSize(PChar(FileName), BufSize);
if BufSize > 0 then begin
Buf := AllocMem(BufSize);
GetFileVersionInfo(PChar(FileName), 0, BufSize, Buf);
SubBlock := '\StringFileInfo\' + EngBrit +'\' + InfoName;
if VerQueryValue(Buf,
PChar(SubBlock),
Pointer(Info),
Len) then begin
if Length(Info) > 0 then
Result := Info;
end; { if VerQueryValue(Buf, ...etc..., Len)}
FreeMem(Buf, BufSize);
end; {if BufSize > 0}
end;
You have to ask the appropriate question where some respomders are pedantic
<g>.
The version rsource in a file has many aspects. There is Fixed File Info, Var
File Info (which lists the LocaleId for all the String File Info in the file),
and String File Info.
As you can see, above I access the String File Info for English (British)
LocaleId. I have a small program which displays all the various Version Info in
a file and aids understanding of the subject. Email me if you would like a
copy.
Alan Lloyd
[email]alanglloyd (AT) aol (DOT) com[/email]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|