include: Fix some winsock definitions.
[wine] / include / 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 #ifdef RPC_NO_WINDOWS_H
22 # include <windef.h>
23 #endif
24
25 #ifdef __RPC_WIN64__
26 # include <pshpack8.h>
27 #endif
28
29 typedef struct tagRPC_ERROR_ENUM_HANDLE
30 {
31     ULONG Signature;
32     void* CurrentPos;
33     void* Head;
34 } RPC_ERROR_ENUM_HANDLE;
35
36 typedef enum tagExtendedErrorParamTypes
37 {
38     eeptAnsiString = 1,
39     eeptUnicodeString,
40     eeptLongVal,
41     eeptShortVal,
42     eeptPointerVal,
43     eeptNone,
44     eeptBinary
45 } ExtendedErrorParamTypes;
46
47 #define MaxNumberOfEEInfoParams 4
48 #define RPC_EEINFO_VERSION      1
49
50 typedef struct tagBinaryParam
51 {
52     void *Buffer;
53     short Size;
54 } BinaryParam;
55
56 typedef struct tagRPC_EE_INFO_PARAM
57 {
58     ExtendedErrorParamTypes ParameterType;
59     union
60     {
61         LPSTR AnsiString;
62         LPWSTR UnicodeString;
63         LONG LVal;
64         short SVal;
65         ULONGLONG PVal;
66         BinaryParam BVal;
67     } u;
68 } RPC_EE_INFO_PARAM;
69
70 #define EEInfoPreviousRecordsMissing    0x1
71 #define EEInfoNextRecordsMissing        0x2
72 #define EEInfoUseFileTime               0x4
73
74 #define EEInfoGCCOM                     11
75 #define EEInfoGCFRS                     12
76
77 typedef struct tagRPC_EXTENDED_ERROR_INFO
78 {
79     ULONG Version;
80     LPWSTR ComputerName;
81     ULONG ProcessID;
82     union
83     {
84         SYSTEMTIME SystemTime;
85         FILETIME FileTime;
86     } u;
87     ULONG GeneratingComponent;
88     ULONG Status;
89     USHORT DetectionLocation;
90     USHORT Flags;
91     int NumberOfParameters;
92     RPC_EE_INFO_PARAM Parameters[MaxNumberOfEEInfoParams];
93 } RPC_EXTENDED_ERROR_INFO;
94
95 #define RPC_ASYNC_VERSION_1_0   sizeof(RPC_ASYNC_STATE)
96
97 typedef enum _RPC_NOTIFICATION_TYPES
98 {
99     RpcNotificationTypeNone,
100     RpcNotificationTypeEvent,
101     RpcNotificationTypeApc,
102     RpcNotificationTypeIoc,
103     RpcNotificationTypeHwnd,
104     RpcNotificationTypeCallback,
105 } RPC_NOTIFICATION_TYPES;
106
107 typedef enum _RPC_ASYNC_EVENT
108 {
109     RpcCallComplete,
110     RpcSendComplete,
111     RpcReceiveComplete,
112     RpcClientDisconnect,
113     RpcClientCancel,
114 } RPC_ASYNC_EVENT;
115
116 struct _RPC_ASYNC_STATE;
117
118 typedef void RPC_ENTRY RPCNOTIFICATION_ROUTINE(struct _RPC_ASYNC_STATE *,void *,RPC_ASYNC_EVENT);
119 typedef RPCNOTIFICATION_ROUTINE *PFN_RPCNOTIFICATION_ROUTINE;
120
121 typedef union _RPC_ASYNC_NOTIFICATION_INFO
122 {
123     struct
124     {
125         PFN_RPCNOTIFICATION_ROUTINE NotificationRoutine;
126         HANDLE hThread;
127     } APC;
128     struct
129     {
130         HANDLE hIOPort;
131         DWORD dwNumberOfBytesTransferred;
132         DWORD_PTR dwCompletionKey;
133         LPOVERLAPPED lpOverlapped;
134     } IOC;
135     struct
136     {
137         HWND hWnd;
138         UINT Msg;
139     } HWND;
140     HANDLE hEvent;
141     PFN_RPCNOTIFICATION_ROUTINE NotificationRoutine;
142 } RPC_ASYNC_NOTIFICATION_INFO, *PRPC_ASYNC_NOTIFICATION_INFO;
143
144 #define RPC_C_NOTIFY_ON_SEND_COMPLETE   0x1
145 #define RPC_C_INFINITE_TIMEOUT          INFINITE
146
147 typedef struct _RPC_ASYNC_STATE
148 {
149     unsigned int Size;
150     ULONG Signature;
151     LONG Lock;
152     ULONG Flags;
153     void *StubInfo;
154     void *UserInfo;
155     void *RuntimeInfo;
156     RPC_ASYNC_EVENT Event;
157     RPC_NOTIFICATION_TYPES NotificationType;
158     RPC_ASYNC_NOTIFICATION_INFO u;
159     LONG_PTR Reserved[4];
160 } RPC_ASYNC_STATE, *PRPC_ASYNC_STATE;
161
162 #define RpcAsyncGetCallHandle(async) (((PRPC_ASYNC_STATE)async)->RuntimeInfo)
163
164 #ifdef __RPC_WIN64__
165 # include <poppack.h>
166 #endif
167
168 #ifdef __cplusplus
169 extern "C" {
170 #endif
171
172 RPCRTAPI RPC_STATUS RPC_ENTRY RpcAsyncInitializeHandle(PRPC_ASYNC_STATE,unsigned int);
173 RPCRTAPI RPC_STATUS RPC_ENTRY RpcAsyncRegisterInfo(PRPC_ASYNC_STATE);
174 RPCRTAPI RPC_STATUS RPC_ENTRY RpcAsyncGetCallStatus(PRPC_ASYNC_STATE);
175 RPCRTAPI RPC_STATUS RPC_ENTRY RpcAsyncCompleteCall(PRPC_ASYNC_STATE,void *);
176 RPCRTAPI RPC_STATUS RPC_ENTRY RpcAsyncAbortCall(PRPC_ASYNC_STATE,ULONG);
177 RPCRTAPI RPC_STATUS RPC_ENTRY RpcAsyncCancelCall(PRPC_ASYNC_STATE,BOOL);
178 RPCRTAPI RPC_STATUS RPC_ENTRY RpcAsyncCleanupThread(DWORD);
179 RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorStartEnumeration(RPC_ERROR_ENUM_HANDLE*);
180 RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorGetNextRecord(RPC_ERROR_ENUM_HANDLE*,BOOL,RPC_EXTENDED_ERROR_INFO*);
181 RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorEndEnumeration(RPC_ERROR_ENUM_HANDLE*);
182 RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorResetEnumeration(RPC_ERROR_ENUM_HANDLE*);
183 RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorGetNumberOfRecords(RPC_ERROR_ENUM_HANDLE*,int*);
184 RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorSaveErrorInfo(RPC_ERROR_ENUM_HANDLE*,PVOID*,SIZE_T*);
185 RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorLoadErrorInfo(PVOID,SIZE_T,RPC_ERROR_ENUM_HANDLE*);
186 RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorAddRecord(RPC_EXTENDED_ERROR_INFO*);
187 RPCRTAPI RPC_STATUS RPC_ENTRY RpcErrorClearInformation(void);
188 RPCRTAPI RPC_STATUS RPC_ENTRY RpcGetAuthorizationContextForClient(RPC_BINDING_HANDLE,BOOL,LPVOID,PLARGE_INTEGER,LUID,DWORD,PVOID,PVOID*);
189 RPCRTAPI RPC_STATUS RPC_ENTRY RpcFreeAuthorizationContext(PVOID*);
190 RPCRTAPI RPC_STATUS RPC_ENTRY RpcSsContextLockExclusive(RPC_BINDING_HANDLE,PVOID);
191 RPCRTAPI RPC_STATUS RPC_ENTRY RpcSsContextLockShared(RPC_BINDING_HANDLE,PVOID);
192
193 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcAsyncSetHandle(PRPC_MESSAGE,PRPC_ASYNC_STATE);
194 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcAsyncAbortCall(PRPC_ASYNC_STATE,ULONG);
195 RPCRTAPI int        RPC_ENTRY I_RpcExceptionFilter(ULONG);
196
197 #ifdef __cplusplus
198 }
199 #endif
200
201 #endif