Leaked source code of windows server 2003
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.

367 lines
11 KiB

  1. /*************************************************************************
  2. *
  3. * wstmsg.h
  4. *
  5. * Session Manager Window Station API Messages
  6. *
  7. * copyright notice: Copyright 1998, Microsoft Corporation
  8. *
  9. *
  10. *************************************************************************/
  11. #ifndef WINAPI
  12. #define WINAPI __stdcall
  13. #endif
  14. #define CITRIX_WINSTATIONAPI_VERSION 1
  15. #define WINSTATIONAPI_PORT_MEMORY_SIZE 0x2000 // 8K will hold everything
  16. /*
  17. * Define WinStation control port name
  18. */
  19. #define WINSTATION_CTRL_PORT_NAME L"\\WinStationCtrlPort"
  20. #define DR_RECONNECT_DEVICE_NAMEW L"\\Device\\Video0"
  21. #define DR_RECONNECT_DEVICE_NAMEA "\\Device\\Video0"
  22. //
  23. // This is the ConnectInfo structure passed at NtConnectPort() time
  24. // so that the server can verify our access rights.
  25. //
  26. typedef struct _WINSTATIONAPI_CONNECT_INFO {
  27. ULONG Version;
  28. ULONG RequestedAccess;
  29. NTSTATUS AcceptStatus;
  30. } WINSTATIONAPI_CONNECT_INFO, *PWINSTATIONAPI_CONNECT_INFO;
  31. /*
  32. * WinStation APIs
  33. * The following APIs are processed by ICASRV or WIN32
  34. * depending on the API. If you make any changes to this
  35. * table, be sure to update the corresponding API dispatch table
  36. * in both ICASRV and in Win32.
  37. */
  38. typedef enum _WINSTATION_APINUMBER {
  39. SMWinStationCreate,
  40. SMWinStationReset,
  41. SMWinStationDisconnect,
  42. SMWinStationWCharLog,
  43. SMWinStationGetSMCommand,
  44. SMWinStationBrokenConnection,
  45. SMWinStationIcaReplyMessage,
  46. SMWinStationIcaShadowHotkey,
  47. SMWinStationDoConnect,
  48. SMWinStationDoDisconnect,
  49. SMWinStationDoReconnect,
  50. SMWinStationExitWindows,
  51. SMWinStationTerminate,
  52. SMWinStationNtSecurity,
  53. SMWinStationDoMessage,
  54. SMWinStationDoBreakPoint,
  55. SMWinStationThinwireStats,
  56. SMWinStationShadowSetup,
  57. SMWinStationShadowStart,
  58. SMWinStationShadowStop,
  59. SMWinStationShadowCleanup,
  60. SMWinStationPassthruEnable,
  61. SMWinStationPassthruDisable,
  62. SMWinStationSetTimeZone,
  63. SMWinStationInitialProgram,
  64. SMWinStationNtsdDebug,
  65. SMWinStationBroadcastSystemMessage, // API for using Window's BroadcastSystemMessage()
  66. SMWinStationSendWindowMessage, // API for using WIndows's SendMessage()
  67. SMWinStationNotify,
  68. SMWinStationDoLoadStringNMessage, // Similar to SMWinStationDoMessage except that CSRSS loads the string
  69. SMWinStationWindowInvalid,
  70. SMWinStationMaxApiNumber
  71. } WINSTATION_APINUMBER;
  72. /*
  73. * API function specific messages for WinStations
  74. */
  75. typedef struct _WINSTATIONCREATEMSG {
  76. WINSTATIONNAME WinStationName;
  77. ULONG LogonId;
  78. } WINSTATIONCREATEMSG;
  79. typedef struct _WINSTATIONRESETMSG {
  80. ULONG LogonId;
  81. } WINSTATIONRESETMSG;
  82. typedef struct _WINSTATIONDISCONNECTMSG {
  83. ULONG LogonId;
  84. } WINSTATIONDISCONNECTMSG;
  85. typedef struct _WINSTATIONDODISCONNECTMSG {
  86. BOOLEAN ConsoleShadowFlag;
  87. ULONG NotUsed;
  88. } WINSTATIONDODISCONNECTMSG;
  89. typedef struct _WINSTATIONDOCONNECTMSG {
  90. BOOLEAN ConsoleShadowFlag;
  91. BOOLEAN fMouse;
  92. BOOLEAN fINetClient;
  93. BOOLEAN fInitialProgram;
  94. BOOLEAN fHideTitleBar;
  95. BOOLEAN fMaximize;
  96. HANDLE hIcaVideoChannel;
  97. HANDLE hIcaMouseChannel;
  98. HANDLE hIcaKeyboardChannel;
  99. HANDLE hIcaBeepChannel;
  100. HANDLE hIcaCommandChannel;
  101. HANDLE hIcaThinwireChannel;
  102. HANDLE hDisplayChangeEvent;
  103. WINSTATIONNAME WinStationName;
  104. WCHAR DisplayDriverName[9];
  105. WCHAR ProtocolName[9];
  106. WCHAR AudioDriverName[9];
  107. USHORT HRes; // are for dynamically changing
  108. USHORT VRes; // display resolution at reconnection.
  109. USHORT ColorDepth;
  110. USHORT ProtocolType; // PROTOCOL_ICA or PROTOCOL_RDP
  111. BOOLEAN fClientDoubleClickSupport;
  112. BOOLEAN fEnableWindowsKey;
  113. ULONG KeyboardType;
  114. ULONG KeyboardSubType;
  115. ULONG KeyboardFunctionKey;
  116. } WINSTATIONDOCONNECTMSG;
  117. typedef struct _WINSTATIONDORECONNECTMSG {
  118. BOOLEAN fMouse;
  119. BOOLEAN fINetClient;
  120. BOOLEAN fClientDoubleClickSupport;
  121. BOOLEAN fEnableWindowsKey;
  122. BOOLEAN fDynamicReconnect; // Session can resize Display at reconnect
  123. WINSTATIONNAME WinStationName;
  124. WCHAR AudioDriverName[9];
  125. WCHAR DisplayDriverName[9];
  126. WCHAR ProtocolName[9];
  127. USHORT HRes; // are for dynamically changing
  128. USHORT VRes; // display resolution at reconnection.
  129. USHORT ColorDepth;
  130. USHORT ProtocolType; // PROTOCOL_ICA or PROTOCOL_RDP
  131. ULONG KeyboardType;
  132. ULONG KeyboardSubType;
  133. ULONG KeyboardFunctionKey;
  134. } WINSTATIONDORECONNECTMSG;
  135. typedef enum _WINSTATIONNOTIFYEVENT {
  136. WinStation_Notify_Disconnect,
  137. WinStation_Notify_Reconnect,
  138. WinStation_Notify_PreReconnect,
  139. WinStation_Notify_SyncDisconnect,
  140. WinStation_Notify_DisableScrnSaver,
  141. WinStation_Notify_EnableScrnSaver,
  142. WinStation_Notify_PreReconnectDesktopSwitch,
  143. WinStation_Notify_HelpAssistantShadowStart,
  144. WinStation_Notify_HelpAssistantShadowFinish,
  145. WinStation_Notify_DisconnectPipe
  146. } WINSTATIONNOTIFYEVENT;
  147. typedef struct _WINSTATIONWINDOWINVALIDMSG {
  148. ULONG hWnd;
  149. ULONG SessionId;
  150. } WINSTATIONWINDOWINVALIDMSG;
  151. typedef struct _WINSTATIONDONOTIFYMSG {
  152. WINSTATIONNOTIFYEVENT NotifyEvent;
  153. } WINSTATIONDONOTIFYMSG;
  154. typedef struct _WINSTATIONTHINWIRESTATSMSG {
  155. CACHE_STATISTICS Stats;
  156. } WINSTATIONTHINWIRESTATSMSG;
  157. typedef struct _WINSTATIONEXITWINDOWSMSG {
  158. ULONG Flags;
  159. } WINSTATIONEXITWINDOWSMSG;
  160. typedef struct _WINSTATIONSENDMESSAGEMSG {
  161. LPWSTR pTitle;
  162. ULONG TitleLength;
  163. LPWSTR pMessage;
  164. ULONG MessageLength;
  165. ULONG Style;
  166. ULONG Timeout;
  167. ULONG Response;
  168. PULONG pResponse;
  169. BOOLEAN DoNotWait;
  170. BOOLEAN DoNotWaitForCorrectDesktop;
  171. PNTSTATUS pStatus;
  172. HANDLE hEvent;
  173. } WINSTATIONSENDMESSAGEMSG;
  174. typedef struct _WINSTATIONLOADSTRINGMSG {
  175. ULONG TitleId;
  176. ULONG MessageId;
  177. ULONG Style;
  178. ULONG Timeout;
  179. ULONG Response;
  180. PULONG pResponse;
  181. PNTSTATUS pStatus;
  182. BOOLEAN DoNotWait;
  183. HANDLE hEvent;
  184. LPWSTR pDomain;
  185. ULONG DomainSize;
  186. LPWSTR pUserName;
  187. ULONG UserNameSize;
  188. } WINSTATIONLOADSTRINGMSG;
  189. typedef struct _WINSTATIONREPLYMESSAGEMSG {
  190. ULONG Response;
  191. PULONG pResponse;
  192. HANDLE hEvent;
  193. NTSTATUS Status;
  194. PNTSTATUS pStatus;
  195. } WINSTATIONREPLYMESSAGEMSG;
  196. typedef struct _WINSTATIONTERMINATEMSG {
  197. ULONG NotUsed;
  198. } WINSTATIONTERMINATEMSG;
  199. typedef struct _WINSTATIONNTSDDEBUGMSG {
  200. ULONG LogonId;
  201. LONG ProcessId;
  202. CLIENT_ID ClientId;
  203. PVOID AttachCompletionRoutine;
  204. } WINSTATIONNTSDDEBUGMSG, *PWINSTATIONNTSDDEBUGMSG;
  205. typedef struct _WINSTATIONBREAKPOINTMSG {
  206. BOOLEAN KernelFlag;
  207. } WINSTATIONBREAKPOINTMSG;
  208. typedef struct _WINSTATIONSHADOWSETUPMSG {
  209. ULONG NotUsed;
  210. } WINSTATIONSHADOWSETUPMSG;
  211. typedef struct _WINSTATIONSHADOWSTARTMSG {
  212. PVOID pThinwireData;
  213. ULONG ThinwireDataLength;
  214. } WINSTATIONSHADOWSTARTMSG;
  215. typedef struct _WINSTATIONSHADOWSTOPMSG {
  216. ULONG NotUsed;
  217. } WINSTATIONSHADOWSTOPMSG;
  218. typedef struct _WINSTATIONSHADOWCLEANUPMSG {
  219. PVOID pThinwireData;
  220. ULONG ThinwireDataLength;
  221. } WINSTATIONSHADOWCLEANUPMSG;
  222. typedef struct _WINSTATIONBROKENCONNECTIONMSG {
  223. ULONG Reason; // reason for broken connection (BROKENCLASS)
  224. ULONG Source; // source for broken connection (BROKENSOURCECLASS)
  225. } WINSTATIONBROKENCONNECTIONMSG;
  226. typedef struct _WINSTATIONWCHARLOG {
  227. WCHAR Buffer[100];
  228. } WINSTATIONWCHARLOG;
  229. // This data structure included all params used by window's BroadcastSystemMessage
  230. // Use this APIto send a message to all windows of a winstation.
  231. typedef struct _WINSTATIONBROADCASTSYSTEMMSG {
  232. DWORD dwFlags;
  233. DWORD dwRecipients;
  234. UINT uiMessage;
  235. WPARAM wParam;
  236. LPARAM lParam;
  237. PVOID dataBuffer;
  238. ULONG bufferSize;
  239. HANDLE hEvent;
  240. ULONG Response;
  241. } WINSTATIONBROADCASTSYSTEMMSG;
  242. // This data structure has all the params used by window's standard SendMessage()API.
  243. // Use this API to send a message to a specific hwnd of a winstation ( you need to know that the appropriate hwnd was)
  244. typedef struct _WINSTATIONSENDWINDOWMSG {
  245. HWND hWnd; // handle of destination window
  246. UINT Msg; // message to send
  247. WPARAM wParam; // first message parameter
  248. LPARAM lParam; // second message parameter
  249. PCHAR dataBuffer;
  250. ULONG bufferSize;
  251. HANDLE hEvent;
  252. ULONG Response;
  253. } WINSTATIONSENDWINDOWMSG;
  254. typedef struct _WINSTATIONSETTIMEZONE {
  255. TS_TIME_ZONE_INFORMATION TimeZone;
  256. } WINSTATIONSETTIMEZONE;
  257. typedef struct _WINSTATION_APIMSG {
  258. PORT_MESSAGE h;
  259. ULONG MessageId;
  260. WINSTATION_APINUMBER ApiNumber;
  261. BOOLEAN WaitForReply;
  262. NTSTATUS ReturnedStatus;
  263. union {
  264. WINSTATIONCREATEMSG Create;
  265. WINSTATIONRESETMSG Reset;
  266. WINSTATIONDISCONNECTMSG Disconnect;
  267. WINSTATIONWCHARLOG WCharLog;
  268. WINSTATIONREPLYMESSAGEMSG ReplyMessage;
  269. WINSTATIONDODISCONNECTMSG DoDisconnect;
  270. WINSTATIONDOCONNECTMSG DoConnect;
  271. WINSTATIONEXITWINDOWSMSG ExitWindows;
  272. WINSTATIONTERMINATEMSG Terminate;
  273. WINSTATIONSENDMESSAGEMSG SendMessage;
  274. WINSTATIONBREAKPOINTMSG BreakPoint;
  275. WINSTATIONDORECONNECTMSG DoReconnect;
  276. WINSTATIONTHINWIRESTATSMSG ThinwireStats;
  277. WINSTATIONSHADOWSETUPMSG ShadowSetup;
  278. WINSTATIONSHADOWSTARTMSG ShadowStart;
  279. WINSTATIONSHADOWSTOPMSG ShadowStop;
  280. WINSTATIONSHADOWCLEANUPMSG ShadowCleanup;
  281. WINSTATIONBROKENCONNECTIONMSG Broken;
  282. WINSTATIONNTSDDEBUGMSG NtsdDebug;
  283. WINSTATIONBROADCASTSYSTEMMSG bMsg; // API for Window's BroadcastSystemMessage()
  284. WINSTATIONSENDWINDOWMSG sMsg; // API for WIndows's SendMessage()
  285. WINSTATIONSETTIMEZONE SetTimeZone;
  286. WINSTATIONDONOTIFYMSG DoNotify;
  287. WINSTATIONLOADSTRINGMSG LoadStringMessage;
  288. WINSTATIONWINDOWINVALIDMSG WindowInvalid;
  289. } u;
  290. } WINSTATION_APIMSG, *PWINSTATION_APIMSG;
  291. /*
  292. * WinStation Kernel object interface routines. These provide a common
  293. * interface to the Nt* API's for the object that can be used by the
  294. * Session manager, the WinStation client DLL, and the CSRSS subsystem.
  295. */
  296. /*
  297. * WinStation kernel object root directory name
  298. */
  299. #define CITRIX_WINSTATION_OBJECT_DIRECTORY L"\\WinStations"
  300. /*
  301. * OpenWinStationObject
  302. *
  303. * Open the WinStation Kernel Object of the given Name.
  304. *
  305. * ENTRY:
  306. * Id
  307. * Id of the WinStation Kernel Object to open. It will be under the path
  308. * of "\WinStations\xxx" in the kernel object name space when
  309. * created.
  310. *
  311. * pHandle (output)
  312. * Pointer to variable to place the handle if the object was created.
  313. *
  314. * EXIT:
  315. * Returns the NTSTATUS code from the operation.
  316. */
  317. NTSTATUS
  318. OpenWinStationObject( ULONG,
  319. PHANDLE,
  320. ULONG );