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.

345 lines
10 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. SMWinStationWindowInvalid,
  69. SMWinStationMaxApiNumber
  70. } WINSTATION_APINUMBER;
  71. /*
  72. * API function specific messages for WinStations
  73. */
  74. typedef struct _WINSTATIONCREATEMSG {
  75. WINSTATIONNAME WinStationName;
  76. ULONG LogonId;
  77. } WINSTATIONCREATEMSG;
  78. typedef struct _WINSTATIONRESETMSG {
  79. ULONG LogonId;
  80. } WINSTATIONRESETMSG;
  81. typedef struct _WINSTATIONDISCONNECTMSG {
  82. ULONG LogonId;
  83. } WINSTATIONDISCONNECTMSG;
  84. typedef struct _WINSTATIONDODISCONNECTMSG {
  85. BOOLEAN ConsoleShadowFlag;
  86. ULONG NotUsed;
  87. } WINSTATIONDODISCONNECTMSG;
  88. typedef struct _WINSTATIONDOCONNECTMSG {
  89. BOOLEAN ConsoleShadowFlag;
  90. BOOLEAN fMouse;
  91. BOOLEAN fINetClient;
  92. BOOLEAN fInitialProgram;
  93. BOOLEAN fHideTitleBar;
  94. BOOLEAN fMaximize;
  95. HANDLE hIcaVideoChannel;
  96. HANDLE hIcaMouseChannel;
  97. HANDLE hIcaKeyboardChannel;
  98. HANDLE hIcaBeepChannel;
  99. HANDLE hIcaCommandChannel;
  100. HANDLE hIcaThinwireChannel;
  101. HANDLE hDisplayChangeEvent;
  102. WINSTATIONNAME WinStationName;
  103. WCHAR DisplayDriverName[9];
  104. WCHAR ProtocolName[9];
  105. WCHAR AudioDriverName[9];
  106. USHORT HRes; // are for dynamically changing
  107. USHORT VRes; // display resolution at reconnection.
  108. USHORT ColorDepth;
  109. USHORT ProtocolType; // PROTOCOL_ICA or PROTOCOL_RDP
  110. BOOLEAN fClientDoubleClickSupport;
  111. BOOLEAN fEnableWindowsKey;
  112. ULONG KeyboardType;
  113. ULONG KeyboardSubType;
  114. ULONG KeyboardFunctionKey;
  115. } WINSTATIONDOCONNECTMSG;
  116. typedef struct _WINSTATIONDORECONNECTMSG {
  117. BOOLEAN fMouse;
  118. BOOLEAN fINetClient;
  119. BOOLEAN fClientDoubleClickSupport;
  120. BOOLEAN fEnableWindowsKey;
  121. BOOLEAN fDynamicReconnect; // Session can resize Display at reconnect
  122. WINSTATIONNAME WinStationName;
  123. WCHAR AudioDriverName[9];
  124. WCHAR DisplayDriverName[9];
  125. WCHAR ProtocolName[9];
  126. USHORT HRes; // are for dynamically changing
  127. USHORT VRes; // display resolution at reconnection.
  128. USHORT ColorDepth;
  129. USHORT ProtocolType; // PROTOCOL_ICA or PROTOCOL_RDP
  130. ULONG KeyboardType;
  131. ULONG KeyboardSubType;
  132. ULONG KeyboardFunctionKey;
  133. } WINSTATIONDORECONNECTMSG;
  134. typedef enum _WINSTATIONNOTIFYEVENT {
  135. WinStation_Notify_Disconnect,
  136. WinStation_Notify_Reconnect,
  137. WinStation_Notify_PreReconnect,
  138. WinStation_Notify_SyncDisconnect,
  139. WinStation_Notify_DisableScrnSaver,
  140. WinStation_Notify_EnableScrnSaver,
  141. WinStation_Notify_PreReconnectDesktopSwitch,
  142. WinStation_Notify_HelpAssistantShadowStart,
  143. WinStation_Notify_HelpAssistantShadowFinish,
  144. WinStation_Notify_DisconnectPipe
  145. } WINSTATIONNOTIFYEVENT;
  146. typedef struct _WINSTATIONWINDOWINVALIDMSG {
  147. ULONG hWnd;
  148. ULONG SessionId;
  149. } WINSTATIONWINDOWINVALIDMSG;
  150. typedef struct _WINSTATIONDONOTIFYMSG {
  151. WINSTATIONNOTIFYEVENT NotifyEvent;
  152. } WINSTATIONDONOTIFYMSG;
  153. typedef struct _WINSTATIONTHINWIRESTATSMSG {
  154. CACHE_STATISTICS Stats;
  155. } WINSTATIONTHINWIRESTATSMSG;
  156. typedef struct _WINSTATIONEXITWINDOWSMSG {
  157. ULONG Flags;
  158. } WINSTATIONEXITWINDOWSMSG;
  159. typedef struct _WINSTATIONSENDMESSAGEMSG {
  160. LPWSTR pTitle;
  161. ULONG TitleLength;
  162. LPWSTR pMessage;
  163. ULONG MessageLength;
  164. ULONG Style;
  165. ULONG Timeout;
  166. ULONG Response;
  167. PULONG pResponse;
  168. BOOLEAN DoNotWait;
  169. HANDLE hEvent;
  170. } WINSTATIONSENDMESSAGEMSG;
  171. typedef struct _WINSTATIONREPLYMESSAGEMSG {
  172. ULONG Response;
  173. PULONG pResponse;
  174. HANDLE hEvent;
  175. } WINSTATIONREPLYMESSAGEMSG;
  176. typedef struct _WINSTATIONTERMINATEMSG {
  177. ULONG NotUsed;
  178. } WINSTATIONTERMINATEMSG;
  179. typedef struct _WINSTATIONNTSDDEBUGMSG {
  180. ULONG LogonId;
  181. LONG ProcessId;
  182. CLIENT_ID ClientId;
  183. PVOID AttachCompletionRoutine;
  184. } WINSTATIONNTSDDEBUGMSG, *PWINSTATIONNTSDDEBUGMSG;
  185. typedef struct _WINSTATIONBREAKPOINTMSG {
  186. BOOLEAN KernelFlag;
  187. } WINSTATIONBREAKPOINTMSG;
  188. typedef struct _WINSTATIONSHADOWSETUPMSG {
  189. ULONG NotUsed;
  190. } WINSTATIONSHADOWSETUPMSG;
  191. typedef struct _WINSTATIONSHADOWSTARTMSG {
  192. PVOID pThinwireData;
  193. ULONG ThinwireDataLength;
  194. } WINSTATIONSHADOWSTARTMSG;
  195. typedef struct _WINSTATIONSHADOWSTOPMSG {
  196. ULONG NotUsed;
  197. } WINSTATIONSHADOWSTOPMSG;
  198. typedef struct _WINSTATIONSHADOWCLEANUPMSG {
  199. PVOID pThinwireData;
  200. ULONG ThinwireDataLength;
  201. } WINSTATIONSHADOWCLEANUPMSG;
  202. typedef struct _WINSTATIONBROKENCONNECTIONMSG {
  203. ULONG Reason; // reason for broken connection (BROKENCLASS)
  204. ULONG Source; // source for broken connection (BROKENSOURCECLASS)
  205. } WINSTATIONBROKENCONNECTIONMSG;
  206. typedef struct _WINSTATIONWCHARLOG {
  207. WCHAR Buffer[100];
  208. } WINSTATIONWCHARLOG;
  209. // This data structure included all params used by window's BroadcastSystemMessage
  210. // Use this APIto send a message to all windows of a winstation.
  211. typedef struct _WINSTATIONBROADCASTSYSTEMMSG {
  212. DWORD dwFlags;
  213. DWORD dwRecipients;
  214. UINT uiMessage;
  215. WPARAM wParam;
  216. LPARAM lParam;
  217. PVOID dataBuffer;
  218. ULONG bufferSize;
  219. HANDLE hEvent;
  220. ULONG Response;
  221. } WINSTATIONBROADCASTSYSTEMMSG;
  222. // This data structure has all the params used by window's standard SendMessage()API.
  223. // Use this API to send a message to a specific hwnd of a winstation ( you need to know that the appropriate hwnd was)
  224. typedef struct _WINSTATIONSENDWINDOWMSG {
  225. HWND hWnd; // handle of destination window
  226. UINT Msg; // message to send
  227. WPARAM wParam; // first message parameter
  228. LPARAM lParam; // second message parameter
  229. PCHAR dataBuffer;
  230. ULONG bufferSize;
  231. HANDLE hEvent;
  232. ULONG Response;
  233. } WINSTATIONSENDWINDOWMSG;
  234. typedef struct _WINSTATIONSETTIMEZONE {
  235. TS_TIME_ZONE_INFORMATION TimeZone;
  236. } WINSTATIONSETTIMEZONE;
  237. typedef struct _WINSTATION_APIMSG {
  238. PORT_MESSAGE h;
  239. ULONG MessageId;
  240. WINSTATION_APINUMBER ApiNumber;
  241. BOOLEAN WaitForReply;
  242. NTSTATUS ReturnedStatus;
  243. union {
  244. WINSTATIONCREATEMSG Create;
  245. WINSTATIONRESETMSG Reset;
  246. WINSTATIONDISCONNECTMSG Disconnect;
  247. WINSTATIONWCHARLOG WCharLog;
  248. WINSTATIONREPLYMESSAGEMSG ReplyMessage;
  249. WINSTATIONDODISCONNECTMSG DoDisconnect;
  250. WINSTATIONDOCONNECTMSG DoConnect;
  251. WINSTATIONEXITWINDOWSMSG ExitWindows;
  252. WINSTATIONTERMINATEMSG Terminate;
  253. WINSTATIONSENDMESSAGEMSG SendMessage;
  254. WINSTATIONBREAKPOINTMSG BreakPoint;
  255. WINSTATIONDORECONNECTMSG DoReconnect;
  256. WINSTATIONTHINWIRESTATSMSG ThinwireStats;
  257. WINSTATIONSHADOWSETUPMSG ShadowSetup;
  258. WINSTATIONSHADOWSTARTMSG ShadowStart;
  259. WINSTATIONSHADOWSTOPMSG ShadowStop;
  260. WINSTATIONSHADOWCLEANUPMSG ShadowCleanup;
  261. WINSTATIONBROKENCONNECTIONMSG Broken;
  262. WINSTATIONNTSDDEBUGMSG NtsdDebug;
  263. WINSTATIONBROADCASTSYSTEMMSG bMsg; // API for Window's BroadcastSystemMessage()
  264. WINSTATIONSENDWINDOWMSG sMsg; // API for WIndows's SendMessage()
  265. WINSTATIONSETTIMEZONE SetTimeZone;
  266. WINSTATIONDONOTIFYMSG DoNotify;
  267. WINSTATIONWINDOWINVALIDMSG WindowInvalid;
  268. } u;
  269. } WINSTATION_APIMSG, *PWINSTATION_APIMSG;
  270. /*
  271. * WinStation Kernel object interface routines. These provide a common
  272. * interface to the Nt* API's for the object that can be used by the
  273. * Session manager, the WinStation client DLL, and the CSRSS subsystem.
  274. */
  275. /*
  276. * WinStation kernel object root directory name
  277. */
  278. #define CITRIX_WINSTATION_OBJECT_DIRECTORY L"\\WinStations"
  279. /*
  280. * OpenWinStationObject
  281. *
  282. * Open the WinStation Kernel Object of the given Name.
  283. *
  284. * ENTRY:
  285. * Id
  286. * Id of the WinStation Kernel Object to open. It will be under the path
  287. * of "\WinStations\xxx" in the kernel object name space when
  288. * created.
  289. *
  290. * pHandle (output)
  291. * Pointer to variable to place the handle if the object was created.
  292. *
  293. * EXIT:
  294. * Returns the NTSTATUS code from the operation.
  295. */
  296. NTSTATUS
  297. OpenWinStationObject( ULONG,
  298. PHANDLE,
  299. ULONG );