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.

85 lines
1.4 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. WordPerfect9_1.cpp
  5. Abstract:
  6. Dispatch WM_USER messages (an OLE message in this case) automatically
  7. so the app doesn't hang. This is needed because of changes in OLE's behavior
  8. from Win9x to NT.
  9. Notes:
  10. This is an app specific shim.
  11. History:
  12. 02/16/2000 clupu Created
  13. --*/
  14. #include "precomp.h"
  15. IMPLEMENT_SHIM_BEGIN(WordPerfect9_1)
  16. #include "ShimHookMacro.h"
  17. APIHOOK_ENUM_BEGIN
  18. APIHOOK_ENUM_ENTRY(PeekMessageA)
  19. APIHOOK_ENUM_END
  20. /*++
  21. Dispatch WM_USER (an OLE message in this case) messages automatically.
  22. --*/
  23. BOOL
  24. APIHOOK(PeekMessageA)(
  25. LPMSG lpMsg,
  26. HWND hWnd,
  27. UINT wMsgFilterMin,
  28. UINT wMsgFilterMax,
  29. UINT wRemoveMsg)
  30. {
  31. BOOL bRet;
  32. bRet = ORIGINAL_API(PeekMessageA)(
  33. lpMsg,
  34. hWnd,
  35. wMsgFilterMin,
  36. wMsgFilterMax,
  37. wRemoveMsg);
  38. if (bRet && lpMsg->message == WM_USER && lpMsg->hwnd != NULL) {
  39. DispatchMessageA(lpMsg);
  40. if (wRemoveMsg == PM_REMOVE) {
  41. return APIHOOK(PeekMessageA)(
  42. lpMsg,
  43. hWnd,
  44. wMsgFilterMin,
  45. wMsgFilterMax,
  46. wRemoveMsg);
  47. }
  48. }
  49. return bRet;
  50. }
  51. /*++
  52. Register hooked functions
  53. --*/
  54. HOOK_BEGIN
  55. APIHOOK_ENTRY(USER32.DLL, PeekMessageA)
  56. HOOK_END
  57. IMPLEMENT_SHIM_END