Author: tkreuzer
Date: Fri Nov 22 11:48:51 2013
New Revision: 61072

URL: http://svn.reactos.org/svn/reactos?rev=61072&view=rev
Log:
[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)

Modified:
    trunk/reactos/ntoskrnl/ps/win32.c
    trunk/reactos/win32ss/user/ntuser/main.c

Modified: trunk/reactos/ntoskrnl/ps/win32.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/win32.c?rev=61072&r1=61071&r2=61072&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ps/win32.c   [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ps/win32.c   [iso-8859-1] Fri Nov 22 11:48:51 2013
@@ -82,13 +82,9 @@
         MmDeleteKernelStack(OldStack, FALSE);
     }
 
-    /* This check is bizare. Check out win32k later */
-    if (!Process->Win32Process)
-    {
-        /* Now tell win32k about us */
-        Status = PspW32ProcessCallout(Process, TRUE);
-        if (!NT_SUCCESS(Status)) return Status;
-    }
+    /* Always do the process callout! */
+    Status = PspW32ProcessCallout(Process, TRUE);
+    if (!NT_SUCCESS(Status)) return Status;
 
     /* Set the new service table */
     Thread->Tcb.ServiceTable = KeServiceDescriptorTableShadow;

Modified: trunk/reactos/win32ss/user/ntuser/main.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/main.c?rev=61072&r1=61071&r2=61072&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/main.c    [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/main.c    [iso-8859-1] Fri Nov 22 
11:48:51 2013
@@ -57,7 +57,7 @@
                       BOOLEAN Create)
 {
     PPROCESSINFO ppiCurrent, *pppi;
-    DECLARE_RETURN(NTSTATUS);
+    NTSTATUS Status;
 
     ASSERT(Process->Peb);
 
@@ -69,18 +69,26 @@
         LARGE_INTEGER Offset;
         PVOID UserBase = NULL;
         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,
                                            sizeof(PROCESSINFO),
                                            USERTAG_PROCESSINFO);
-
         if (ppiCurrent == NULL)
         {
-            ERR_CH(UserProcess, "Failed to allocate ppi for PID:0x%lx\n", 
HandleToUlong(Process->UniqueProcessId));
-            RETURN( STATUS_NO_MEMORY);
+            ERR_CH(UserProcess, "Failed to allocate ppi for PID:0x%lx\n",
+                   HandleToUlong(Process->UniqueProcessId));
+            Status = STATUS_NO_MEMORY;
+            goto Leave;
         }
 
         RtlZeroMemory(ppiCurrent, sizeof(PROCESSINFO));
@@ -111,7 +119,7 @@
         if (!NT_SUCCESS(Status))
         {
             TRACE_CH(UserProcess,"Failed to map the global heap! 0x%x\n", 
Status);
-            RETURN(Status);
+            goto Leave;
         }
         ppiCurrent->HeapMappings.Next = NULL;
         ppiCurrent->HeapMappings.KernelMapping = (PVOID)GlobalUserHeap;
@@ -241,11 +249,11 @@
         ExFreePoolWithTag(ppiCurrent, USERTAG_PROCESSINFO);
     }
 
-    RETURN( STATUS_SUCCESS);
-
-CLEANUP:
+    Status = STATUS_SUCCESS;
+
+Leave:
     UserLeave();
-    END_CLEANUP;
+    return Status;
 }
 
 NTSTATUS NTAPI


Reply via email to