3 #include <user32/callback.h>
4 #include <user32/accel.h>
12 /* See debug.h for debug/trace constants */
13 DWORD DebugTraceLevel
= MIN_TRACE
;
17 extern RTL_CRITICAL_SECTION gcsMPH
;
18 static ULONG User32TlsIndex
;
20 /* To make the linker happy */
21 VOID STDCALL
KeBugCheck (ULONG BugCheckCode
) {}
23 HWINSTA ProcessWindowStation
;
28 return((PUSER32_THREAD_DATA
)TlsGetValue(User32TlsIndex
));
34 PUSER32_THREAD_DATA ThreadData
;
36 ThreadData
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
37 sizeof(USER32_THREAD_DATA
));
38 TlsSetValue(User32TlsIndex
, ThreadData
);
44 PUSER32_THREAD_DATA ThreadData
;
46 ThreadData
= (PUSER32_THREAD_DATA
)TlsGetValue(User32TlsIndex
);
47 HeapFree(GetProcessHeap(), HEAP_ZERO_MEMORY
, ThreadData
);
48 TlsSetValue(User32TlsIndex
, 0);
56 /* Set up the kernel callbacks. */
57 NtCurrentPeb()->KernelCallbackTable
[USER32_CALLBACK_WINDOWPROC
] =
58 (PVOID
)User32CallWindowProcFromKernel
;
59 NtCurrentPeb()->KernelCallbackTable
[USER32_CALLBACK_SENDASYNCPROC
] =
60 (PVOID
)User32CallSendAsyncProcForKernel
;
61 NtCurrentPeb()->KernelCallbackTable
[USER32_CALLBACK_LOADSYSMENUTEMPLATE
] =
62 (PVOID
)User32LoadSysMenuTemplateForKernel
;
63 NtCurrentPeb()->KernelCallbackTable
[USER32_CALLBACK_LOADDEFAULTCURSORS
] =
64 (PVOID
)User32SetupDefaultCursors
;
65 NtCurrentPeb()->KernelCallbackTable
[USER32_CALLBACK_HOOKPROC
] =
66 (PVOID
)User32CallHookProcFromKernel
;
68 /* Allocate an index for user32 thread local data. */
69 User32TlsIndex
= TlsAlloc();
73 RtlInitializeCriticalSection(&U32AccelCacheLock
);
74 RtlInitializeCriticalSection(&gcsMPH
);
76 GdiDllInitialize(NULL
, DLL_PROCESS_ATTACH
, NULL
);
86 GdiDllInitialize(NULL
, DLL_PROCESS_DETACH
, NULL
);
88 TlsFree(User32TlsIndex
);
104 case DLL_PROCESS_ATTACH
:
105 hProcessHeap
= RtlGetProcessHeap();
109 case DLL_THREAD_ATTACH
:
112 case DLL_THREAD_DETACH
:
115 case DLL_PROCESS_DETACH
:
116 DeleteFrameBrushes();
117 /* CleanupThread();*/