Source code of Windows XP (NT5)
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.

73 lines
904 B

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. RemoveBroadcastPostMessage.cpp
  5. Abstract:
  6. Fix apps that don't handle broadcast messages.
  7. Notes:
  8. This is a general purpose shim.
  9. History:
  10. 04/28/2000 a-batjar Created
  11. --*/
  12. #include "precomp.h"
  13. IMPLEMENT_SHIM_BEGIN(RemoveBroadcastPostMessage)
  14. #include "ShimHookMacro.h"
  15. APIHOOK_ENUM_BEGIN
  16. APIHOOK_ENUM_ENTRY(PostMessageA)
  17. APIHOOK_ENUM_END
  18. /*++
  19. Filter HWND_BROADCAST messages
  20. --*/
  21. BOOL
  22. APIHOOK(PostMessageA)(
  23. HWND hwnd,
  24. UINT Msg,
  25. WPARAM wParam,
  26. LPARAM lParam
  27. )
  28. {
  29. if (hwnd == HWND_BROADCAST)
  30. {
  31. hwnd = NULL;
  32. }
  33. return ORIGINAL_API(PostMessageA)(
  34. hwnd,
  35. Msg,
  36. wParam,
  37. lParam);
  38. }
  39. /*++
  40. Register hooked functions
  41. --*/
  42. HOOK_BEGIN
  43. APIHOOK_ENTRY(USER32.DLL, PostMessageA)
  44. HOOK_END
  45. IMPLEMENT_SHIM_END