[SMSS] Implement SmpStartCsr

This commit is contained in:
Hervé Poussineau 2021-05-24 11:50:16 +02:00
parent 98882fb089
commit 735d2b4c93
2 changed files with 45 additions and 2 deletions

View File

@ -153,8 +153,44 @@ SmpStartCsr(IN PSM_API_MSG SmApiMsg,
IN PSMP_CLIENT_CONTEXT ClientContext,
IN HANDLE SmApiPort)
{
DPRINT1("%s is not yet implemented\n", __FUNCTION__);
return STATUS_NOT_IMPLEMENTED;
PSM_START_CSR_MSG SmStartCsr = &SmApiMsg->u.StartCsr;
UNICODE_STRING InitialCommand;
HANDLE InitialCommandProcess, InitialCommandProcessId, WindowsSubSysProcessId;
NTSTATUS Status;
Status = SmpLoadSubSystemsForMuSession(&SmStartCsr->MuSessionId,
&WindowsSubSysProcessId,
&InitialCommand);
if (!NT_SUCCESS(Status))
{
DPRINT1("SMSS: SmpLoadSubSystemsForMuSession failed with status 0x%08x\n", Status);
return Status;
}
if (SmStartCsr->Length)
{
InitialCommand.Length = InitialCommand.MaximumLength = SmStartCsr->Length;
InitialCommand.Buffer = SmStartCsr->Buffer;
}
Status = SmpExecuteInitialCommand(SmStartCsr->MuSessionId,
&InitialCommand,
&InitialCommandProcess,
&InitialCommandProcessId);
if (!NT_SUCCESS(Status))
{
DPRINT1("SMSS: SmpExecuteInitialCommand failed with status 0x%08x\n", Status);
/* FIXME: undo effects of SmpLoadSubSystemsForMuSession */
ASSERT(FALSE);
return Status;
}
NtClose(InitialCommandProcess);
SmStartCsr->WindowsSubSysProcessId = WindowsSubSysProcessId;
SmStartCsr->SmpInitialCommandProcessId = InitialCommandProcessId;
return STATUS_SUCCESS;
}
NTSTATUS

View File

@ -289,6 +289,13 @@ SmpCheckDuplicateMuSessionId(
IN ULONG MuSessionId
);
NTSTATUS
NTAPI
SmpExecuteInitialCommand(IN ULONG MuSessionId,
IN PUNICODE_STRING InitialCommand,
IN HANDLE InitialCommandProcess,
OUT PHANDLE ReturnPid);
NTSTATUS
NTAPI
SmpExecuteImage(