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.

362 lines
7.1 KiB

  1. /*++ BUILD Version: 0002 // Increment this if a change has global effects
  2. Copyright (c) 1989-1999 Microsoft Corporation
  3. Module Name:
  4. ntlpcapi.h
  5. Abstract:
  6. This is the include file for the Local Procedure Call (LPC) sub-component
  7. of NTOS.
  8. Author:
  9. Steve Wood (stevewo) 13-Mar-1989
  10. Revision History:
  11. --*/
  12. #ifndef _NTLPCAPI_
  13. #define _NTLPCAPI_
  14. #if _MSC_VER > 1000
  15. #pragma once
  16. #endif
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. //
  21. // Connection Port Type Specific Access Rights.
  22. //
  23. #define PORT_CONNECT (0x0001)
  24. #define PORT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
  25. SYNCHRONIZE | 0x1)
  26. // begin_ntifs begin_nthal
  27. #if defined(USE_LPC6432)
  28. #define LPC_CLIENT_ID CLIENT_ID64
  29. #define LPC_SIZE_T ULONGLONG
  30. #define LPC_PVOID ULONGLONG
  31. #define LPC_HANDLE ULONGLONG
  32. #else
  33. #define LPC_CLIENT_ID CLIENT_ID
  34. #define LPC_SIZE_T SIZE_T
  35. #define LPC_PVOID PVOID
  36. #define LPC_HANDLE HANDLE
  37. #endif
  38. typedef struct _PORT_MESSAGE {
  39. union {
  40. struct {
  41. CSHORT DataLength;
  42. CSHORT TotalLength;
  43. } s1;
  44. ULONG Length;
  45. } u1;
  46. union {
  47. struct {
  48. CSHORT Type;
  49. CSHORT DataInfoOffset;
  50. } s2;
  51. ULONG ZeroInit;
  52. } u2;
  53. union {
  54. LPC_CLIENT_ID ClientId;
  55. double DoNotUseThisField; // Force quadword alignment
  56. };
  57. ULONG MessageId;
  58. union {
  59. LPC_SIZE_T ClientViewSize; // Only valid on LPC_CONNECTION_REQUEST message
  60. ULONG CallbackId; // Only valid on LPC_REQUEST message
  61. };
  62. // UCHAR Data[];
  63. } PORT_MESSAGE, *PPORT_MESSAGE;
  64. // end_ntifs end_nthal
  65. typedef struct _PORT_DATA_ENTRY {
  66. LPC_PVOID Base;
  67. ULONG Size;
  68. } PORT_DATA_ENTRY, *PPORT_DATA_ENTRY;
  69. typedef struct _PORT_DATA_INFORMATION {
  70. ULONG CountDataEntries;
  71. PORT_DATA_ENTRY DataEntries[1];
  72. } PORT_DATA_INFORMATION, *PPORT_DATA_INFORMATION;
  73. //
  74. // Valid return values for the PORT_MESSAGE Type file
  75. //
  76. #define LPC_REQUEST 1
  77. #define LPC_REPLY 2
  78. #define LPC_DATAGRAM 3
  79. #define LPC_LOST_REPLY 4
  80. #define LPC_PORT_CLOSED 5
  81. #define LPC_CLIENT_DIED 6
  82. #define LPC_EXCEPTION 7
  83. #define LPC_DEBUG_EVENT 8
  84. #define LPC_ERROR_EVENT 9
  85. #define LPC_CONNECTION_REQUEST 10
  86. // begin_ntifs
  87. //
  88. // The following bit may be placed in the Type field of a message
  89. // prior calling NtRequestPort or NtRequestWaitReplyPort. If the
  90. // previous mode is KernelMode, the bit it left as is and passed
  91. // to the receiver of the message. Otherwise the bit is clear.
  92. //
  93. #define LPC_KERNELMODE_MESSAGE (CSHORT)0x8000
  94. // end_ntifs
  95. #define PORT_VALID_OBJECT_ATTRIBUTES (OBJ_CASE_INSENSITIVE)
  96. // begin_ntddk begin_wdm
  97. #ifdef _WIN64
  98. #define PORT_MAXIMUM_MESSAGE_LENGTH 512
  99. #else
  100. #define PORT_MAXIMUM_MESSAGE_LENGTH 256
  101. #endif
  102. // end_ntddk end_wdm
  103. #if defined(USE_LPC6432)
  104. #undef PORT_MAXIMUM_MESSAGE_LENGTH
  105. #define PORT_MAXIMUM_MESSAGE_LENGTH 512
  106. #endif
  107. typedef struct _LPC_CLIENT_DIED_MSG {
  108. PORT_MESSAGE PortMsg;
  109. LARGE_INTEGER CreateTime;
  110. } LPC_CLIENT_DIED_MSG, *PLPC_CLIENT_DIED_MSG;
  111. // begin_ntifs
  112. typedef struct _PORT_VIEW {
  113. ULONG Length;
  114. LPC_HANDLE SectionHandle;
  115. ULONG SectionOffset;
  116. LPC_SIZE_T ViewSize;
  117. LPC_PVOID ViewBase;
  118. LPC_PVOID ViewRemoteBase;
  119. } PORT_VIEW, *PPORT_VIEW;
  120. typedef struct _REMOTE_PORT_VIEW {
  121. ULONG Length;
  122. LPC_SIZE_T ViewSize;
  123. LPC_PVOID ViewBase;
  124. } REMOTE_PORT_VIEW, *PREMOTE_PORT_VIEW;
  125. // end_ntifs
  126. NTSYSCALLAPI
  127. NTSTATUS
  128. NTAPI
  129. NtCreatePort(
  130. OUT PHANDLE PortHandle,
  131. IN POBJECT_ATTRIBUTES ObjectAttributes,
  132. IN ULONG MaxConnectionInfoLength,
  133. IN ULONG MaxMessageLength,
  134. IN ULONG MaxPoolUsage
  135. );
  136. NTSYSCALLAPI
  137. NTSTATUS
  138. NTAPI
  139. NtCreateWaitablePort(
  140. OUT PHANDLE PortHandle,
  141. IN POBJECT_ATTRIBUTES ObjectAttributes,
  142. IN ULONG MaxConnectionInfoLength,
  143. IN ULONG MaxMessageLength,
  144. IN ULONG MaxPoolUsage
  145. );
  146. // begin_ntifs
  147. NTSYSCALLAPI
  148. NTSTATUS
  149. NTAPI
  150. NtConnectPort(
  151. OUT PHANDLE PortHandle,
  152. IN PUNICODE_STRING PortName,
  153. IN PSECURITY_QUALITY_OF_SERVICE SecurityQos,
  154. IN OUT PPORT_VIEW ClientView OPTIONAL,
  155. IN OUT PREMOTE_PORT_VIEW ServerView OPTIONAL,
  156. OUT PULONG MaxMessageLength OPTIONAL,
  157. IN OUT PVOID ConnectionInformation OPTIONAL,
  158. IN OUT PULONG ConnectionInformationLength OPTIONAL
  159. );
  160. NTSYSCALLAPI
  161. NTSTATUS
  162. NTAPI
  163. NtSecureConnectPort(
  164. OUT PHANDLE PortHandle,
  165. IN PUNICODE_STRING PortName,
  166. IN PSECURITY_QUALITY_OF_SERVICE SecurityQos,
  167. IN OUT PPORT_VIEW ClientView OPTIONAL,
  168. IN PSID RequiredServerSid,
  169. IN OUT PREMOTE_PORT_VIEW ServerView OPTIONAL,
  170. OUT PULONG MaxMessageLength OPTIONAL,
  171. IN OUT PVOID ConnectionInformation OPTIONAL,
  172. IN OUT PULONG ConnectionInformationLength OPTIONAL
  173. );
  174. // end_ntifs
  175. NTSYSCALLAPI
  176. NTSTATUS
  177. NTAPI
  178. NtListenPort(
  179. IN HANDLE PortHandle,
  180. OUT PPORT_MESSAGE ConnectionRequest
  181. );
  182. NTSYSCALLAPI
  183. NTSTATUS
  184. NTAPI
  185. NtAcceptConnectPort(
  186. OUT PHANDLE PortHandle,
  187. IN PVOID PortContext,
  188. IN PPORT_MESSAGE ConnectionRequest,
  189. IN BOOLEAN AcceptConnection,
  190. IN OUT PPORT_VIEW ServerView OPTIONAL,
  191. OUT PREMOTE_PORT_VIEW ClientView OPTIONAL
  192. );
  193. NTSYSCALLAPI
  194. NTSTATUS
  195. NTAPI
  196. NtCompleteConnectPort(
  197. IN HANDLE PortHandle
  198. );
  199. NTSYSCALLAPI
  200. NTSTATUS
  201. NTAPI
  202. NtRequestPort(
  203. IN HANDLE PortHandle,
  204. IN PPORT_MESSAGE RequestMessage
  205. );
  206. // begin_ntifs
  207. NTSYSCALLAPI
  208. NTSTATUS
  209. NTAPI
  210. NtRequestWaitReplyPort(
  211. IN HANDLE PortHandle,
  212. IN PPORT_MESSAGE RequestMessage,
  213. OUT PPORT_MESSAGE ReplyMessage
  214. );
  215. // end_ntifs
  216. NTSYSCALLAPI
  217. NTSTATUS
  218. NTAPI
  219. NtReplyPort(
  220. IN HANDLE PortHandle,
  221. IN PPORT_MESSAGE ReplyMessage
  222. );
  223. NTSYSCALLAPI
  224. NTSTATUS
  225. NTAPI
  226. NtReplyWaitReplyPort(
  227. IN HANDLE PortHandle,
  228. IN OUT PPORT_MESSAGE ReplyMessage
  229. );
  230. NTSYSCALLAPI
  231. NTSTATUS
  232. NTAPI
  233. NtReplyWaitReceivePort(
  234. IN HANDLE PortHandle,
  235. OUT PVOID *PortContext OPTIONAL,
  236. IN PPORT_MESSAGE ReplyMessage OPTIONAL,
  237. OUT PPORT_MESSAGE ReceiveMessage
  238. );
  239. NTSYSCALLAPI
  240. NTSTATUS
  241. NTAPI
  242. NtReplyWaitReceivePortEx(
  243. IN HANDLE PortHandle,
  244. OUT PVOID *PortContext OPTIONAL,
  245. IN PPORT_MESSAGE ReplyMessage OPTIONAL,
  246. OUT PPORT_MESSAGE ReceiveMessage,
  247. IN PLARGE_INTEGER Timeout OPTIONAL
  248. );
  249. NTSYSCALLAPI
  250. NTSTATUS
  251. NTAPI
  252. NtImpersonateClientOfPort(
  253. IN HANDLE PortHandle,
  254. IN PPORT_MESSAGE Message
  255. );
  256. NTSYSCALLAPI
  257. NTSTATUS
  258. NTAPI
  259. NtReadRequestData(
  260. IN HANDLE PortHandle,
  261. IN PPORT_MESSAGE Message,
  262. IN ULONG DataEntryIndex,
  263. OUT PVOID Buffer,
  264. IN SIZE_T BufferSize,
  265. OUT PSIZE_T NumberOfBytesRead OPTIONAL
  266. );
  267. NTSYSCALLAPI
  268. NTSTATUS
  269. NTAPI
  270. NtWriteRequestData(
  271. IN HANDLE PortHandle,
  272. IN PPORT_MESSAGE Message,
  273. IN ULONG DataEntryIndex,
  274. IN PVOID Buffer,
  275. IN SIZE_T BufferSize,
  276. OUT PSIZE_T NumberOfBytesWritten OPTIONAL
  277. );
  278. typedef enum _PORT_INFORMATION_CLASS {
  279. PortBasicInformation
  280. #if DEVL
  281. , PortDumpInformation
  282. #endif
  283. } PORT_INFORMATION_CLASS;
  284. NTSYSCALLAPI
  285. NTSTATUS
  286. NTAPI
  287. NtQueryInformationPort(
  288. IN HANDLE PortHandle,
  289. IN PORT_INFORMATION_CLASS PortInformationClass,
  290. OUT PVOID PortInformation,
  291. IN ULONG Length,
  292. OUT PULONG ReturnLength OPTIONAL
  293. );
  294. #ifdef __cplusplus
  295. }
  296. #endif
  297. #endif // _NTLPCAPI_