bill@wfhami.UUCP (Bill Hogsett) (03/11/89)
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?
--
******************************************************************************
Bill Hogsett CLEVELAND AREA-AMIGA USERS' GROUP
ncoast!bill (216) 581-2284 (BBS)
ncoast!wfhami!bill
3715 Townley Rd.
Shaker Heights, OH 44122 I get paid for my legal opinions, but
216-295-1624 I'd really rather talk about my Amiga.
******************************************************************************
thomas@cbmvax.UUCP (Dave Thomas QA) (03/14/89)
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 =============================================================================
dillon@HERMES.BERKELEY.EDU (Matt Dillon) (03/15/89)
:> 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; Uh, that's a nice easy way to crash your machine ... it is actually proc->pr_WindowPtr . Essentially, you should do this: APTR Save; Save = p->pr_WindowPtr; p->pr_WindowPtr = (APTR)-1L; (do stuff that you don't want reuqesters for here) p->pr_WindowPtr = Save; -Matt
thomas@cbmvax.UUCP (Dave Thomas QA) (03/15/89)
In article <8903150738.AA12483@hermes.berkeley.edu> dillon@HERMES.BERKELEY.EDU (Matt Dillon) writes: > :> 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; > > Uh, that's a nice easy way to crash your machine ... it is actually > proc->pr_WindowPtr . Essentially, you should do this: > > APTR Save; > > Save = p->pr_WindowPtr; > p->pr_WindowPtr = (APTR)-1L; > > (do stuff that you don't want reuqesters for here) > > p->pr_WindowPtr = Save; > > -Matt OOPS! You're right...That's what I get for not looking in the include file. My memory seems to be going...Hope I didn't confuse anybody. Dave -- ============================================================================= Dave Thomas COMMODORE AMIGA TEST ENGINEERING // /_ |\/||/_ /_ UUCP ...{allegra,rutgers}!cbmvax!thomas \X/ / \| ||\// \ ============================================================================= Opinions expressed are my own...no one else wants them =============================================================================
w-colinp@microsoft.UUCP (Colin Plumb) (03/16/89)
bill@wfhami.UUCP (Bill Hogsett) wrote: > Is there a way to check for the existence of a device or directory and > not have a requestor if the check fails? This is, I belive, in the "common questions" posting. If you set your process's pr_WindowPtr to -1, Dos errors will not put up a requester, but simply return an error code. By default it's 0, meaning workbench screen, but you can also point it to a window, and error requesters will pop up in that window's screen. -- -Colin (uunet!microsoft!w-colinp) "Don't listen to me. I never do." - The Doctor