ReactOS  0.4.13-dev-464-g6b95727
smmsg.h
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Windows-Compatible Session Manager
3  * LICENSE: BSD 2-Clause License
4  * FILE: include/reactos/subsys/sm/smmsg.h
5  * PURPOSE: SMSS (SB and SM) Message Format
6  * PROGRAMMERS: Alex Ionescu
7  */
8 #pragma once
9 #ifndef _SM_MSG_
10 #define _SM_MSG_
11 
12 //
13 // There are the APIs that a Client (such as CSRSS) can send to the SMSS Server.
14 //
15 // These are called "SM" APIs.
16 //
17 // The exact names are not known, but we are basing them on the SmpApiName array
18 // in the checked build of SMSS, which is probably a close approximation. We add
19 // "p" to use the similar nomenclature seen/leaked out in the Base CSRSS APIs.
20 //
21 // The enumeration finishes with an enumeratee holding the maximum API number.
22 // Its name is based on BasepMaxApiNumber, UserpMaxApiNumber...
23 //
24 //
25 typedef enum _SMSRV_API_NUMBER
26 {
34 
37 
38 //
39 // These are the structures making up the SM_API_MSG packet structure defined
40 // below. Each one corresponds to an equivalent API from the list above.
41 //
43 {
46 
48 {
52 
54 {
57 
58 typedef struct _SM_EXEC_PGM_MSG
59 {
63 #ifndef _WIN64
64 C_ASSERT(sizeof(SM_EXEC_PGM_MSG) == 0x48);
65 #endif
66 
68 {
72 
73 typedef struct _SM_START_CSR_MSG
74 {
77  WCHAR Buffer[128];
81 
82 typedef struct _SM_STOP_CSR_MSG
83 {
86 
87 //
88 // This is the actual packet structure sent over LCP to the \SmApiPort
89 //
90 typedef struct _SM_API_MSG
91 {
95  union
96  {
104  } u;
106 
107 //
108 // This is the size that Server 2003 SP1 SMSS expects, so make sure we conform.
109 //
110 #ifndef _WIN64
111 C_ASSERT(sizeof(SM_API_MSG) == 0x130);
112 #endif
113 
114 //
115 // There are the APIs that the SMSS Server can send to a client (such as CSRSS).
116 //
117 // These are called "SB" APIs.
118 //
119 // The exact names are unknown but we are basing them on the CsrServerSbApiName
120 // array in the checked build of CSRSRV which is probably a close approximation.
121 // We add "p" to use the similar nomenclature seen/leaked out in the Base CSRSS
122 // APIs.
123 //
124 // The enumeration finishes with an enumeratee holding the maximum API number.
125 // Its name is based on BasepMaxApiNumber, UserpMaxApiNumber...
126 //
127 //
128 typedef enum _SB_API_NUMBER
129 {
134 
136 } SB_API_NUMBER;
137 
138 //
139 // These are the structures making up the SB_API_MSG packet structure defined
140 // below. Each one corresponds to an equivalent API from the list above.
141 //
143 {
150 
152 {
155 
157 {
160 
161 #define SB_PROCESS_FLAGS_DEBUG 0x1
162 #define SB_PROCESS_FLAGS_WAIT_ON_THREAD 0x2
163 #define SB_PROCESS_FLAGS_RESERVE_1MB 0x8
164 #define SB_PROCESS_FLAGS_SKIP_CHECKS 0x20
166 {
167  union
168  {
169  struct
170  {
177  } In;
178  struct
179  {
184  } Out;
185  };
187 
188 //
189 // When the server connects to a client, this structure is exchanged
190 //
191 typedef struct _SB_CONNECTION_INFO
192 {
196 
197 //
198 // This is the actual packet structure sent over LCP to the \SbApiPort
199 //
200 typedef struct _SB_API_MSG
201 {
203  union
204  {
206  struct
207  {
210  union
211  {
216  };
217  };
218  };
220 
221 //
222 // This is the size that Server 2003 SP1 SMSS expects, so make sure we conform.
223 //
224 #ifndef _WIN64
225 C_ASSERT(sizeof(SB_CONNECTION_INFO) == 0xF4);
226 C_ASSERT(sizeof(SB_API_MSG) == 0x110);
227 #endif
228 
229 //
230 // SB Message Handler
231 //
232 typedef
233 BOOLEAN
235  IN PSB_API_MSG SbApiMsg
236 );
237 
238 //
239 // The actual server functions that a client linking with smlib can call
240 //
241 NTSTATUS
242 NTAPI
244  IN PUNICODE_STRING SbApiPortName,
245  IN HANDLE SbApiPort,
248 );
249 
250 NTSTATUS
251 NTAPI
252 SmExecPgm(
254  IN PRTL_USER_PROCESS_INFORMATION ProcessInformation,
255  IN BOOLEAN DebugFlag
256 );
257 
258 NTSTATUS
259 NTAPI
263  IN NTSTATUS SessionStatus
264 );
265 
266 #endif
PORT_MESSAGE h
Definition: smmsg.h:92
SM_EXEC_PGM_MSG ExecPgm
Definition: smmsg.h:100
#define IN
Definition: typedefs.h:38
ULONG SubsystemType
Definition: smmsg.h:193
ULONG MuSessionId
Definition: smmsg.h:84
NTSTATUS NTAPI SmSessionComplete(IN HANDLE SmApiPort, IN ULONG SessionId, IN NTSTATUS SessionStatus)
Definition: smclient.c:135
RTL_USER_PROCESS_INFORMATION ProcessInformation
Definition: smmsg.h:60
HANDLE SmApiPort
Definition: smss.c:23
struct _SB_CREATE_PROCESS_MSG * PSB_CREATE_PROCESS_MSG
PORT_MESSAGE h
Definition: smmsg.h:202
union _SM_API_MSG::@3372 u
ULONG Length
Definition: smmsg.h:76
SM_CREATE_FOREIGN_SESSION_MSG CreateForeignSession
Definition: smmsg.h:97
ULONG SessionId
Definition: dllmain.c:28
struct _SM_TERMINATE_FOREIGN_SESSION_MSG * PSM_TERMINATE_FOREIGN_SESSION_MSG
LONG NTSTATUS
Definition: precomp.h:26
SM_LOAD_DEFERED_SUBSYSTEM_MSG LoadDefered
Definition: smmsg.h:101
HANDLE WindowsSubSysProcessId
Definition: smmsg.h:78
struct _SB_API_MSG SB_API_MSG
struct _SB_CONNECTION_INFO SB_CONNECTION_INFO
struct _SM_CREATE_FOREIGN_SESSION_MSG SM_CREATE_FOREIGN_SESSION_MSG
SB_CREATE_SESSION_MSG CreateSession
Definition: smmsg.h:212
SM_TERMINATE_FOREIGN_SESSION_MSG TerminateForeignComplete
Definition: smmsg.h:99
struct _SM_EXEC_PGM_MSG * PSM_EXEC_PGM_MSG
struct _SM_STOP_CSR_MSG SM_STOP_CSR_MSG
struct _SM_LOAD_DEFERED_SUBSYSTEM_MSG SM_LOAD_DEFERED_SUBSYSTEM_MSG
enum _SMSRV_API_NUMBER SMSRV_API_NUMBER
struct _SB_TERMINATE_SESSION_MSG SB_TERMINATE_SESSION_MSG
struct _SM_API_MSG * PSM_API_MSG
struct _SB_CREATE_SESSION_MSG * PSB_CREATE_SESSION_MSG
PUNICODE_STRING CommandLine
Definition: smmsg.h:173
RTL_USER_PROCESS_INFORMATION ProcessInfo
Definition: smmsg.h:145
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
_SMSRV_API_NUMBER
Definition: smmsg.h:25
SB_CREATE_PROCESS_MSG CreateProcess
Definition: smmsg.h:215
struct _SM_STOP_CSR_MSG * PSM_STOP_CSR_MSG
unsigned char BOOLEAN
SB_API_NUMBER ApiNumber
Definition: smmsg.h:208
struct _SM_CREATE_FOREIGN_SESSION_MSG * PSM_CREATE_FOREIGN_SESSION_MSG
struct _SB_CREATE_SESSION_MSG SB_CREATE_SESSION_MSG
Definition: bufpool.h:45
NTSTATUS ReturnValue
Definition: smmsg.h:209
SMSRV_API_NUMBER ApiNumber
Definition: smmsg.h:93
PUNICODE_STRING DllPath
Definition: smmsg.h:174
ULONG MuSessionId
Definition: smmsg.h:75
SB_TERMINATE_SESSION_MSG TerminateSession
Definition: smmsg.h:213
PUNICODE_STRING ImageName
Definition: smmsg.h:171
struct _SB_FOREIGN_SESSION_COMPLETE_MSG * PSB_FOREIGN_SESSION_COMPLETE_MSG
enum _SB_API_NUMBER SB_API_NUMBER
__wchar_t WCHAR
Definition: xmlstorage.h:180
struct _SM_TERMINATE_FOREIGN_SESSION_MSG SM_TERMINATE_FOREIGN_SESSION_MSG
struct _SB_CONNECTION_INFO * PSB_CONNECTION_INFO
struct _SM_SESSION_COMPLETE_MSG * PSM_SESSION_COMPLETE_MSG
struct _SB_API_MSG * PSB_API_MSG
CLIENT_ID ClientId
Definition: smmsg.h:148
SB_FOREIGN_SESSION_COMPLETE_MSG ForeignSessionComplete
Definition: smmsg.h:214
NTSTATUS NTAPI SmExecPgm(IN HANDLE SmApiPort, IN PRTL_USER_PROCESS_INFORMATION ProcessInformation, IN BOOLEAN DebugFlag)
Definition: smclient.c:21
WCHAR SbApiPortName[120]
Definition: smmsg.h:194
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:414
struct _SB_CREATE_PROCESS_MSG SB_CREATE_PROCESS_MSG
HANDLE SmpInitialCommandProcessId
Definition: smmsg.h:79
BOOLEAN DebugFlag
Definition: smmsg.h:61
struct _SM_LOAD_DEFERED_SUBSYSTEM_MSG * PSM_LOAD_DEFERED_SUBSYSTEM_MSG
SM_START_CSR_MSG StartCsr
Definition: smmsg.h:102
struct _SB_CREATE_PROCESS_MSG::@3373::@3375 In
struct _SB_FOREIGN_SESSION_COMPLETE_MSG SB_FOREIGN_SESSION_COMPLETE_MSG
BOOLEAN(NTAPI * PSB_API_ROUTINE)(IN PSB_API_MSG SbApiMsg)
Definition: smmsg.h:234
struct _SB_TERMINATE_SESSION_MSG * PSB_TERMINATE_SESSION_MSG
struct _SM_API_MSG SM_API_MSG
_SB_API_NUMBER
Definition: smmsg.h:128
struct _SM_START_CSR_MSG * PSM_START_CSR_MSG
SB_CONNECTION_INFO ConnectionInfo
Definition: smmsg.h:205
SM_STOP_CSR_MSG StopCsr
Definition: smmsg.h:103
struct _SB_CREATE_PROCESS_MSG::@3373::@3376 Out
HANDLE ProcessHandle
Definition: smmsg.h:180
struct _SM_SESSION_COMPLETE_MSG SM_SESSION_COMPLETE_MSG
ImageType
Definition: gdiplusenums.h:191
NTSTATUS NTAPI SmConnectToSm(IN PUNICODE_STRING SbApiPortName, IN HANDLE SbApiPort, IN ULONG ImageType, OUT PHANDLE SmApiPort)
Definition: smclient.c:68
struct _SM_EXEC_PGM_MSG SM_EXEC_PGM_MSG
#define BOOLEAN
Definition: pedump.c:73
#define OUT
Definition: typedefs.h:39
unsigned int ULONG
Definition: retypes.h:1
struct _SM_START_CSR_MSG SM_START_CSR_MSG
PUNICODE_STRING CurrentDirectory
Definition: smmsg.h:172
SM_SESSION_COMPLETE_MSG SessionComplete
Definition: smmsg.h:98
CLIENT_ID ClientId
Definition: smmsg.h:183
NTSTATUS SessionStatus
Definition: smmsg.h:50
C_ASSERT(sizeof(SM_EXEC_PGM_MSG)==0x48)
NTSTATUS ReturnValue
Definition: smmsg.h:94