Author: aandrejevic
Date: Sat Mar 1 04:37:01 2014
New Revision: 62363
URL:
http://svn.reactos.org/svn/reactos?rev=62363&view=rev
Log:
[BASESRV]
Continue implementing BaseSrvCheckVDM.
Modified:
branches/ntvdm/subsystems/win/basesrv/vdm.c
Modified: branches/ntvdm/subsystems/win/basesrv/vdm.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/win/basesrv/vd…
==============================================================================
--- branches/ntvdm/subsystems/win/basesrv/vdm.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/win/basesrv/vdm.c [iso-8859-1] Sat Mar 1 04:37:01 2014
@@ -184,6 +184,8 @@
PBASE_CHECK_VDM CheckVdmRequest =
&((PBASE_API_MESSAGE)ApiMessage)->Data.CheckVDMRequest;
PRTL_CRITICAL_SECTION CriticalSection = NULL;
PVDM_CONSOLE_RECORD ConsoleRecord = NULL;
+ PVDM_DOS_RECORD DosRecord = NULL;
+ BOOLEAN NewConsoleRecord = FALSE;
/* Don't do anything if the VDM has been disabled in the registry */
if (!BaseSrvIsVdmAllowed()) return STATUS_ACCESS_DENIED;
@@ -253,23 +255,65 @@
ConsoleRecord->CurDirsLength = 0;
ConsoleRecord->SessionId = GetNextDosSesId();
InitializeListHead(&ConsoleRecord->DosListHead);
-
+ // TODO: The console record structure is incomplete
+
+ /* Remember that the console record was allocated here */
+ NewConsoleRecord = TRUE;
+ }
+
+ /* Allocate a new DOS record */
+ DosRecord = (PVDM_DOS_RECORD)RtlAllocateHeap(BaseSrvHeap,
+ HEAP_ZERO_MEMORY,
+ sizeof(VDM_DOS_RECORD));
+ if (DosRecord == NULL)
+ {
+ Status = STATUS_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /* Initialize the DOS record */
+ DosRecord->State = NewConsoleRecord ? VDM_NOT_LOADED : VDM_READY;
+ DosRecord->ExitCode = 0;
+ // TODO: The DOS record structure is incomplete
+
+ /* Add the DOS record */
+ InsertHeadList(&ConsoleRecord->DosListHead, &DosRecord->Entry);
+
+ if (NewConsoleRecord)
+ {
/* Add the console record */
InsertTailList(&VDMConsoleListHead, &ConsoleRecord->Entry);
}
+ CheckVdmRequest->VDMState = DosRecord->State;
+ Status = STATUS_SUCCESS;
+ }
+ else
+ {
// TODO: NOT IMPLEMENTED
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
- else
- {
- // TODO: NOT IMPLEMENTED
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
- }
Cleanup:
+ /* Check if it failed */
+ if (!NT_SUCCESS(Status))
+ {
+ /* Free the DOS record */
+ if (DosRecord != NULL)
+ {
+ RtlFreeHeap(BaseSrvHeap, 0, DosRecord);
+ DosRecord = NULL;
+ }
+
+ /* Free the console record if it was allocated here */
+ if (NewConsoleRecord)
+ {
+ RtlFreeHeap(BaseSrvHeap, 0, ConsoleRecord);
+ ConsoleRecord = NULL;
+ }
+ }
+
/* Leave the critical section */
RtlLeaveCriticalSection(CriticalSection);