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.

105 lines
2.0 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. RiskII.cpp
  5. Abstract:
  6. This shim hooks LoadImageA to intercept the loading of two
  7. cursors and returns copies of the system cursors instead of
  8. the ones RiskII was trying to get. RiskII's cursors were
  9. being rendered by software and it caused them to flicker since
  10. RiskII locks the primary surface. The system cursors are
  11. hardware cursors and don't flicker.
  12. History:
  13. 08/03/2000 t-adams Created
  14. --*/
  15. #include "precomp.h"
  16. #include <mmsystem.h>
  17. IMPLEMENT_SHIM_BEGIN(RiskII)
  18. #include "ShimHookMacro.h"
  19. APIHOOK_ENUM_BEGIN
  20. APIHOOK_ENUM_ENTRY(LoadImageA)
  21. APIHOOK_ENUM_END
  22. /*++
  23. Abstract:
  24. Intercept the load of two cursors, and replace with the appropriate
  25. similar-looking system cursors.
  26. History:
  27. 08/03/2000 t-adams Created
  28. --*/
  29. HANDLE
  30. APIHOOK(LoadImageA)(
  31. HINSTANCE hinst,
  32. LPCSTR lpszName,
  33. UINT uType,
  34. int cxDesired,
  35. int cyDesired,
  36. UINT fuLoad)
  37. {
  38. HANDLE hRet = INVALID_HANDLE_VALUE;
  39. CSTRING_TRY
  40. {
  41. CString csName(lpszName);
  42. if (csName.CompareNoCase(L"Gfx\\Arrow_m.cur") == 0 )
  43. {
  44. HCURSOR hCur = LoadCursor(NULL, IDC_ARROW);
  45. if (hCur)
  46. {
  47. hRet = CopyCursor(hCur);
  48. }
  49. }
  50. else if (csName.CompareNoCase(L"Gfx\\Busy_m.cur") == 0 )
  51. {
  52. HCURSOR hCur = LoadCursor(NULL, IDC_WAIT);
  53. if (hCur)
  54. {
  55. hRet = CopyCursor(hCur);
  56. }
  57. }
  58. }
  59. CSTRING_CATCH
  60. {
  61. // Do Nothing
  62. }
  63. if (hRet == INVALID_HANDLE_VALUE)
  64. {
  65. hRet = ORIGINAL_API(LoadImageA)(hinst, lpszName, uType, cxDesired, cyDesired, fuLoad);
  66. }
  67. return hRet;
  68. }
  69. /*++
  70. Register hooked functions
  71. --*/
  72. HOOK_BEGIN
  73. APIHOOK_ENTRY(USER32.DLL, LoadImageA)
  74. HOOK_END
  75. IMPLEMENT_SHIM_END