Date: Wed, 5 Jun 1996 13:29:51 +0200 (IST) From: Eli Zaretskii To: Carl Johansson Cc: djgpp AT delorie DOT com Subject: Re: File sharing? In-Reply-To: <4ovfjt$egp@oravannahka.Helsinki.FI> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On 3 Jun 1996, Carl Johansson wrote: > >How come that DJGPP v2 appears to ignore > >file sharing completely? It so happens that I > [snip] > > With VC++ I get the following error message: > > Sharing violation reading drive D > Abort, Retry, Fail? > Error setting somefile.ext, error: > > for each file Windows uses (ex. KEYBOARD:DRV, USER:EXE etc.) > at the time the program attempts to access it (note that > strerror fails to return anything, not even "No error"). > With DJGPP I get nothing, it works perfectly from my point of > view here. From the above error messages I'm not sure DJGPP ``works perfectly''. The key question is: does DJGPP-compiled code indeed change the attributes of the files, or just silently fails? If it fails, then I think I understand what's going on. Windows doesn't want you to access those files, so it opens them in a DENYALL (or some such) sharing mode. When your program tries to access the file, SHARE (or VSHARE) generates Int 24h. Your program doesn't install a handler for Int 24h, so for VC++ you see the usual "Abort, Retry, Explode" message. But DJGPP is a DPMI program, and most DPMI servers (Windows among them) just silently fail the DOS call that triggered Int 24h. So you think DJGPP program works while in reality it just silently fails. If I'm correct, then there is no way you can protect your system files by just changing their attributes, unless you find a way to temporarily disable the SHARE locks.