The device default palette is accessed through two pointers, DirectDeviceDefaultPalette and MemoryDeviceDefaultPalette, depending on whether an OD_DIRECT or OD_MEMORY DC is in use. The size of the DirectDeviceDefaultPalette is always kept in ulDirectDeviceDefaultPaletteSize.
The direct device default palette is changed by the ReduceDefaultPaletteSize and IncreaseDefaultPaletteSize functions. These functions change the ulDirectDeviceDefaultPaletteSize, DirectDeviceDefaultPalette, and DefaultDirectLogicalColorTable variables, and update the entries in the DirectSpecialColorTable.