The real, definitive, Visual C++ support branch. Accept no substitutes
[reactos.git] / include / psdk / rpcasync.h
1 /*
2 * Copyright (C) 2007 Francois Gouget
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18 #ifndef __WINE_RPCASYNC_H
19 #define __WINE_RPCASYNC_H
20
21
22 typedef struct tagRPC_ERROR_ENUM_HANDLE
23 {
24 ULONG Signature;
25 void* CurrentPos;
26 void* Head;
27 } RPC_ERROR_ENUM_HANDLE;
28
29 typedef enum tagExtendedErrorParamTypes
30 {
31 eeptAnsiString = 1,
32 eeptUnicodeString,
33 eeptLongVal,
34 eeptShortVal,
35 eeptPointerVal,
36 eeptNone,
37 eeptBinary
38 } ExtendedErrorParamTypes;
39
40 #define MaxNumberOfEEInfoParams 4
41 #define RPC_EEINFO_VERSION 1
42
43 typedef struct tagBinaryParam
44 {
45 void *Buffer;
46 short Size;
47 } BinaryParam;
48
49 typedef struct tagRPC_EE_INFO_PARAM
50 {
51 ExtendedErrorParamTypes ParameterType;
52 union
53 {
54 LPSTR AnsiString;
55 LPWSTR UnicodeString;
56 LONG LVal;
57 short SVal;
58 ULONGLONG PVal;
59 BinaryParam BVal;
60 } u;
61 } RPC_EE_INFO_PARAM;
62
63 #define EEInfoPreviousRecordsMissing 0x1
64 #define EEInfoNextRecordsMissing 0x2
65 #define EEInfoUseFileTime 0x4
66
67 #define EEInfoGCCOM 11
68 #define EEInfoGCFRS 12
69
70 typedef struct tagRPC_EXTENDED_ERROR_INFO
71 {
72 ULONG Version;
73 LPWSTR ComputerName;
74 ULONG ProcessID;
75 union
76 {
77 SYSTEMTIME SystemTime;
78 FILETIME FileTime;
79 } u;
80 ULONG GeneratingComponent;
81 ULONG Status;
82 USHORT DetectionLocation;
83 USHORT Flags;
84 int NumberOfParameters;
85 RPC_EE_INFO_PARAM Parameters[MaxNumberOfEEInfoParams];
86 } RPC_EXTENDED_ERROR_INFO;
87
88 #define RPC_ASYNC_VERSION_1_0 sizeof(RPC_ASYNC_STATE)
89
90 typedef enum _RPC_NOTIFICATION_TYPES
91 {
92 RpcNotificationTypeNone,
93 RpcNotificationTypeEvent,
94 RpcNotificationTypeApc,
95 RpcNotificationTypeIoc,
96 RpcNotificationTypeHwnd,
97 RpcNotificationTypeCallback,
98 } RPC_NOTIFICATION_TYPES;
99
100 typedef enum _RPC_ASYNC_EVENT
101 {
102 RpcCallComplete,
103 RpcSendComplete,
104 RpcReceiveComplete,
105 RpcClientDisconnect,
106 RpcClientCancel,
107 } RPC_ASYNC_EVENT;
108
109 struct _RPC_ASYNC_STATE;
110
111 typedef void RPC_ENTRY RPCNOTIFICATION_ROUTINE(struct _RPC_ASYNC_STATE *,void *,RPC_ASYNC_EVENT);
112 typedef RPCNOTIFICATION_ROUTINE *PFN_RPCNOTIFICATION_ROUTINE;
113
114 typedef union _RPC_ASYNC_NOTIFICATION_INFO
115 {
116 struct
117 {
118 PFN_RPCNOTIFICATION_ROUTINE NotificationRoutine;
119 HANDLE hThread;
120 } APC;
121 struct
122 {
123 HANDLE hIOPort;
124 DWORD dwNumberOfBytesTransferred;
125 DWORD_PTR dwCompletionKey;
126 LPOVERLAPPED lpOverlapped;
127 } IOC;
128 struct
129 {
130 HWND hWnd;
131 UINT Msg;
132 } HWND;
133 HANDLE hEvent;
134 PFN_RPCNOTIFICATION_ROUTINE NotificationRoutine;
135 } RPC_ASYNC_NOTIFICATION_INFO, *PRPC_ASYNC_NOTIFICATION_INFO;
136
137 #define RPC_C_NOTIFY_ON_SEND_COMPLETE 0x1
138 #define RPC_C_INFINITE_TIMEOUT INFINITE
139
140 typedef struct _RPC_ASYNC_STATE
141 {
142 unsigned int Size;
143 ULONG Signature;
144 LONG Lock;
145 ULONG Flags;
146 void *StubInfo;
147 void *UserInfo;
148 void *RuntimeInfo;
149 RPC_ASYNC_EVENT Event;
150 RPC_NOTIFICATION_TYPES NotificationType;
151 RPC_ASYNC_NOTIFICATION_INFO u;
152 LONG_PTR Reserved[4];
153 } RPC_ASYNC_STATE, *PRPC_ASYNC_STATE;
154
155 #define RpcAsyncGetCallHandle(async) (((PRPC_ASYNC_STATE)async)->RuntimeInfo)
156
157 #ifdef __cplusplus
158 extern "C" {
159 #endif
160
161 RPCRTAPI RPC_STATUS RPC_ENTRY RpcAsyncInitializeHandle(PRPC_ASYNC_STATE,unsigned int);
162 RPCRTAPI RPC_STATUS RPC_ENTRY RpcAsyncRegisterInfo(PRPC_ASYNC_STATE);
163 RPCRTAPI RPC_STATUS RPC_ENTRY RpcAsyncGetCallStatus(PRPC_ASYNC_STATE);
164 RPCRTAPI RPC_STATUS RPC_ENTRY RpcAsyncCompleteCall(PRPC_ASYNC_STATE,void *);
165 RPCRTAPI RPC_STATUS RPC_ENTRY RpcAsyncAbortCall(PRPC_ASYNC_STATE,ULONG);
166 RPCRTAPI RPC_STATUS RPC_ENTRY RpcAsyncCancelCall(PRPC_ASYNC_STATE,BOOL);
167 RPCRTAPI RPC_STATUS RPC_ENTRY RpcAsyncCleanupThread(DWORD);
168 RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorStartEnumeration(RPC_ERROR_ENUM_HANDLE*);
169 RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorGetNextRecord(RPC_ERROR_ENUM_HANDLE*,BOOL,RPC_EXTENDED_ERROR_INFO*);
170 RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorEndEnumeration(RPC_ERROR_ENUM_HANDLE*);
171 RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorResetEnumeration(RPC_ERROR_ENUM_HANDLE*);
172 RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorGetNumberOfRecords(RPC_ERROR_ENUM_HANDLE*,int*);
173 RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorSaveErrorInfo(RPC_ERROR_ENUM_HANDLE*,PVOID*,SIZE_T*);
174 RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorLoadErrorInfo(PVOID,SIZE_T,RPC_ERROR_ENUM_HANDLE*);
175 RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorAddRecord(RPC_EXTENDED_ERROR_INFO*);
176 RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorClearInformation(void);
177 RPCRTAPI RPC_STATUS RPC_ENTRY RpcGetAuthorizationContextForClient(RPC_BINDING_HANDLE,BOOL,LPVOID,PLARGE_INTEGER,LUID,DWORD,PVOID,PVOID*);
178 RPCRTAPI RPC_STATUS RPC_ENTRY RpcFreeAuthorizationContext(PVOID*);
179 RPCRTAPI RPC_STATUS RPC_ENTRY RpcSsContextLockExclusive(RPC_BINDING_HANDLE,PVOID);
180 RPCRTAPI RPC_STATUS RPC_ENTRY RpcSsContextLockShared(RPC_BINDING_HANDLE,PVOID);
181
182 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcAsyncSetHandle(PRPC_MESSAGE,PRPC_ASYNC_STATE);
183 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcAsyncAbortCall(PRPC_ASYNC_STATE,ULONG);
184 RPCRTAPI int RPC_ENTRY I_RpcExceptionFilter(ULONG);
185
186 #ifdef __cplusplus
187 }
188 #endif
189
190 #endif