|
|
/*++
Copyright (c) 2000 Microsoft Corporation
Module Name:
ForceDefaultSystemPaletteEntries.cpp
Abstract:
This shim hard-codes DefaultPalette with correct palette information.
Notes:
This is a general purpose shim.
History:
11/22/1999 linstev Created 11/29/2000 a-larrsh Ported to Multi-Shim Format --*/
#include "precomp.h"
IMPLEMENT_SHIM_BEGIN(ForceDefaultSystemPaletteEntries) #include "ShimHookMacro.h"
APIHOOK_ENUM_BEGIN APIHOOK_ENUM_ENTRY(GetSystemPaletteEntries) APIHOOK_ENUM_END
// Initialize global palette
DWORD DefaultPalette[256] = { 0x00000000, 0x00000080, 0x00008000, 0x00008080, 0x00800000, 0x00800080, 0x00808000, 0x00C0C0C0, 0x00C0DCC0, 0x00F0CAA6, 0x04081824, 0x04142830, 0x0418303C, 0x04304D61, 0x0451514D, 0x044D7161, 0x04826D61, 0x040C1414, 0x04597582, 0x04759E08, 0x04303438, 0x04AA6938, 0x04203428, 0x04496161, 0x0449869E, 0x047D9A6D, 0x040869CB, 0x048E8682, 0x0475615D, 0x040061EB, 0x04000871, 0x042C3830, 0x040471EF, 0x048E92AA, 0x04306DF7, 0x0404C3C3, 0x0492AAB2, 0x04101814, 0x04040C08, 0x040C7110, 0x04CFA282, 0x040008AA, 0x0428412C, 0x04498EB2, 0x04204D61, 0x04555955, 0x0404D3D3, 0x041C3C4D, 0x0420A6F7, 0x0410A210, 0x0418241C, 0x045DAEF3, 0x04719EAA, 0x04B2E720, 0x04102871, 0x0486C3D3, 0x04288A2C, 0x040C51BA, 0x0459716D, 0x04494D4D, 0x04AAB6C3, 0x04005100, 0x0420CBF7, 0x044D8A51, 0x04BEC7B2, 0x04043CBA, 0x04101C18, 0x040851DF, 0x04A6E7A6, 0x049ECF24, 0x04797592, 0x04AE7559, 0x049E8269, 0x04CFE3DF, 0x040C2030, 0x0428692C, 0x049EA2A2, 0x04F7C782, 0x0434617D, 0x04B6BEBE, 0x04969E86, 0x04DBFBD3, 0x04655149, 0x0465EF65, 0x04AED3D3, 0x04E7924D, 0x04B2BEB2, 0x04D7DBDB, 0x04797571, 0x04344D59, 0x0486B2CF, 0x04512C14, 0x04A6FBFB, 0x04385965, 0x04828E92, 0x041C4161, 0x04595961, 0x04002000, 0x043C6D7D, 0x045DB2D7, 0x0438EF3C, 0x0451CB55, 0x041C2424, 0x0461C3F3, 0x0408A2A2, 0x0438413C, 0x04204951, 0x04108A14, 0x04103010, 0x047DE7F7, 0x04143449, 0x04B2652C, 0x04F7EBAA, 0x043C7192, 0x0404FBFB, 0x04696151, 0x04EFC796, 0x040441D7, 0x04000404, 0x04388AF7, 0x048AD3F3, 0x04006500, 0x040004E3, 0x04DBFFFF, 0x04F7AE69, 0x04CF864D, 0x0455A2D3, 0x04EBEFE3, 0x04EB8A41, 0x04CF9261, 0x04C3F710, 0x048E8E82, 0x04FBFFFF, 0x04104110, 0x04040851, 0x0482FBFB, 0x043CC734, 0x04088A8A, 0x04384545, 0x04514134, 0x043C7996, 0x041C6161, 0x04EBB282, 0x04004100, 0x04715951, 0x04A2AAA6, 0x04B2B6B2, 0x04C3FBFB, 0x04000834, 0x0428413C, 0x04C7C7CF, 0x04CFD3D3, 0x04824520, 0x0408CB0C, 0x041C1C1C, 0x04A6B29A, 0x0471A6BE, 0x04CF9E6D, 0x046D7161, 0x04008A04, 0x045171BE, 0x04C7D3C3, 0x04969E96, 0x04798696, 0x042C1C10, 0x04385149, 0x04BE7538, 0x0408141C, 0x04C3C7C7, 0x04202C28, 0x04D3E3CF, 0x0471826D, 0x04653C1C, 0x0404EF08, 0x04345575, 0x046D92A6, 0x04797979, 0x0486F38A, 0x04925528, 0x04E3E7E7, 0x04456151, 0x041C499A, 0x04656961, 0x048E9EA2, 0x047986D3, 0x04204151, 0x048AC7E3, 0x04007100, 0x04519EBE, 0x0410510C, 0x04A6AAAA, 0x042C3030, 0x04D37934, 0x04183030, 0x0449828E, 0x04CBFBC3, 0x046D7171, 0x040428A6, 0x044D4545, 0x04040C14, 0x04087575, 0x0471CB79, 0x044D6D0C, 0x04FBFBD3, 0x04AAB2AE, 0x04929292, 0x04F39E55, 0x04005D00, 0x04E3D7B2, 0x04F7FBC3, 0x043C5951, 0x0404B2B2, 0x0434658E, 0x040486EF, 0x04F7FBE3, 0x04616161, 0x04DFE3DF, 0x041C100C, 0x0408100C, 0x0408180C, 0x04598600, 0x0424FBFB, 0x04346171, 0x04042CC7, 0x04AEC79A, 0x0445AE4D, 0x0428A62C, 0x04EFA265, 0x047D8282, 0x04F7D79A, 0x0465D3F7, 0x04E3E7BA, 0x04003000, 0x04245571, 0x04DF823C, 0x048AAEC3, 0x04A2C3D3, 0x04A6FBA2, 0x04F3FFF3, 0x04AAD7E7, 0x04EFEFC3, 0x0455F7FB, 0x04EFF3F3, 0x04BED3B2, 0x0404EBEB, 0x04A6E3F7, 0x00F0FBFF, 0x00A4A0A0, 0x00808080, 0x000000FF, 0x0000FF00, 0x0000FFFF, 0x00FF0000, 0x00FF00FF, 0x00FFFF00, 0x00FFFFFF };
/*++
Copy the values stored in DefaultPalette into lppe.
--*/
UINT APIHOOK(GetSystemPaletteEntries)( HDC hdc, UINT iStartIndex, UINT nEntries, LPPALETTEENTRY lppe ) { if (lppe) { if (iStartIndex < 256) { // From original NT code, prevent overruning the user-provided buffer.
int cToCopy = min(256-iStartIndex, nEntries); memcpy( lppe, &DefaultPalette[iStartIndex], cToCopy * sizeof(PALETTEENTRY)); } } else { nEntries = 256; } return nEntries; }
/*++
Register hooked functions
--*/
HOOK_BEGIN APIHOOK_ENTRY(GDI32.DLL, GetSystemPaletteEntries) HOOK_END
IMPLEMENT_SHIM_END
|