[BASESRV]
authorAleksandar Andrejevic <aandrejevic@reactos.org>
Tue, 6 May 2014 22:17:26 +0000 (22:17 +0000)
committerAleksandar Andrejevic <aandrejevic@reactos.org>
Tue, 6 May 2014 22:17:26 +0000 (22:17 +0000)
Don't set the process handle in BaseSrvCheckVDM.
Close the process handle when removing the console record.

svn path=/trunk/; revision=63182

reactos/subsystems/win/basesrv/vdm.c

index 4156620..782918c 100644 (file)
@@ -269,6 +269,9 @@ VOID NTAPI BaseSrvCleanupVdmRecords(ULONG ProcessId)
                 ConsoleRecord->CurDirsLength = 0;
             }
 
+            /* Close the process handle */
+            if (ConsoleRecord->ProcessHandle) NtClose(ConsoleRecord->ProcessHandle);
+
             /* Close the event handle */
             if (ConsoleRecord->ServerEvent) NtClose(ConsoleRecord->ServerEvent);
 
@@ -613,7 +616,7 @@ CSR_API(BaseSrvCheckVDM)
 
             /* Initialize the console record */
             ConsoleRecord->ConsoleHandle = CheckVdmRequest->ConsoleHandle;
-            ConsoleRecord->ProcessHandle = CsrGetClientThread()->Process->ProcessHandle;
+            ConsoleRecord->ProcessHandle = NULL;
             ConsoleRecord->ServerEvent = ConsoleRecord->ClientEvent = NULL;
             ConsoleRecord->ReenterCount = 0;
             ConsoleRecord->CurrentDirs = NULL;
@@ -779,6 +782,7 @@ CSR_API(BaseSrvUpdateVDMEntry)
                      */
                     if (ConsoleRecord->DosListHead.Flink == &ConsoleRecord->DosListHead)
                     {
+                        if (ConsoleRecord->ProcessHandle) NtClose(ConsoleRecord->ProcessHandle);
                         if (ConsoleRecord->ServerEvent) NtClose(ConsoleRecord->ServerEvent);
                         RemoveEntryList(&ConsoleRecord->Entry);
                         RtlFreeHeap(BaseSrvHeap, 0, ConsoleRecord);