Path: utzoo!attcan!uunet!ogicse!uwm.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!emory!mephisto!udel!eplrx7!leipold From: leipold@eplrx7.uucp (Walt Leipold) Newsgroups: comp.sys.mac.programmer Subject: Re: Wisdom of ExitToShell in a ShutDown proc Message-ID: <1990Mar5.133533.28731@eplrx7.uucp> Date: 5 Mar 90 13:35:33 GMT References: <4143@hub.UUCP> Sender: usenet@udel.EDU Reply-To: leipold@eplrx7.UUCP (Walt Leipold) Organization: DuPont Engineering Physics Lab Lines: 27 In article <4143@hub.UUCP> 6600pete@ucsbuxa.ucsb.edu writes: >In the process of debugging a ShutDown proc, I have told the debugger >to 'es' (ExitToShell) a number of times. This has the curious but not >surprising effect of restarting MultiFinder and all her default >applications. Does anyone know if it would be a safe or wise practice >to allow a user to ExitToShell from a ShutDown proc? No, it's not safe to call ExitToShell from a ShutDown proc. The thing to do is patch _ShutDown. In my case, I needed to execute my ShutDown task only if the user had selected Shutdown (not Restart), but there wasn't any way for my ShutDown routine to tell what kind of Shutdown was happening. So I patched _ShutDown to save the top word of the stack (the routine selector), and wrote a standard ShutDown proc which looked at the saved routine selector to decide whether to do its thing. Source code on request... >Pete Gontier | InterNet: 6600pete@ucsbuxa.ucsb.edu, BitNet: 6600pete@ucsbuxa >Editor, Macker | Online Macintosh Programming Journal; mail for subscription >Hire this kid | Mac, DOS, C, Pascal, asm, excellent communication skills -- "As long as you've lit one candle, Walt Leipold you're allowed to curse the darkness." (leipolw%esvax@dupont.com) -- -- The UUCP Mailer