[BASESRV]

Add a pair of event handles to the console record.
Implement BaseSrvSetReenterCount.


svn path=/branches/ntvdm/; revision=62600
This commit is contained in:
Aleksandar Andrejevic 2014-04-02 01:29:50 +00:00
parent 37d5c52cdc
commit 0e0f35fea9
2 changed files with 39 additions and 2 deletions

View file

@ -382,6 +382,7 @@ CSR_API(BaseSrvCheckVDM)
{ {
NTSTATUS Status; NTSTATUS Status;
PBASE_CHECK_VDM CheckVdmRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.CheckVDMRequest; PBASE_CHECK_VDM CheckVdmRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.CheckVDMRequest;
PCSR_PROCESS ClientProcess;
PRTL_CRITICAL_SECTION CriticalSection = NULL; PRTL_CRITICAL_SECTION CriticalSection = NULL;
PVDM_CONSOLE_RECORD ConsoleRecord = NULL; PVDM_CONSOLE_RECORD ConsoleRecord = NULL;
PVDM_DOS_RECORD DosRecord = NULL; PVDM_DOS_RECORD DosRecord = NULL;
@ -423,6 +424,11 @@ CSR_API(BaseSrvCheckVDM)
return STATUS_INVALID_PARAMETER; return STATUS_INVALID_PARAMETER;
} }
/* Lock the process */
Status = CsrLockProcessByClientId(ApiMessage->Header.ClientId.UniqueProcess,
&ClientProcess);
if (!NT_SUCCESS(Status)) return Status;
CriticalSection = (CheckVdmRequest->BinaryType != BINARY_TYPE_SEPARATE_WOW) CriticalSection = (CheckVdmRequest->BinaryType != BINARY_TYPE_SEPARATE_WOW)
? &DosCriticalSection ? &DosCriticalSection
: &WowCriticalSection; : &WowCriticalSection;
@ -451,6 +457,9 @@ CSR_API(BaseSrvCheckVDM)
/* Initialize the console record */ /* Initialize the console record */
ConsoleRecord->ConsoleHandle = CheckVdmRequest->ConsoleHandle; ConsoleRecord->ConsoleHandle = CheckVdmRequest->ConsoleHandle;
ConsoleRecord->ProcessHandle = ClientProcess->ProcessHandle;
ConsoleRecord->ServerEvent = ConsoleRecord->ClientEvent = NULL;
ConsoleRecord->ReenterCount = 0;
ConsoleRecord->CurrentDirs = NULL; ConsoleRecord->CurrentDirs = NULL;
ConsoleRecord->CurDirsLength = 0; ConsoleRecord->CurDirsLength = 0;
ConsoleRecord->SessionId = GetNextDosSesId(); ConsoleRecord->SessionId = GetNextDosSesId();
@ -544,6 +553,9 @@ Cleanup:
/* Leave the critical section */ /* Leave the critical section */
RtlLeaveCriticalSection(CriticalSection); RtlLeaveCriticalSection(CriticalSection);
/* Unlock the process */
CsrUnlockProcess(ClientProcess);
return Status; return Status;
} }
@ -806,8 +818,30 @@ Cleanup:
CSR_API(BaseSrvSetReenterCount) CSR_API(BaseSrvSetReenterCount)
{ {
DPRINT1("%s not yet implemented\n", __FUNCTION__); NTSTATUS Status = STATUS_SUCCESS;
return STATUS_NOT_IMPLEMENTED; PBASE_SET_REENTER_COUNT SetReenterCountRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.SetReenterCountRequest;
PVDM_CONSOLE_RECORD ConsoleRecord;
/* Enter the critical section */
RtlEnterCriticalSection(&DosCriticalSection);
/* Get the console record */
Status = BaseSrvGetConsoleRecord(SetReenterCountRequest->ConsoleHandle, &ConsoleRecord);
if (!NT_SUCCESS(Status)) goto Cleanup;
if (SetReenterCountRequest->fIncDec == VDM_INC_REENTER_COUNT) ConsoleRecord->ReenterCount++;
else if (SetReenterCountRequest->fIncDec == VDM_DEC_REENTER_COUNT)
{
ConsoleRecord->ReenterCount--;
if (ConsoleRecord->ServerEvent != NULL) NtSetEvent(ConsoleRecord->ServerEvent, NULL);
}
else Status = STATUS_INVALID_PARAMETER;
Cleanup:
/* Leave the critical section */
RtlLeaveCriticalSection(&DosCriticalSection);
return Status;
} }
CSR_API(BaseSrvSetVDMCurDirs) CSR_API(BaseSrvSetVDMCurDirs)

View file

@ -21,6 +21,9 @@ typedef struct _VDM_CONSOLE_RECORD
LIST_ENTRY Entry; LIST_ENTRY Entry;
HANDLE ConsoleHandle; HANDLE ConsoleHandle;
HANDLE ProcessHandle; HANDLE ProcessHandle;
HANDLE ServerEvent;
HANDLE ClientEvent;
ULONG ReenterCount;
PCHAR CurrentDirs; PCHAR CurrentDirs;
ULONG CurDirsLength; ULONG CurDirsLength;
ULONG SessionId; ULONG SessionId;