home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!spool.mu.edu!umn.edu!csus.edu!netcom.com!gurgle
- From: gurgle@netcom.com (Pete Gontier)
- Subject: Re: HELP! INIT and patching probs
- Message-ID: <1992Dec31.002355.26458@netcom.com>
- Organization: cellular
- References: <C03AHq.9LF@news.cso.uiuc.edu>
- Date: Thu, 31 Dec 1992 00:23:55 GMT
- Lines: 33
-
- cole@alexia.lis.uiuc.edu (Sandra Stewart-Cole) writes:
- > The central problem is that I've got an INIT that installs some trap
- >patches for various tasks (primarily a patch to PrGlue and one to SystemTask so
- >I can get regular frequent cpu time without VBL hassles) and I need these
- >patches to have access to some resources (alerts and dialogs being the chief
- >need) but I found no supported way to either find my own filename as an INIT,
- >or to lock open the INIT's file so that I have a resource map to let resource
- >calls work with.
-
- I don't have the first clue where the -34 error is coming from, but you
- don't need to find out. And you don't need to go to low memory, either.
- A call to CurResFile and then PBGetFCBInfo will do nicely. If the resource
- file is opened more than once, the resource file reference number may
- not match to the file manager file reference number, which is what you
- need for the call to PBGetFCBInfo, but it seems that they match if the
- resource file is open only once, which is the case at INIT time.
- PBGetFCBInfo also works no matter where your INIT is installed in the
- special folder hierarchy in the System Folder. It doesn't work if the
- user moves your INIT after booting, but you can do a hierarchical search
- within the file system for a file with your creator code if you're
- worried about that.
-
- Regarding leaving your file open: the INIT 31 mechanism (the INIT loader)
- does some pretty weird things to ensure that all resource files opened
- by an INIT get closed. I even went so far as to patch CloseResFile
- once to see if I could keep my own resource file open. No dice. INIT
- 31 goes to low memory and checks some resource map chain variables to
- see when they are restored to a state before it started the INIT. If
- you patch CloseResFile to not close your fork, INIT 31 vainly keeps
- trying. I considered munging the map chain, but it was too ugly a
- thought and I decided to open the file whenever I needed it.
- --
- Pete Gontier // EC Technology // gurgle@netcom.netcom.com
-