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.

432 lines
8.4 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. rpcasync.h
  5. Abstract:
  6. This module contains the RPC runtime APIs needed to use
  7. [async] RPC features.
  8. --*/
  9. #ifndef __RPCASYNC_H__
  10. #define __RPCASYNC_H__
  11. #if _MSC_VER > 1000
  12. #pragma once
  13. #endif
  14. #if defined(__RPC_WIN64__)
  15. #include <pshpack8.h>
  16. #endif
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. #define RPC_ASYNC_VERSION_1_0 sizeof(RPC_ASYNC_STATE)
  21. typedef
  22. enum _RPC_NOTIFICATION_TYPES
  23. {
  24. RpcNotificationTypeNone,
  25. RpcNotificationTypeEvent,
  26. RpcNotificationTypeApc,
  27. RpcNotificationTypeIoc,
  28. RpcNotificationTypeHwnd,
  29. RpcNotificationTypeCallback
  30. } RPC_NOTIFICATION_TYPES;
  31. typedef
  32. enum _RPC_ASYNC_EVENT {
  33. RpcCallComplete,
  34. RpcSendComplete,
  35. RpcReceiveComplete
  36. } RPC_ASYNC_EVENT;
  37. struct _RPC_ASYNC_STATE;
  38. typedef void RPC_ENTRY
  39. RPCNOTIFICATION_ROUTINE (
  40. struct _RPC_ASYNC_STATE *pAsync,
  41. void *Context,
  42. RPC_ASYNC_EVENT Event);
  43. typedef RPCNOTIFICATION_ROUTINE *PFN_RPCNOTIFICATION_ROUTINE;
  44. typedef struct _RPC_ASYNC_STATE {
  45. unsigned int Size; // size of this structure
  46. unsigned long Signature;
  47. long Lock;
  48. unsigned long Flags;
  49. void *StubInfo;
  50. void *UserInfo;
  51. void *RuntimeInfo;
  52. RPC_ASYNC_EVENT Event;
  53. RPC_NOTIFICATION_TYPES NotificationType;
  54. union {
  55. //
  56. // Notification by APC
  57. //
  58. struct {
  59. PFN_RPCNOTIFICATION_ROUTINE NotificationRoutine;
  60. HANDLE hThread;
  61. } APC;
  62. //
  63. // Notification by IO completion port
  64. //
  65. struct {
  66. HANDLE hIOPort;
  67. DWORD dwNumberOfBytesTransferred;
  68. DWORD_PTR dwCompletionKey;
  69. LPOVERLAPPED lpOverlapped;
  70. } IOC;
  71. //
  72. // Notification by window message
  73. //
  74. struct {
  75. HWND hWnd;
  76. UINT Msg;
  77. } HWND;
  78. //
  79. // Notification by event
  80. //
  81. HANDLE hEvent;
  82. //
  83. // Notification by callback function
  84. //
  85. // This option is available only to OLE
  86. //
  87. PFN_RPCNOTIFICATION_ROUTINE NotificationRoutine;
  88. } u;
  89. LONG_PTR Reserved[4];
  90. } RPC_ASYNC_STATE, *PRPC_ASYNC_STATE;
  91. // Possible values for Flags
  92. #define RPC_C_NOTIFY_ON_SEND_COMPLETE 0x1
  93. #define RPC_C_INFINITE_TIMEOUT INFINITE
  94. #define RpcAsyncGetCallHandle(pAsync) (((PRPC_ASYNC_STATE) pAsync)->RuntimeInfo)
  95. RPCRTAPI
  96. RPC_STATUS
  97. RPC_ENTRY
  98. RpcAsyncInitializeHandle (
  99. PRPC_ASYNC_STATE pAsync,
  100. unsigned int Size
  101. );
  102. RPCRTAPI
  103. RPC_STATUS
  104. RPC_ENTRY
  105. RpcAsyncRegisterInfo (
  106. PRPC_ASYNC_STATE pAsync
  107. ) ;
  108. RPCRTAPI
  109. RPC_STATUS
  110. RPC_ENTRY
  111. RpcAsyncGetCallStatus (
  112. PRPC_ASYNC_STATE pAsync
  113. ) ;
  114. RPCRTAPI
  115. RPC_STATUS
  116. RPC_ENTRY
  117. RpcAsyncCompleteCall (
  118. PRPC_ASYNC_STATE pAsync,
  119. void *Reply
  120. ) ;
  121. RPCRTAPI
  122. RPC_STATUS
  123. RPC_ENTRY
  124. RpcAsyncAbortCall (
  125. PRPC_ASYNC_STATE pAsync,
  126. unsigned long ExceptionCode
  127. ) ;
  128. RPCRTAPI
  129. RPC_STATUS
  130. RPC_ENTRY
  131. RpcAsyncCancelCall (
  132. IN PRPC_ASYNC_STATE pAsync,
  133. IN BOOL fAbort
  134. ) ;
  135. RPCRTAPI
  136. RPC_STATUS
  137. RPC_ENTRY
  138. RpcAsyncCleanupThread (
  139. IN DWORD dwTimeout
  140. );
  141. typedef enum tagExtendedErrorParamTypes
  142. {
  143. eeptAnsiString = 1,
  144. eeptUnicodeString,
  145. eeptLongVal,
  146. eeptShortVal,
  147. eeptPointerVal,
  148. eeptNone,
  149. eeptBinary
  150. } ExtendedErrorParamTypes;
  151. #define MaxNumberOfEEInfoParams 4
  152. #define RPC_EEINFO_VERSION 1
  153. typedef struct tagBinaryParam
  154. {
  155. void *Buffer;
  156. short Size;
  157. } BinaryParam;
  158. typedef struct tagRPC_EE_INFO_PARAM
  159. {
  160. ExtendedErrorParamTypes ParameterType;
  161. union
  162. {
  163. LPSTR AnsiString;
  164. LPWSTR UnicodeString;
  165. long LVal;
  166. short SVal;
  167. ULONGLONG PVal;
  168. BinaryParam BVal;
  169. } u;
  170. } RPC_EE_INFO_PARAM;
  171. #define EEInfoPreviousRecordsMissing 1
  172. #define EEInfoNextRecordsMissing 2
  173. #define EEInfoUseFileTime 4
  174. #define EEInfoGCCOM 11
  175. typedef struct tagRPC_EXTENDED_ERROR_INFO
  176. {
  177. ULONG Version;
  178. LPWSTR ComputerName;
  179. ULONG ProcessID;
  180. union
  181. {
  182. SYSTEMTIME SystemTime;
  183. FILETIME FileTime;
  184. } u;
  185. ULONG GeneratingComponent;
  186. ULONG Status;
  187. USHORT DetectionLocation;
  188. USHORT Flags;
  189. int NumberOfParameters;
  190. RPC_EE_INFO_PARAM Parameters[MaxNumberOfEEInfoParams];
  191. } RPC_EXTENDED_ERROR_INFO;
  192. typedef struct tagRPC_ERROR_ENUM_HANDLE
  193. {
  194. ULONG Signature;
  195. void *CurrentPos;
  196. void *Head;
  197. } RPC_ERROR_ENUM_HANDLE;
  198. RPCRTAPI
  199. RPC_STATUS
  200. RPC_ENTRY
  201. RpcErrorStartEnumeration (
  202. IN OUT RPC_ERROR_ENUM_HANDLE *EnumHandle
  203. );
  204. RPCRTAPI
  205. RPC_STATUS
  206. RPC_ENTRY
  207. RpcErrorGetNextRecord (
  208. IN RPC_ERROR_ENUM_HANDLE *EnumHandle,
  209. IN BOOL CopyStrings,
  210. OUT RPC_EXTENDED_ERROR_INFO *ErrorInfo
  211. );
  212. RPCRTAPI
  213. RPC_STATUS
  214. RPC_ENTRY
  215. RpcErrorEndEnumeration (
  216. IN OUT RPC_ERROR_ENUM_HANDLE *EnumHandle
  217. );
  218. RPCRTAPI
  219. RPC_STATUS
  220. RPC_ENTRY
  221. RpcErrorResetEnumeration (
  222. IN OUT RPC_ERROR_ENUM_HANDLE *EnumHandle
  223. );
  224. RPCRTAPI
  225. RPC_STATUS
  226. RPC_ENTRY
  227. RpcErrorGetNumberOfRecords (
  228. IN RPC_ERROR_ENUM_HANDLE *EnumHandle,
  229. OUT int *Records
  230. );
  231. RPCRTAPI
  232. RPC_STATUS
  233. RPC_ENTRY
  234. RpcErrorSaveErrorInfo (
  235. IN RPC_ERROR_ENUM_HANDLE *EnumHandle,
  236. OUT PVOID *ErrorBlob,
  237. OUT size_t *BlobSize
  238. );
  239. RPCRTAPI
  240. RPC_STATUS
  241. RPC_ENTRY
  242. RpcErrorLoadErrorInfo (
  243. IN PVOID ErrorBlob,
  244. IN size_t BlobSize,
  245. OUT RPC_ERROR_ENUM_HANDLE *EnumHandle
  246. );
  247. RPCRTAPI
  248. RPC_STATUS
  249. RPC_ENTRY
  250. RpcErrorAddRecord (
  251. IN RPC_EXTENDED_ERROR_INFO *ErrorInfo
  252. );
  253. RPCRTAPI
  254. void
  255. RPC_ENTRY
  256. RpcErrorClearInformation (
  257. void
  258. );
  259. RPCRTAPI
  260. RPC_STATUS
  261. RPC_ENTRY
  262. RpcGetAuthorizationContextForClient (
  263. IN RPC_BINDING_HANDLE ClientBinding OPTIONAL,
  264. IN BOOL ImpersonateOnReturn,
  265. IN PVOID Reserved1,
  266. IN PLARGE_INTEGER pExpirationTime OPTIONAL,
  267. IN LUID Reserved2,
  268. IN DWORD Reserved3,
  269. IN PVOID Reserved4,
  270. OUT PVOID *pAuthzClientContext
  271. );
  272. RPCRTAPI
  273. RPC_STATUS
  274. RPC_ENTRY
  275. RpcFreeAuthorizationContext (
  276. IN OUT PVOID *pAuthzClientContext
  277. );
  278. RPCRTAPI
  279. RPC_STATUS
  280. RPC_ENTRY
  281. RpcSsContextLockExclusive (
  282. IN RPC_BINDING_HANDLE ServerBindingHandle,
  283. IN PVOID UserContext
  284. );
  285. RPCRTAPI
  286. RPC_STATUS
  287. RPC_ENTRY
  288. RpcSsContextLockShared (
  289. IN RPC_BINDING_HANDLE ServerBindingHandle,
  290. IN PVOID UserContext
  291. );
  292. #define RPC_CALL_ATTRIBUTES_VERSION (1)
  293. #define RPC_QUERY_SERVER_PRINCIPAL_NAME (2)
  294. #define RPC_QUERY_CLIENT_PRINCIPAL_NAME (4)
  295. typedef struct tagRPC_CALL_ATTRIBUTES_V1_W
  296. {
  297. unsigned int Version;
  298. unsigned long Flags;
  299. unsigned long ServerPrincipalNameBufferLength;
  300. unsigned short *ServerPrincipalName;
  301. unsigned long ClientPrincipalNameBufferLength;
  302. unsigned short *ClientPrincipalName;
  303. unsigned long AuthenticationLevel;
  304. unsigned long AuthenticationService;
  305. BOOL NullSession;
  306. } RPC_CALL_ATTRIBUTES_V1_W;
  307. typedef struct tagRPC_CALL_ATTRIBUTES_V1_A
  308. {
  309. unsigned int Version;
  310. unsigned long Flags;
  311. unsigned long ServerPrincipalNameBufferLength;
  312. unsigned char *ServerPrincipalName;
  313. unsigned long ClientPrincipalNameBufferLength;
  314. unsigned char *ClientPrincipalName;
  315. unsigned long AuthenticationLevel;
  316. unsigned long AuthenticationService;
  317. BOOL NullSession;
  318. } RPC_CALL_ATTRIBUTES_V1_A;
  319. RPCRTAPI
  320. RPC_STATUS
  321. RPC_ENTRY
  322. RpcServerInqCallAttributesW (
  323. IN RPC_BINDING_HANDLE ClientBinding, OPTIONAL
  324. IN OUT void *RpcCallAttributes
  325. );
  326. RPCRTAPI
  327. RPC_STATUS
  328. RPC_ENTRY
  329. RpcServerInqCallAttributesA (
  330. IN RPC_BINDING_HANDLE ClientBinding, OPTIONAL
  331. IN OUT void *RpcCallAttributes
  332. );
  333. #ifdef UNICODE
  334. # define RPC_CALL_ATTRIBUTES_V1 RPC_CALL_ATTRIBUTES_V1_W
  335. # define RpcServerInqCallAttributes RpcServerInqCallAttributesW
  336. #else
  337. # define RPC_CALL_ATTRIBUTES_V1 RPC_CALL_ATTRIBUTES_V1_A
  338. # define RpcServerInqCallAttributes RpcServerInqCallAttributesA
  339. #endif // !UNICODE
  340. typedef RPC_CALL_ATTRIBUTES_V1 RPC_CALL_ATTRIBUTES;
  341. //
  342. // Internal APIs
  343. //
  344. RPC_STATUS RPC_ENTRY
  345. I_RpcAsyncSetHandle (
  346. IN PRPC_MESSAGE Message,
  347. IN PRPC_ASYNC_STATE pAsync
  348. );
  349. RPC_STATUS RPC_ENTRY
  350. I_RpcAsyncAbortCall (
  351. IN PRPC_ASYNC_STATE pAsync,
  352. IN unsigned long ExceptionCode
  353. ) ;
  354. int
  355. RPC_ENTRY
  356. I_RpcExceptionFilter (
  357. unsigned long ExceptionCode
  358. );
  359. #ifdef __cplusplus
  360. }
  361. #endif
  362. #if defined(__RPC_WIN64__)
  363. #include <poppack.h>
  364. #endif
  365. #endif /* __RPCASYNC_H__ */