Author: ion
Date: Wed Aug 28 22:35:28 2013
New Revision: 59862
URL:
http://svn.reactos.org/svn/reactos?rev=59862&view=rev
Log:
[NTDLL]: Don't give every process a KernelCallbackTable. Only GUI processes need one.
[USER32]: Initialize the KernelCallbackTable when loaded in GUI process. Also, store it
statically instead of requiring a heap allocation (just like Windows).
Modified:
trunk/reactos/dll/ntdll/ldr/ldrinit.c
trunk/reactos/win32ss/user/user32/misc/dllmain.c
Modified: trunk/reactos/dll/ntdll/ldr/ldrinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/ldr/ldrinit.c?re…
==============================================================================
--- trunk/reactos/dll/ntdll/ldr/ldrinit.c [iso-8859-1] (original)
+++ trunk/reactos/dll/ntdll/ldr/ldrinit.c [iso-8859-1] Wed Aug 28 22:35:28 2013
@@ -1696,18 +1696,6 @@
return STATUS_NO_MEMORY;
}
- // FIXME: Is it located properly?
- /* Initialize table of callbacks for the kernel. */
- Peb->KernelCallbackTable = RtlAllocateHeap(RtlGetProcessHeap(),
- 0,
- sizeof(PVOID) *
- (USER32_CALLBACK_MAXIMUM + 1));
- if (!Peb->KernelCallbackTable)
- {
- DPRINT1("Failed to create callback table\n");
- ZwTerminateProcess(NtCurrentProcess(), STATUS_INSUFFICIENT_RESOURCES);
- }
-
/* Allocate an Activation Context Stack */
Status =
RtlAllocateActivationContextStack(&Teb->ActivationContextStackPointer);
if (!NT_SUCCESS(Status)) return Status;
Modified: trunk/reactos/win32ss/user/user32/misc/dllmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/misc/d…
==============================================================================
--- trunk/reactos/win32ss/user/user32/misc/dllmain.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/misc/dllmain.c [iso-8859-1] Wed Aug 28 22:35:28
2013
@@ -194,34 +194,28 @@
{
}
+PVOID apfnDispatch[USER32_CALLBACK_MAXIMUM + 1] =
+{
+ User32CallWindowProcFromKernel,
+ User32CallSendAsyncProcForKernel,
+ User32LoadSysMenuTemplateForKernel,
+ User32SetupDefaultCursors,
+ User32CallHookProcFromKernel,
+ User32CallEventProcFromKernel,
+ User32CallLoadMenuFromKernel,
+ User32CallClientThreadSetupFromKernel,
+ User32CallClientLoadLibraryFromKernel,
+ User32CallGetCharsetInfo,
+};
+
BOOL
Init(VOID)
{
USERCONNECT UserCon;
- PVOID *KernelCallbackTable;
- /* Set up the kernel callbacks. */
- KernelCallbackTable = NtCurrentPeb()->KernelCallbackTable;
- KernelCallbackTable[USER32_CALLBACK_WINDOWPROC] =
- (PVOID)User32CallWindowProcFromKernel;
- KernelCallbackTable[USER32_CALLBACK_SENDASYNCPROC] =
- (PVOID)User32CallSendAsyncProcForKernel;
- KernelCallbackTable[USER32_CALLBACK_LOADSYSMENUTEMPLATE] =
- (PVOID)User32LoadSysMenuTemplateForKernel;
- KernelCallbackTable[USER32_CALLBACK_LOADDEFAULTCURSORS] =
- (PVOID)User32SetupDefaultCursors;
- KernelCallbackTable[USER32_CALLBACK_HOOKPROC] =
- (PVOID)User32CallHookProcFromKernel;
- KernelCallbackTable[USER32_CALLBACK_EVENTPROC] =
- (PVOID)User32CallEventProcFromKernel;
- KernelCallbackTable[USER32_CALLBACK_LOADMENU] =
- (PVOID)User32CallLoadMenuFromKernel;
- KernelCallbackTable[USER32_CALLBACK_CLIENTTHREADSTARTUP] =
- (PVOID)User32CallClientThreadSetupFromKernel;
- KernelCallbackTable[USER32_CALLBACK_CLIENTLOADLIBRARY] =
- (PVOID)User32CallClientLoadLibraryFromKernel;
- KernelCallbackTable[USER32_CALLBACK_GETCHARSETINFO] =
- (PVOID)User32CallGetCharsetInfo;
+ /* Set PEB data */
+ NtCurrentPeb()->KernelCallbackTable = apfnDispatch;
+ NtCurrentPeb()->PostProcessInitRoutine = NULL;
NtUserProcessConnect( NtCurrentProcess(),
&UserCon,