home *** CD-ROM | disk | FTP | other *** search
/ CD Action 7 B / cdactioncoverdisc / utils / fix1mb / prochook.h < prev    next >
C/C++ Source or Header  |  1995-05-01  |  3KB  |  75 lines

  1. /*
  2.   PROCHOOK.H - Copyright (c) 1993 James M. Finnegan, All Rights Reserved
  3. */
  4.  
  5. // ProcHook Header.  Used by the ProcHook DLL source files, as well
  6. // as any app using the DLL.
  7.  
  8. #ifndef _INC_PROCHOOK
  9. #define _INC_PROCHOOK
  10.  
  11. #ifdef __cplusplus
  12. extern "C" {            // No mangling!
  13. #endif
  14.  
  15. #include <windows.h>
  16.  
  17. // Byte pack structures
  18. #pragma pack(1)
  19.  
  20. typedef struct tagHOOKCHILD
  21. {
  22.     WORD                 wSig;         // Signature
  23.     struct  tagHOOKCHILD near *prev;   // Ptr to previous hook
  24.     struct  tagHOOKCHILD near *next;   // Ptr to next hook
  25.     VOID            near *npHookMaster;// Ptr to master structure
  26.     BYTE                 cBytes[5];    // Bytes of hooked function
  27.     FARPROC              lpfnNewFunc;  // Ptr to New function
  28. }HOOKCHILD;                
  29.  
  30. typedef HOOKCHILD            *PHOOKCHILD;
  31. typedef HOOKCHILD NEAR       *NPHOOKCHILD;
  32. typedef HOOKCHILD FAR        *LPHOOKCHILD;
  33.  
  34. typedef struct tagHOOKMASTER
  35. {
  36.     WORD                 wSig;         // Signature
  37.     struct tagHOOKMASTER near *prev;   // Ptr to previous master
  38.     struct tagHOOKMASTER near *next;   // Ptr to next master
  39.     NPHOOKCHILD          head;         // Ptr to head of child struct 
  40.     NPHOOKCHILD          tail;         // Ptr to tail of child struct
  41.     BOOL                 bExclusive;   // Exclusive Hook field
  42.     WORD                 wCount;       // Count of # of hooks to this function
  43.     WORD                 wUnhookCount; // Count of # of unhooks to this function
  44.     WORD                 wDataSel;     // Selector to aliased code selector
  45.     FARPROC              lpfnHookedFunction;// Ptr to original function
  46. }HOOKMASTER;
  47.  
  48. typedef HOOKMASTER            *PHOOKMASTER;
  49. typedef HOOKMASTER NEAR       *NPHOOKMASTER;
  50. typedef HOOKMASTER FAR        *LPHOOKMASTER;
  51.  
  52.  
  53. NPHOOKCHILD  WINAPI SetProcAddress (FARPROC, FARPROC, BOOL);
  54. BOOL         WINAPI SetProcRelease (NPHOOKCHILD);
  55. BOOL         WINAPI ProcHook       (NPHOOKCHILD);
  56. BOOL         WINAPI ProcUnhook     (NPHOOKCHILD);
  57.  
  58. NPHOOKMASTER WINAPI GetFirstHMaster(LPHOOKMASTER);
  59. NPHOOKMASTER WINAPI GetNextHMaster (LPHOOKMASTER);
  60. NPHOOKCHILD  WINAPI GetFirstHChild (LPHOOKMASTER, LPHOOKCHILD);
  61. NPHOOKCHILD  WINAPI GetNextHChild  (LPHOOKCHILD);
  62.  
  63. WORD         WINAPI GetOrdFromAddr (HMODULE, FARPROC);
  64. LPSTR        WINAPI GetNameFromOrd (HMODULE, WORD);
  65.  
  66.  
  67. // Set packing back to its default
  68. #pragma pack()
  69.  
  70. #ifdef __cplusplus
  71. }                       // End of extern "C" {
  72. #endif 
  73.  
  74. #endif  // _INC_PROCHOOK
  75.