+ CriticalSection = (CheckVdmRequest->BinaryType != BINARY_TYPE_SEPARATE_WOW)
+ ? &DosCriticalSection
+ : &WowCriticalSection;
+
+ /* Enter the critical section */
+ RtlEnterCriticalSection(CriticalSection);
+
+ /* Check if this is a DOS or WOW VDM */
+ if (CheckVdmRequest->BinaryType != BINARY_TYPE_SEPARATE_WOW)
+ {
+ /* Get the console record */
+ Status = BaseSrvGetConsoleRecord(CheckVdmRequest->ConsoleHandle,
+ &ConsoleRecord);
+
+ if (!NT_SUCCESS(Status))
+ {
+ /* Allocate a new console record */
+ ConsoleRecord = (PVDM_CONSOLE_RECORD)RtlAllocateHeap(BaseSrvHeap,
+ HEAP_ZERO_MEMORY,
+ sizeof(VDM_CONSOLE_RECORD));
+ if (ConsoleRecord == NULL)
+ {
+ Status = STATUS_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /* Initialize the console record */
+ ConsoleRecord->ConsoleHandle = CheckVdmRequest->ConsoleHandle;
+ ConsoleRecord->CurrentDirs = NULL;
+ ConsoleRecord->CurDirsLength = 0;
+ ConsoleRecord->SessionId = GetNextDosSesId();
+ InitializeListHead(&ConsoleRecord->DosListHead);
+
+ /* Add the console record */
+ InsertTailList(&VDMConsoleListHead, &ConsoleRecord->Entry);
+ }
+
+ // TODO: NOT IMPLEMENTED
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+ }
+ else
+ {
+ // TODO: NOT IMPLEMENTED
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+ }
+
+Cleanup:
+ /* Leave the critical section */
+ RtlLeaveCriticalSection(CriticalSection);
+
+ return Status;