Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

185 lines
9.6 KiB

  1. //*****************************************************************************
  2. //
  3. // HOOKS -
  4. //
  5. // Header file for 32bit stubs and thunks of 16bit hooks
  6. //
  7. //
  8. // 01-07-92 NanduriR Created.
  9. //
  10. //*****************************************************************************
  11. typedef LONG (APIENTRY *HKPROC)(INT, LONG, LONG);
  12. typedef struct {
  13. HANDLE hMod; // Module handle
  14. INT cHookProcs; // Total Number of thunk stubs.
  15. } HOOKPERPROCESSDATA, FAR *LPHOOKPERPROCESSDATA;
  16. typedef struct {
  17. BYTE iIndex; // array index;
  18. BYTE InUse; // TRUE if this Proc32 is already hooked
  19. HAND16 hMod16; // 16bit HookDLL module handle
  20. HANDLE hMod; // Modulehande of Thunk Hook Dll
  21. HKPROC Proc32; // 32bit HookProc stub
  22. INT iHook; // type of Hook
  23. DWORD Proc16; // actual 16bit HookProc
  24. INT TaskId; // id of task that callled setwindowshook
  25. HHOOK hHook; // handle returned by SetWindowHookEx
  26. } HOOKSTATEDATA, FAR *LPHOOKSTATEDATA;
  27. typedef struct {
  28. INT nCode; // the input params to a hook func.
  29. LONG wParam;
  30. LONG lParam;
  31. } HOOKPARAMS, FAR *LPHOOKPARAMS;
  32. #define PUTMSGFILTER16(pMsg16,lpMsg) {\
  33. STOREWORD(pMsg16->hwnd, GETHWND16((lpMsg)->hwnd));\
  34. STOREWORD(pMsg16->message, (lpMsg)->message);\
  35. STOREWORD(pMsg16->wParam, (lpMsg)->wParam);\
  36. STORELONG(pMsg16->lParam, (lpMsg)->lParam);\
  37. STORELONG(pMsg16->time, (lpMsg)->time);\
  38. STOREWORD(pMsg16->pt.x, (lpMsg)->pt.x);\
  39. STOREWORD(pMsg16->pt.y, (lpMsg)->pt.y);\
  40. }
  41. #define GETMSGFILTER16(pMsg16,lpMsg) {\
  42. (lpMsg)->hwnd = HWND32(FETCHWORD(pMsg16->hwnd));\
  43. (lpMsg)->message = FETCHWORD(pMsg16->message);\
  44. (lpMsg)->wParam = FETCHWORD(pMsg16->wParam);\
  45. (lpMsg)->lParam = FETCHLONG(pMsg16->lParam);\
  46. (lpMsg)->time = FETCHLONG(pMsg16->time);\
  47. (lpMsg)->pt.x = FETCHSHORT(pMsg16->pt.x);\
  48. (lpMsg)->pt.y = FETCHSHORT(pMsg16->pt.y);\
  49. }
  50. #define PUTMOUSEHOOKSTRUCT16(pMHStruct16,lpMHStruct) {\
  51. STOREWORD(pMHStruct16->pt.x, (lpMHStruct)->pt.x);\
  52. STOREWORD(pMHStruct16->pt.y, (lpMHStruct)->pt.y);\
  53. STOREWORD(pMHStruct16->hwnd, GETHWND16((lpMHStruct)->hwnd));\
  54. STOREWORD(pMHStruct16->wHitTestCode, (lpMHStruct)->wHitTestCode);\
  55. STORELONG(pMHStruct16->dwExtraInfo, (lpMHStruct)->dwExtraInfo);\
  56. }
  57. #define GETMOUSEHOOKSTRUCT16(pMHStruct16,lpMHStruct) {\
  58. (lpMHStruct)->pt.x = FETCHSHORT(pMHStruct16->pt.x);\
  59. (lpMHStruct)->pt.y = FETCHSHORT(pMHStruct16->pt.y);\
  60. (lpMHStruct)->hwnd = HWND32(FETCHWORD(pMHStruct16->hwnd));\
  61. (lpMHStruct)->wHitTestCode = FETCHWORD(pMHStruct16->wHitTestCode);\
  62. (lpMHStruct)->dwExtraInfo = FETCHLONG(pMHStruct16->dwExtraInfo);\
  63. }
  64. // afterdark 3.0 compares the t1=lpeventmsg->time with t2=getcurrenttime().
  65. // physically t2 > t1 always - we truncate t2 to a multiple of 64 and
  66. // thus sometimes t2 < t1 (numerically) which confuses the app and
  67. // triggers the screen saver. So we do identical truncation here.
  68. // No compatibility flag is used
  69. // - nanduri
  70. #define PUTEVENTMSG16(pEventMsg16,lpEventMsg) {\
  71. STOREWORD(pEventMsg16->message, (lpEventMsg)->message);\
  72. STOREWORD(pEventMsg16->paramL, (lpEventMsg)->paramL);\
  73. STOREWORD(pEventMsg16->paramH, (lpEventMsg)->paramH);\
  74. STORELONG(pEventMsg16->time, GRAINYTICS((lpEventMsg)->time));\
  75. }
  76. #define PUTCBTACTIVATESTRUCT16(pCbtAStruct16,lpCbtAStruct) {\
  77. STOREWORD(pCbtAStruct16->fMouse, (lpCbtAStruct)->fMouse);\
  78. STOREWORD(pCbtAStruct16->hWndActive, (GETHWND16((lpCbtAStruct)->hWndActive)));\
  79. }
  80. #define GETCBTACTIVATESTRUCT16(pCbtAStruct16,lpCbtAStruct) {\
  81. (lpCbtAStruct)->fMouse = FETCHWORD(pCbtAStruct16->fMouse);\
  82. (lpCbtAStruct)->hWndActive = HWND32(FETCHWORD(pCbtAStruct16->hWndActive));\
  83. }
  84. LONG APIENTRY WU32StdHookProc(INT nCode, LONG wParam, LONG lParam, INT iFunc);
  85. LONG APIENTRY WU32SubStdHookProc01(INT nCode, LONG wParam, LONG lParam);
  86. LONG APIENTRY WU32SubStdHookProc02(INT nCode, LONG wParam, LONG lParam);
  87. LONG APIENTRY WU32SubStdHookProc03(INT nCode, LONG wParam, LONG lParam);
  88. LONG APIENTRY WU32SubStdHookProc04(INT nCode, LONG wParam, LONG lParam);
  89. LONG APIENTRY WU32SubStdHookProc05(INT nCode, LONG wParam, LONG lParam);
  90. LONG APIENTRY WU32SubStdHookProc06(INT nCode, LONG wParam, LONG lParam);
  91. LONG APIENTRY WU32SubStdHookProc07(INT nCode, LONG wParam, LONG lParam);
  92. LONG APIENTRY WU32SubStdHookProc08(INT nCode, LONG wParam, LONG lParam);
  93. LONG APIENTRY WU32SubStdHookProc09(INT nCode, LONG wParam, LONG lParam);
  94. LONG APIENTRY WU32SubStdHookProc10(INT nCode, LONG wParam, LONG lParam);
  95. LONG APIENTRY WU32SubStdHookProc11(INT nCode, LONG wParam, LONG lParam);
  96. LONG APIENTRY WU32SubStdHookProc12(INT nCode, LONG wParam, LONG lParam);
  97. LONG APIENTRY WU32SubStdHookProc13(INT nCode, LONG wParam, LONG lParam);
  98. LONG APIENTRY WU32SubStdHookProc14(INT nCode, LONG wParam, LONG lParam);
  99. LONG APIENTRY WU32SubStdHookProc15(INT nCode, LONG wParam, LONG lParam);
  100. LONG APIENTRY WU32SubStdHookProc16(INT nCode, LONG wParam, LONG lParam);
  101. LONG APIENTRY WU32SubStdHookProc17(INT nCode, LONG wParam, LONG lParam);
  102. LONG APIENTRY WU32SubStdHookProc18(INT nCode, LONG wParam, LONG lParam);
  103. LONG APIENTRY WU32SubStdHookProc19(INT nCode, LONG wParam, LONG lParam);
  104. LONG APIENTRY WU32SubStdHookProc20(INT nCode, LONG wParam, LONG lParam);
  105. LONG APIENTRY WU32SubStdHookProc21(INT nCode, LONG wParam, LONG lParam);
  106. LONG APIENTRY WU32SubStdHookProc22(INT nCode, LONG wParam, LONG lParam);
  107. LONG APIENTRY WU32SubStdHookProc23(INT nCode, LONG wParam, LONG lParam);
  108. LONG APIENTRY WU32SubStdHookProc24(INT nCode, LONG wParam, LONG lParam);
  109. LONG APIENTRY WU32SubStdHookProc25(INT nCode, LONG wParam, LONG lParam);
  110. LONG APIENTRY WU32SubStdHookProc26(INT nCode, LONG wParam, LONG lParam);
  111. LONG APIENTRY WU32SubStdHookProc27(INT nCode, LONG wParam, LONG lParam);
  112. LONG APIENTRY WU32SubStdHookProc28(INT nCode, LONG wParam, LONG lParam);
  113. LONG APIENTRY WU32SubStdHookProc29(INT nCode, LONG wParam, LONG lParam);
  114. LONG APIENTRY WU32SubStdHookProc30(INT nCode, LONG wParam, LONG lParam);
  115. LONG APIENTRY WU32SubStdHookProc31(INT nCode, LONG wParam, LONG lParam);
  116. LONG APIENTRY WU32SubStdHookProc32(INT nCode, LONG wParam, LONG lParam);
  117. BOOL W32InitHookState(HANDLE hMod);
  118. BOOL W32GetNotInUseHookStateData(LPHOOKSTATEDATA lpData);
  119. BOOL W32GetHookStateData(LPHOOKSTATEDATA lpData);
  120. BOOL W32SetHookStateData(LPHOOKSTATEDATA lpData);
  121. BOOL W32GetThunkHookProc(INT iHook, DWORD Proc16, LPHOOKSTATEDATA lpData);
  122. HHOOK W32FreeHHook(INT iHook, DWORD Proc16);
  123. HHOOK W32FreeHHookOfIndex(INT iFunc);
  124. BOOL W32GetHookParams(LPHOOKPARAMS lpHookParams);
  125. LONG ThunkCallWndProcHook(INT nCode, LONG wParam, LPCWPSTRUCT lpCwpStruct,
  126. LPHOOKSTATEDATA lpHSData);
  127. LONG ThunkCbtHook(INT nCode, LONG wParam, LONG lParam,
  128. LPHOOKSTATEDATA lpHSData);
  129. LONG ThunkKeyBoardHook(INT nCode, LONG wParam, LONG lParam,
  130. LPHOOKSTATEDATA lpHSData);
  131. LONG ThunkMsgFilterHook(INT nCode, LONG wParam, LPMSG lpMsg,
  132. LPHOOKSTATEDATA lpHSData);
  133. LONG ThunkJournalHook(INT nCode, LONG wParam, LPEVENTMSG lpEventMsg,
  134. LPHOOKSTATEDATA lpHSData);
  135. LONG ThunkDebugHook(INT nCode, LONG wParam, LONG lParam,
  136. LPHOOKSTATEDATA lpHSData);
  137. LONG ThunkMouseHook(INT nCode, LONG wParam, LPMOUSEHOOKSTRUCT lpMHStruct,
  138. LPHOOKSTATEDATA lpHSData);
  139. LONG ThunkShellHook(INT nCode, LONG wParam, LONG lParam,
  140. LPHOOKSTATEDATA lpHSData);
  141. LONG APIENTRY WU32StdDefHookProc(INT nCode, LONG wParam, LONG lParam, INT iFunc);
  142. VOID W32UnhookHooks( HAND16 hMod16, BOOL fQueue );
  143. BOOL W32FreeOwnedHooks(INT iTaskId);
  144. INT W32IsDuplicateHook(INT iHook, DWORD Proc16, INT TaskId);
  145. LONG ThunkCallWndProcHook16(INT nCode, LONG wParam, VPVOID lpCwpStruct,
  146. LPHOOKSTATEDATA lpHSData);
  147. LONG ThunkCbtHook16(INT nCode, LONG wParam, VPVOID lParam,
  148. LPHOOKSTATEDATA lpHSData);
  149. LONG ThunkKeyBoardHook16(INT nCode, LONG wParam, LONG lParam,
  150. LPHOOKSTATEDATA lpHSData);
  151. LONG ThunkMsgFilterHook16(INT nCode, LONG wParam, VPVOID lpMsg,
  152. LPHOOKSTATEDATA lpHSData);
  153. LONG ThunkJournalHook16(INT nCode, LONG wParam, VPVOID lpEventMsg,
  154. LPHOOKSTATEDATA lpHSData);
  155. LONG ThunkDebugHook16(INT nCode, LONG wParam, LONG lParam,
  156. LPHOOKSTATEDATA lpHSData);
  157. LONG ThunkMouseHook16(INT nCode, LONG wParam, VPVOID lpMHStruct,
  158. LPHOOKSTATEDATA lpHSData);
  159. LONG ThunkShellHook16(INT nCode, LONG wParam, LONG lParam,
  160. LPHOOKSTATEDATA lpHSData);
  161. DWORD W32GetHookDDEMsglParam(VOID);
  162. VOID GetEventMessage16(PEVENTMSG16 pEventMsg16, LPEVENTMSG lpEventMsg);