Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!mcsun!sunic!draken!d88-jwa From: d88-jwa@nada.kth.se (Jon Watte) Newsgroups: comp.sys.mac.programmer Subject: Re: Shutdown Manager Message-ID: <2794@draken.nada.kth.se> Date: 22 Jan 90 20:14:07 GMT References: <1990Jan16.193431.28545@eplrx7.uucp> <1409@smurf.ira.uka.de> <13905@reed.UUCP> Reply-To: d88-jwa@nada.kth.se (Jon W{tte) Organization: Royal Institute of Technology, Stockholm, Sweden Lines: 40 In article <13905@reed.UUCP> chaffee@reed.UUCP (Alex Chaffee) writes: >I'm not intimately familiar with the Shutdown manager, but I have patched a >few traps in my time. I offer the following suggestion: Patch Shutdown, >but since you're worried about compatibility, just have that patch set a >flag somewhere that your real shutdown routine can see it. Then proceed >legally and cleanly to _Shutdown... Presumably, your sdUnmount (or >sdPowerOff) routine will get called at the right time, look at the flag, and >if it's been set, put up the dialog box. Does anyone see a problem with >this? Or is it redundant? Well, the problem was that if your shutdown manager task puts up the dialog, there's no way to get OUT of the shutdown sequence... Presumably, though, it's safe to tail-patch _Shutdown, since I have very grave doubts any buggy core routines will call this, and thus Apple patch it to fix a bug :-) Patch _Shutdown Put up your dialog If cancel - well, return (with an error ? or ExitToShell() ?) If not - well, JMP away to the address you got when you patched Or is there still a better way ? On the subject of trap patching; I'd like to write an INIT and FKEY combination that lets me switch keyboard layout without going into the chooser (or is there one already ?) I thought about my INIT patching _KeyTrans, and changing the pointer on the stack to a KCHR I've loaded into memory. Anyone see a problem with this, except that I'll have to lock the KCHR down constantly (since _KeyTrans is presumably called at interrupt time) ? h+ -- --- Stay alert ! - Trust no one ! - Keep your laser handy ! --- h+@nada.kth.se == h+@proxxi.se == Jon Watte longer .sig available on request