Why don't you have some sort of ini-file located with the network
file. The ini file can then contain the version number of the file.

Instead of checking the version number of the network file, read the
ini-file and go from there.

Regards,
Colin

On 24 September 2012 16:53, Robo <[email protected]> wrote:
> Our program on start up checks for updates on a network drive by
> comparing file version numbers against the local file.
>
> The method runs quick on local files, but slow on the network file,
> especially for files larger than 10MB. We found that disabling virus
> scanning (Microsoft Forefront in this case) means the check is done in
> less than 1sec instead of 10sec.
>
> Anyone know a way to check the version number of a network file
> without triggering the virus scanner? This is particularly problematic
> because this runs every time the program starts, so start up time is
> increasing by heaps.
>
> Here's our code for checking file version:
>
> function TFileVersion.ReadVersionInfo(sProgram: string; Major, Minor,
>                                         Release, Build : pWord) :Boolean;
> var
>   Info:       PVSFixedFileInfo;
> //{$ifdef VER120} {Delphi 4 definition for this differs from D2 & D3}
> //  InfoSize:   Cardinal;
> //{$else}
>   InfoSize:   UINT;
> //{$endif}
>   nHwnd:      DWORD;
>   BufferSize: DWORD;
>   Buffer:     Pointer;
> begin
>   BufferSize := GetFileVersionInfoSize(pchar(sProgram),nHWnd); {Get buffer 
> size}
>   Result := True;
>   if BufferSize <> 0 then begin {if zero, there is no version info}
>     GetMem( Buffer, BufferSize); {allocate buffer memory}
>     try
>       if GetFileVersionInfo(PChar(sProgram),nHWnd,BufferSize,Buffer) then 
> begin
>         {got version info}
>         if VerQueryValue(Buffer, '\', Pointer(Info), InfoSize) then begin
>           {got root block version information}
>           if Assigned(Major) then begin
>             Major^ := HiWord(Info^.dwFileVersionMS); {extract major version}
>           end;
>           if Assigned(Minor) then begin
>             Minor^ := LoWord(Info^.dwFileVersionMS); {extract minor version}
>           end;
>           if Assigned(Release) then begin
>             Release^ := HiWord(Info^.dwFileVersionLS); {extract release 
> version}
>           end;
>           if Assigned(Build) then begin
>             Build^ := LoWord(Info^.dwFileVersionLS); {extract build version}
>           end;
>
>           iDateTime := (Info^.dwFileDateMS) shl 32;
>           iDateTime := iDateTime + Info^.dwFileDateLS;
>           //always comes back zero for some reason
>
>         end else begin
>           Result := False; {no root block version info}
>         end;
>       end else begin
>         Result := False; {couldn't extract version info}
>       end;
>     finally
>       FreeMem(Buffer, BufferSize); {release buffer memory}
>     end;
>   end else begin
>     Result := False; {no version info at all in the file}
>   end;
> end;
>
> Thanks
>
> Robo
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: [email protected]
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to [email protected] with 
> Subject: unsubscribe
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: [email protected]
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [email protected] with 
Subject: unsubscribe

Reply via email to