https://git.reactos.org/?p=reactos.git;a=commitdiff;h=735d2b4c93fc29d92c3de…
commit 735d2b4c93fc29d92c3de543c4e0a62fd380deca
Author: Hervé Poussineau <hpoussin(a)reactos.org>
AuthorDate: Mon May 24 11:50:16 2021 +0200
Commit: Hervé Poussineau <hpoussin(a)reactos.org>
CommitDate: Tue May 25 18:48:16 2021 +0200
[SMSS] Implement SmpStartCsr
---
base/system/smss/smloop.c | 40 ++++++++++++++++++++++++++++++++++++++--
base/system/smss/smss.h | 7 +++++++
2 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/base/system/smss/smloop.c b/base/system/smss/smloop.c
index ff5067a44ad..d44b6f026bc 100644
--- a/base/system/smss/smloop.c
+++ b/base/system/smss/smloop.c
@@ -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
diff --git a/base/system/smss/smss.h b/base/system/smss/smss.h
index c59ecfff605..7b2ad99e670 100644
--- a/base/system/smss/smss.h
+++ b/base/system/smss/smss.h
@@ -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(