Author: ion
Date: Sun Jan 29 17:16:01 2012
New Revision: 55290
URL: http://svn.reactos.org/svn/reactos?rev=55290&view=rev
Log:
[SMSS]: Add a new header which precisely documents the SB and SM packet structure and protocol. These match the Server 2003 SP1 definitions and sizes and would allow a ReactOS SMSS to talk to a Windows CSRSS and vice-versa.
Added:
trunk/reactos/include/reactos/subsys/sm/smmsg.h (with props)
Added: trunk/reactos/include/reactos/subsys/sm/smmsg.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/subsys/sm/…
==============================================================================
--- trunk/reactos/include/reactos/subsys/sm/smmsg.h (added)
+++ trunk/reactos/include/reactos/subsys/sm/smmsg.h [iso-8859-1] Sun Jan 29 17:16:01 2012
@@ -1,0 +1,207 @@
+/*
+ * PROJECT: ReactOS Windows-Compatible Session Manager
+ * LICENSE: BSD 2-Clause License
+ * FILE: include/reactos/subsystems/sm/smmsg.h
+ * PURPOSE: SMSS (SB and SM) Message Format
+ * PROGRAMMERS: Alex Ionescu
+ */
+
+//
+// There are the APIs that a Client (such as CSRSS) can send to the SMSS Server.
+//
+// These are called "SM" APIs.
+//
+// The exact names are not known, but we are basing them on the SmpApiName array
+// in the checked build of SMSS, which is probably a close approximation. We add
+// "p" to use the similar nomenclature seen/leaked out in the Base CSRSS APIs.
+//
+//
+typedef enum _SMSRV_API_NUMBER
+{
+ SmpCreateForeignSession,
+ SmpSessionComplete,
+ SmpTerminateForeignSession,
+ SmpExecPgm,
+ SmpLoadDeferedSubsystem,
+ SmpStartCsr,
+ SmpStopCsr,
+ SmpMaxApiNumber // Based on BasepMaxApiNumber, UserpMaxApiNumber...
+} SMSRV_API_NUMBER;
+
+//
+// These are the structures making up the SM_API_MSG packet structure defined
+// below. Each one corresponds to an equivalent API from the list above.
+//
+typedef struct _SM_CREATE_FOREIGN_SESSION_MSG
+{
+ ULONG NotImplemented;
+} SM_CREATE_FOREIGN_SESSION_MSG, *PSM_CREATE_FOREIGN_SESSION_MSG;
+
+typedef struct _SM_SESSION_COMPLETE_MSG
+{
+ ULONG SessionId;
+ NTSTATUS Status;
+} SM_SESSION_COMPLETE_MSG, *PSM_SESSION_COMPLETE_MSG;
+
+typedef struct _SM_TERMINATE_FOREIGN_SESSION_MSG
+{
+ ULONG NotImplemented;
+} SM_TERMINATE_FOREIGN_SESSION_MSG, *PSM_TERMINATE_FOREIGN_SESSION_MSG;
+
+typedef struct _SM_EXEC_PGM_MSG
+{
+ RTL_USER_PROCESS_INFORMATION ProcessInformation;
+ BOOLEAN DebugFlag;
+} SM_EXEC_PGM_MSG, *PM_EXEC_PGM_MSG;
+
+typedef struct _SM_LOAD_DEFERED_SUBSYSTEM_MSG
+{
+ ULONG Length;
+ WCHAR Buffer[32];
+} SM_LOAD_DEFERED_SUBSYSTEM_MSG, *PSM_LOAD_DEFERED_SUBSYSTEM_MSG;
+
+typedef struct _SM_START_CSR_MSG
+{
+ ULONG MuSessionId;
+ ULONG Length;
+ WCHAR Buffer[128];
+ HANDLE WindowsSubSysProcessId;
+ HANDLE SmpInitialCommandProcessId;
+} SM_START_CSR_MSG, *PSM_START_CSR_MSG;
+
+typedef struct _SM_STOP_CSR_MSG
+{
+ ULONG MuSessionId;
+} SM_STOP_CSR_MSG, *PSM_STOP_CSR_MSG;
+
+//
+// This is the actual packet structure sent over LCP to the \SmApiPort
+//
+typedef struct _SM_API_MSG
+{
+ PORT_MESSAGE h;
+ SMSRV_API_NUMBER ApiNumber;
+ NTSTATUS ReturnValue;
+ union
+ {
+ SM_CREATE_FOREIGN_SESSION_MSG CreateForeignSession;
+ SM_SESSION_COMPLETE_MSG SessionComplete;
+ SM_TERMINATE_FOREIGN_SESSION_MSG TerminateForeignComplete;
+ SM_EXEC_PGM_MSG ExecPgm;
+ SM_LOAD_DEFERED_SUBSYSTEM_MSG LoadDefered;
+ SM_START_CSR_MSG StartCsr;
+ SM_STOP_CSR_MSG StopCsr;
+ } u;
+} SM_API_MSG, *PSM_API_MSG;
+
+//
+// This is the size that Server 2003 SP1 SMSS expects, so make sure we conform.
+//
+C_ASSERT(sizeof(SM_API_MSG) == 0x130);
+
+//
+// There are the APIs that the SMSS Serve can send to a client (such as CSRSS)
+//
+// These are called "SB" APIs.
+//
+// The exact names are unknown but we are basing them on the CsrServerSbApiName
+// array in the checked build of CSRSRV which is probably a close approximation.
+// We add "p" to use the similar nomenclature seen/leaked out in the Base CSRSS
+// APIs.
+//
+//
+typedef enum _SB_API_NUMBER
+{
+ SbpCreateSession,
+ SbpTerminateSession,
+ SbpForeignSessionComplete,
+ SbpCreateProcess,
+ SbpMaxApiNumber // Based on BasepMaxApiNumber, UserpMaxApiNumber...
+} SB_API_NUMBER;
+
+//
+// These are the structures making up the SB_API_MSG packet structure defined
+// below. Each one corresponds to an equivalent API from the list above.
+//
+typedef struct _SB_CREATE_SESSION_MSG
+{
+ ULONG SessionId;
+ RTL_USER_PROCESS_INFORMATION ProcessInfo;
+} SB_CREATE_SESSION_MSG, *PSB_CREATE_SESSION_MSG;
+
+typedef struct _SB_TERMINATE_SESSION_MSG
+{
+ ULONG SessionId;
+} SB_TERMINATE_SESSION_MSG, *PSB_TERMINATE_SESSION_MSG;
+
+typedef struct _SB_FOREIGN_SESSION_COMPLETE_MSG
+{
+ ULONG SessionId;
+} SB_FOREIGN_SESSION_COMPLETE_MSG, *PSB_FOREIGN_SESSION_COMPLETE_MSG;
+
+#define SB_PROCESS_FLAGS_DEBUG 0x1
+#define SB_PROCESS_FLAGS_WAIT_ON_THREAD 0x2
+#define SB_PROCESS_FLAGS_RESERVE_1MB 0x8
+#define SB_PROCESS_FLAGS_SKIP_CHECKS 0x20
+typedef struct _SB_CREATE_PROCESS_MSG
+{
+ union
+ {
+ struct
+ {
+ PUNICODE_STRING ImageName;
+ PUNICODE_STRING CurrentDirectory;
+ PUNICODE_STRING CommandLine;
+ PUNICODE_STRING DllPath;
+ ULONG Flags;
+ ULONG DebugFlags;
+ } In;
+ struct
+ {
+ HANDLE ProcessHandle;
+ HANDLE ThreadHandle;
+ ULONG SubsystemType;
+ CLIENT_ID ClientId;
+ } Out;
+ };
+} SB_CREATE_PROCESS_MSG, *PSB_CREATE_PROCESS_MSG;
+
+//
+// When the server connects to a client, this structure is exchanged
+//
+typedef struct _SB_CONNECTION_INFO
+{
+ ULONG SubsystemType;
+ WCHAR SbApiPortName[120];
+} SB_CONNECTION_INFO, *PSB_CONNECTION_INFO;
+
+//
+// This is the actual packet structure sent over LCP to the \SbApiPort
+//
+typedef struct _SB_API_MSG
+{
+ PORT_MESSAGE Header;
+ union
+ {
+ SB_CONNECTION_INFO ConnectionInfo;
+ struct
+ {
+ SB_API_NUMBER ApiNumber;
+ NTSTATUS ReturnValue;
+ union
+ {
+ SB_CREATE_SESSION_MSG CreateSession;
+ SB_TERMINATE_SESSION_MSG TerminateSession;
+ SB_FOREIGN_SESSION_COMPLETE_MSG ForeignSessionComplete;
+ SB_CREATE_PROCESS_MSG CreateProcess;
+ };
+ };
+ };
+} SB_API_MSG, *PSB_API_MSG;
+
+//
+// This is the size that Server 2003 SP1 SMSS expects, so make sure we conform.
+//
+C_ASSERT(sizeof(SB_CONNECTION_INFO) == 0xF4);
+C_ASSERT(sizeof(SB_API_MSG) == 0x110);
+
Propchange: trunk/reactos/include/reactos/subsys/sm/smmsg.h
------------------------------------------------------------------------------
svn:eol-style = native