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