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.

364 lines
7.5 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 LPC_NO_IMPERSONATE (CSHORT)0x4000
  96. #define PORT_VALID_OBJECT_ATTRIBUTES (OBJ_CASE_INSENSITIVE)
  97. // begin_ntddk begin_wdm
  98. #ifdef _WIN64
  99. #define PORT_MAXIMUM_MESSAGE_LENGTH 512
  100. #else
  101. #define PORT_MAXIMUM_MESSAGE_LENGTH 256
  102. #endif
  103. // end_ntddk end_wdm
  104. #if defined(USE_LPC6432)
  105. #undef PORT_MAXIMUM_MESSAGE_LENGTH
  106. #define PORT_MAXIMUM_MESSAGE_LENGTH 512
  107. #endif
  108. typedef struct _LPC_CLIENT_DIED_MSG {
  109. PORT_MESSAGE PortMsg;
  110. LARGE_INTEGER CreateTime;
  111. } LPC_CLIENT_DIED_MSG, *PLPC_CLIENT_DIED_MSG;
  112. // begin_ntifs
  113. typedef struct _PORT_VIEW {
  114. ULONG Length;
  115. LPC_HANDLE SectionHandle;
  116. ULONG SectionOffset;
  117. LPC_SIZE_T ViewSize;
  118. LPC_PVOID ViewBase;
  119. LPC_PVOID ViewRemoteBase;
  120. } PORT_VIEW, *PPORT_VIEW;
  121. typedef struct _REMOTE_PORT_VIEW {
  122. ULONG Length;
  123. LPC_SIZE_T ViewSize;
  124. LPC_PVOID ViewBase;
  125. } REMOTE_PORT_VIEW, *PREMOTE_PORT_VIEW;
  126. // end_ntifs
  127. NTSYSCALLAPI
  128. NTSTATUS
  129. NTAPI
  130. NtCreatePort(
  131. OUT PHANDLE PortHandle,
  132. IN POBJECT_ATTRIBUTES ObjectAttributes,
  133. IN ULONG MaxConnectionInfoLength,
  134. IN ULONG MaxMessageLength,
  135. IN ULONG MaxPoolUsage
  136. );
  137. NTSYSCALLAPI
  138. NTSTATUS
  139. NTAPI
  140. NtCreateWaitablePort(
  141. OUT PHANDLE PortHandle,
  142. IN POBJECT_ATTRIBUTES ObjectAttributes,
  143. IN ULONG MaxConnectionInfoLength,
  144. IN ULONG MaxMessageLength,
  145. IN ULONG MaxPoolUsage
  146. );
  147. // begin_ntifs
  148. NTSYSCALLAPI
  149. NTSTATUS
  150. NTAPI
  151. NtConnectPort(
  152. OUT PHANDLE PortHandle,
  153. IN PUNICODE_STRING PortName,
  154. IN PSECURITY_QUALITY_OF_SERVICE SecurityQos,
  155. IN OUT PPORT_VIEW ClientView OPTIONAL,
  156. IN OUT PREMOTE_PORT_VIEW ServerView OPTIONAL,
  157. OUT PULONG MaxMessageLength OPTIONAL,
  158. IN OUT PVOID ConnectionInformation OPTIONAL,
  159. IN OUT PULONG ConnectionInformationLength OPTIONAL
  160. );
  161. NTSYSCALLAPI
  162. NTSTATUS
  163. NTAPI
  164. NtSecureConnectPort(
  165. OUT PHANDLE PortHandle,
  166. IN PUNICODE_STRING PortName,
  167. IN PSECURITY_QUALITY_OF_SERVICE SecurityQos,
  168. IN OUT PPORT_VIEW ClientView OPTIONAL,
  169. IN PSID RequiredServerSid,
  170. IN OUT PREMOTE_PORT_VIEW ServerView OPTIONAL,
  171. OUT PULONG MaxMessageLength OPTIONAL,
  172. IN OUT PVOID ConnectionInformation OPTIONAL,
  173. IN OUT PULONG ConnectionInformationLength OPTIONAL
  174. );
  175. // end_ntifs
  176. NTSYSCALLAPI
  177. NTSTATUS
  178. NTAPI
  179. NtListenPort(
  180. IN HANDLE PortHandle,
  181. OUT PPORT_MESSAGE ConnectionRequest
  182. );
  183. NTSYSCALLAPI
  184. NTSTATUS
  185. NTAPI
  186. NtAcceptConnectPort(
  187. OUT PHANDLE PortHandle,
  188. IN PVOID PortContext,
  189. IN PPORT_MESSAGE ConnectionRequest,
  190. IN BOOLEAN AcceptConnection,
  191. IN OUT PPORT_VIEW ServerView OPTIONAL,
  192. OUT PREMOTE_PORT_VIEW ClientView OPTIONAL
  193. );
  194. NTSYSCALLAPI
  195. NTSTATUS
  196. NTAPI
  197. NtCompleteConnectPort(
  198. IN HANDLE PortHandle
  199. );
  200. NTSYSCALLAPI
  201. NTSTATUS
  202. NTAPI
  203. NtRequestPort(
  204. IN HANDLE PortHandle,
  205. IN PPORT_MESSAGE RequestMessage
  206. );
  207. // begin_ntifs
  208. NTSYSCALLAPI
  209. NTSTATUS
  210. NTAPI
  211. NtRequestWaitReplyPort(
  212. IN HANDLE PortHandle,
  213. IN PPORT_MESSAGE RequestMessage,
  214. OUT PPORT_MESSAGE ReplyMessage
  215. );
  216. // end_ntifs
  217. NTSYSCALLAPI
  218. NTSTATUS
  219. NTAPI
  220. NtReplyPort(
  221. IN HANDLE PortHandle,
  222. IN PPORT_MESSAGE ReplyMessage
  223. );
  224. NTSYSCALLAPI
  225. NTSTATUS
  226. NTAPI
  227. NtReplyWaitReplyPort(
  228. IN HANDLE PortHandle,
  229. IN OUT PPORT_MESSAGE ReplyMessage
  230. );
  231. NTSYSCALLAPI
  232. NTSTATUS
  233. NTAPI
  234. NtReplyWaitReceivePort(
  235. IN HANDLE PortHandle,
  236. OUT PVOID *PortContext OPTIONAL,
  237. IN PPORT_MESSAGE ReplyMessage OPTIONAL,
  238. OUT PPORT_MESSAGE ReceiveMessage
  239. );
  240. NTSYSCALLAPI
  241. NTSTATUS
  242. NTAPI
  243. NtReplyWaitReceivePortEx(
  244. IN HANDLE PortHandle,
  245. OUT PVOID *PortContext OPTIONAL,
  246. IN PPORT_MESSAGE ReplyMessage OPTIONAL,
  247. OUT PPORT_MESSAGE ReceiveMessage,
  248. IN PLARGE_INTEGER Timeout OPTIONAL
  249. );
  250. NTSYSCALLAPI
  251. NTSTATUS
  252. NTAPI
  253. NtImpersonateClientOfPort(
  254. IN HANDLE PortHandle,
  255. IN PPORT_MESSAGE Message
  256. );
  257. NTSYSCALLAPI
  258. NTSTATUS
  259. NTAPI
  260. NtReadRequestData(
  261. IN HANDLE PortHandle,
  262. IN PPORT_MESSAGE Message,
  263. IN ULONG DataEntryIndex,
  264. OUT PVOID Buffer,
  265. IN SIZE_T BufferSize,
  266. OUT PSIZE_T NumberOfBytesRead OPTIONAL
  267. );
  268. NTSYSCALLAPI
  269. NTSTATUS
  270. NTAPI
  271. NtWriteRequestData(
  272. IN HANDLE PortHandle,
  273. IN PPORT_MESSAGE Message,
  274. IN ULONG DataEntryIndex,
  275. IN PVOID Buffer,
  276. IN SIZE_T BufferSize,
  277. OUT PSIZE_T NumberOfBytesWritten OPTIONAL
  278. );
  279. typedef enum _PORT_INFORMATION_CLASS {
  280. PortBasicInformation
  281. #if DEVL
  282. , PortDumpInformation
  283. #endif
  284. } PORT_INFORMATION_CLASS;
  285. NTSYSCALLAPI
  286. NTSTATUS
  287. NTAPI
  288. NtQueryInformationPort(
  289. IN HANDLE PortHandle,
  290. IN PORT_INFORMATION_CLASS PortInformationClass,
  291. OUT PVOID PortInformation,
  292. IN ULONG Length,
  293. OUT PULONG ReturnLength OPTIONAL
  294. );
  295. #ifdef __cplusplus
  296. }
  297. #endif
  298. #endif // _NTLPCAPI_