mirror of
https://github.com/reactos/reactos.git
synced 2024-12-31 19:42:51 +00:00
[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). svn path=/trunk/; revision=59862
This commit is contained in:
parent
74053e9f52
commit
0ba0d34b5c
2 changed files with 17 additions and 35 deletions
|
@ -1696,18 +1696,6 @@ LdrpInitializeProcess(IN PCONTEXT Context,
|
|||
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;
|
||||
|
|
|
@ -194,34 +194,28 @@ CleanupThread(VOID)
|
|||
{
|
||||
}
|
||||
|
||||
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,
|
||||
|
|
Loading…
Reference in a new issue