Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygendcattr.c
Go to the documentation of this file.
00001 /* 00002 * COPYRIGHT: See COPYING in the top level directory 00003 * PROJECT: ReactOS kernel 00004 * PURPOSE: Functions for creation and destruction of DCs 00005 * FILE: subsystem/win32/win32k/objects/dcattr.c 00006 * PROGRAMER: Timo Kreuzer (timo.kreuzer@rectos.org) 00007 */ 00008 00009 #include <win32k.h> 00010 00011 #define NDEBUG 00012 #include <debug.h> 00013 00014 #define GDIDCATTRFREE 8 00015 00016 typedef struct _GDI_DC_ATTR_FREELIST 00017 { 00018 LIST_ENTRY Entry; 00019 DWORD nEntries; 00020 PVOID AttrList[GDIDCATTRFREE]; 00021 } GDI_DC_ATTR_FREELIST, *PGDI_DC_ATTR_FREELIST; 00022 00023 typedef struct _GDI_DC_ATTR_ENTRY 00024 { 00025 DC_ATTR Attr[GDIDCATTRFREE]; 00026 } GDI_DC_ATTR_ENTRY, *PGDI_DC_ATTR_ENTRY; 00027 00028 00029 BOOL 00030 NTAPI 00031 DC_bAllocDcAttr(PDC pdc) 00032 { 00033 PPROCESSINFO ppi; 00034 PDC_ATTR pdcattr; 00035 00036 ppi = PsGetCurrentProcessWin32Process(); 00037 ASSERT(ppi); 00038 00039 pdcattr = GdiPoolAllocate(ppi->pPoolDcAttr); 00040 if (!pdcattr) 00041 { 00042 DPRINT1("Could not allocate DC attr\n"); 00043 return FALSE; 00044 } 00045 00046 /* Copy the content from the kernel mode dc attr */ 00047 pdc->pdcattr = pdcattr; 00048 *pdc->pdcattr = pdc->dcattr; 00049 00050 /* Set the object attribute in the handle table */ 00051 GDIOBJ_vSetObjectAttr(&pdc->BaseObject, pdcattr); 00052 00053 DPRINT("DC_AllocDcAttr: pdc=%p, pdc->pdcattr=%p\n", pdc, pdc->pdcattr); 00054 return TRUE; 00055 } 00056 00057 VOID 00058 NTAPI 00059 DC_vFreeDcAttr(PDC pdc) 00060 { 00061 PPROCESSINFO ppi; 00062 00063 if (pdc->pdcattr == &pdc->dcattr) 00064 { 00065 // Internal DC object! 00066 return; 00067 } 00068 00069 /* Reset the object attribute in the handle table */ 00070 GDIOBJ_vSetObjectAttr(&pdc->BaseObject, NULL); 00071 00072 ppi = PsGetCurrentProcessWin32Process(); 00073 ASSERT(ppi); 00074 GdiPoolFree(ppi->pPoolDcAttr, pdc->pdcattr); 00075 00076 /* Reset to kmode dcattr */ 00077 pdc->pdcattr = &pdc->dcattr; 00078 } Generated on Sun May 27 2012 04:38:24 for ReactOS by
1.7.6.1
|