mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 18:43:41 +00:00
[NTOSKRNL/WIN32K]
Always call the win32 process callout from PsConvertToGuiThread and handle the case where we alrady have an allocated win32 process there. (The original win32k sometimes allocates a win32 process, but doesn't initialize it, so it needs to be called again to do so) svn path=/trunk/; revision=61072
This commit is contained in:
parent
b5f60c3595
commit
dfc5f7e3fa
2 changed files with 21 additions and 17 deletions
|
@ -82,13 +82,9 @@ PsConvertToGuiThread(VOID)
|
||||||
MmDeleteKernelStack(OldStack, FALSE);
|
MmDeleteKernelStack(OldStack, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This check is bizare. Check out win32k later */
|
/* Always do the process callout! */
|
||||||
if (!Process->Win32Process)
|
Status = PspW32ProcessCallout(Process, TRUE);
|
||||||
{
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
/* Now tell win32k about us */
|
|
||||||
Status = PspW32ProcessCallout(Process, TRUE);
|
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set the new service table */
|
/* Set the new service table */
|
||||||
Thread->Tcb.ServiceTable = KeServiceDescriptorTableShadow;
|
Thread->Tcb.ServiceTable = KeServiceDescriptorTableShadow;
|
||||||
|
|
|
@ -57,7 +57,7 @@ Win32kProcessCallback(struct _EPROCESS *Process,
|
||||||
BOOLEAN Create)
|
BOOLEAN Create)
|
||||||
{
|
{
|
||||||
PPROCESSINFO ppiCurrent, *pppi;
|
PPROCESSINFO ppiCurrent, *pppi;
|
||||||
DECLARE_RETURN(NTSTATUS);
|
NTSTATUS Status;
|
||||||
|
|
||||||
ASSERT(Process->Peb);
|
ASSERT(Process->Peb);
|
||||||
|
|
||||||
|
@ -69,18 +69,26 @@ Win32kProcessCallback(struct _EPROCESS *Process,
|
||||||
LARGE_INTEGER Offset;
|
LARGE_INTEGER Offset;
|
||||||
PVOID UserBase = NULL;
|
PVOID UserBase = NULL;
|
||||||
PRTL_USER_PROCESS_PARAMETERS pParams = Process->Peb->ProcessParameters;
|
PRTL_USER_PROCESS_PARAMETERS pParams = Process->Peb->ProcessParameters;
|
||||||
NTSTATUS Status;
|
|
||||||
|
|
||||||
ASSERT(PsGetProcessWin32Process(Process) == NULL);
|
/* We might be called with an already allocated win32 process */
|
||||||
|
ppiCurrent = PsGetProcessWin32Process(Process);
|
||||||
|
if (ppiCurrent != NULL)
|
||||||
|
{
|
||||||
|
/* There is no more to do for us (this is a success code!) */
|
||||||
|
Status = STATUS_ALREADY_WIN32;
|
||||||
|
goto Leave;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Allocate a new win32 process */
|
||||||
ppiCurrent = ExAllocatePoolWithTag(NonPagedPool,
|
ppiCurrent = ExAllocatePoolWithTag(NonPagedPool,
|
||||||
sizeof(PROCESSINFO),
|
sizeof(PROCESSINFO),
|
||||||
USERTAG_PROCESSINFO);
|
USERTAG_PROCESSINFO);
|
||||||
|
|
||||||
if (ppiCurrent == NULL)
|
if (ppiCurrent == NULL)
|
||||||
{
|
{
|
||||||
ERR_CH(UserProcess, "Failed to allocate ppi for PID:0x%lx\n", HandleToUlong(Process->UniqueProcessId));
|
ERR_CH(UserProcess, "Failed to allocate ppi for PID:0x%lx\n",
|
||||||
RETURN( STATUS_NO_MEMORY);
|
HandleToUlong(Process->UniqueProcessId));
|
||||||
|
Status = STATUS_NO_MEMORY;
|
||||||
|
goto Leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlZeroMemory(ppiCurrent, sizeof(PROCESSINFO));
|
RtlZeroMemory(ppiCurrent, sizeof(PROCESSINFO));
|
||||||
|
@ -111,7 +119,7 @@ Win32kProcessCallback(struct _EPROCESS *Process,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
TRACE_CH(UserProcess,"Failed to map the global heap! 0x%x\n", Status);
|
TRACE_CH(UserProcess,"Failed to map the global heap! 0x%x\n", Status);
|
||||||
RETURN(Status);
|
goto Leave;
|
||||||
}
|
}
|
||||||
ppiCurrent->HeapMappings.Next = NULL;
|
ppiCurrent->HeapMappings.Next = NULL;
|
||||||
ppiCurrent->HeapMappings.KernelMapping = (PVOID)GlobalUserHeap;
|
ppiCurrent->HeapMappings.KernelMapping = (PVOID)GlobalUserHeap;
|
||||||
|
@ -241,11 +249,11 @@ Win32kProcessCallback(struct _EPROCESS *Process,
|
||||||
ExFreePoolWithTag(ppiCurrent, USERTAG_PROCESSINFO);
|
ExFreePoolWithTag(ppiCurrent, USERTAG_PROCESSINFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
RETURN( STATUS_SUCCESS);
|
Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
CLEANUP:
|
Leave:
|
||||||
UserLeave();
|
UserLeave();
|
||||||
END_CLEANUP;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue