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.

75 lines
1.4 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. BigGameHunter3.cpp
  5. Abstract:
  6. BGH calls GetWindowLong() to get a window procedure and subsequently
  7. does not call CallWindowProc() with the value returned from
  8. GetWindowLong(). This patch calls GetWindowLongW( ), which returns the
  9. window procedure.
  10. Notes:
  11. This is an app specific shim. Making it general will require generating
  12. a stub function that just uses CallWindowProc for every returned handle.
  13. Too much work, not enough gain.
  14. History:
  15. 03/16/2000 prashkud Created
  16. --*/
  17. #include "precomp.h"
  18. IMPLEMENT_SHIM_BEGIN(BigGameHunter3)
  19. #include "ShimHookMacro.h"
  20. APIHOOK_ENUM_BEGIN
  21. APIHOOK_ENUM_ENTRY(GetWindowLongA)
  22. APIHOOK_ENUM_END
  23. /*++
  24. This function intercepts GetWindowLong( ), checks the nIndex for GWL_WNDPROC
  25. and if it is,calls GetWindowLongW( ). Otherwise, it calls GetWindowLongA( )
  26. --*/
  27. LONG
  28. APIHOOK(GetWindowLongA)(
  29. HWND hwnd,
  30. int nIndex )
  31. {
  32. LONG lRet;
  33. // Apply the modification only if the App wants a WindowProc.
  34. if (nIndex == GWL_WNDPROC)
  35. {
  36. lRet = GetWindowLongW(hwnd, nIndex);
  37. }
  38. else
  39. {
  40. lRet = ORIGINAL_API(GetWindowLongA)(hwnd, nIndex);
  41. }
  42. return lRet;
  43. }
  44. /*++
  45. Register hooked functions
  46. --*/
  47. HOOK_BEGIN
  48. APIHOOK_ENTRY(USER32.DLL, GetWindowLongA)
  49. HOOK_END
  50. IMPLEMENT_SHIM_END