Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #11667

Random file access errors

From Arne Ortlinghaus <Arne.Ortlinghaus@acs.it>
Newsgroups comp.lang.clipper.visual-objects
Subject Random file access errors
Date 2018-05-25 11:30 +0200
Organization Aioe.org NNTP Server
Message-ID <pe8l3u$1bvu$1@gioia.aioe.org> (permalink)

Show all headers | View raw


It seems that random file access errors are increasing together with our 
programs when copying, creating, or deleting files. It seems to me that 
this is due to changes in the Antivirus programs (we are using mainly 
Trend antivirus). I believe that it is not because of the last Windows 
updates, but I am still not sure. This seems to happen sometimes after 
having created a file and then trying to read it. But it seems also that 
the program cannot access a file after some copy processes of other 
files in the process. A reason could be some behavior driven controls by 
Antivirus (or Windows) and temporarily blocking operations of a process. 
Currently I am inserting calls to the function FFileCanOpen as defined 
below in different parts of the program to see if this reduces the 
number of errors. I use FFileCanOpen(nil, cfile,FO_EXCLUSIVE, 3, false) 
for example. In this case the function repeats opening the file in 
exclusive mode for a certain maximum number of seconds.

Arne




function FFileCanOpen(oOwner, cFile, nMode, nSecWait, lWithErrorMessages)
//p Testen, ob eine Datei mit einem bestimmten Attribut geöffnet werden 
kann und Warten für nSecWait, falls es nicht geht
//a oOwner - falls angegeben Progressbar (noch nicht ausprogrammiert)
//a cInFile
//a nMode
// FO_SHARED     := 0x00000040  // Allow other processes to read or write
// FO_EXCLUSIVE  := 0x00000010  // Exclusive
//a nSecWait
//a lWithErrorMessages
//
local lOk as logic
local pOutfile as ptr
local lGoOn as logic
local nsec as dword
Default (@lWithErrorMessages, true)
if Empty(nMode)
    nMode := FO_EXCLUSIVE
endif
if Empty(nSecWait)
    nSecWait := 0
endif
lOk := true
lGoOn := true
nsec := 0
do while lGoOn
    lGoOn := false
    pOutfile := FOpen2(cFile, nMode)
    if pOutfile == F_Error
       nsec += 1
       if nsec <= nSecWait
          lGoOn := true
          Sleep(1000)
       else
          lOk := false
    		if lWithErrorMessages
    			MsgError 
(Msg(ID_DATEIOeffnen)+CRLF+cFile+CRLF+DosErrString(FError()), 
Msg(ID_DATEIoeffnen))
    		endif
       endif
    endif
    if pOutfile != null_ptr .and. pOutfile != F_Error
    	FClose(pOutfile)
    endif
enddo

return lOk

Back to comp.lang.clipper.visual-objects | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Random file access errors Arne Ortlinghaus <Arne.Ortlinghaus@acs.it> - 2018-05-25 11:30 +0200
  Re: Random file access errors dlzc <dlzc1@cox.net> - 2018-05-25 06:41 -0700
  Re: Random file access errors gianluca.pinoli@proximacentauri.it - 2018-05-29 07:47 -0700
    Re: Random file access errors "Wolfgang Riedmann" <wriedmann@gmail.com> - 2018-05-30 05:30 +0200

csiph-web