Author: aandrejevic Date: Sun Feb 9 22:26:13 2014 New Revision: 62086
URL: http://svn.reactos.org/svn/reactos?rev=62086&view=rev Log: [BASESRV] Implement BaseSrvGetVDMCurDirs. The current directory information is stored in the console record, and it applies to all DOS records within it.
Modified: branches/ntvdm/subsystems/win/basesrv/vdm.c branches/ntvdm/subsystems/win/basesrv/vdm.h
Modified: branches/ntvdm/subsystems/win/basesrv/vdm.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/win/basesrv/vdm... ============================================================================== --- branches/ntvdm/subsystems/win/basesrv/vdm.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/win/basesrv/vdm.c [iso-8859-1] Sun Feb 9 22:26:13 2014 @@ -115,7 +115,7 @@
/* Return the result */ IsFirstVDMRequest->FirstVDM = FirstVDM; - + /* Clear the first VDM flag */ FirstVDM = FALSE;
@@ -142,8 +142,43 @@
CSR_API(BaseSrvGetVDMCurDirs) { - DPRINT1("%s not yet implemented\n", __FUNCTION__); - return STATUS_NOT_IMPLEMENTED; + NTSTATUS Status; + PBASE_GETSET_VDM_CURDIRS VDMCurrentDirsRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.VDMCurrentDirsRequest; + PVDM_CONSOLE_RECORD ConsoleRecord; + + /* Validate the output buffer */ + if (!CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&VDMCurrentDirsRequest->lpszzCurDirs, + VDMCurrentDirsRequest->cchCurDirs, + sizeof(*VDMCurrentDirsRequest->lpszzCurDirs))) + { + return STATUS_INVALID_PARAMETER; + } + + /* Enter the critical section */ + RtlEnterCriticalSection(&DosCriticalSection); + + /* Find the console record */ + Status = BaseSrvGetConsoleRecord(VDMCurrentDirsRequest->ConsoleHandle, &ConsoleRecord); + if (!NT_SUCCESS(Status)) goto Cleanup; + + /* Check if the buffer is large enough */ + if (VDMCurrentDirsRequest->cchCurDirs < ConsoleRecord->CurDirsLength) + { + Status = STATUS_BUFFER_TOO_SMALL; + goto Cleanup; + } + + /* Copy the data */ + RtlMoveMemory(VDMCurrentDirsRequest->lpszzCurDirs, + ConsoleRecord->CurrentDirs, + ConsoleRecord->CurDirsLength); + +Cleanup: + /* Leave the critical section */ + RtlLeaveCriticalSection(&DosCriticalSection); + + return Status; }
CSR_API(BaseSrvBatNotification)
Modified: branches/ntvdm/subsystems/win/basesrv/vdm.h URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/win/basesrv/vdm... ============================================================================== --- branches/ntvdm/subsystems/win/basesrv/vdm.h [iso-8859-1] (original) +++ branches/ntvdm/subsystems/win/basesrv/vdm.h [iso-8859-1] Sun Feb 9 22:26:13 2014 @@ -15,6 +15,8 @@ { LIST_ENTRY Entry; HANDLE ConsoleHandle; + PCHAR CurrentDirs; + ULONG CurDirsLength; LIST_ENTRY DosListHead; // TODO: Structure incomplete!!! } VDM_CONSOLE_RECORD, *PVDM_CONSOLE_RECORD;