merge down changes from win32k-gdi-dx

1. Cleanup the layout it was mix of space and tab for whitespace
2. dllmain add same behoirs as xp/vista

svn path=/trunk/; revision=33797
This commit is contained in:
Magnus Olsen 2008-06-01 07:54:17 +00:00
parent 1177ff923f
commit 61f33dad43

View file

@ -15,18 +15,26 @@ PDEVCAPS GdiDevCaps = NULL;
PGDIHANDLECACHE GdiHandleCache = NULL; PGDIHANDLECACHE GdiHandleCache = NULL;
/* /*
* GDI32.DLL doesn't have an entry point. The initialization is done by a call * GDI32.DLL does have an entry point for disable threadlibrarycall,. The initialization is done by a call
* to GdiDllInitialize(). This call is done from the entry point of USER32.DLL. * to GdiDllInitialize(). This call is done from the entry point of USER32.DLL.
*/ */
BOOL BOOL
WINAPI WINAPI
DllMain ( DllMain (
HANDLE hDll, HANDLE hDll,
DWORD dwReason, DWORD dwReason,
LPVOID lpReserved LPVOID lpReserved)
)
{ {
return TRUE; switch (dwReason)
{
case DLL_PROCESS_ATTACH :
DisableThreadLibraryCalls(hDll);
break;
default:
break;
}
return TRUE;
} }
@ -34,15 +42,15 @@ VOID
WINAPI WINAPI
GdiProcessSetup (VOID) GdiProcessSetup (VOID)
{ {
hProcessHeap = GetProcessHeap(); hProcessHeap = GetProcessHeap();
/* map the gdi handle table to user space */ /* map the gdi handle table to user space */
GdiHandleTable = NtCurrentTeb()->ProcessEnvironmentBlock->GdiSharedHandleTable; GdiHandleTable = NtCurrentTeb()->ProcessEnvironmentBlock->GdiSharedHandleTable;
GdiSharedHandleTable = NtCurrentTeb()->ProcessEnvironmentBlock->GdiSharedHandleTable; GdiSharedHandleTable = NtCurrentTeb()->ProcessEnvironmentBlock->GdiSharedHandleTable;
GdiDevCaps = &GdiSharedHandleTable->DevCaps; GdiDevCaps = &GdiSharedHandleTable->DevCaps;
CurrentProcessId = NtCurrentTeb()->Cid.UniqueProcess; CurrentProcessId = NtCurrentTeb()->Cid.UniqueProcess;
GDI_BatchLimit = (DWORD) NtCurrentTeb()->ProcessEnvironmentBlock->GdiDCAttributeList; GDI_BatchLimit = (DWORD) NtCurrentTeb()->ProcessEnvironmentBlock->GdiDCAttributeList;
GdiHandleCache = (PGDIHANDLECACHE)NtCurrentTeb()->ProcessEnvironmentBlock->GdiHandleBuffer; GdiHandleCache = (PGDIHANDLECACHE)NtCurrentTeb()->ProcessEnvironmentBlock->GdiHandleBuffer;
} }
@ -52,34 +60,33 @@ GdiProcessSetup (VOID)
BOOL BOOL
WINAPI WINAPI
GdiDllInitialize ( GdiDllInitialize (
HANDLE hDll, HANDLE hDll,
DWORD dwReason, DWORD dwReason,
LPVOID lpReserved LPVOID lpReserved)
)
{ {
switch (dwReason) switch (dwReason)
{ {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
GdiProcessSetup (); GdiProcessSetup ();
break; break;
case DLL_THREAD_ATTACH: case DLL_THREAD_ATTACH:
NtCurrentTeb()->GdiTebBatch.Offset = 0; NtCurrentTeb()->GdiTebBatch.Offset = 0;
NtCurrentTeb()->GdiBatchCount = 0; NtCurrentTeb()->GdiBatchCount = 0;
break; break;
default: default:
return FALSE; return FALSE;
} }
// Very simple, the list will fill itself as it is needed. // Very simple, the list will fill itself as it is needed.
if(!SetStockObjects) if(!SetStockObjects)
{ {
RtlZeroMemory( &stock_objects, NB_STOCK_OBJECTS); //Assume Ros is dirty. RtlZeroMemory( &stock_objects, NB_STOCK_OBJECTS); //Assume Ros is dirty.
SetStockObjects = TRUE; SetStockObjects = TRUE;
} }
return TRUE; return TRUE;
} }
/* EOF */ /* EOF */