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 __RPCDCEP_H__ 7 #define __RPCDCEP_H__ 8 9 #include <_mingw_unicode.h> 10 11 #ifdef __cplusplus 12 extern "C" { 13 #endif 14 15 typedef struct _RPC_VERSION { 16 unsigned short MajorVersion; 17 unsigned short MinorVersion; 18 } RPC_VERSION; 19 20 typedef struct _RPC_SYNTAX_IDENTIFIER { 21 GUID SyntaxGUID; 22 RPC_VERSION SyntaxVersion; 23 } RPC_SYNTAX_IDENTIFIER,*PRPC_SYNTAX_IDENTIFIER; 24 25 typedef struct _RPC_MESSAGE { 26 RPC_BINDING_HANDLE Handle; 27 unsigned __LONG32 DataRepresentation; 28 void *Buffer; 29 unsigned int BufferLength; 30 unsigned int ProcNum; 31 PRPC_SYNTAX_IDENTIFIER TransferSyntax; 32 void *RpcInterfaceInformation; 33 void *ReservedForRuntime; 34 RPC_MGR_EPV *ManagerEpv; 35 void *ImportContext; 36 unsigned __LONG32 RpcFlags; 37 } RPC_MESSAGE,*PRPC_MESSAGE; 38 39 typedef RPC_STATUS RPC_ENTRY RPC_FORWARD_FUNCTION(UUID *InterfaceId,RPC_VERSION *InterfaceVersion,UUID *ObjectId,unsigned char *Rpcpro,void **ppDestEndpoint); 40 41 enum RPC_ADDRESS_CHANGE_TYPE { 42 PROTOCOL_NOT_LOADED = 1,PROTOCOL_LOADED,PROTOCOL_ADDRESS_CHANGE 43 }; 44 45 typedef void RPC_ENTRY RPC_ADDRESS_CHANGE_FN(void *arg); 46 47 #define RPC_CONTEXT_HANDLE_DEFAULT_GUARD ((void *) -4083) 48 49 #define RPC_CONTEXT_HANDLE_DEFAULT_FLAGS __MSABI_LONG(0x00000000U) 50 #define RPC_CONTEXT_HANDLE_FLAGS __MSABI_LONG(0x30000000U) 51 #define RPC_CONTEXT_HANDLE_SERIALIZE __MSABI_LONG(0x10000000U) 52 #define RPC_CONTEXT_HANDLE_DONT_SERIALIZE __MSABI_LONG(0x20000000U) 53 54 #define RPC_NCA_FLAGS_DEFAULT 0x00000000 55 #define RPC_NCA_FLAGS_IDEMPOTENT 0x00000001 56 #define RPC_NCA_FLAGS_BROADCAST 0x00000002 57 #define RPC_NCA_FLAGS_MAYBE 0x00000004 58 59 #define RPC_BUFFER_COMPLETE 0x00001000 60 #define RPC_BUFFER_PARTIAL 0x00002000 61 #define RPC_BUFFER_EXTRA 0x00004000 62 #define RPC_BUFFER_ASYNC 0x00008000 63 #define RPC_BUFFER_NONOTIFY 0x00010000 64 65 #define RPCFLG_MESSAGE __MSABI_LONG(0x01000000U) 66 #define RPCFLG_AUTO_COMPLETE __MSABI_LONG(0x08000000U) 67 #define RPCFLG_LOCAL_CALL __MSABI_LONG(0x10000000U) 68 #define RPCFLG_INPUT_SYNCHRONOUS __MSABI_LONG(0x20000000U) 69 #define RPCFLG_ASYNCHRONOUS __MSABI_LONG(0x40000000U) 70 #define RPCFLG_NON_NDR __MSABI_LONG(0x80000000U) 71 72 #define RPCFLG_HAS_MULTI_SYNTAXES __MSABI_LONG(0x02000000U) 73 #define RPCFLG_HAS_CALLBACK __MSABI_LONG(0x04000000U) 74 75 #define RPC_FLAGS_VALID_BIT 0x00008000 76 77 typedef void (__RPC_STUB *RPC_DISPATCH_FUNCTION)(PRPC_MESSAGE Message); 78 79 typedef struct { 80 unsigned int DispatchTableCount; 81 RPC_DISPATCH_FUNCTION *DispatchTable; 82 LONG_PTR Reserved; 83 } RPC_DISPATCH_TABLE,*PRPC_DISPATCH_TABLE; 84 85 typedef struct _RPC_PROTSEQ_ENDPOINT { 86 unsigned char *RpcProtocolSequence; 87 unsigned char *Endpoint; 88 } RPC_PROTSEQ_ENDPOINT,*PRPC_PROTSEQ_ENDPOINT; 89 90 #define NT351_INTERFACE_SIZE 0x40 91 #define RPC_INTERFACE_HAS_PIPES 0x0001 92 93 typedef struct _RPC_SERVER_INTERFACE { 94 unsigned int Length; 95 RPC_SYNTAX_IDENTIFIER InterfaceId; 96 RPC_SYNTAX_IDENTIFIER TransferSyntax; 97 PRPC_DISPATCH_TABLE DispatchTable; 98 unsigned int RpcProtseqEndpointCount; 99 PRPC_PROTSEQ_ENDPOINT RpcProtseqEndpoint; 100 RPC_MGR_EPV *DefaultManagerEpv; 101 void const *InterpreterInfo; 102 unsigned int Flags; 103 } RPC_SERVER_INTERFACE,*PRPC_SERVER_INTERFACE; 104 105 typedef struct _RPC_CLIENT_INTERFACE { 106 unsigned int Length; 107 RPC_SYNTAX_IDENTIFIER InterfaceId; 108 RPC_SYNTAX_IDENTIFIER TransferSyntax; 109 PRPC_DISPATCH_TABLE DispatchTable; 110 unsigned int RpcProtseqEndpointCount; 111 PRPC_PROTSEQ_ENDPOINT RpcProtseqEndpoint; 112 ULONG_PTR Reserved; 113 void const *InterpreterInfo; 114 unsigned int Flags; 115 } RPC_CLIENT_INTERFACE,*PRPC_CLIENT_INTERFACE; 116 117 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcNegotiateTransferSyntax(RPC_MESSAGE *Message); 118 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcGetBuffer(RPC_MESSAGE *Message); 119 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcGetBufferWithObject(RPC_MESSAGE *Message,UUID *ObjectUuid); 120 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcSendReceive(RPC_MESSAGE *Message); 121 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcFreeBuffer(RPC_MESSAGE *Message); 122 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcSend(PRPC_MESSAGE Message); 123 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcReceive(PRPC_MESSAGE Message,unsigned int Size); 124 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcFreePipeBuffer(RPC_MESSAGE *Message); 125 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcReallocPipeBuffer(PRPC_MESSAGE Message,unsigned int NewSize); 126 127 typedef void *I_RPC_MUTEX; 128 129 #define I_RpcNsBindingSetEntryName __MINGW_NAME_AW(I_RpcNsBindingSetEntryName) 130 #define I_RpcServerUseProtseqEp2 __MINGW_NAME_AW(I_RpcServerUseProtseqEp2) 131 #define I_RpcServerUseProtseq2 __MINGW_NAME_AW(I_RpcServerUseProtseq2) 132 #define I_RpcBindingInqDynamicEndpoint __MINGW_NAME_AW(I_RpcBindingInqDynamicEndpoint) 133 134 RPCRTAPI void RPC_ENTRY I_RpcRequestMutex(I_RPC_MUTEX *Mutex); 135 RPCRTAPI void RPC_ENTRY I_RpcClearMutex(I_RPC_MUTEX Mutex); 136 RPCRTAPI void RPC_ENTRY I_RpcDeleteMutex(I_RPC_MUTEX Mutex); 137 RPCRTAPI void *RPC_ENTRY I_RpcAllocate(unsigned int Size); 138 RPCRTAPI void RPC_ENTRY I_RpcFree(void *Object); 139 RPCRTAPI void RPC_ENTRY I_RpcPauseExecution(unsigned __LONG32 Milliseconds); 140 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcGetExtendedError(); 141 142 typedef void (__RPC_API *PRPC_RUNDOWN)(void *AssociationContext); 143 144 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcMonitorAssociation(RPC_BINDING_HANDLE Handle,PRPC_RUNDOWN RundownRoutine,void *Context); 145 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcStopMonitorAssociation(RPC_BINDING_HANDLE Handle); 146 RPCRTAPI RPC_BINDING_HANDLE RPC_ENTRY I_RpcGetCurrentCallHandle(void); 147 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcGetAssociationContext(RPC_BINDING_HANDLE BindingHandle,void **AssociationContext); 148 RPCRTAPI void *RPC_ENTRY I_RpcGetServerContextList(RPC_BINDING_HANDLE BindingHandle); 149 RPCRTAPI void RPC_ENTRY I_RpcSetServerContextList(RPC_BINDING_HANDLE BindingHandle,void *ServerContextList); 150 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcNsInterfaceExported(unsigned __LONG32 EntryNameSyntax,unsigned short *EntryName,RPC_SERVER_INTERFACE *RpcInterfaceInformation); 151 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcNsInterfaceUnexported(unsigned __LONG32 EntryNameSyntax,unsigned short *EntryName,RPC_SERVER_INTERFACE *RpcInterfaceInformation); 152 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcBindingToStaticStringBindingW(RPC_BINDING_HANDLE Binding,unsigned short **StringBinding); 153 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcBindingInqSecurityContext(RPC_BINDING_HANDLE Binding,void **SecurityContextHandle); 154 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcBindingInqWireIdForSnego(RPC_BINDING_HANDLE Binding,RPC_CSTR WireId); 155 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcBindingInqMarshalledTargetInfo (RPC_BINDING_HANDLE Binding,unsigned __LONG32 *MarshalledTargetInfoLength,RPC_CSTR *MarshalledTargetInfo); 156 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcBindingInqLocalClientPID(RPC_BINDING_HANDLE Binding,unsigned __LONG32 *Pid); 157 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcBindingHandleToAsyncHandle(RPC_BINDING_HANDLE Binding,void **AsyncHandle); 158 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcNsBindingSetEntryNameW(RPC_BINDING_HANDLE Binding,unsigned __LONG32 EntryNameSyntax,RPC_WSTR EntryName); 159 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcNsBindingSetEntryNameA(RPC_BINDING_HANDLE Binding,unsigned __LONG32 EntryNameSyntax,RPC_CSTR EntryName); 160 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcServerUseProtseqEp2A(RPC_CSTR NetworkAddress,RPC_CSTR Protseq,unsigned int MaxCalls,RPC_CSTR Endpoint,void *SecurityDescriptor,void *Policy); 161 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcServerUseProtseqEp2W(RPC_WSTR NetworkAddress,RPC_WSTR Protseq,unsigned int MaxCalls,RPC_WSTR Endpoint,void *SecurityDescriptor,void *Policy); 162 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcServerUseProtseq2W(RPC_WSTR NetworkAddress,RPC_WSTR Protseq,unsigned int MaxCalls,void *SecurityDescriptor,void *Policy); 163 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcServerUseProtseq2A(RPC_CSTR NetworkAddress,RPC_CSTR Protseq,unsigned int MaxCalls,void *SecurityDescriptor,void *Policy); 164 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcBindingInqDynamicEndpointW(RPC_BINDING_HANDLE Binding,RPC_WSTR *DynamicEndpoint); 165 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcBindingInqDynamicEndpointA(RPC_BINDING_HANDLE Binding,RPC_CSTR *DynamicEndpoint); 166 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcServerCheckClientRestriction(RPC_BINDING_HANDLE Context); 167 168 #define TRANSPORT_TYPE_CN 0x01 169 #define TRANSPORT_TYPE_DG 0x02 170 #define TRANSPORT_TYPE_LPC 0x04 171 #define TRANSPORT_TYPE_WMSG 0x08 172 173 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcBindingInqTransportType(RPC_BINDING_HANDLE Binding,unsigned int *Type); 174 175 typedef struct _RPC_TRANSFER_SYNTAX { 176 UUID Uuid; 177 unsigned short VersMajor; 178 unsigned short VersMinor; 179 } RPC_TRANSFER_SYNTAX; 180 181 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcIfInqTransferSyntaxes(RPC_IF_HANDLE RpcIfHandle,RPC_TRANSFER_SYNTAX *TransferSyntaxes,unsigned int TransferSyntaxSize,unsigned int *TransferSyntaxCount); 182 RPCRTAPI RPC_STATUS RPC_ENTRY I_UuidCreate(UUID *Uuid); 183 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcBindingCopy(RPC_BINDING_HANDLE SourceBinding,RPC_BINDING_HANDLE *DestinationBinding); 184 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcBindingIsClientLocal(RPC_BINDING_HANDLE BindingHandle,unsigned int *ClientLocalFlag); 185 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcBindingInqConnId(RPC_BINDING_HANDLE Binding,void **ConnId,int *pfFirstCall); 186 RPCRTAPI void RPC_ENTRY I_RpcSsDontSerializeContext(void); 187 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcLaunchDatagramReceiveThread(void *pAddress); 188 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcServerRegisterForwardFunction(RPC_FORWARD_FUNCTION *pForwardFunction); 189 RPC_ADDRESS_CHANGE_FN *RPC_ENTRY I_RpcServerInqAddressChangeFn(); 190 RPC_STATUS RPC_ENTRY I_RpcServerSetAddressChangeFn(RPC_ADDRESS_CHANGE_FN *pAddressChangeFn); 191 192 #define RPC_P_ADDR_FORMAT_TCP_IPV4 1 193 #define RPC_P_ADDR_FORMAT_TCP_IPV6 2 194 195 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcServerInqLocalConnAddress(RPC_BINDING_HANDLE Binding,void *Buffer,unsigned __LONG32 *BufferSize,unsigned __LONG32 *AddressFormat); 196 RPCRTAPI void RPC_ENTRY I_RpcSessionStrictContextHandle(); 197 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcTurnOnEEInfoPropagation(void); 198 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcConnectionInqSockBuffSize(unsigned __LONG32 *RecvBuffSize,unsigned __LONG32 *SendBuffSize); 199 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcConnectionSetSockBuffSize(unsigned __LONG32 RecvBuffSize,unsigned __LONG32 SendBuffSize); 200 201 typedef void (*RPCLT_PDU_FILTER_FUNC)(void *Buffer,unsigned int BufferLength,int fDatagram); 202 typedef void (__cdecl *RPC_SETFILTER_FUNC)(RPCLT_PDU_FILTER_FUNC pfnFilter); 203 204 #ifndef WINNT 205 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcServerStartListening(void *hWnd); 206 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcServerStopListening(); 207 208 typedef RPC_STATUS (*RPC_BLOCKING_FN)(void *hWnd,void *Context,void *hSyncEvent); 209 210 #define I_RpcServerUnregisterEndpoint __MINGW_NAME_AW(I_RpcServerUnregisterEndpoint) 211 212 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcBindingSetAsync(RPC_BINDING_HANDLE Binding,RPC_BLOCKING_FN BlockingFn,unsigned __LONG32 ServerTid); 213 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcSetThreadParams(int fClientFree,void *Context,void *hWndClient); 214 RPCRTAPI unsigned int RPC_ENTRY I_RpcWindowProc(void *hWnd,unsigned int Message,unsigned int wParam,unsigned __LONG32 lParam); 215 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcServerUnregisterEndpointA(RPC_CSTR Protseq,RPC_CSTR Endpoint); 216 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcServerUnregisterEndpointW(RPC_WSTR Protseq,RPC_WSTR Endpoint); 217 #endif 218 219 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcServerInqTransportType(unsigned int *Type); 220 RPCRTAPI __LONG32 RPC_ENTRY I_RpcMapWin32Status(RPC_STATUS Status); 221 222 typedef struct _RPC_C_OPT_METADATA_DESCRIPTOR { 223 unsigned __LONG32 BufferSize; 224 char *Buffer; 225 } RPC_C_OPT_METADATA_DESCRIPTOR; 226 227 typedef struct _RDR_CALLOUT_STATE { 228 RPC_STATUS LastError; 229 void *LastEEInfo; 230 RPC_HTTP_REDIRECTOR_STAGE LastCalledStage; 231 unsigned short *ServerName; 232 unsigned short *ServerPort; 233 unsigned short *RemoteUser; 234 unsigned short *AuthType; 235 unsigned char ResourceTypePresent; 236 unsigned char MetadataPresent; 237 unsigned char SessionIdPresent; 238 unsigned char InterfacePresent; 239 UUID ResourceType; 240 RPC_C_OPT_METADATA_DESCRIPTOR Metadata; 241 UUID SessionId; 242 RPC_SYNTAX_IDENTIFIER Interface; 243 void *CertContext; 244 } RDR_CALLOUT_STATE; 245 246 typedef RPC_STATUS (RPC_ENTRY *I_RpcProxyIsValidMachineFn)(char *pszMachine,char *pszDotMachine,unsigned __LONG32 dwPortNumber); 247 typedef RPC_STATUS (RPC_ENTRY *I_RpcProxyGetClientAddressFn)(void *Context,char *Buffer,unsigned __LONG32 *BufferLength); 248 typedef RPC_STATUS (RPC_ENTRY *I_RpcProxyGetConnectionTimeoutFn)(unsigned __LONG32 *ConnectionTimeout); 249 typedef RPC_STATUS (RPC_ENTRY *I_RpcPerformCalloutFn)(void *Context,RDR_CALLOUT_STATE *CallOutState,RPC_HTTP_REDIRECTOR_STAGE Stage); 250 typedef void (RPC_ENTRY *I_RpcFreeCalloutStateFn)(RDR_CALLOUT_STATE *CallOutState); 251 252 typedef struct tagI_RpcProxyCallbackInterface { 253 I_RpcProxyIsValidMachineFn IsValidMachineFn; 254 I_RpcProxyGetClientAddressFn GetClientAddressFn; 255 I_RpcProxyGetConnectionTimeoutFn GetConnectionTimeoutFn; 256 I_RpcPerformCalloutFn PerformCalloutFn; 257 I_RpcFreeCalloutStateFn FreeCalloutStateFn; 258 } I_RpcProxyCallbackInterface; 259 260 #define RPC_PROXY_CONNECTION_TYPE_IN_PROXY 0 261 #define RPC_PROXY_CONNECTION_TYPE_OUT_PROXY 1 262 263 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcProxyNewConnection(unsigned __LONG32 ConnectionType,unsigned short *ServerAddress,unsigned short *ServerPort,unsigned short *MinConnTimeout,void *ConnectionParameter,RDR_CALLOUT_STATE *CallOutState,I_RpcProxyCallbackInterface *ProxyCallbackInterface); 264 RPCRTAPI RPC_STATUS RPC_ENTRY I_RpcReplyToClientWithStatus(void *ConnectionParameter,RPC_STATUS RpcStatus); 265 RPCRTAPI void RPC_ENTRY I_RpcRecordCalloutFailure(RPC_STATUS RpcStatus,RDR_CALLOUT_STATE *CallOutState,unsigned short *DllName); 266 267 #ifdef __cplusplus 268 } 269 #endif 270 #endif 271