home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / PRG / CPCoplandト.sit / CPCoplandƒ / CPCopland.c < prev    next >
C/C++ Source or Header  |  1995-10-01  |  1KB  |  52 lines

  1. /*
  2.     File:        CPCopland.c
  3.     
  4.     Contains:    Copland Control Panel under System 7 simulation.
  5.     
  6.     Copyright:    ゥ1995 Chris K. Thomas.  All Rights Reserved.
  7. */
  8.  
  9. #include <Traps.h>
  10. #include "ShowInitIcon.h"
  11.  
  12. OSErr _CoplandDispatchPatch(FileParamPtr inFPB: __A0) : __D0;
  13. void _CoplandOldDispatchAddress(UniversalProcPtr: __A0);
  14.  
  15. void main()
  16. {
  17.     Handle us = GetResource('INIT', 0);
  18.     // * should check for NULL here
  19.     
  20.     DetachResource(us);
  21.     
  22.     ShowInitIcon(128, true);
  23.     
  24.     _CoplandOldDispatchAddress(GetOSTrapAddress(_HFSDispatch));
  25.     SetOSTrapAddress((UniversalProcPtr)_CoplandDispatchPatch, _HFSDispatch);
  26. }
  27.  
  28. asm OSErr _CoplandDispatchPatch(FileParamPtr inFPB: __A0) : __D0
  29. {
  30.     movea.l    oldAddress, a1
  31.     jsr        (a1)
  32.     
  33.         // if (offset of ioFlFndrInfo (fdType is first field)) is 'APPC'
  34.     cmpi.l    #'APPC', 0x20(a0)
  35.     bne        done
  36.     
  37.         // change it to 'APPL'
  38.     move.l    #'APPL', 0x20(a0)
  39.  
  40. done:
  41.     rts
  42.     
  43.         // store old address
  44.     entry    static _CoplandOldDispatchAddress
  45.     lea        oldAddress, a1
  46.     move.l    a0, (a1)
  47.     rts
  48.     
  49.         // old dispatch address storage
  50. oldAddress:
  51.     dc.l    0x000000
  52. }