cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

rpc.h (32854B)


      1/**
      2 * WinPR: Windows Portable Runtime
      3 * Microsoft Remote Procedure Call (MSRPC)
      4 *
      5 * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
      6 *
      7 * Licensed under the Apache License, Version 2.0 (the "License");
      8 * you may not use this file except in compliance with the License.
      9 * You may obtain a copy of the License at
     10 *
     11 *     http://www.apache.org/licenses/LICENSE-2.0
     12 *
     13 * Unless required by applicable law or agreed to in writing, software
     14 * distributed under the License is distributed on an "AS IS" BASIS,
     15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     16 * See the License for the specific language governing permissions and
     17 * limitations under the License.
     18 */
     19
     20#ifndef WINPR_RPC_H
     21#define WINPR_RPC_H
     22
     23#include <winpr/wtypes.h>
     24
     25typedef struct _CONTEXT_HANDLE
     26{
     27	UINT32 ContextType;
     28	BYTE ContextUuid[16];
     29} CONTEXT_HANDLE;
     30
     31typedef PCONTEXT_HANDLE PTUNNEL_CONTEXT_HANDLE_NOSERIALIZE;
     32typedef PCONTEXT_HANDLE PTUNNEL_CONTEXT_HANDLE_SERIALIZE;
     33
     34typedef PCONTEXT_HANDLE PCHANNEL_CONTEXT_HANDLE_NOSERIALIZE;
     35typedef PCONTEXT_HANDLE PCHANNEL_CONTEXT_HANDLE_SERIALIZE;
     36
     37#if defined(_WIN32) && !defined(_UWP)
     38
     39#include <rpc.h>
     40
     41#else
     42
     43#include <winpr/winpr.h>
     44#include <winpr/wtypes.h>
     45#include <winpr/sspi.h>
     46#include <winpr/spec.h>
     47#include <winpr/error.h>
     48
     49#define RPC_S_OK ERROR_SUCCESS
     50#define RPC_S_INVALID_ARG ERROR_INVALID_PARAMETER
     51#define RPC_S_OUT_OF_MEMORY ERROR_OUTOFMEMORY
     52#define RPC_S_OUT_OF_THREADS ERROR_MAX_THRDS_REACHED
     53#define RPC_S_INVALID_LEVEL ERROR_INVALID_PARAMETER
     54#define RPC_S_BUFFER_TOO_SMALL ERROR_INSUFFICIENT_BUFFER
     55#define RPC_S_INVALID_SECURITY_DESC ERROR_INVALID_SECURITY_DESCR
     56#define RPC_S_ACCESS_DENIED ERROR_ACCESS_DENIED
     57#define RPC_S_SERVER_OUT_OF_MEMORY ERROR_NOT_ENOUGH_SERVER_MEMORY
     58#define RPC_S_ASYNC_CALL_PENDING ERROR_IO_PENDING
     59#define RPC_S_UNKNOWN_PRINCIPAL ERROR_NONE_MAPPED
     60#define RPC_S_TIMEOUT ERROR_TIMEOUT
     61
     62#define RPC_X_NO_MEMORY RPC_S_OUT_OF_MEMORY
     63#define RPC_X_INVALID_BOUND RPC_S_INVALID_BOUND
     64#define RPC_X_INVALID_TAG RPC_S_INVALID_TAG
     65#define RPC_X_ENUM_VALUE_TOO_LARGE RPC_X_ENUM_VALUE_OUT_OF_RANGE
     66#define RPC_X_SS_CONTEXT_MISMATCH ERROR_INVALID_HANDLE
     67#define RPC_X_INVALID_BUFFER ERROR_INVALID_USER_BUFFER
     68#define RPC_X_PIPE_APP_MEMORY ERROR_OUTOFMEMORY
     69#define RPC_X_INVALID_PIPE_OPERATION RPC_X_WRONG_PIPE_ORDER
     70
     71#define RPC_VAR_ENTRY __cdecl
     72
     73typedef long RPC_STATUS;
     74
     75#ifndef _WIN32
     76typedef CHAR* RPC_CSTR;
     77typedef WCHAR* RPC_WSTR;
     78#endif
     79
     80typedef void* I_RPC_HANDLE;
     81typedef I_RPC_HANDLE RPC_BINDING_HANDLE;
     82typedef RPC_BINDING_HANDLE handle_t;
     83
     84typedef struct _RPC_BINDING_VECTOR
     85{
     86	unsigned long Count;
     87	RPC_BINDING_HANDLE BindingH[1];
     88} RPC_BINDING_VECTOR;
     89#define rpc_binding_vector_t RPC_BINDING_VECTOR
     90
     91typedef struct _UUID_VECTOR
     92{
     93	unsigned long Count;
     94	UUID* Uuid[1];
     95} UUID_VECTOR;
     96#define uuid_vector_t UUID_VECTOR
     97
     98typedef void* RPC_IF_HANDLE;
     99
    100typedef struct _RPC_IF_ID
    101{
    102	UUID Uuid;
    103	unsigned short VersMajor;
    104	unsigned short VersMinor;
    105} RPC_IF_ID;
    106
    107#define RPC_C_BINDING_INFINITE_TIMEOUT 10
    108#define RPC_C_BINDING_MIN_TIMEOUT 0
    109#define RPC_C_BINDING_DEFAULT_TIMEOUT 5
    110#define RPC_C_BINDING_MAX_TIMEOUT 9
    111
    112#define RPC_C_CANCEL_INFINITE_TIMEOUT -1
    113
    114#define RPC_C_LISTEN_MAX_CALLS_DEFAULT 1234
    115#define RPC_C_PROTSEQ_MAX_REQS_DEFAULT 10
    116
    117#define RPC_C_BIND_TO_ALL_NICS 1
    118#define RPC_C_USE_INTERNET_PORT 0x1
    119#define RPC_C_USE_INTRANET_PORT 0x2
    120#define RPC_C_DONT_FAIL 0x4
    121
    122#define RPC_C_MQ_TEMPORARY 0x0000
    123#define RPC_C_MQ_PERMANENT 0x0001
    124#define RPC_C_MQ_CLEAR_ON_OPEN 0x0002
    125#define RPC_C_MQ_USE_EXISTING_SECURITY 0x0004
    126#define RPC_C_MQ_AUTHN_LEVEL_NONE 0x0000
    127#define RPC_C_MQ_AUTHN_LEVEL_PKT_INTEGRITY 0x0008
    128#define RPC_C_MQ_AUTHN_LEVEL_PKT_PRIVACY 0x0010
    129
    130#define RPC_C_OPT_MQ_DELIVERY 1
    131#define RPC_C_OPT_MQ_PRIORITY 2
    132#define RPC_C_OPT_MQ_JOURNAL 3
    133#define RPC_C_OPT_MQ_ACKNOWLEDGE 4
    134#define RPC_C_OPT_MQ_AUTHN_SERVICE 5
    135#define RPC_C_OPT_MQ_AUTHN_LEVEL 6
    136#define RPC_C_OPT_MQ_TIME_TO_REACH_QUEUE 7
    137#define RPC_C_OPT_MQ_TIME_TO_BE_RECEIVED 8
    138#define RPC_C_OPT_BINDING_NONCAUSAL 9
    139#define RPC_C_OPT_SECURITY_CALLBACK 10
    140#define RPC_C_OPT_UNIQUE_BINDING 11
    141#define RPC_C_OPT_CALL_TIMEOUT 12
    142#define RPC_C_OPT_DONT_LINGER 13
    143#define RPC_C_OPT_MAX_OPTIONS 14
    144
    145#define RPC_C_MQ_EXPRESS 0
    146#define RPC_C_MQ_RECOVERABLE 1
    147
    148#define RPC_C_MQ_JOURNAL_NONE 0
    149#define RPC_C_MQ_JOURNAL_DEADLETTER 1
    150#define RPC_C_MQ_JOURNAL_ALWAYS 2
    151
    152#define RPC_C_FULL_CERT_CHAIN 0x0001
    153
    154typedef struct _RPC_PROTSEQ_VECTORA
    155{
    156	unsigned int Count;
    157	unsigned char* Protseq[1];
    158} RPC_PROTSEQ_VECTORA;
    159
    160typedef struct _RPC_PROTSEQ_VECTORW
    161{
    162	unsigned int Count;
    163	unsigned short* Protseq[1];
    164} RPC_PROTSEQ_VECTORW;
    165
    166#ifdef UNICODE
    167#define RPC_PROTSEQ_VECTOR RPC_PROTSEQ_VECTORW
    168#else
    169#define RPC_PROTSEQ_VECTOR RPC_PROTSEQ_VECTORA
    170#endif
    171
    172typedef struct _RPC_POLICY
    173{
    174	unsigned int Length;
    175	unsigned long EndpointFlags;
    176	unsigned long NICFlags;
    177} RPC_POLICY, *PRPC_POLICY;
    178
    179typedef void RPC_OBJECT_INQ_FN(UUID* ObjectUuid, UUID* TypeUuid, RPC_STATUS* pStatus);
    180typedef RPC_STATUS RPC_IF_CALLBACK_FN(RPC_IF_HANDLE InterfaceUuid, void* Context);
    181typedef void RPC_SECURITY_CALLBACK_FN(void* Context);
    182
    183#define RPC_MGR_EPV void
    184
    185typedef struct
    186{
    187	unsigned int Count;
    188	unsigned long Stats[1];
    189} RPC_STATS_VECTOR;
    190
    191#define RPC_C_STATS_CALLS_IN 0
    192#define RPC_C_STATS_CALLS_OUT 1
    193#define RPC_C_STATS_PKTS_IN 2
    194#define RPC_C_STATS_PKTS_OUT 3
    195
    196typedef struct
    197{
    198	unsigned long Count;
    199	RPC_IF_ID* IfId[1];
    200} RPC_IF_ID_VECTOR;
    201
    202#ifndef _WIN32
    203
    204typedef void* RPC_AUTH_IDENTITY_HANDLE;
    205typedef void* RPC_AUTHZ_HANDLE;
    206
    207#define RPC_C_AUTHN_LEVEL_DEFAULT 0
    208#define RPC_C_AUTHN_LEVEL_NONE 1
    209#define RPC_C_AUTHN_LEVEL_CONNECT 2
    210#define RPC_C_AUTHN_LEVEL_CALL 3
    211#define RPC_C_AUTHN_LEVEL_PKT 4
    212#define RPC_C_AUTHN_LEVEL_PKT_INTEGRITY 5
    213#define RPC_C_AUTHN_LEVEL_PKT_PRIVACY 6
    214
    215#define RPC_C_IMP_LEVEL_DEFAULT 0
    216#define RPC_C_IMP_LEVEL_ANONYMOUS 1
    217#define RPC_C_IMP_LEVEL_IDENTIFY 2
    218#define RPC_C_IMP_LEVEL_IMPERSONATE 3
    219#define RPC_C_IMP_LEVEL_DELEGATE 4
    220
    221#define RPC_C_QOS_IDENTITY_STATIC 0
    222#define RPC_C_QOS_IDENTITY_DYNAMIC 1
    223
    224#define RPC_C_QOS_CAPABILITIES_DEFAULT 0x0
    225#define RPC_C_QOS_CAPABILITIES_MUTUAL_AUTH 0x1
    226#define RPC_C_QOS_CAPABILITIES_MAKE_FULLSIC 0x2
    227#define RPC_C_QOS_CAPABILITIES_ANY_AUTHORITY 0x4
    228#define RPC_C_QOS_CAPABILITIES_IGNORE_DELEGATE_FAILURE 0x8
    229#define RPC_C_QOS_CAPABILITIES_LOCAL_MA_HINT 0x10
    230
    231#define RPC_C_PROTECT_LEVEL_DEFAULT (RPC_C_AUTHN_LEVEL_DEFAULT)
    232#define RPC_C_PROTECT_LEVEL_NONE (RPC_C_AUTHN_LEVEL_NONE)
    233#define RPC_C_PROTECT_LEVEL_CONNECT (RPC_C_AUTHN_LEVEL_CONNECT)
    234#define RPC_C_PROTECT_LEVEL_CALL (RPC_C_AUTHN_LEVEL_CALL)
    235#define RPC_C_PROTECT_LEVEL_PKT (RPC_C_AUTHN_LEVEL_PKT)
    236#define RPC_C_PROTECT_LEVEL_PKT_INTEGRITY (RPC_C_AUTHN_LEVEL_PKT_INTEGRITY)
    237#define RPC_C_PROTECT_LEVEL_PKT_PRIVACY (RPC_C_AUTHN_LEVEL_PKT_PRIVACY)
    238
    239#define RPC_C_AUTHN_NONE 0
    240#define RPC_C_AUTHN_DCE_PRIVATE 1
    241#define RPC_C_AUTHN_DCE_PUBLIC 2
    242#define RPC_C_AUTHN_DEC_PUBLIC 4
    243#define RPC_C_AUTHN_GSS_NEGOTIATE 9
    244#define RPC_C_AUTHN_WINNT 10
    245#define RPC_C_AUTHN_GSS_SCHANNEL 14
    246#define RPC_C_AUTHN_GSS_KERBEROS 16
    247#define RPC_C_AUTHN_DPA 17
    248#define RPC_C_AUTHN_MSN 18
    249#define RPC_C_AUTHN_DIGEST 21
    250#define RPC_C_AUTHN_MQ 100
    251#define RPC_C_AUTHN_DEFAULT 0xFFFFFFFFL
    252
    253#define RPC_C_NO_CREDENTIALS ((RPC_AUTH_IDENTITY_HANDLE)MAXUINT_PTR)
    254
    255#define RPC_C_SECURITY_QOS_VERSION 1L
    256#define RPC_C_SECURITY_QOS_VERSION_1 1L
    257
    258typedef struct _RPC_SECURITY_QOS
    259{
    260	unsigned long Version;
    261	unsigned long Capabilities;
    262	unsigned long IdentityTracking;
    263	unsigned long ImpersonationType;
    264} RPC_SECURITY_QOS, *PRPC_SECURITY_QOS;
    265
    266#define RPC_C_SECURITY_QOS_VERSION_2 2L
    267
    268#define RPC_C_AUTHN_INFO_TYPE_HTTP 1
    269
    270#define RPC_C_HTTP_AUTHN_TARGET_SERVER 1
    271#define RPC_C_HTTP_AUTHN_TARGET_PROXY 2
    272
    273#define RPC_C_HTTP_AUTHN_SCHEME_BASIC 0x00000001
    274#define RPC_C_HTTP_AUTHN_SCHEME_NTLM 0x00000002
    275#define RPC_C_HTTP_AUTHN_SCHEME_PASSPORT 0x00000004
    276#define RPC_C_HTTP_AUTHN_SCHEME_DIGEST 0x00000008
    277#define RPC_C_HTTP_AUTHN_SCHEME_NEGOTIATE 0x00000010
    278#define RPC_C_HTTP_AUTHN_SCHEME_CERT 0x00010000
    279
    280#define RPC_C_HTTP_FLAG_USE_SSL 1
    281#define RPC_C_HTTP_FLAG_USE_FIRST_AUTH_SCHEME 2
    282#define RPC_C_HTTP_FLAG_IGNORE_CERT_CN_INVALID 8
    283
    284typedef struct _RPC_HTTP_TRANSPORT_CREDENTIALS_W
    285{
    286	SEC_WINNT_AUTH_IDENTITY_W* TransportCredentials;
    287	unsigned long Flags;
    288	unsigned long AuthenticationTarget;
    289	unsigned long NumberOfAuthnSchemes;
    290	unsigned long* AuthnSchemes;
    291	unsigned short* ServerCertificateSubject;
    292} RPC_HTTP_TRANSPORT_CREDENTIALS_W, *PRPC_HTTP_TRANSPORT_CREDENTIALS_W;
    293
    294typedef struct _RPC_HTTP_TRANSPORT_CREDENTIALS_A
    295{
    296	SEC_WINNT_AUTH_IDENTITY_A* TransportCredentials;
    297	unsigned long Flags;
    298	unsigned long AuthenticationTarget;
    299	unsigned long NumberOfAuthnSchemes;
    300	unsigned long* AuthnSchemes;
    301	unsigned char* ServerCertificateSubject;
    302} RPC_HTTP_TRANSPORT_CREDENTIALS_A, *PRPC_HTTP_TRANSPORT_CREDENTIALS_A;
    303
    304typedef struct _RPC_SECURITY_QOS_V2_W
    305{
    306	unsigned long Version;
    307	unsigned long Capabilities;
    308	unsigned long IdentityTracking;
    309	unsigned long ImpersonationType;
    310	unsigned long AdditionalSecurityInfoType;
    311	union {
    312		RPC_HTTP_TRANSPORT_CREDENTIALS_W* HttpCredentials;
    313	} u;
    314} RPC_SECURITY_QOS_V2_W, *PRPC_SECURITY_QOS_V2_W;
    315
    316typedef struct _RPC_SECURITY_QOS_V2_A
    317{
    318	unsigned long Version;
    319	unsigned long Capabilities;
    320	unsigned long IdentityTracking;
    321	unsigned long ImpersonationType;
    322	unsigned long AdditionalSecurityInfoType;
    323	union {
    324		RPC_HTTP_TRANSPORT_CREDENTIALS_A* HttpCredentials;
    325	} u;
    326} RPC_SECURITY_QOS_V2_A, *PRPC_SECURITY_QOS_V2_A;
    327
    328#define RPC_C_SECURITY_QOS_VERSION_3 3L
    329
    330typedef struct _RPC_SECURITY_QOS_V3_W
    331{
    332	unsigned long Version;
    333	unsigned long Capabilities;
    334	unsigned long IdentityTracking;
    335	unsigned long ImpersonationType;
    336	unsigned long AdditionalSecurityInfoType;
    337	union {
    338		RPC_HTTP_TRANSPORT_CREDENTIALS_W* HttpCredentials;
    339	} u;
    340	void* Sid;
    341} RPC_SECURITY_QOS_V3_W, *PRPC_SECURITY_QOS_V3_W;
    342
    343typedef struct _RPC_SECURITY_QOS_V3_A
    344{
    345	unsigned long Version;
    346	unsigned long Capabilities;
    347	unsigned long IdentityTracking;
    348	unsigned long ImpersonationType;
    349	unsigned long AdditionalSecurityInfoType;
    350	union {
    351		RPC_HTTP_TRANSPORT_CREDENTIALS_A* HttpCredentials;
    352	} u;
    353	void* Sid;
    354} RPC_SECURITY_QOS_V3_A, *PRPC_SECURITY_QOS_V3_A;
    355
    356typedef enum _RPC_HTTP_REDIRECTOR_STAGE
    357{
    358	RPCHTTP_RS_REDIRECT = 1,
    359	RPCHTTP_RS_ACCESS_1,
    360	RPCHTTP_RS_SESSION,
    361	RPCHTTP_RS_ACCESS_2,
    362	RPCHTTP_RS_INTERFACE
    363} RPC_HTTP_REDIRECTOR_STAGE;
    364
    365typedef RPC_STATUS (*RPC_NEW_HTTP_PROXY_CHANNEL)(
    366    RPC_HTTP_REDIRECTOR_STAGE RedirectorStage, unsigned short* ServerName,
    367    unsigned short* ServerPort, unsigned short* RemoteUser, unsigned short* AuthType,
    368    void* ResourceUuid, void* Metadata, void* SessionId, void* Interface, void* Reserved,
    369    unsigned long Flags, unsigned short** NewServerName, unsigned short** NewServerPort);
    370
    371typedef void (*RPC_HTTP_PROXY_FREE_STRING)(unsigned short* String);
    372
    373#define RPC_C_AUTHZ_NONE 0
    374#define RPC_C_AUTHZ_NAME 1
    375#define RPC_C_AUTHZ_DCE 2
    376#define RPC_C_AUTHZ_DEFAULT 0xFFFFFFFF
    377
    378#endif
    379
    380typedef void (*RPC_AUTH_KEY_RETRIEVAL_FN)(void* Arg, unsigned short* ServerPrincName,
    381                                          unsigned long KeyVer, void** Key, RPC_STATUS* pStatus);
    382
    383#define DCE_C_ERROR_STRING_LEN 256
    384
    385typedef I_RPC_HANDLE* RPC_EP_INQ_HANDLE;
    386
    387#define RPC_C_EP_ALL_ELTS 0
    388#define RPC_C_EP_MATCH_BY_IF 1
    389#define RPC_C_EP_MATCH_BY_OBJ 2
    390#define RPC_C_EP_MATCH_BY_BOTH 3
    391
    392#define RPC_C_VERS_ALL 1
    393#define RPC_C_VERS_COMPATIBLE 2
    394#define RPC_C_VERS_EXACT 3
    395#define RPC_C_VERS_MAJOR_ONLY 4
    396#define RPC_C_VERS_UPTO 5
    397
    398typedef int (*RPC_MGMT_AUTHORIZATION_FN)(RPC_BINDING_HANDLE ClientBinding,
    399                                         unsigned long RequestedMgmtOperation, RPC_STATUS* pStatus);
    400
    401#define RPC_C_MGMT_INQ_IF_IDS 0
    402#define RPC_C_MGMT_INQ_PRINC_NAME 1
    403#define RPC_C_MGMT_INQ_STATS 2
    404#define RPC_C_MGMT_IS_SERVER_LISTEN 3
    405#define RPC_C_MGMT_STOP_SERVER_LISTEN 4
    406
    407#define RPC_C_PARM_MAX_PACKET_LENGTH 1
    408#define RPC_C_PARM_BUFFER_LENGTH 2
    409
    410#define RPC_IF_AUTOLISTEN 0x0001
    411#define RPC_IF_OLE 0x0002
    412#define RPC_IF_ALLOW_UNKNOWN_AUTHORITY 0x0004
    413#define RPC_IF_ALLOW_SECURE_ONLY 0x0008
    414#define RPC_IF_ALLOW_CALLBACKS_WITH_NO_AUTH 0x0010
    415#define RPC_IF_ALLOW_LOCAL_ONLY 0x0020
    416#define RPC_IF_SEC_NO_CACHE 0x0040
    417
    418typedef struct _RPC_BINDING_HANDLE_OPTIONS_V1
    419{
    420	unsigned long Version;
    421	unsigned long Flags;
    422	unsigned long ComTimeout;
    423	unsigned long CallTimeout;
    424} RPC_BINDING_HANDLE_OPTIONS_V1, RPC_BINDING_HANDLE_OPTIONS;
    425
    426typedef struct
    427{
    428	unsigned long Version;
    429	unsigned short* ServerPrincName;
    430	unsigned long AuthnLevel;
    431	unsigned long AuthnSvc;
    432	SEC_WINNT_AUTH_IDENTITY* AuthIdentity;
    433	RPC_SECURITY_QOS* SecurityQos;
    434} RPC_BINDING_HANDLE_SECURITY_V1, RPC_BINDING_HANDLE_SECURITY;
    435
    436typedef struct _RPC_BINDING_HANDLE_TEMPLATE
    437{
    438	unsigned long Version;
    439	unsigned long Flags;
    440	unsigned long ProtocolSequence;
    441	unsigned short* NetworkAddress;
    442	unsigned short* StringEndpoint;
    443	union {
    444		unsigned short* Reserved;
    445	} u1;
    446	UUID ObjectUuid;
    447} RPC_BINDING_HANDLE_TEMPLATE_V1, RPC_BINDING_HANDLE_TEMPLATE;
    448
    449#define RPC_CALL_STATUS_IN_PROGRESS 0x01
    450#define RPC_CALL_STATUS_CANCELLED 0x02
    451#define RPC_CALL_STATUS_DISCONNECTED 0x03
    452
    453#include <winpr/ndr.h>
    454#include <winpr/midl.h>
    455
    456#ifdef __cplusplus
    457extern "C"
    458{
    459#endif
    460
    461	WINPR_API RPC_STATUS RpcBindingCopy(RPC_BINDING_HANDLE SourceBinding,
    462	                                    RPC_BINDING_HANDLE* DestinationBinding);
    463	WINPR_API RPC_STATUS RpcBindingFree(RPC_BINDING_HANDLE* Binding);
    464	WINPR_API RPC_STATUS RpcBindingSetOption(RPC_BINDING_HANDLE hBinding, unsigned long option,
    465	                                         ULONG_PTR optionValue);
    466	WINPR_API RPC_STATUS RpcBindingInqOption(RPC_BINDING_HANDLE hBinding, unsigned long option,
    467	                                         ULONG_PTR* pOptionValue);
    468	WINPR_API RPC_STATUS RpcBindingFromStringBindingA(RPC_CSTR StringBinding,
    469	                                                  RPC_BINDING_HANDLE* Binding);
    470	WINPR_API RPC_STATUS RpcBindingFromStringBindingW(RPC_WSTR StringBinding,
    471	                                                  RPC_BINDING_HANDLE* Binding);
    472	WINPR_API RPC_STATUS RpcSsGetContextBinding(void* ContextHandle, RPC_BINDING_HANDLE* Binding);
    473	WINPR_API RPC_STATUS RpcBindingInqObject(RPC_BINDING_HANDLE Binding, UUID* ObjectUuid);
    474	WINPR_API RPC_STATUS RpcBindingReset(RPC_BINDING_HANDLE Binding);
    475	WINPR_API RPC_STATUS RpcBindingSetObject(RPC_BINDING_HANDLE Binding, UUID* ObjectUuid);
    476	WINPR_API RPC_STATUS RpcMgmtInqDefaultProtectLevel(unsigned long AuthnSvc,
    477	                                                   unsigned long* AuthnLevel);
    478	WINPR_API RPC_STATUS RpcBindingToStringBindingA(RPC_BINDING_HANDLE Binding,
    479	                                                RPC_CSTR* StringBinding);
    480	WINPR_API RPC_STATUS RpcBindingToStringBindingW(RPC_BINDING_HANDLE Binding,
    481	                                                RPC_WSTR* StringBinding);
    482	WINPR_API RPC_STATUS RpcBindingVectorFree(RPC_BINDING_VECTOR** BindingVector);
    483	WINPR_API RPC_STATUS RpcStringBindingComposeA(RPC_CSTR ObjUuid, RPC_CSTR Protseq,
    484	                                              RPC_CSTR NetworkAddr, RPC_CSTR Endpoint,
    485	                                              RPC_CSTR Options, RPC_CSTR* StringBinding);
    486	WINPR_API RPC_STATUS RpcStringBindingComposeW(RPC_WSTR ObjUuid, RPC_WSTR Protseq,
    487	                                              RPC_WSTR NetworkAddr, RPC_WSTR Endpoint,
    488	                                              RPC_WSTR Options, RPC_WSTR* StringBinding);
    489	WINPR_API RPC_STATUS RpcStringBindingParseA(RPC_CSTR StringBinding, RPC_CSTR* ObjUuid,
    490	                                            RPC_CSTR* Protseq, RPC_CSTR* NetworkAddr,
    491	                                            RPC_CSTR* Endpoint, RPC_CSTR* NetworkOptions);
    492	WINPR_API RPC_STATUS RpcStringBindingParseW(RPC_WSTR StringBinding, RPC_WSTR* ObjUuid,
    493	                                            RPC_WSTR* Protseq, RPC_WSTR* NetworkAddr,
    494	                                            RPC_WSTR* Endpoint, RPC_WSTR* NetworkOptions);
    495	WINPR_API RPC_STATUS RpcStringFreeA(RPC_CSTR* String);
    496	WINPR_API RPC_STATUS RpcStringFreeW(RPC_WSTR* String);
    497	WINPR_API RPC_STATUS RpcIfInqId(RPC_IF_HANDLE RpcIfHandle, RPC_IF_ID* RpcIfId);
    498	WINPR_API RPC_STATUS RpcNetworkIsProtseqValidA(RPC_CSTR Protseq);
    499	WINPR_API RPC_STATUS RpcNetworkIsProtseqValidW(RPC_WSTR Protseq);
    500	WINPR_API RPC_STATUS RpcMgmtInqComTimeout(RPC_BINDING_HANDLE Binding, unsigned int* Timeout);
    501	WINPR_API RPC_STATUS RpcMgmtSetComTimeout(RPC_BINDING_HANDLE Binding, unsigned int Timeout);
    502	WINPR_API RPC_STATUS RpcMgmtSetCancelTimeout(long Timeout);
    503	WINPR_API RPC_STATUS RpcNetworkInqProtseqsA(RPC_PROTSEQ_VECTORA** ProtseqVector);
    504	WINPR_API RPC_STATUS RpcNetworkInqProtseqsW(RPC_PROTSEQ_VECTORW** ProtseqVector);
    505	WINPR_API RPC_STATUS RpcObjectInqType(UUID* ObjUuid, UUID* TypeUuid);
    506	WINPR_API RPC_STATUS RpcObjectSetInqFn(RPC_OBJECT_INQ_FN* InquiryFn);
    507	WINPR_API RPC_STATUS RpcObjectSetType(UUID* ObjUuid, UUID* TypeUuid);
    508	WINPR_API RPC_STATUS RpcProtseqVectorFreeA(RPC_PROTSEQ_VECTORA** ProtseqVector);
    509	WINPR_API RPC_STATUS RpcProtseqVectorFreeW(RPC_PROTSEQ_VECTORW** ProtseqVector);
    510	WINPR_API RPC_STATUS RpcServerInqBindings(RPC_BINDING_VECTOR** BindingVector);
    511	WINPR_API RPC_STATUS RpcServerInqIf(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid,
    512	                                    RPC_MGR_EPV** MgrEpv);
    513	WINPR_API RPC_STATUS RpcServerListen(unsigned int MinimumCallThreads, unsigned int MaxCalls,
    514	                                     unsigned int DontWait);
    515	WINPR_API RPC_STATUS RpcServerRegisterIf(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid,
    516	                                         RPC_MGR_EPV* MgrEpv);
    517	WINPR_API RPC_STATUS RpcServerRegisterIfEx(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid,
    518	                                           RPC_MGR_EPV* MgrEpv, unsigned int Flags,
    519	                                           unsigned int MaxCalls,
    520	                                           RPC_IF_CALLBACK_FN* IfCallback);
    521	WINPR_API RPC_STATUS RpcServerRegisterIf2(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid,
    522	                                          RPC_MGR_EPV* MgrEpv, unsigned int Flags,
    523	                                          unsigned int MaxCalls, unsigned int MaxRpcSize,
    524	                                          RPC_IF_CALLBACK_FN* IfCallbackFn);
    525	WINPR_API RPC_STATUS RpcServerUnregisterIf(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid,
    526	                                           unsigned int WaitForCallsToComplete);
    527	WINPR_API RPC_STATUS RpcServerUnregisterIfEx(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid,
    528	                                             int RundownContextHandles);
    529	WINPR_API RPC_STATUS RpcServerUseAllProtseqs(unsigned int MaxCalls, void* SecurityDescriptor);
    530	WINPR_API RPC_STATUS RpcServerUseAllProtseqsEx(unsigned int MaxCalls, void* SecurityDescriptor,
    531	                                               PRPC_POLICY Policy);
    532	WINPR_API RPC_STATUS RpcServerUseAllProtseqsIf(unsigned int MaxCalls, RPC_IF_HANDLE IfSpec,
    533	                                               void* SecurityDescriptor);
    534	WINPR_API RPC_STATUS RpcServerUseAllProtseqsIfEx(unsigned int MaxCalls, RPC_IF_HANDLE IfSpec,
    535	                                                 void* SecurityDescriptor, PRPC_POLICY Policy);
    536	WINPR_API RPC_STATUS RpcServerUseProtseqA(RPC_CSTR Protseq, unsigned int MaxCalls,
    537	                                          void* SecurityDescriptor);
    538	WINPR_API RPC_STATUS RpcServerUseProtseqExA(RPC_CSTR Protseq, unsigned int MaxCalls,
    539	                                            void* SecurityDescriptor, PRPC_POLICY Policy);
    540	WINPR_API RPC_STATUS RpcServerUseProtseqW(RPC_WSTR Protseq, unsigned int MaxCalls,
    541	                                          void* SecurityDescriptor);
    542	WINPR_API RPC_STATUS RpcServerUseProtseqExW(RPC_WSTR Protseq, unsigned int MaxCalls,
    543	                                            void* SecurityDescriptor, PRPC_POLICY Policy);
    544	WINPR_API RPC_STATUS RpcServerUseProtseqEpA(RPC_CSTR Protseq, unsigned int MaxCalls,
    545	                                            RPC_CSTR Endpoint, void* SecurityDescriptor);
    546	WINPR_API RPC_STATUS RpcServerUseProtseqEpExA(RPC_CSTR Protseq, unsigned int MaxCalls,
    547	                                              RPC_CSTR Endpoint, void* SecurityDescriptor,
    548	                                              PRPC_POLICY Policy);
    549	WINPR_API RPC_STATUS RpcServerUseProtseqEpW(RPC_WSTR Protseq, unsigned int MaxCalls,
    550	                                            RPC_WSTR Endpoint, void* SecurityDescriptor);
    551	WINPR_API RPC_STATUS RpcServerUseProtseqEpExW(RPC_WSTR Protseq, unsigned int MaxCalls,
    552	                                              RPC_WSTR Endpoint, void* SecurityDescriptor,
    553	                                              PRPC_POLICY Policy);
    554	WINPR_API RPC_STATUS RpcServerUseProtseqIfA(RPC_CSTR Protseq, unsigned int MaxCalls,
    555	                                            RPC_IF_HANDLE IfSpec, void* SecurityDescriptor);
    556	WINPR_API RPC_STATUS RpcServerUseProtseqIfExA(RPC_CSTR Protseq, unsigned int MaxCalls,
    557	                                              RPC_IF_HANDLE IfSpec, void* SecurityDescriptor,
    558	                                              PRPC_POLICY Policy);
    559	WINPR_API RPC_STATUS RpcServerUseProtseqIfW(RPC_WSTR Protseq, unsigned int MaxCalls,
    560	                                            RPC_IF_HANDLE IfSpec, void* SecurityDescriptor);
    561	WINPR_API RPC_STATUS RpcServerUseProtseqIfExW(RPC_WSTR Protseq, unsigned int MaxCalls,
    562	                                              RPC_IF_HANDLE IfSpec, void* SecurityDescriptor,
    563	                                              PRPC_POLICY Policy);
    564	WINPR_API void RpcServerYield(void);
    565	WINPR_API RPC_STATUS RpcMgmtStatsVectorFree(RPC_STATS_VECTOR** StatsVector);
    566	WINPR_API RPC_STATUS RpcMgmtInqStats(RPC_BINDING_HANDLE Binding, RPC_STATS_VECTOR** Statistics);
    567	WINPR_API RPC_STATUS RpcMgmtIsServerListening(RPC_BINDING_HANDLE Binding);
    568	WINPR_API RPC_STATUS RpcMgmtStopServerListening(RPC_BINDING_HANDLE Binding);
    569	WINPR_API RPC_STATUS RpcMgmtWaitServerListen(void);
    570	WINPR_API RPC_STATUS RpcMgmtSetServerStackSize(unsigned long ThreadStackSize);
    571	WINPR_API void RpcSsDontSerializeContext(void);
    572	WINPR_API RPC_STATUS RpcMgmtEnableIdleCleanup(void);
    573	WINPR_API RPC_STATUS RpcMgmtInqIfIds(RPC_BINDING_HANDLE Binding, RPC_IF_ID_VECTOR** IfIdVector);
    574	WINPR_API RPC_STATUS RpcIfIdVectorFree(RPC_IF_ID_VECTOR** IfIdVector);
    575	WINPR_API RPC_STATUS RpcMgmtInqServerPrincNameA(RPC_BINDING_HANDLE Binding,
    576	                                                unsigned long AuthnSvc,
    577	                                                RPC_CSTR* ServerPrincName);
    578	WINPR_API RPC_STATUS RpcMgmtInqServerPrincNameW(RPC_BINDING_HANDLE Binding,
    579	                                                unsigned long AuthnSvc,
    580	                                                RPC_WSTR* ServerPrincName);
    581	WINPR_API RPC_STATUS RpcServerInqDefaultPrincNameA(unsigned long AuthnSvc, RPC_CSTR* PrincName);
    582	WINPR_API RPC_STATUS RpcServerInqDefaultPrincNameW(unsigned long AuthnSvc, RPC_WSTR* PrincName);
    583	WINPR_API RPC_STATUS RpcEpResolveBinding(RPC_BINDING_HANDLE Binding, RPC_IF_HANDLE IfSpec);
    584	WINPR_API RPC_STATUS RpcNsBindingInqEntryNameA(RPC_BINDING_HANDLE Binding,
    585	                                               unsigned long EntryNameSyntax,
    586	                                               RPC_CSTR* EntryName);
    587	WINPR_API RPC_STATUS RpcNsBindingInqEntryNameW(RPC_BINDING_HANDLE Binding,
    588	                                               unsigned long EntryNameSyntax,
    589	                                               RPC_WSTR* EntryName);
    590
    591	WINPR_API RPC_STATUS RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle);
    592	WINPR_API RPC_STATUS RpcRevertToSelfEx(RPC_BINDING_HANDLE BindingHandle);
    593	WINPR_API RPC_STATUS RpcRevertToSelf(void);
    594	WINPR_API RPC_STATUS RpcBindingInqAuthClientA(RPC_BINDING_HANDLE ClientBinding,
    595	                                              RPC_AUTHZ_HANDLE* Privs,
    596	                                              RPC_CSTR* ServerPrincName,
    597	                                              unsigned long* AuthnLevel,
    598	                                              unsigned long* AuthnSvc, unsigned long* AuthzSvc);
    599	WINPR_API RPC_STATUS RpcBindingInqAuthClientW(RPC_BINDING_HANDLE ClientBinding,
    600	                                              RPC_AUTHZ_HANDLE* Privs,
    601	                                              RPC_WSTR* ServerPrincName,
    602	                                              unsigned long* AuthnLevel,
    603	                                              unsigned long* AuthnSvc, unsigned long* AuthzSvc);
    604	WINPR_API RPC_STATUS RpcBindingInqAuthClientExA(RPC_BINDING_HANDLE ClientBinding,
    605	                                                RPC_AUTHZ_HANDLE* Privs,
    606	                                                RPC_CSTR* ServerPrincName,
    607	                                                unsigned long* AuthnLevel,
    608	                                                unsigned long* AuthnSvc,
    609	                                                unsigned long* AuthzSvc, unsigned long Flags);
    610	WINPR_API RPC_STATUS RpcBindingInqAuthClientExW(RPC_BINDING_HANDLE ClientBinding,
    611	                                                RPC_AUTHZ_HANDLE* Privs,
    612	                                                RPC_WSTR* ServerPrincName,
    613	                                                unsigned long* AuthnLevel,
    614	                                                unsigned long* AuthnSvc,
    615	                                                unsigned long* AuthzSvc, unsigned long Flags);
    616	WINPR_API RPC_STATUS RpcBindingInqAuthInfoA(RPC_BINDING_HANDLE Binding,
    617	                                            RPC_CSTR* ServerPrincName,
    618	                                            unsigned long* AuthnLevel, unsigned long* AuthnSvc,
    619	                                            RPC_AUTH_IDENTITY_HANDLE* AuthIdentity,
    620	                                            unsigned long* AuthzSvc);
    621	WINPR_API RPC_STATUS RpcBindingInqAuthInfoW(RPC_BINDING_HANDLE Binding,
    622	                                            RPC_WSTR* ServerPrincName,
    623	                                            unsigned long* AuthnLevel, unsigned long* AuthnSvc,
    624	                                            RPC_AUTH_IDENTITY_HANDLE* AuthIdentity,
    625	                                            unsigned long* AuthzSvc);
    626	WINPR_API RPC_STATUS RpcBindingSetAuthInfoA(RPC_BINDING_HANDLE Binding,
    627	                                            RPC_CSTR ServerPrincName, unsigned long AuthnLevel,
    628	                                            unsigned long AuthnSvc,
    629	                                            RPC_AUTH_IDENTITY_HANDLE AuthIdentity,
    630	                                            unsigned long AuthzSvc);
    631	WINPR_API RPC_STATUS RpcBindingSetAuthInfoExA(RPC_BINDING_HANDLE Binding,
    632	                                              RPC_CSTR ServerPrincName,
    633	                                              unsigned long AuthnLevel, unsigned long AuthnSvc,
    634	                                              RPC_AUTH_IDENTITY_HANDLE AuthIdentity,
    635	                                              unsigned long AuthzSvc,
    636	                                              RPC_SECURITY_QOS* SecurityQos);
    637	WINPR_API RPC_STATUS RpcBindingSetAuthInfoW(RPC_BINDING_HANDLE Binding,
    638	                                            RPC_WSTR ServerPrincName, unsigned long AuthnLevel,
    639	                                            unsigned long AuthnSvc,
    640	                                            RPC_AUTH_IDENTITY_HANDLE AuthIdentity,
    641	                                            unsigned long AuthzSvc);
    642	WINPR_API RPC_STATUS RpcBindingSetAuthInfoExW(RPC_BINDING_HANDLE Binding,
    643	                                              RPC_WSTR ServerPrincName,
    644	                                              unsigned long AuthnLevel, unsigned long AuthnSvc,
    645	                                              RPC_AUTH_IDENTITY_HANDLE AuthIdentity,
    646	                                              unsigned long AuthzSvc,
    647	                                              RPC_SECURITY_QOS* SecurityQOS);
    648	WINPR_API RPC_STATUS RpcBindingInqAuthInfoExA(
    649	    RPC_BINDING_HANDLE Binding, RPC_CSTR* ServerPrincName, unsigned long* AuthnLevel,
    650	    unsigned long* AuthnSvc, RPC_AUTH_IDENTITY_HANDLE* AuthIdentity, unsigned long* AuthzSvc,
    651	    unsigned long RpcQosVersion, RPC_SECURITY_QOS* SecurityQOS);
    652	WINPR_API RPC_STATUS RpcBindingInqAuthInfoExW(
    653	    RPC_BINDING_HANDLE Binding, RPC_WSTR* ServerPrincName, unsigned long* AuthnLevel,
    654	    unsigned long* AuthnSvc, RPC_AUTH_IDENTITY_HANDLE* AuthIdentity, unsigned long* AuthzSvc,
    655	    unsigned long RpcQosVersion, RPC_SECURITY_QOS* SecurityQOS);
    656
    657	WINPR_API RPC_STATUS RpcServerRegisterAuthInfoA(RPC_CSTR ServerPrincName,
    658	                                                unsigned long AuthnSvc,
    659	                                                RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, void* Arg);
    660	WINPR_API RPC_STATUS RpcServerRegisterAuthInfoW(RPC_WSTR ServerPrincName,
    661	                                                unsigned long AuthnSvc,
    662	                                                RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, void* Arg);
    663
    664	WINPR_API RPC_STATUS RpcBindingServerFromClient(RPC_BINDING_HANDLE ClientBinding,
    665	                                                RPC_BINDING_HANDLE* ServerBinding);
    666	WINPR_API DECLSPEC_NORETURN void RpcRaiseException(RPC_STATUS exception);
    667	WINPR_API RPC_STATUS RpcTestCancel(void);
    668	WINPR_API RPC_STATUS RpcServerTestCancel(RPC_BINDING_HANDLE BindingHandle);
    669	WINPR_API RPC_STATUS RpcCancelThread(void* Thread);
    670	WINPR_API RPC_STATUS RpcCancelThreadEx(void* Thread, long Timeout);
    671
    672	WINPR_API RPC_STATUS UuidCreate(UUID* Uuid);
    673	WINPR_API RPC_STATUS UuidCreateSequential(UUID* Uuid);
    674	WINPR_API RPC_STATUS UuidToStringA(const UUID* Uuid, RPC_CSTR* StringUuid);
    675	WINPR_API RPC_STATUS UuidFromStringA(RPC_CSTR StringUuid, UUID* Uuid);
    676	WINPR_API RPC_STATUS UuidToStringW(const UUID* Uuid, RPC_WSTR* StringUuid);
    677	WINPR_API RPC_STATUS UuidFromStringW(RPC_WSTR StringUuid, UUID* Uuid);
    678	WINPR_API signed int UuidCompare(const UUID* Uuid1, const UUID* Uuid2, RPC_STATUS* Status);
    679	WINPR_API RPC_STATUS UuidCreateNil(UUID* NilUuid);
    680	WINPR_API int UuidEqual(const UUID* Uuid1, const UUID* Uuid2, RPC_STATUS* Status);
    681	WINPR_API unsigned short UuidHash(const UUID* Uuid, RPC_STATUS* Status);
    682	WINPR_API int UuidIsNil(const UUID* Uuid, RPC_STATUS* Status);
    683
    684	WINPR_API RPC_STATUS RpcEpRegisterNoReplaceA(RPC_IF_HANDLE IfSpec,
    685	                                             RPC_BINDING_VECTOR* BindingVector,
    686	                                             UUID_VECTOR* UuidVector, RPC_CSTR Annotation);
    687	WINPR_API RPC_STATUS RpcEpRegisterNoReplaceW(RPC_IF_HANDLE IfSpec,
    688	                                             RPC_BINDING_VECTOR* BindingVector,
    689	                                             UUID_VECTOR* UuidVector, RPC_WSTR Annotation);
    690	WINPR_API RPC_STATUS RpcEpRegisterA(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector,
    691	                                    UUID_VECTOR* UuidVector, RPC_CSTR Annotation);
    692	WINPR_API RPC_STATUS RpcEpRegisterW(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector,
    693	                                    UUID_VECTOR* UuidVector, RPC_WSTR Annotation);
    694	WINPR_API RPC_STATUS RpcEpUnregister(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector,
    695	                                     UUID_VECTOR* UuidVector);
    696
    697	WINPR_API RPC_STATUS DceErrorInqTextA(RPC_STATUS RpcStatus, RPC_CSTR ErrorText);
    698	WINPR_API RPC_STATUS DceErrorInqTextW(RPC_STATUS RpcStatus, RPC_WSTR ErrorText);
    699
    700	WINPR_API RPC_STATUS RpcMgmtEpEltInqBegin(RPC_BINDING_HANDLE EpBinding,
    701	                                          unsigned long InquiryType, RPC_IF_ID* IfId,
    702	                                          unsigned long VersOption, UUID* ObjectUuid,
    703	                                          RPC_EP_INQ_HANDLE* InquiryContext);
    704	WINPR_API RPC_STATUS RpcMgmtEpEltInqDone(RPC_EP_INQ_HANDLE* InquiryContext);
    705	WINPR_API RPC_STATUS RpcMgmtEpEltInqNextA(RPC_EP_INQ_HANDLE InquiryContext, RPC_IF_ID* IfId,
    706	                                          RPC_BINDING_HANDLE* Binding, UUID* ObjectUuid,
    707	                                          RPC_CSTR* Annotation);
    708	WINPR_API RPC_STATUS RpcMgmtEpEltInqNextW(RPC_EP_INQ_HANDLE InquiryContext, RPC_IF_ID* IfId,
    709	                                          RPC_BINDING_HANDLE* Binding, UUID* ObjectUuid,
    710	                                          RPC_WSTR* Annotation);
    711	WINPR_API RPC_STATUS RpcMgmtEpUnregister(RPC_BINDING_HANDLE EpBinding, RPC_IF_ID* IfId,
    712	                                         RPC_BINDING_HANDLE Binding, UUID* ObjectUuid);
    713	WINPR_API RPC_STATUS RpcMgmtSetAuthorizationFn(RPC_MGMT_AUTHORIZATION_FN AuthorizationFn);
    714
    715	WINPR_API RPC_STATUS RpcServerInqBindingHandle(RPC_BINDING_HANDLE* Binding);
    716
    717#ifdef __cplusplus
    718}
    719#endif
    720
    721#endif
    722
    723#endif /* WINPR_RPC_H */