home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1999 / MacHack 1999.toast / The Hacks / DotMatrixScript / init.c < prev    next >
Encoding:
Text File  |  1999-06-25  |  524 b   |  27 lines  |  [TEXT/CWIE]

  1. typedef struct {
  2.     short                firstInstruction;
  3.     UniversalProcPtr    origFunction;
  4. } ptch, *ptchPtr, **ptchHdl;
  5.  
  6.  
  7. void main (void)
  8. {
  9.     THz                    origZone;
  10.     Handle                ptchRes;
  11.     UniversalProcPtr    newPatch;
  12.     
  13.     origZone = GetZone();
  14.     SetZone (SystemZone());
  15.     
  16.     ptchRes = Get1Resource ('PTCH', 128);
  17.     if (ptchRes)
  18.     {
  19.         DetachResource (ptchRes);
  20.         
  21.         (*(ptchHdl)ptchRes)->origFunction = NGetTrapAddress (_PrGlue, ToolTrap);
  22.         NSetTrapAddress ((ProcPtr)&(*(ptchHdl)ptchRes)->firstInstruction, _PrGlue, ToolTrap);
  23.     }
  24.     
  25.     SetZone (origZone);
  26. }
  27.