rpcasync.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. /**
  2. * This file has no copyright assigned and is placed in the Public Domain.
  3. * This file is part of the mingw-w64 runtime package.
  4. * No warranty is given; refer to the file DISCLAIMER.PD within this package.
  5. */
  6. #ifndef __RPCASYNC_H__
  7. #define __RPCASYNC_H__
  8. #include <_mingw_unicode.h>
  9. #ifdef __RPC_WIN64__
  10. #include <pshpack8.h>
  11. #endif
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #define RPC_ASYNC_VERSION_1_0 sizeof(RPC_ASYNC_STATE)
  16. typedef enum _RPC_NOTIFICATION_TYPES {
  17. RpcNotificationTypeNone,RpcNotificationTypeEvent,RpcNotificationTypeApc,RpcNotificationTypeIoc,RpcNotificationTypeHwnd,
  18. RpcNotificationTypeCallback
  19. } RPC_NOTIFICATION_TYPES;
  20. typedef enum _RPC_ASYNC_EVENT {
  21. RpcCallComplete,RpcSendComplete,RpcReceiveComplete
  22. } RPC_ASYNC_EVENT;
  23. struct _RPC_ASYNC_STATE;
  24. typedef void RPC_ENTRY RPCNOTIFICATION_ROUTINE(struct _RPC_ASYNC_STATE *pAsync,void *Context,RPC_ASYNC_EVENT Event);
  25. typedef RPCNOTIFICATION_ROUTINE *PFN_RPCNOTIFICATION_ROUTINE;
  26. typedef struct _RPC_ASYNC_STATE {
  27. unsigned int Size;
  28. unsigned __LONG32 Signature;
  29. __LONG32 Lock;
  30. unsigned __LONG32 Flags;
  31. void *StubInfo;
  32. void *UserInfo;
  33. void *RuntimeInfo;
  34. RPC_ASYNC_EVENT Event;
  35. RPC_NOTIFICATION_TYPES NotificationType;
  36. union {
  37. struct {
  38. PFN_RPCNOTIFICATION_ROUTINE NotificationRoutine;
  39. HANDLE hThread;
  40. } APC;
  41. struct {
  42. HANDLE hIOPort;
  43. DWORD dwNumberOfBytesTransferred;
  44. DWORD_PTR dwCompletionKey;
  45. LPOVERLAPPED lpOverlapped;
  46. } IOC;
  47. struct {
  48. HWND hWnd;
  49. UINT Msg;
  50. } HWND;
  51. HANDLE hEvent;
  52. PFN_RPCNOTIFICATION_ROUTINE NotificationRoutine;
  53. } u;
  54. LONG_PTR Reserved[4];
  55. } RPC_ASYNC_STATE,*PRPC_ASYNC_STATE;
  56. #define RPC_C_NOTIFY_ON_SEND_COMPLETE 0x1
  57. #define RPC_C_INFINITE_TIMEOUT INFINITE
  58. #define RpcAsyncGetCallHandle(pAsync) (((PRPC_ASYNC_STATE) pAsync)->RuntimeInfo)
  59. RPCRTAPI RPC_STATUS RPC_ENTRY RpcAsyncInitializeHandle(PRPC_ASYNC_STATE pAsync,unsigned int Size);
  60. RPCRTAPI RPC_STATUS RPC_ENTRY RpcAsyncRegisterInfo(PRPC_ASYNC_STATE pAsync);
  61. RPCRTAPI RPC_STATUS RPC_ENTRY RpcAsyncGetCallStatus(PRPC_ASYNC_STATE pAsync);
  62. RPCRTAPI RPC_STATUS RPC_ENTRY RpcAsyncCompleteCall(PRPC_ASYNC_STATE pAsync,void *Reply);
  63. RPCRTAPI RPC_STATUS RPC_ENTRY RpcAsyncAbortCall(PRPC_ASYNC_STATE pAsync,unsigned __LONG32 ExceptionCode);
  64. RPCRTAPI RPC_STATUS RPC_ENTRY RpcAsyncCancelCall(PRPC_ASYNC_STATE pAsync,WINBOOL fAbort);
  65. RPCRTAPI RPC_STATUS RPC_ENTRY RpcAsyncCleanupThread(DWORD dwTimeout);
  66. typedef enum tagExtendedErrorParamTypes {
  67. eeptAnsiString = 1,eeptUnicodeString,eeptLongVal,eeptShortVal,eeptPointerVal,eeptNone,eeptBinary
  68. } ExtendedErrorParamTypes;
  69. #define MaxNumberOfEEInfoParams 4
  70. #define RPC_EEINFO_VERSION 1
  71. typedef struct tagBinaryParam {
  72. void *Buffer;
  73. short Size;
  74. } BinaryParam;
  75. typedef struct tagRPC_EE_INFO_PARAM {
  76. ExtendedErrorParamTypes ParameterType;
  77. union {
  78. LPSTR AnsiString;
  79. LPWSTR UnicodeString;
  80. __LONG32 LVal;
  81. short SVal;
  82. ULONGLONG PVal;
  83. BinaryParam BVal;
  84. } u;
  85. } RPC_EE_INFO_PARAM;
  86. #define EEInfoPreviousRecordsMissing 1
  87. #define EEInfoNextRecordsMissing 2
  88. #define EEInfoUseFileTime 4
  89. #define EEInfoGCCOM 11
  90. #define EEInfoGCFRS 12
  91. typedef struct tagRPC_EXTENDED_ERROR_INFO {
  92. ULONG Version;
  93. LPWSTR ComputerName;
  94. ULONG ProcessID;
  95. union {
  96. SYSTEMTIME SystemTime;
  97. FILETIME FileTime;
  98. } u;
  99. ULONG GeneratingComponent;
  100. ULONG Status;
  101. USHORT DetectionLocation;
  102. USHORT Flags;
  103. int NumberOfParameters;
  104. RPC_EE_INFO_PARAM Parameters[MaxNumberOfEEInfoParams];
  105. } RPC_EXTENDED_ERROR_INFO;
  106. typedef struct tagRPC_ERROR_ENUM_HANDLE {
  107. ULONG Signature;
  108. void *CurrentPos;
  109. void *Head;
  110. } RPC_ERROR_ENUM_HANDLE;
  111. RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorStartEnumeration(RPC_ERROR_ENUM_HANDLE *EnumHandle);
  112. RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorGetNextRecord(RPC_ERROR_ENUM_HANDLE *EnumHandle,WINBOOL CopyStrings,RPC_EXTENDED_ERROR_INFO *ErrorInfo);
  113. RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorEndEnumeration(RPC_ERROR_ENUM_HANDLE *EnumHandle);
  114. RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorResetEnumeration(RPC_ERROR_ENUM_HANDLE *EnumHandle);
  115. RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorGetNumberOfRecords(RPC_ERROR_ENUM_HANDLE *EnumHandle,int *Records);
  116. RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorSaveErrorInfo(RPC_ERROR_ENUM_HANDLE *EnumHandle,PVOID *ErrorBlob,size_t *BlobSize);
  117. RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorLoadErrorInfo(PVOID ErrorBlob,size_t BlobSize,RPC_ERROR_ENUM_HANDLE *EnumHandle);
  118. RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorAddRecord(RPC_EXTENDED_ERROR_INFO *ErrorInfo);
  119. RPCRTAPI void RPC_ENTRY RpcErrorClearInformation(void);
  120. RPCRTAPI RPC_STATUS RPC_ENTRY RpcGetAuthorizationContextForClient(RPC_BINDING_HANDLE ClientBinding,WINBOOL ImpersonateOnReturn,PVOID Reserved1,PLARGE_INTEGER pExpirationTime,LUID Reserved2,DWORD Reserved3,PVOID Reserved4,PVOID *pAuthzClientContext);
  121. RPCRTAPI RPC_STATUS RPC_ENTRY RpcFreeAuthorizationContext(PVOID *pAuthzClientContext);
  122. RPCRTAPI RPC_STATUS RPC_ENTRY RpcSsContextLockExclusive(RPC_BINDING_HANDLE ServerBindingHandle,PVOID UserContext);
  123. RPCRTAPI RPC_STATUS RPC_ENTRY RpcSsContextLockShared(RPC_BINDING_HANDLE ServerBindingHandle,PVOID UserContext);
  124. #define RPC_CALL_ATTRIBUTES_VERSION (1)
  125. #define RPC_QUERY_SERVER_PRINCIPAL_NAME (2)
  126. #define RPC_QUERY_CLIENT_PRINCIPAL_NAME (4)
  127. typedef struct tagRPC_CALL_ATTRIBUTES_V1_W {
  128. unsigned int Version;
  129. unsigned __LONG32 Flags;
  130. unsigned __LONG32 ServerPrincipalNameBufferLength;
  131. unsigned short *ServerPrincipalName;
  132. unsigned __LONG32 ClientPrincipalNameBufferLength;
  133. unsigned short *ClientPrincipalName;
  134. unsigned __LONG32 AuthenticationLevel;
  135. unsigned __LONG32 AuthenticationService;
  136. WINBOOL NullSession;
  137. } RPC_CALL_ATTRIBUTES_V1_W;
  138. typedef struct tagRPC_CALL_ATTRIBUTES_V1_A {
  139. unsigned int Version;
  140. unsigned __LONG32 Flags;
  141. unsigned __LONG32 ServerPrincipalNameBufferLength;
  142. unsigned char *ServerPrincipalName;
  143. unsigned __LONG32 ClientPrincipalNameBufferLength;
  144. unsigned char *ClientPrincipalName;
  145. unsigned __LONG32 AuthenticationLevel;
  146. unsigned __LONG32 AuthenticationService;
  147. WINBOOL NullSession;
  148. } RPC_CALL_ATTRIBUTES_V1_A;
  149. #define RPC_CALL_ATTRIBUTES_V1 __MINGW_NAME_UAW(RPC_CALL_ATTRIBUTES_V1)
  150. #define RpcServerInqCallAttributes __MINGW_NAME_AW(RpcServerInqCallAttributes)
  151. RPCRTAPI RPC_STATUS RPC_ENTRY RpcServerInqCallAttributesW(RPC_BINDING_HANDLE ClientBinding,void *RpcCallAttributes);
  152. RPCRTAPI RPC_STATUS RPC_ENTRY RpcServerInqCallAttributesA(RPC_BINDING_HANDLE ClientBinding,void *RpcCallAttributes);
  153. typedef RPC_CALL_ATTRIBUTES_V1 RPC_CALL_ATTRIBUTES;
  154. RPC_STATUS RPC_ENTRY I_RpcAsyncSetHandle(PRPC_MESSAGE Message,PRPC_ASYNC_STATE pAsync);
  155. RPC_STATUS RPC_ENTRY I_RpcAsyncAbortCall(PRPC_ASYNC_STATE pAsync,unsigned __LONG32 ExceptionCode);
  156. int RPC_ENTRY I_RpcExceptionFilter(unsigned __LONG32 ExceptionCode);
  157. typedef union _RPC_ASYNC_NOTIFICATION_INFO {
  158. struct {
  159. PFN_RPCNOTIFICATION_ROUTINE NotificationRoutine;
  160. HANDLE hThread;
  161. } APC;
  162. struct {
  163. HANDLE hIOPort;
  164. DWORD dwNumberOfBytesTransferred;
  165. DWORD_PTR dwCompletionKey;
  166. LPOVERLAPPED lpOverlapped;
  167. } IOC;
  168. struct {
  169. HWND hWnd;
  170. UINT Msg;
  171. } HWND;
  172. HANDLE hEvent;
  173. PFN_RPCNOTIFICATION_ROUTINE NotificationRoutine;
  174. } RPC_ASYNC_NOTIFICATION_INFO, *PRPC_ASYNC_NOTIFICATION_INFO;
  175. RPC_STATUS RPC_ENTRY RpcBindingBind(
  176. PRPC_ASYNC_STATE pAsync,
  177. RPC_BINDING_HANDLE Binding,
  178. RPC_IF_HANDLE IfSpec
  179. );
  180. RPC_STATUS RPC_ENTRY RpcBindingUnbind(
  181. RPC_BINDING_HANDLE Binding
  182. );
  183. typedef enum _RpcCallType {
  184. rctInvalid,
  185. rctNormal,
  186. rctTraining,
  187. rctGuaranteed
  188. } RpcCallType;
  189. typedef enum _RpcLocalAddressFormat {
  190. rlafInvalid,
  191. rlafIPv4,
  192. rlafIPv6
  193. } RpcLocalAddressFormat;
  194. typedef enum _RPC_NOTIFICATIONS {
  195. RpcNotificationCallNone = 0,
  196. RpcNotificationClientDisconnect = 1,
  197. RpcNotificationCallCancel = 2
  198. } RPC_NOTIFICATIONS;
  199. typedef enum _RpcCallClientLocality {
  200. rcclInvalid,
  201. rcclLocal,
  202. rcclRemote,
  203. rcclClientUnknownLocality
  204. } RpcCallClientLocality;
  205. RPC_STATUS RPC_ENTRY RpcServerSubscribeForNotification(
  206. RPC_BINDING_HANDLE Binding,
  207. DWORD Notification,
  208. RPC_NOTIFICATION_TYPES NotificationType,
  209. RPC_ASYNC_NOTIFICATION_INFO *NotificationInfo
  210. );
  211. RPC_STATUS RPC_ENTRY RpcServerUnsubscribeForNotification(
  212. RPC_BINDING_HANDLE Binding,
  213. RPC_NOTIFICATIONS Notification,
  214. unsigned __LONG32 *NotificationsQueued
  215. );
  216. #if (_WIN32_WINNT >= 0x0600)
  217. typedef struct tagRPC_CALL_LOCAL_ADDRESS_V1_A {
  218. unsigned int Version;
  219. void *Buffer;
  220. unsigned __LONG32 BufferSize;
  221. RpcLocalAddressFormat AddressFormat;
  222. } RPC_CALL_LOCAL_ADDRESS_V1_A, RPC_CALL_LOCAL_ADDRESS_A;
  223. typedef struct tagRPC_CALL_LOCAL_ADDRESS_V1_W {
  224. unsigned int Version;
  225. void *Buffer;
  226. unsigned __LONG32 BufferSize;
  227. RpcLocalAddressFormat AddressFormat;
  228. } RPC_CALL_LOCAL_ADDRESS_V1_W, RPC_CALL_LOCAL_ADDRESS_W;
  229. #define RPC_CALL_LOCAL_ADDRESS_V1 __MINGW_NAME_AW(RPC_CALL_LOCAL_ADDRESS_V1_)
  230. #define RPC_CALL_LOCAL_ADDRESS __MINGW_NAME_AW(RPC_CALL_LOCAL_ADDRESS_)
  231. typedef struct tagRPC_CALL_ATTRIBUTES_V2A {
  232. unsigned int Version;
  233. unsigned __LONG32 Flags;
  234. unsigned __LONG32 ServerPrincipalNameBufferLength;
  235. unsigned short *ServerPrincipalName;
  236. unsigned __LONG32 ClientPrincipalNameBufferLength;
  237. unsigned short *ClientPrincipalName;
  238. unsigned __LONG32 AuthenticationLevel;
  239. unsigned __LONG32 AuthenticationService;
  240. WINBOOL NullSession;
  241. WINBOOL KernelMode;
  242. unsigned __LONG32 ProtocolSequence;
  243. RpcCallClientLocality IsClientLocal;
  244. HANDLE ClientPID;
  245. unsigned __LONG32 CallStatus;
  246. RpcCallType CallType;
  247. RPC_CALL_LOCAL_ADDRESS_A *CallLocalAddress;
  248. unsigned short OpNum;
  249. UUID InterfaceUuid;
  250. } RPC_CALL_ATTRIBUTES_V2_A, RPC_CALL_ATTRIBUTES_A;
  251. typedef struct tagRPC_CALL_ATTRIBUTES_V2W {
  252. unsigned int Version;
  253. unsigned __LONG32 Flags;
  254. unsigned __LONG32 ServerPrincipalNameBufferLength;
  255. unsigned short *ServerPrincipalName;
  256. unsigned __LONG32 ClientPrincipalNameBufferLength;
  257. unsigned short *ClientPrincipalName;
  258. unsigned __LONG32 AuthenticationLevel;
  259. unsigned __LONG32 AuthenticationService;
  260. WINBOOL NullSession;
  261. WINBOOL KernelMode;
  262. unsigned __LONG32 ProtocolSequence;
  263. RpcCallClientLocality IsClientLocal;
  264. HANDLE ClientPID;
  265. unsigned __LONG32 CallStatus;
  266. RpcCallType CallType;
  267. RPC_CALL_LOCAL_ADDRESS_W *CallLocalAddress;
  268. unsigned short OpNum;
  269. UUID InterfaceUuid;
  270. } RPC_CALL_ATTRIBUTES_V2_W, RPC_CALL_ATTRIBUTES_W;
  271. #define RPC_CALL_ATTRIBUTES_V2 __MINGW_NAME_AW(RPC_CALL_ATTRIBUTES_V2_)
  272. RPC_STATUS RPC_ENTRY RpcDiagnoseError(
  273. RPC_BINDING_HANDLE BindingHandle,
  274. RPC_IF_HANDLE IfSpec,
  275. RPC_STATUS RpcStatus,
  276. RPC_ERROR_ENUM_HANDLE *EnumHandle,
  277. ULONG Options,
  278. HWND ParentWindow
  279. );
  280. #endif /*(_WIN32_WINNT >= 0x0600)*/
  281. #ifdef __cplusplus
  282. }
  283. #endif
  284. #ifdef __RPC_WIN64__
  285. #include <poppack.h>
  286. #endif
  287. #endif