Path: utzoo!attcan!uunet!lll-winken!elroy.jpl.nasa.gov!peregrine!ccicpg!felix!dhw68k!thecloud From: thecloud@dhw68k.cts.com (Ken McLeod) Newsgroups: comp.sys.mac.programmer Subject: Re: detecting macsbug Message-ID: <1990Sep30.124813.4364@dhw68k.cts.com> Date: 30 Sep 90 12:48:13 GMT References: <109400@tiger.oxy.edu> <20759@well.sf.ca.us> Reply-To: thecloud@dhw68k.cts.com (Ken McLeod) Organization: Wolfskill & Dowling residence; Anaheim, CA (USA) Lines: 33 In article <20759@well.sf.ca.us> smoke@well.sf.ca.us (Nicholas Jackiw) writes: >In article <109400@tiger.oxy.edu> sonenbli@oxy.edu (Andrew D. Sonenblick) writes: >>is there a cool way of detecting whether macsbug is installed? > >Can you just check if GetTrapAddress($A9FF)<>GetTrapAddress(UnImplTrapNum)? >This will, of course, only tell you if -somebody- has installed a debugger, >not necessarily whether -macsbug- has. ($A9FF is the _Debug trap.) Check out Checking to see if the _Debugger and/or _DebugStr traps are implemented is the obvious thing to do... unfortunately, they appear to be implemented all the time now in current systems, whether a debugger is installed or not. Another method, also fraught with peril, is to test the low-memory vector MacJmp ($120) for a valid (positive, even, non-zero address) pointer to Macsbug's code. This is the method MacEnvy uses, as of 2.1; however, it hasn't proved to be a 100% infallible test. :( If MacJmp contains an *invalid* pointer, you can be reasonably sure that Macsbug is NOT installed. A third method would be to read the name of the debugger from the boot blocks, then try to OpenRFPerm() that file in the System Folder and see whether ResError() returns noErr or resFNotFound. Obviously, this wouldn't work if someone placed the Macsbug file in their System Folder after boot time (or removed it after boot time) before your program had a chance to check for it. Maybe there will eventually be a Gestalt selector for this. Or not. -ken -- ========== ....... ============================================= Ken McLeod :. .: UUCP: ...{spsd,zardoz,felix}!dhw68k!thecloud ========== :::.. ..::: INTERNET: thecloud@dhw68k.cts.com //// =============================================