Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!snorkelwacker!ira.uka.de!smurf!urlichs From: urlichs@smurf.ira.uka.de Newsgroups: comp.sys.mac.programmer Subject: Re: Shutdown Manager Message-ID: <1409@smurf.ira.uka.de> Date: 17 Jan 90 21:32:10 GMT References: <1990Jan16.193431.28545@eplrx7.uucp> Reply-To: urlichs@smurf.ira.uka.de (Matthias Urlichs) Organization: University of Karlsruhe, FRG Lines: 38 In comp.sys.mac.programmer leipold@eplrx7.UUCP (Walt Leipold) writes: < < The problem: Since my shutdown task must use dialogs and other resources < from its INIT file in the System folder, I've installed it to run before < sdUnMount time. However, IM V doesn't tell me how a shutdown task can < determine whether it was invoked via a "Shutdown" or a "Restart" from < Finder/Multifinder (right now, the stupid dialog appears for every Restart < as well as every Shutdown). < Install something with sdOnUnmount to load the resources, stash their handles somewhere, and another procedure with sdOnPowerOff to execute the code. However, see below... < I suppose I can patch the Shutdown trap and work my magic before any < Shutdown tasks are run, but the mere existence of the Shutdown Manager < makes me reluctant to reinvent the (possibly incompatible) wheel. So, < does anybody out there have any idea how my shutdown task can determine < what kind of shutdown/restart it was called during? < Patch Shutdown. I do it. Apple does it (Apple Internet Router). So why shouldn't you? If you want to offer the user any "Continue" button, you _have_ to patch Shutdown. (Continue with the trap by jumping to the original address, or just return without calling the original trap to cancel. Since you might not be the only guy who got that idea, do the actual shutting down from within a normally installed routine.) Programs that don't patch _Shutdown and then expect to be able to continue anyway by calling _ExitToShell are creating big problems. (Example: TOPS.) Related question: IM V says that first the drivers are closed (more exactly, they are send a GoodByeKiss or whatever), then volumes are unmounted. Since volumes are accessed through drivers, this does strike me as slightly illogical... Anyone know more about this? -- Matthias Urlichs