As described in GDI Support for Graphics Drivers, GDI handles much of the palette management work. The driver must supply its default palette to GDI in the DEVINFO structure when GDI calls DrvEnablePDEV. At this time, the driver should create the default palette with a call to the GDI service function EngCreatePalette.
Drivers that support settable palettes also must support the entry point DrvSetPalette. This function is used exclusively by display drivers.