Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!oliveb!amiga!cbmvax!thomas From: thomas@cbmvax.UUCP (Dave Thomas QA) Newsgroups: comp.sys.amiga.tech Subject: Re: Testing for disk (Lock?) Keywords: Lock, Help, T-Disk Message-ID: <6248@cbmvax.UUCP> Date: 14 Mar 89 14:38:05 GMT References: <0422.AA0422@wfhami> Reply-To: thomas@cbmvax.UUCP (Dave Thomas QA) Organization: Commodore Technology, West Chester, PA Lines: 48 In article <0422.AA0422@wfhami> bill@wfhami.UUCP (Bill Hogsett) writes: > > I am modifying the C code for the old Tecmar T-Disk (yep its still > ticking!). I now have it running with FFS, but can't get the old code to > properly tell if it is being run after the disk has already been mounted. > > I have tried the following: > > /* This calls up a requestor!!*/ > lock=Lock("dh0:c", SHARED_LOCK); > if (lock != 0) > { > UnLock(lock); > return HDERR_IsMounted; > } > This works fine if the disk has already been mounted. It returns what > you would expect. The problem is that it prompts for DH0: if it is called > before the disk is mounted (the normal case). > > Is there a way to check for the existence of a device or directory and > not have a requestor if the check fails? Yep. In the process structure there is a field called pr_ConsoleTask. If it is set to -1 (I think) this will inhibit DOS requesters appearing for that process. struct Process *p; p = (struct Process *) FindTask (0); p->pr_ConsoleTask = (APTR) -1; This should do the trick. You should restore the original value when your program exits or that process will not get requesters ever again... Dave > -- > ****************************************************************************** > Bill Hogsett CLEVELAND AREA-AMIGA USERS' GROUP > ncoast!bill (216) 581-2284 (BBS) > ncoast!wfhami!bill -- ============================================================================= Dave Thomas COMMODORE AMIGA TEST ENGINEERING // /_ |\/||/_ /_ UUCP ...{allegra,rutgers}!cbmvax!thomas \X/ / \| ||\// \ ============================================================================= Opinions expressed are my own...no one else wants them =============================================================================