home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / SimpleTrap / Sources / SimpleTrap.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-23  |  745 b   |  48 lines

  1. #include <MacMemory.h>
  2. #include <MixedMode.h>
  3. #include <Patches.h>
  4. #include <Traps.h>
  5. #include <A4Stuff.h>
  6.  
  7. #include "SignatureToApp.h"
  8.  
  9. // Prototypes
  10. pascal void main(void);
  11. pascal void SimpleTrap(void);
  12.  
  13.  
  14. pascal void
  15. main(void)
  16. {
  17.     OSErr    err;
  18.     THz        currZone;
  19.     
  20.     EnterCodeResource();
  21.     
  22.     DetachResource(GetResource('INIT', 0));
  23.     
  24.     currZone = GetZone();
  25.     SetZone(SystemZone());
  26.     
  27.     if (GetToolTrapAddress(0xABCD) == GetToolTrapAddress(_Unimplemented))
  28.         SetToolTrapAddress((UniversalProcPtr)SimpleTrap, 0xABCD);
  29.     
  30.     SetZone(currZone);
  31.     
  32.     ExitCodeResource();
  33. }
  34.  
  35.  
  36. pascal void
  37. SimpleTrap(void)
  38. {
  39.     EnterCodeResource();
  40.     
  41.     SignatureToApp(FOUR_CHAR_CODE('ttxt'), NULL, NULL, NULL, 
  42.         Sig2App_LaunchApplication, launchContinue);
  43.     
  44.     ExitCodeResource();
  45. }
  46.  
  47.  
  48.