[BRANCHES]
[reactos.git] / reactos / subsystems / win / basesrv / proc.c
index e61405c..53113f7 100644 (file)
@@ -9,6 +9,7 @@
 /* INCLUDES *******************************************************************/
 
 #include "basesrv.h"
+#include "vdm.h"
 
 #define NDEBUG
 #include <debug.h>
@@ -167,7 +168,30 @@ CSR_API(BaseSrvCreateProcess)
 
     /* FIXME: Should notify user32 */
 
-    /* FIXME: VDM vodoo */
+    /* Check if this is a VDM process */
+    if (CreateProcessRequest->VdmBinaryType)
+    {
+        PVDM_CONSOLE_RECORD ConsoleRecord;
+
+        if (CreateProcessRequest->VdmTask != 0)
+        {
+            /* Get the console record using the task ID */
+            Status = GetConsoleRecordBySessionId(CreateProcessRequest->VdmTask,
+                                                 &ConsoleRecord);
+        }
+        else
+        {
+            /* Get the console record using the console handle */
+            Status = BaseSrvGetConsoleRecord(CreateProcessRequest->hVDM,
+                                             &ConsoleRecord);
+        }
+
+        /* Check if it failed */
+        if (!NT_SUCCESS(Status)) return Status;
+
+        /* Store the process ID of the VDM in the console record */
+        ConsoleRecord->ProcessId = HandleToUlong(CreateProcessRequest->ClientId.UniqueProcess);
+    }
 
     /* Return the result of this operation */
     return Status;