Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygensmmsg.h
Go to the documentation of this file.
00001 /* 00002 * PROJECT: ReactOS Windows-Compatible Session Manager 00003 * LICENSE: BSD 2-Clause License 00004 * FILE: include/reactos/subsystems/sm/smmsg.h 00005 * PURPOSE: SMSS (SB and SM) Message Format 00006 * PROGRAMMERS: Alex Ionescu 00007 */ 00008 #pragma once 00009 #ifndef _SM_MSG_ 00010 #define _SM_MSG_ 00011 00012 // 00013 // There are the APIs that a Client (such as CSRSS) can send to the SMSS Server. 00014 // 00015 // These are called "SM" APIs. 00016 // 00017 // The exact names are not known, but we are basing them on the SmpApiName array 00018 // in the checked build of SMSS, which is probably a close approximation. We add 00019 // "p" to use the similar nomenclature seen/leaked out in the Base CSRSS APIs. 00020 // 00021 // 00022 typedef enum _SMSRV_API_NUMBER 00023 { 00024 SmCreateForeignSessionApi, 00025 SmSessionCompleteApi, 00026 SmTerminateForeignSessionApi, 00027 SmExecPgmApi, 00028 SmLoadDeferedSubsystemApi, 00029 SmStartCsrApi, 00030 SmStopCsrApi, 00031 SmMaxApiNumber // Based on BasepMaxApiNumber, UserpMaxApiNumber... 00032 } SMSRV_API_NUMBER; 00033 00034 // 00035 // These are the structures making up the SM_API_MSG packet structure defined 00036 // below. Each one corresponds to an equivalent API from the list above. 00037 // 00038 typedef struct _SM_CREATE_FOREIGN_SESSION_MSG 00039 { 00040 ULONG NotImplemented; 00041 } SM_CREATE_FOREIGN_SESSION_MSG, *PSM_CREATE_FOREIGN_SESSION_MSG; 00042 00043 typedef struct _SM_SESSION_COMPLETE_MSG 00044 { 00045 ULONG SessionId; 00046 NTSTATUS SessionStatus; 00047 } SM_SESSION_COMPLETE_MSG, *PSM_SESSION_COMPLETE_MSG; 00048 00049 typedef struct _SM_TERMINATE_FOREIGN_SESSION_MSG 00050 { 00051 ULONG NotImplemented; 00052 } SM_TERMINATE_FOREIGN_SESSION_MSG, *PSM_TERMINATE_FOREIGN_SESSION_MSG; 00053 00054 typedef struct _SM_EXEC_PGM_MSG 00055 { 00056 RTL_USER_PROCESS_INFORMATION ProcessInformation; 00057 BOOLEAN DebugFlag; 00058 } SM_EXEC_PGM_MSG, *PSM_EXEC_PGM_MSG; 00059 #ifndef _WIN64 00060 C_ASSERT(sizeof(SM_EXEC_PGM_MSG) == 0x48); 00061 #endif 00062 00063 typedef struct _SM_LOAD_DEFERED_SUBSYSTEM_MSG 00064 { 00065 ULONG Length; 00066 WCHAR Buffer[32]; 00067 } SM_LOAD_DEFERED_SUBSYSTEM_MSG, *PSM_LOAD_DEFERED_SUBSYSTEM_MSG; 00068 00069 typedef struct _SM_START_CSR_MSG 00070 { 00071 ULONG MuSessionId; 00072 ULONG Length; 00073 WCHAR Buffer[128]; 00074 HANDLE WindowsSubSysProcessId; 00075 HANDLE SmpInitialCommandProcessId; 00076 } SM_START_CSR_MSG, *PSM_START_CSR_MSG; 00077 00078 typedef struct _SM_STOP_CSR_MSG 00079 { 00080 ULONG MuSessionId; 00081 } SM_STOP_CSR_MSG, *PSM_STOP_CSR_MSG; 00082 00083 // 00084 // This is the actual packet structure sent over LCP to the \SmApiPort 00085 // 00086 typedef struct _SM_API_MSG 00087 { 00088 PORT_MESSAGE h; 00089 SMSRV_API_NUMBER ApiNumber; 00090 NTSTATUS ReturnValue; 00091 union 00092 { 00093 SM_CREATE_FOREIGN_SESSION_MSG CreateForeignSession; 00094 SM_SESSION_COMPLETE_MSG SessionComplete; 00095 SM_TERMINATE_FOREIGN_SESSION_MSG TerminateForeignComplete; 00096 SM_EXEC_PGM_MSG ExecPgm; 00097 SM_LOAD_DEFERED_SUBSYSTEM_MSG LoadDefered; 00098 SM_START_CSR_MSG StartCsr; 00099 SM_STOP_CSR_MSG StopCsr; 00100 } u; 00101 } SM_API_MSG, *PSM_API_MSG; 00102 00103 // 00104 // This is the size that Server 2003 SP1 SMSS expects, so make sure we conform. 00105 // 00106 #ifndef _WIN64 00107 C_ASSERT(sizeof(SM_API_MSG) == 0x130); 00108 #endif 00109 00110 // 00111 // There are the APIs that the SMSS Serve can send to a client (such as CSRSS) 00112 // 00113 // These are called "SB" APIs. 00114 // 00115 // The exact names are unknown but we are basing them on the CsrServerSbApiName 00116 // array in the checked build of CSRSRV which is probably a close approximation. 00117 // We add "p" to use the similar nomenclature seen/leaked out in the Base CSRSS 00118 // APIs. 00119 // 00120 // 00121 typedef enum _SB_API_NUMBER 00122 { 00123 SbpCreateSession, 00124 SbpTerminateSession, 00125 SbpForeignSessionComplete, 00126 SbpCreateProcess, 00127 SbpMaxApiNumber // Based on BasepMaxApiNumber, UserpMaxApiNumber... 00128 } SB_API_NUMBER; 00129 00130 // 00131 // These are the structures making up the SB_API_MSG packet structure defined 00132 // below. Each one corresponds to an equivalent API from the list above. 00133 // 00134 typedef struct _SB_CREATE_SESSION_MSG 00135 { 00136 ULONG SessionId; 00137 RTL_USER_PROCESS_INFORMATION ProcessInfo; 00138 ULONG Unknown; 00139 ULONG MuSessionId; 00140 CLIENT_ID ClientId; 00141 } SB_CREATE_SESSION_MSG, *PSB_CREATE_SESSION_MSG; 00142 00143 typedef struct _SB_TERMINATE_SESSION_MSG 00144 { 00145 ULONG SessionId; 00146 } SB_TERMINATE_SESSION_MSG, *PSB_TERMINATE_SESSION_MSG; 00147 00148 typedef struct _SB_FOREIGN_SESSION_COMPLETE_MSG 00149 { 00150 ULONG SessionId; 00151 } SB_FOREIGN_SESSION_COMPLETE_MSG, *PSB_FOREIGN_SESSION_COMPLETE_MSG; 00152 00153 #define SB_PROCESS_FLAGS_DEBUG 0x1 00154 #define SB_PROCESS_FLAGS_WAIT_ON_THREAD 0x2 00155 #define SB_PROCESS_FLAGS_RESERVE_1MB 0x8 00156 #define SB_PROCESS_FLAGS_SKIP_CHECKS 0x20 00157 typedef struct _SB_CREATE_PROCESS_MSG 00158 { 00159 union 00160 { 00161 struct 00162 { 00163 PUNICODE_STRING ImageName; 00164 PUNICODE_STRING CurrentDirectory; 00165 PUNICODE_STRING CommandLine; 00166 PUNICODE_STRING DllPath; 00167 ULONG Flags; 00168 ULONG DebugFlags; 00169 } In; 00170 struct 00171 { 00172 HANDLE ProcessHandle; 00173 HANDLE ThreadHandle; 00174 ULONG SubsystemType; 00175 CLIENT_ID ClientId; 00176 } Out; 00177 }; 00178 } SB_CREATE_PROCESS_MSG, *PSB_CREATE_PROCESS_MSG; 00179 00180 // 00181 // When the server connects to a client, this structure is exchanged 00182 // 00183 typedef struct _SB_CONNECTION_INFO 00184 { 00185 ULONG SubsystemType; 00186 WCHAR SbApiPortName[120]; 00187 } SB_CONNECTION_INFO, *PSB_CONNECTION_INFO; 00188 00189 // 00190 // This is the actual packet structure sent over LCP to the \SbApiPort 00191 // 00192 typedef struct _SB_API_MSG 00193 { 00194 PORT_MESSAGE h; 00195 union 00196 { 00197 SB_CONNECTION_INFO ConnectionInfo; 00198 struct 00199 { 00200 SB_API_NUMBER ApiNumber; 00201 NTSTATUS ReturnValue; 00202 union 00203 { 00204 SB_CREATE_SESSION_MSG CreateSession; 00205 SB_TERMINATE_SESSION_MSG TerminateSession; 00206 SB_FOREIGN_SESSION_COMPLETE_MSG ForeignSessionComplete; 00207 SB_CREATE_PROCESS_MSG CreateProcess; 00208 }; 00209 }; 00210 }; 00211 } SB_API_MSG, *PSB_API_MSG; 00212 00213 // 00214 // This is the size that Server 2003 SP1 SMSS expects, so make sure we conform. 00215 // 00216 #ifndef _WIN64 00217 C_ASSERT(sizeof(SB_CONNECTION_INFO) == 0xF4); 00218 C_ASSERT(sizeof(SB_API_MSG) == 0x110); 00219 #endif 00220 00221 // 00222 // SB Message Handler 00223 // 00224 typedef 00225 BOOLEAN 00226 (NTAPI *PSB_API_ROUTINE)( 00227 IN PSB_API_MSG SbApiMsg 00228 ); 00229 00230 // 00231 // The actual server functions that a client linking with smlib can call 00232 // 00233 NTSTATUS 00234 NTAPI 00235 SmConnectToSm( 00236 IN PUNICODE_STRING SbApiPortName, 00237 IN HANDLE SbApiPort, 00238 IN ULONG ImageType, 00239 IN HANDLE SmApiPort 00240 ); 00241 00242 NTSTATUS 00243 NTAPI 00244 SmExecPgm( 00245 IN HANDLE SmApiPort, 00246 IN PRTL_USER_PROCESS_INFORMATION ProcessInformation, 00247 IN BOOLEAN DebugFlag 00248 ); 00249 00250 NTSTATUS 00251 NTAPI 00252 SmSessionComplete( 00253 IN HANDLE SmApiPort, 00254 IN ULONG SessionId, 00255 IN NTSTATUS SessionStatus 00256 ); 00257 00258 #endif Generated on Mon May 28 2012 04:33:11 for ReactOS by
1.7.6.1
|