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.

69 lines
1.2 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. FakeThemeMetrics.cpp
  5. Abstract:
  6. This Shim will allow the Skemers group to shim applications that do not behave
  7. well with "Themed" system metrics
  8. History:
  9. 11/30/2000 a-brienw Converted to shim frame work version 2.
  10. --*/
  11. #include "precomp.h"
  12. #ifndef ARRAYSIZE
  13. #define ARRAYSIZE(x) sizeof(x)/sizeof((x)[0])
  14. #endif
  15. IMPLEMENT_SHIM_BEGIN(CanvasCheckedButtons)
  16. #include "ShimHookMacro.h"
  17. // Add APIs that you wish to hook to this enumeration. The first one
  18. // must have "= USERAPIHOOKSTART", and the last one must be
  19. // APIHOOK_Count.
  20. APIHOOK_ENUM_BEGIN
  21. APIHOOK_ENUM_ENTRY(GetSysColor)
  22. APIHOOK_ENUM_END
  23. #define CLRMAX(x) {if (x > 227) x = 227;}
  24. DWORD APIHOOK(GetSysColor)(int nIndex)
  25. {
  26. if (nIndex == COLOR_BTNFACE)
  27. {
  28. COLORREF crOld = (COLORREF)ORIGINAL_API(GetSysColor)(nIndex);
  29. BYTE r = GetRValue(crOld);
  30. BYTE g = GetGValue(crOld);
  31. BYTE b = GetBValue(crOld);
  32. CLRMAX(r);
  33. CLRMAX(g);
  34. CLRMAX(b);
  35. return RGB(r,g,b);
  36. }
  37. return ORIGINAL_API(GetSysColor)(nIndex);
  38. }
  39. /*++
  40. Register hooked functions
  41. --*/
  42. HOOK_BEGIN
  43. APIHOOK_ENTRY(USER32.DLL, GetSysColor)
  44. HOOK_END
  45. IMPLEMENT_SHIM_END