[comp.sys.amiga.tech] Finding DOS Handler Message Ports

ranjit@eniac.seas.upenn.edu (Ranjit Bhatnagar) (10/05/88)

Alright, suppose I were writing a DOS handler which would filter
packets given to it and pass them on to other handlers.  How can I,
given a filename, figure out the handler corresponding to it without
actually making any attempt to access the file (or device) in question?

The cheap solution is "don't do that.  Use high-level DOS commands
such as Open(filename,...) in your handler, and let DOS sort it out."
But that just doesn't sound cool.  I'm hoping there's a function I
can call, or a table that I can look in without violating system
privacy, that maps names to handlers.

Door prize to the first person to guess what I want this handler
to do.  (By the way: nearly all my understanding of how
handlers works comes from Matt Dillon's example ramdisk.  Thanks,
Matt!)

	- Ranjit



			  She watch channel ZERO!?
she watched  she watched  she watched  she watched  she watched  she watched  
"Trespassers w"   ranjit@eniac.seas.upenn.edu	mailrus!eecae!netnews!eniac!...

mlelstv@faui44.informatik.uni-erlangen.de (Michael van Elst ) (10/10/88)

In article <5459@netnews.upenn.edu> ranjit@eniac.seas.upenn.edu.UUCP (Ranjit Bhatnagar) writes:
>Alright, suppose I were writing a DOS handler which would filter
>packets given to it and pass them on to other handlers.  How can I,
>given a filename, figure out the handler corresponding to it without
>actually making any attempt to access the file (or device) in question?
>

There is a functions called DeviceProc in the dos.library.
You pass a filename to the function and it returns a pointer to
the corresponding handlers messageport. There you can send
DosPackets like ACTION_INHIBIT to stop the file system or
ACTION_FIND_INPUT to open a file for reading, etc.

The filename you pass to this functions doesn't need to refer
to an existing file.
You might stop dos from asking you to insert a disk if you want
to access a volume that is not mounted.
This is done by writing a -1 into your Process structure pr_WindowPtr
field. Don't forget to restore the original value.

You can find the handler that serves your current directory by
examining your Process structure pr_FileSys field.

The DeviceProc function cannot be used with CON: and RAW: handlers
because there might be more than one of each.
The Open call returns a BPTR to FileHandle. You can find the handler
port in the fh_Type field of this FileHandle structure.

Hope that helps.

				Michael van Elst

E-mail: UUCP: ...uunet!unido!fauern!faui44!mlelstv