[comp.sys.mac.programmer] DRVR question

mf2u+@andrew.cmu.edu (Matthew Raymond Flatt) (01/17/90)

 I have written a driver that I want loaded at startup (with my INIT)
and be able to call from another application. If I open driver from
within the application, it receives Control calls just fine, but if I
open the driver, close the application, and then start a new appl and
try to send the driver a Control call, I get an address. The driver IS
in memory - the Device Control Entry points to it - but it still doesn't
work. I've written many (working) DAs, but never a non-DA driver. Any
suggestions???

Matthew

aw0g+@andrew.cmu.edu (Aaron Wohl) (01/18/90)

What heap is the DRVR loaded in?  Normaly this would be this application
heap... Do you return an error in the drvr to the goodbye kiss and close
calls?  I think you need to do that to stay open.  Also,  do you use
dCtlStorage and if so which heap is it allocated in?  Also remember
things like regions are really handles and have to be in the right heap.

Also, I have heard talk about OpenDriver() failing if the driver is
already open, I didn't try it myself though.  Some code I disasembled
ran over the divice table looking to see if the driver it wanted was
present and if it was found doing control calls without ever having done
an open.  This allows the DRVR to be renumbered and still have things
work.   Apple of course assigns fixed driver numebers for its drivers
and can just try a control call and see if it fails and then do an open
if so.

Aaron