Difference between revisions of "Techwiki:DC State Saving"
|Line 55:||Line 55:|
'''The following fields
'''The following fields :'''
Latest revision as of 09:15, 18 May 2015
DC State saving is done from SaveDC (NtGdiSaveDC), restoring from RestoreDC (NtGdiRestoreDC). The Saved levels form a linked list of HDCs, with the first saved state DC in the original DC's dclevel.hdcSave. Each Saved DC has this field set to the last DC that was saved before. The hdcSave field is initialized with 0. The dclevel.lSaveDepth specifies the DCs save level. It is initialized with 1 and grows by one each time you call SaveDC. After calling RestoreDC, it is restored to the requested level. Saved DCs don't belong to the current process. The ProcessId field is 0x80000012 (GDI_OBJ_HMGR_NONE) (found on XP). After restoring the state, ulDirty flags are set: 0x0012001f ( (DIRTY_FILL 0x01 | DIRTY_LINE 0x02 | DIRTY_TEXT 0x04 | DIRTY_BACKGROUND 0x08 | DIRTY_CHARSET 0x10 | 0x20000).
The following fields are saved:
- DC.ppdev: either copied or initialized to the same value as the original DC
- DC.dclevel.lapath (at least partly)
- *DC.pdc->pdcattr (full dcattr is copied, only some fields in VisRectRegion seem to be restored to a valid state)
The following fields are not saved:
The following fields are modified:
The following fields need investigation: