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.

141 lines
4.4 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. ForceDefaultSystemPaletteEntries.cpp
  5. Abstract:
  6. This shim hard-codes DefaultPalette with correct palette information.
  7. Notes:
  8. This is a general purpose shim.
  9. History:
  10. 11/22/1999 linstev Created
  11. 11/29/2000 a-larrsh Ported to Multi-Shim Format
  12. --*/
  13. #include "precomp.h"
  14. IMPLEMENT_SHIM_BEGIN(ForceDefaultSystemPaletteEntries)
  15. #include "ShimHookMacro.h"
  16. APIHOOK_ENUM_BEGIN
  17. APIHOOK_ENUM_ENTRY(GetSystemPaletteEntries)
  18. APIHOOK_ENUM_END
  19. // Initialize global palette
  20. DWORD DefaultPalette[256] =
  21. {
  22. 0x00000000, 0x00000080, 0x00008000, 0x00008080,
  23. 0x00800000, 0x00800080, 0x00808000, 0x00C0C0C0,
  24. 0x00C0DCC0, 0x00F0CAA6, 0x04081824, 0x04142830,
  25. 0x0418303C, 0x04304D61, 0x0451514D, 0x044D7161,
  26. 0x04826D61, 0x040C1414, 0x04597582, 0x04759E08,
  27. 0x04303438, 0x04AA6938, 0x04203428, 0x04496161,
  28. 0x0449869E, 0x047D9A6D, 0x040869CB, 0x048E8682,
  29. 0x0475615D, 0x040061EB, 0x04000871, 0x042C3830,
  30. 0x040471EF, 0x048E92AA, 0x04306DF7, 0x0404C3C3,
  31. 0x0492AAB2, 0x04101814, 0x04040C08, 0x040C7110,
  32. 0x04CFA282, 0x040008AA, 0x0428412C, 0x04498EB2,
  33. 0x04204D61, 0x04555955, 0x0404D3D3, 0x041C3C4D,
  34. 0x0420A6F7, 0x0410A210, 0x0418241C, 0x045DAEF3,
  35. 0x04719EAA, 0x04B2E720, 0x04102871, 0x0486C3D3,
  36. 0x04288A2C, 0x040C51BA, 0x0459716D, 0x04494D4D,
  37. 0x04AAB6C3, 0x04005100, 0x0420CBF7, 0x044D8A51,
  38. 0x04BEC7B2, 0x04043CBA, 0x04101C18, 0x040851DF,
  39. 0x04A6E7A6, 0x049ECF24, 0x04797592, 0x04AE7559,
  40. 0x049E8269, 0x04CFE3DF, 0x040C2030, 0x0428692C,
  41. 0x049EA2A2, 0x04F7C782, 0x0434617D, 0x04B6BEBE,
  42. 0x04969E86, 0x04DBFBD3, 0x04655149, 0x0465EF65,
  43. 0x04AED3D3, 0x04E7924D, 0x04B2BEB2, 0x04D7DBDB,
  44. 0x04797571, 0x04344D59, 0x0486B2CF, 0x04512C14,
  45. 0x04A6FBFB, 0x04385965, 0x04828E92, 0x041C4161,
  46. 0x04595961, 0x04002000, 0x043C6D7D, 0x045DB2D7,
  47. 0x0438EF3C, 0x0451CB55, 0x041C2424, 0x0461C3F3,
  48. 0x0408A2A2, 0x0438413C, 0x04204951, 0x04108A14,
  49. 0x04103010, 0x047DE7F7, 0x04143449, 0x04B2652C,
  50. 0x04F7EBAA, 0x043C7192, 0x0404FBFB, 0x04696151,
  51. 0x04EFC796, 0x040441D7, 0x04000404, 0x04388AF7,
  52. 0x048AD3F3, 0x04006500, 0x040004E3, 0x04DBFFFF,
  53. 0x04F7AE69, 0x04CF864D, 0x0455A2D3, 0x04EBEFE3,
  54. 0x04EB8A41, 0x04CF9261, 0x04C3F710, 0x048E8E82,
  55. 0x04FBFFFF, 0x04104110, 0x04040851, 0x0482FBFB,
  56. 0x043CC734, 0x04088A8A, 0x04384545, 0x04514134,
  57. 0x043C7996, 0x041C6161, 0x04EBB282, 0x04004100,
  58. 0x04715951, 0x04A2AAA6, 0x04B2B6B2, 0x04C3FBFB,
  59. 0x04000834, 0x0428413C, 0x04C7C7CF, 0x04CFD3D3,
  60. 0x04824520, 0x0408CB0C, 0x041C1C1C, 0x04A6B29A,
  61. 0x0471A6BE, 0x04CF9E6D, 0x046D7161, 0x04008A04,
  62. 0x045171BE, 0x04C7D3C3, 0x04969E96, 0x04798696,
  63. 0x042C1C10, 0x04385149, 0x04BE7538, 0x0408141C,
  64. 0x04C3C7C7, 0x04202C28, 0x04D3E3CF, 0x0471826D,
  65. 0x04653C1C, 0x0404EF08, 0x04345575, 0x046D92A6,
  66. 0x04797979, 0x0486F38A, 0x04925528, 0x04E3E7E7,
  67. 0x04456151, 0x041C499A, 0x04656961, 0x048E9EA2,
  68. 0x047986D3, 0x04204151, 0x048AC7E3, 0x04007100,
  69. 0x04519EBE, 0x0410510C, 0x04A6AAAA, 0x042C3030,
  70. 0x04D37934, 0x04183030, 0x0449828E, 0x04CBFBC3,
  71. 0x046D7171, 0x040428A6, 0x044D4545, 0x04040C14,
  72. 0x04087575, 0x0471CB79, 0x044D6D0C, 0x04FBFBD3,
  73. 0x04AAB2AE, 0x04929292, 0x04F39E55, 0x04005D00,
  74. 0x04E3D7B2, 0x04F7FBC3, 0x043C5951, 0x0404B2B2,
  75. 0x0434658E, 0x040486EF, 0x04F7FBE3, 0x04616161,
  76. 0x04DFE3DF, 0x041C100C, 0x0408100C, 0x0408180C,
  77. 0x04598600, 0x0424FBFB, 0x04346171, 0x04042CC7,
  78. 0x04AEC79A, 0x0445AE4D, 0x0428A62C, 0x04EFA265,
  79. 0x047D8282, 0x04F7D79A, 0x0465D3F7, 0x04E3E7BA,
  80. 0x04003000, 0x04245571, 0x04DF823C, 0x048AAEC3,
  81. 0x04A2C3D3, 0x04A6FBA2, 0x04F3FFF3, 0x04AAD7E7,
  82. 0x04EFEFC3, 0x0455F7FB, 0x04EFF3F3, 0x04BED3B2,
  83. 0x0404EBEB, 0x04A6E3F7, 0x00F0FBFF, 0x00A4A0A0,
  84. 0x00808080, 0x000000FF, 0x0000FF00, 0x0000FFFF,
  85. 0x00FF0000, 0x00FF00FF, 0x00FFFF00, 0x00FFFFFF
  86. };
  87. /*++
  88. Copy the values stored in DefaultPalette into lppe.
  89. --*/
  90. UINT
  91. APIHOOK(GetSystemPaletteEntries)(
  92. HDC hdc,
  93. UINT iStartIndex,
  94. UINT nEntries,
  95. LPPALETTEENTRY lppe
  96. )
  97. {
  98. if (lppe)
  99. {
  100. memcpy(
  101. lppe,
  102. &DefaultPalette[iStartIndex],
  103. nEntries * sizeof(PALETTEENTRY));
  104. }
  105. else
  106. {
  107. nEntries = 256;
  108. }
  109. return nEntries;
  110. }
  111. /*++
  112. Register hooked functions
  113. --*/
  114. HOOK_BEGIN
  115. APIHOOK_ENTRY(GDI32.DLL, GetSystemPaletteEntries)
  116. HOOK_END
  117. IMPLEMENT_SHIM_END