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.

65 lines
949 B

  1. /*++
  2. Copyright (c) 2002 Microsoft Corporation
  3. Module Name:
  4. DrEye.cpp
  5. Abstract:
  6. The App calls GetFocus Which returned NULL. This value was passed onto CWnd::FromHandle.
  7. CWnd::FromHandle returned NULL. App checked for this return value & threw AV.
  8. The fix is to return a valid handle when GetFocus is called.
  9. Notes:
  10. This is an app specific shim.
  11. History:
  12. 01/07/2002 mamathas Created
  13. --*/
  14. #include "precomp.h"
  15. IMPLEMENT_SHIM_BEGIN(DrEye)
  16. #include "ShimHookMacro.h"
  17. APIHOOK_ENUM_BEGIN
  18. APIHOOK_ENUM_ENTRY(GetFocus)
  19. APIHOOK_ENUM_END
  20. /*++
  21. Hook GetFocus and try to return a valid handle.
  22. --*/
  23. HWND
  24. APIHOOK(GetFocus)()
  25. {
  26. HWND hWnd = ORIGINAL_API(GetFocus)();
  27. if (hWnd) {
  28. return hWnd;
  29. }
  30. else {
  31. return GetDesktopWindow();
  32. }
  33. }
  34. /*++
  35. Register hooked functions
  36. --*/
  37. HOOK_BEGIN
  38. APIHOOK_ENTRY(USER32.DLL, GetFocus)
  39. HOOK_END
  40. IMPLEMENT_SHIM_END