mirror of
https://github.com/reactos/reactos.git
synced 2024-10-15 13:45:58 +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
|
@ -1696,18 +1696,6 @@ LdrpInitializeProcess(IN PCONTEXT Context,
|
||||||
return STATUS_NO_MEMORY;
|
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 */
|
/* Allocate an Activation Context Stack */
|
||||||
Status = RtlAllocateActivationContextStack(&Teb->ActivationContextStackPointer);
|
Status = RtlAllocateActivationContextStack(&Teb->ActivationContextStackPointer);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
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
|
BOOL
|
||||||
Init(VOID)
|
Init(VOID)
|
||||||
{
|
{
|
||||||
USERCONNECT UserCon;
|
USERCONNECT UserCon;
|
||||||
PVOID *KernelCallbackTable;
|
|
||||||
|
|
||||||
/* Set up the kernel callbacks. */
|
/* Set PEB data */
|
||||||
KernelCallbackTable = NtCurrentPeb()->KernelCallbackTable;
|
NtCurrentPeb()->KernelCallbackTable = apfnDispatch;
|
||||||
KernelCallbackTable[USER32_CALLBACK_WINDOWPROC] =
|
NtCurrentPeb()->PostProcessInitRoutine = NULL;
|
||||||
(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;
|
|
||||||
|
|
||||||
NtUserProcessConnect( NtCurrentProcess(),
|
NtUserProcessConnect( NtCurrentProcess(),
|
||||||
&UserCon,
|
&UserCon,
|
||||||
|
|
Loading…
Reference in a new issue