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.

91 lines
1.8 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. CreateResumesQuickandEasy.cpp
  5. Abstract:
  6. Hooks all application-defined window procedures and filters out an illegal
  7. OCM notification code which causes the application to beep annoyingly.
  8. Notes:
  9. History:
  10. 03/22/2000 mnikkel Created
  11. 01/10/2001 mnikkel Corrected to prevent a recursion problem.
  12. 01/11/2001 mnikkel Trimmed down to only necessary routines.
  13. --*/
  14. #include "precomp.h"
  15. #include "olectl.h"
  16. IMPLEMENT_SHIM_BEGIN(CreateResumesQuickandEasy)
  17. #include "ShimHookMacro.h"
  18. APIHOOK_ENUM_BEGIN
  19. APIHOOK_ENUM_ENTRY(RegisterClassA)
  20. APIHOOK_ENUM_END
  21. /*++
  22. Change OCM_NOTIFY behaviour
  23. --*/
  24. LRESULT CALLBACK
  25. CreateResumesQuickandEasy_WindowProcHook(
  26. WNDPROC pfnOld, // address of old WindowProc
  27. HWND hwnd, // handle to window
  28. UINT uMsg, // message identifier
  29. WPARAM wParam, // first message parameter
  30. LPARAM lParam // second message parameter
  31. )
  32. {
  33. if (uMsg == OCM_NOTIFY)
  34. {
  35. NMHDR *pNmhdr = (LPNMHDR) lParam;
  36. // For OCM Notification check for the illegal code and toss it
  37. // (App Create Resumes Quick and Easy)
  38. if (pNmhdr && pNmhdr->idFrom == 0 && pNmhdr->code == 0x704)
  39. return 0;
  40. }
  41. return (*pfnOld)(hwnd, uMsg, wParam, lParam);
  42. }
  43. /*++
  44. Hook all possible calls that can initialize or change a window's
  45. WindowProc (or DialogProc)
  46. --*/
  47. ATOM
  48. APIHOOK(RegisterClassA)(
  49. CONST WNDCLASSA *lpWndClass // class data
  50. )
  51. {
  52. WNDCLASSA wcNewWndClass = *lpWndClass;
  53. wcNewWndClass.lpfnWndProc = (WNDPROC) HookCallback(lpWndClass->lpfnWndProc, CreateResumesQuickandEasy_WindowProcHook);
  54. return ORIGINAL_API(RegisterClassA)(&wcNewWndClass);
  55. }
  56. /*++
  57. Register hooked functions
  58. --*/
  59. HOOK_BEGIN
  60. APIHOOK_ENTRY(USER32.DLL, RegisterClassA);
  61. HOOK_END
  62. IMPLEMENT_SHIM_END