You could probably put an exclusion in your anti-virus software so that it does not scan that file at all.<br><br><div class="gmail_quote">On Mon, Sep 24, 2012 at 6:53 PM, Robo <span dir="ltr"><<a href="mailto:robo555@gmail.com" target="_blank">robo555@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Our program on start up checks for updates on a network drive by<br>
comparing file version numbers against the local file.<br>
<br>
The method runs quick on local files, but slow on the network file,<br>
especially for files larger than 10MB. We found that disabling virus<br>
scanning (Microsoft Forefront in this case) means the check is done in<br>
less than 1sec instead of 10sec.<br>
<br>
Anyone know a way to check the version number of a network file<br>
without triggering the virus scanner? This is particularly problematic<br>
because this runs every time the program starts, so start up time is<br>
increasing by heaps.<br>
<br>
Here's our code for checking file version:<br>
<br>
function TFileVersion.ReadVersionInfo(sProgram: string; Major, Minor,<br>
Release, Build : pWord) :Boolean;<br>
var<br>
Info: PVSFixedFileInfo;<br>
//{$ifdef VER120} {Delphi 4 definition for this differs from D2 & D3}<br>
// InfoSize: Cardinal;<br>
//{$else}<br>
InfoSize: UINT;<br>
//{$endif}<br>
nHwnd: DWORD;<br>
BufferSize: DWORD;<br>
Buffer: Pointer;<br>
begin<br>
BufferSize := GetFileVersionInfoSize(pchar(sProgram),nHWnd); {Get buffer size}<br>
Result := True;<br>
if BufferSize <> 0 then begin {if zero, there is no version info}<br>
GetMem( Buffer, BufferSize); {allocate buffer memory}<br>
try<br>
if GetFileVersionInfo(PChar(sProgram),nHWnd,BufferSize,Buffer) then begin<br>
{got version info}<br>
if VerQueryValue(Buffer, '\', Pointer(Info), InfoSize) then begin<br>
{got root block version information}<br>
if Assigned(Major) then begin<br>
Major^ := HiWord(Info^.dwFileVersionMS); {extract major version}<br>
end;<br>
if Assigned(Minor) then begin<br>
Minor^ := LoWord(Info^.dwFileVersionMS); {extract minor version}<br>
end;<br>
if Assigned(Release) then begin<br>
Release^ := HiWord(Info^.dwFileVersionLS); {extract release version}<br>
end;<br>
if Assigned(Build) then begin<br>
Build^ := LoWord(Info^.dwFileVersionLS); {extract build version}<br>
end;<br>
<br>
iDateTime := (Info^.dwFileDateMS) shl 32;<br>
iDateTime := iDateTime + Info^.dwFileDateLS;<br>
//always comes back zero for some reason<br>
<br>
end else begin<br>
Result := False; {no root block version info}<br>
end;<br>
end else begin<br>
Result := False; {couldn't extract version info}<br>
end;<br>
finally<br>
FreeMem(Buffer, BufferSize); {release buffer memory}<br>
end;<br>
end else begin<br>
Result := False; {no version info at all in the file}<br>
end;<br>
end;<br>
<br>
Thanks<br>
<span class="HOEnZb"><font color="#888888"><br>
Robo<br>
_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><pre cols="72">Alister Christie
Computers for People
Ph: 04 471 1849 Fax: 04 471 1266
<a href="http://www.salespartner.co.nz" target="_blank">http://www.salespartner.co.nz</a>
Follow us on Twitter <a href="http://twitter.com/salespartner" target="_blank">http://twitter.com/salespartner</a>
PO Box 13085
Johnsonville
Wellington</pre><br>