Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!uakari.primate.wisc.edu!caen!uwm.edu!ux1.cso.uiuc.edu!resnick From: resnick@cogsci.uiuc.edu (Pete Resnick) Newsgroups: comp.sys.mac.programmer Subject: Re: Init Delete Thyself Message-ID: <1991May23.150314.27585@ux1.cso.uiuc.edu> Date: 23 May 91 15:03:14 GMT References: <24620@unix.SRI.COM> Sender: usenet@ux1.cso.uiuc.edu (News) Organization: University of Illinois at Urbana Lines: 39 mxmora@unix.sri.com (Matthew Xavier Mora) writes: >I would like to completly delete the file from the system folder but there >seems to be a few problems. For one, the file is busy and the second thing, >if you delete a file in the system folder at init time, then you screw up the >index count of the system folder. You definitely want Joe Holt's Notification Manager code. Basically, here's what it does: 1. From the INIT, load up a resource that contains code to be executed later, including deleting the file, throwing away your notification string, etc. into a pointer in the System heap. This will be your Notification Manager response routine. 2. Post the notificication from the INIT that says whatever you want (or nothing at all for that matter). 3. When the INIT process is done, your response routine is called, and not at interrupt time, so you can do all sorts of nasty things, including deleting your file. 4. The last few lines of your response routines will put the address of ToolScratch, an 8-byte area for tempory storage in low memory, onto the stack and the instructions for DisposPtr of your response routine and the JMP to what was in the stack pointer into ToolScratch. This will remove the response routine from memory, and go on its merry way. If lots of people write who want the code, I can post it. It is the cleanest way to do error messages and other things from INITs that I have ever seen. pr -- Pete Resnick (...so what is a mojo, and why would one be rising?) Graduate assistant - Philosophy Department, Gregory Hall, UIUC System manager - Cognitive Science Group, Beckman Institute, UIUC Internet/ARPAnet/EDUnet : resnick@cogsci.uiuc.edu BITNET (if no other way) : FREE0285@UIUCVMD