Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

232 lines
4.6 KiB

  1. /*++ BUILD Version: 0001 // Increment this if a change has global effects
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. ntsm.h
  5. Abstract:
  6. This module describes the data types and procedure prototypes
  7. that make up the NT session manager. This includes API's
  8. exported by the Session manager and related subsystems.
  9. Author:
  10. Mark Lucovsky (markl) 21-Jun-1989
  11. Revision History:
  12. --*/
  13. #ifndef _NTSM_
  14. #define _NTSM_
  15. #if _MSC_VER > 1000
  16. #pragma once
  17. #endif
  18. #include <nt.h>
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. typedef PVOID PARGUMENTS;
  23. typedef PVOID PUSERPROFILE;
  24. //
  25. // Message formats used by the Session Manager SubSystem to communicate
  26. // with the Emulation SubSystems, via the Sb API calls exported by each
  27. // emulation subsystem.
  28. //
  29. typedef struct _SBCONNECTINFO {
  30. ULONG SubsystemImageType;
  31. WCHAR EmulationSubSystemPortName[120];
  32. } SBCONNECTINFO, *PSBCONNECTINFO;
  33. typedef enum _SBAPINUMBER {
  34. SbCreateSessionApi,
  35. SbTerminateSessionApi,
  36. SbForeignSessionCompleteApi,
  37. SbCreateProcessApi,
  38. SbMaxApiNumber
  39. } SBAPINUMBER;
  40. typedef struct _SBCREATESESSION {
  41. ULONG SessionId;
  42. RTL_USER_PROCESS_INFORMATION ProcessInformation;
  43. PUSERPROFILE UserProfile;
  44. ULONG DebugSession;
  45. CLIENT_ID DebugUiClientId;
  46. } SBCREATESESSION, *PSBCREATESESSION;
  47. typedef struct _SBTERMINATESESSION {
  48. ULONG SessionId;
  49. NTSTATUS TerminationStatus;
  50. } SBTERMINATESESSION, *PSBTERMINATESESSION;
  51. typedef struct _SBFOREIGNSESSIONCOMPLETE {
  52. ULONG SessionId;
  53. NTSTATUS TerminationStatus;
  54. } SBFOREIGNSESSIONCOMPLETE, *PSBFOREIGNSESSIONCOMPLETE;
  55. typedef struct _SBCREATEPROCESSIN {
  56. IN PUNICODE_STRING ImageFileName;
  57. IN PUNICODE_STRING CurrentDirectory;
  58. IN PUNICODE_STRING CommandLine;
  59. IN PUNICODE_STRING DefaultLibPath;
  60. IN ULONG Flags;
  61. IN ULONG DefaultDebugFlags;
  62. } SBCREATEPROCESSIN, *PSBCREATEPROCESSIN;
  63. typedef struct _SBCREATEPROCESSOUT {
  64. OUT HANDLE Process;
  65. OUT HANDLE Thread;
  66. OUT ULONG SubSystemType;
  67. OUT CLIENT_ID ClientId;
  68. } SBCREATEPROCESSOUT, *PSBCREATEPROCESSOUT;
  69. typedef struct _SBCREATEPROCESS {
  70. union {
  71. SBCREATEPROCESSIN i;
  72. SBCREATEPROCESSOUT o;
  73. };
  74. } SBCREATEPROCESS, *PSBCREATEPROCESS;
  75. typedef struct _SBAPIMSG {
  76. PORT_MESSAGE h;
  77. union {
  78. SBCONNECTINFO ConnectionRequest;
  79. struct {
  80. SBAPINUMBER ApiNumber;
  81. NTSTATUS ReturnedStatus;
  82. union {
  83. SBCREATESESSION CreateSession;
  84. SBTERMINATESESSION TerminateSession;
  85. SBFOREIGNSESSIONCOMPLETE ForeignSessionComplete;
  86. SBCREATEPROCESS CreateProcess;
  87. } u;
  88. };
  89. };
  90. } SBAPIMSG, *PSBAPIMSG;
  91. //
  92. // API's Exported by Sm
  93. //
  94. NTSTATUS
  95. NTAPI
  96. SmCreateForeignSession(
  97. IN HANDLE SmApiPort,
  98. OUT PULONG ForeignSessionId,
  99. IN ULONG SourceSessionId,
  100. IN PRTL_USER_PROCESS_INFORMATION ProcessInformation,
  101. IN PCLIENT_ID DebugUiClientId OPTIONAL
  102. );
  103. NTSTATUS
  104. NTAPI
  105. SmSessionComplete(
  106. IN HANDLE SmApiPort,
  107. IN ULONG SessionId,
  108. IN NTSTATUS CompletionStatus
  109. );
  110. NTSTATUS
  111. NTAPI
  112. SmTerminateForeignSession(
  113. IN HANDLE SmApiPort,
  114. IN ULONG ForeignSessionId,
  115. IN NTSTATUS TerminationStatus
  116. );
  117. NTSTATUS
  118. NTAPI
  119. SmExecPgm(
  120. IN HANDLE SmApiPort,
  121. IN PRTL_USER_PROCESS_INFORMATION ProcessInformation,
  122. IN BOOLEAN DebugFlag
  123. );
  124. NTSTATUS
  125. NTAPI
  126. SmLoadDeferedSubsystem(
  127. IN HANDLE SmApiPort,
  128. IN PUNICODE_STRING DeferedSubsystem
  129. );
  130. NTSTATUS
  131. NTAPI
  132. SmConnectToSm(
  133. IN PUNICODE_STRING SbApiPortName OPTIONAL,
  134. IN HANDLE SbApiPort OPTIONAL,
  135. IN ULONG SbImageType OPTIONAL,
  136. OUT PHANDLE SmApiPort
  137. );
  138. //
  139. // Emulation Subsystems must export the following APIs
  140. //
  141. NTSTATUS
  142. NTAPI
  143. SbCreateSession(
  144. IN PSBAPIMSG SbApiMsg
  145. );
  146. NTSTATUS
  147. NTAPI
  148. SbTerminateSession(
  149. IN PSBAPIMSG SbApiMsg
  150. );
  151. NTSTATUS
  152. NTAPI
  153. SbForeignSessionComplete(
  154. IN PSBAPIMSG SbApiMsg
  155. );
  156. NTSTATUS
  157. NTAPI
  158. SmStartCsr(
  159. IN HANDLE SmApiPort,
  160. OUT PULONG pMuSessionId,
  161. IN PUNICODE_STRING InitialCommand,
  162. OUT PULONG_PTR pInitialCommandProcessId,
  163. OUT PULONG_PTR pWindowsSubSysProcessId
  164. );
  165. NTSTATUS
  166. NTAPI
  167. SmStopCsr(
  168. IN HANDLE SmApiPort,
  169. IN ULONG LogonId
  170. );
  171. //
  172. // Moved from sm\server\sminit.c so CSR can use it
  173. //
  174. #define SMP_DEBUG_FLAG 0x00000001
  175. #define SMP_ASYNC_FLAG 0x00000002
  176. #define SMP_AUTOCHK_FLAG 0x00000004
  177. #define SMP_SUBSYSTEM_FLAG 0x00000008
  178. #define SMP_IMAGE_NOT_FOUND 0x00000010
  179. #define SMP_DONT_START 0x00000020
  180. #define SMP_AUTOFMT_FLAG 0x00000040
  181. #define SMP_POSIX_SI_FLAG 0x00000080
  182. #define SMP_POSIX_FLAG 0x00000100
  183. #define SMP_OS2_FLAG 0x00000200
  184. #ifdef __cplusplus
  185. }
  186. #endif
  187. #endif // _NTSM_