' ########################################################################################
' Microsoft Windows
' File: RpcDce.inc
' Contents: DCE RPC runtime APIs.
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_RpcDce_PBI)
#DEFINE PBX_RpcDce_PBI
%EQUATE `RPCDCE_INC = 1
#INCLUDE ONCE "Legacy/System/BaseTsd.inc" ' for MAXUINT_PTR
'/*typedef char small;*/
'/*typedef unsigned char byte;*/
'/*typedef unsigned char boolean;*/
'#include <specstrings.h>
'typedef __nullterminated unsigned char __RPC_FAR * RPC_CSTR;
'#if defined(RPC_USE_NATIVE_WCHAR) && defined(_NATIVE_WCHAR_T_DEFINED)
'typedef __nullterminated wchar_t __RPC_FAR * RPC_WSTR;
'typedef __nullterminated const wchar_t * RPC_CWSTR;
'#else
'typedef __nullterminated unsigned short __RPC_FAR * RPC_WSTR;
'typedef __nullterminated const unsigned short * RPC_CWSTR;
'#endif
'typedef I_RPC_HANDLE RPC_BINDING_HANDLE;
'typedef RPC_BINDING_HANDLE handle_t;
'#define rpc_binding_handle_t RPC_BINDING_HANDLE
#IF NOT %DEF(%GUIDDEF_INC)
%EQUATE `GUIDDEF_INC = 1
#INCLUDE ONCE "Legacy/UI/Guiddef.inc"
#ENDIF ' /* GUID_DEFINED */
'#ifndef UUID_DEFINED
'#define UUID_DEFINED
'typedef GUID UUID;
'#ifndef uuid_t
'#define uuid_t UUID
'#endif
'#endif
' // Size = 8 bytes
TYPE RPC_BINDING_VECTOR DWORD
 Count AS DWORD ' unsigned long
 BindingH(0) AS DWORD ' RPC_BINDING_HANDLE
END TYPE
' // Size = 8 bytes
TYPE UUID_VECTOR DWORD
 Count AS DWORD ' unsigned long
 Uuind(0) AS GUID PTR ' UUID *Uuid[1];
END TYPE
'typedef void * RPC_IF_HANDLE;
#IF NOT %DEF(%IFID_DEFINED)
%EQUATE `IFID_DEFINED = 1
' // Size = 20 bytes
TYPE RPC_IF_ID WORD
 Uuid AS GUID ' UUID
 VersMajor AS WORD ' unsigned short
 VersMinor AS WORD ' unsigned short
END TYPE
#ENDIF
%EQUATE `RPC_C_BINDING_INFINITE_TIMEOUT = 10
%EQUATE `RPC_C_BINDING_MIN_TIMEOUT = 0
%EQUATE `RPC_C_BINDING_DEFAULT_TIMEOUT = 5
%EQUATE `RPC_C_BINDING_MAX_TIMEOUT = 9
%EQUATE `RPC_C_CANCEL_INFINITE_TIMEOUT = -1
%EQUATE `RPC_C_LISTEN_MAX_CALLS_DEFAULT = 1234
%EQUATE `RPC_C_PROTSEQ_MAX_REQS_DEFAULT = 10
'// RPC_POLICY EndpointFlags.
%EQUATE `RPC_C_BIND_TO_ALL_NICS = 1
%EQUATE `RPC_C_USE_INTERNET_PORT = &H1
%EQUATE `RPC_C_USE_INTRANET_PORT = &H2
%EQUATE `RPC_C_DONT_FAIL = &H4
'#if (NTDDI_VERSION < NTDDI_VISTA)
'// RPC_POLICY EndpointFlags specific to the Falcon/RPC transport (deprecated for Vista)
%EQUATE `RPC_C_MQ_TEMPORARY = &H0000
%EQUATE `RPC_C_MQ_PERMANENT = &H0001
%EQUATE `RPC_C_MQ_CLEAR_ON_OPEN = &H0002
%EQUATE `RPC_C_MQ_USE_EXISTING_SECURITY = &H0004
%EQUATE `RPC_C_MQ_AUTHN_LEVEL_NONE = &H0000
%EQUATE `RPC_C_MQ_AUTHN_LEVEL_PKT_INTEGRITY = &H0008
%EQUATE `RPC_C_MQ_AUTHN_LEVEL_PKT_PRIVACY = &H0010
'// Falcon/Rpc options are deprecated from Vista
%EQUATE `RPC_C_MQ_EXPRESS = 0 ' // Client: RPC_C_MQ_DELIVERY.
%EQUATE `RPC_C_MQ_RECOVERABLE = 1
%EQUATE `RPC_C_MQ_JOURNAL_NONE = 0 ' // Client: RPC_C_MQ_JOURNAL.
%EQUATE `RPC_C_MQ_JOURNAL_DEADLETTER = 1
%EQUATE `RPC_C_MQ_JOURNAL_ALWAYS = 2
'// Client: RpcBindingSetOption() values for the Falcon/RPC transport:
%EQUATE `RPC_C_OPT_MQ_DELIVERY = 1
%EQUATE `RPC_C_OPT_MQ_PRIORITY = 2
%EQUATE `RPC_C_OPT_MQ_JOURNAL = 3
%EQUATE `RPC_C_OPT_MQ_ACKNOWLEDGE = 4
%EQUATE `RPC_C_OPT_MQ_AUTHN_SERVICE = 5
%EQUATE `RPC_C_OPT_MQ_AUTHN_LEVEL = 6
%EQUATE `RPC_C_OPT_MQ_TIME_TO_REACH_QUEUE = 7
%EQUATE `RPC_C_OPT_MQ_TIME_TO_BE_RECEIVED = 8
'#endif // (NTDDI_VERSION < NTDDI_VISTA)
%EQUATE `RPC_C_OPT_BINDING_NONCAUSAL = 9
%EQUATE `RPC_C_OPT_SECURITY_CALLBACK = 10
%EQUATE `RPC_C_OPT_UNIQUE_BINDING = 11
'#if (NTDDI_VERSION <= NTDDI_WIN2K)
'#define RPC_C_OPT_MAX_OPTIONS 12
'#elif (NTDDI_VERSION <= NTDDI_WS03)
%EQUATE `RPC_C_OPT_CALL_TIMEOUT = 12
%EQUATE `RPC_C_OPT_DONT_LINGER = 13
'%RPC_C_OPT_MAX_OPTIONS = 14
'#else
%EQUATE `RPC_C_OPT_TRANS_SEND_BUFFER_SIZE = 5
%EQUATE `RPC_C_OPT_CALL_TIMEOUT = 12
%EQUATE `RPC_C_OPT_DONT_LINGER = 13
%EQUATE `RPC_C_OPT_TRUST_PEER = 14
%EQUATE `RPC_C_OPT_ASYNC_BLOCK = 15
%EQUATE `RPC_C_OPT_OPTIMIZE_TIME = 16
'%RPC_C_OPT_MAX_OPTIONS = 17
'#endif // (NTDDI_VERSION <= NTDDI_WIN2K)
'// flags for RpcServerInqAuthClientEx
'//
%EQUATE `RPC_C_FULL_CERT_CHAIN = &H0001
' // Size = 8 bytes
TYPE RPC_PROTSEQ_VECTORA DWORD
 Count AS DWORD ' unsigned int
 Protseq(0) AS BYTE PTR ' unsigned char *
END TYPE
' // Size = 8 bytes
TYPE RPC_PROTSEQ_VECTORW DWORD
 Count AS DWORD ' unsigned int
 Protseq(0) AS WORD PTR ' unsigned short *
END TYPE
#IF %DEF(%UNICODE)
 MACRO RPC_PROTSEQ_VECTOR = RPC_PROTSEQ_VECTORW
#ELSE
 MACRO RPC_PROTSEQ_VECTOR = RPC_PROTSEQ_VECTORA
#ENDIF
' // Size = 12 bytes
TYPE RPC_POLICY DWORD
 Length AS DWORD ' unsigned int
 EndpointFlags AS DWORD ' unsigned long
 NICFlags AS DWORD ' unsigned long
END TYPE
'typedef void __RPC_USER
'RPC_OBJECT_INQ_FN (
' IN UUID * ObjectUuid,
' OUT UUID * TypeUuid,
' OUT RPC_STATUS * Status
' );
'typedef RPC_STATUS RPC_ENTRY
'RPC_IF_CALLBACK_FN (
' IN RPC_IF_HANDLE InterfaceUuid,
' IN void *Context
' ) ;
'typedef void RPC_ENTRY
'RPC_SECURITY_CALLBACK_FN (
' IN void *Context
' ) ;
'#define RPC_MGR_EPV void
' // Size = 8 bytes
TYPE RPC_STATS_VECTOR DWORD
 Count AS DWORD ' unsigned int
 Stats(0) AS DWORD ' unsigned long
END TYPE
%EQUATE `RPC_C_STATS_CALLS_IN = 0
%EQUATE `RPC_C_STATS_CALLS_OUT = 1
%EQUATE `RPC_C_STATS_PKTS_IN = 2
%EQUATE `RPC_C_STATS_PKTS_OUT = 3
' // Size = 8 bytes
TYPE RPC_IF_ID_VECTOR DWORD
 Count AS DWORD ' unsigned long
 IfId(0) AS RPC_IF_ID PTR ' RPC_IF_ID *
END TYPE
'/* client */
DECLARE FUNCTION RpcBindingCopy LIB "rpcrt4.dll" ALIAS "RpcBindingCopy" ( BYVAL SourceBinding AS QUAD , BYREF DestinationBinding AS QUAD ) AS LONG ' RPC_STATUS
'/* client */
DECLARE FUNCTION RpcBindingFree LIB "rpcrt4.dll" ALIAS "RpcBindingFree" ( BYREF Binding AS QUAD ) AS LONG ' RPC_STATUS
'/* client */
DECLARE FUNCTION RpcBindingSetOption LIB "rpcrt4.dll" ALIAS "RpcBindingSetOption" ( BYVAL hBinding AS QUAD , BYVAL option AS QUAD , BYVAL optionValue AS QUAD ) AS LONG ' RPC_STATUS
'/* client */
DECLARE FUNCTION RpcBindingInqOption LIB "rpcrt4.dll" ALIAS "RpcBindingInqOption" ( BYVAL hBinding AS QUAD , BYVAL option AS QUAD , BYREF pOptionValue AS QUAD ) AS LONG ' RPC_STATUS
'/* client */
'#if !defined(_KRPCENV_)
DECLARE FUNCTION RpcBindingFromStringBindingA LIB "rpcrt4.dll" ALIAS "RpcBindingFromStringBindingA" ( BYREF StringBinding AS ASCIIZ , BYREF Binding AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcBindingFromStringBindingW LIB "rpcrt4.dll" ALIAS "RpcBindingFromStringBindingW" ( BYREF StringBinding AS WSTRINGZ , BYREF Binding AS QUAD ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcBindingFromStringBinding = RpcBindingFromStringBindingW
#ELSE
 MACRO RpcBindingFromStringBinding = RpcBindingFromStringBindingA
#ENDIF
'#endif /* _KRPCENV_ */
'/* client */
DECLARE FUNCTION RpcSsGetContextBinding LIB "rpcrt4.dll" ALIAS "RpcSsGetContextBinding" ( BYVAL ContextHandle AS QUAD , BYREF Binding AS QUAD ) AS LONG ' RPC_STATUS
'/* client/server */
DECLARE FUNCTION RpcBindingInqObject LIB "rpcrt4.dll" ALIAS "RpcBindingInqObject" ( BYVAL Binding AS QUAD , BYREF ObjectUuid AS GUID ) AS LONG ' RPC_STATUS
'/* client */
DECLARE FUNCTION RpcBindingReset LIB "rpcrt4.dll" ALIAS "RpcBindingReset" ( BYVAL Binding AS QUAD ) AS LONG ' RPC_STATUS
'/* RpcBindingServerFromClient : UNSUPPORTED */
'/* RpcBindingSetAuthInfo */
'/* client */
DECLARE FUNCTION RpcBindingSetObject LIB "rpcrt4.dll" ALIAS "RpcBindingSetObject" ( BYVAL Binding AS QUAD , BYREF ObjectUuid AS GUID ) AS LONG ' RPC_STATUS
'/* client/server */
DECLARE FUNCTION RpcMgmtInqDefaultProtectLevel LIB "rpcrt4.dll" ALIAS "RpcMgmtInqDefaultProtectLevel" ( BYVAL AuthnSvc AS QUAD , BYREF AuthnLevel AS QUAD ) AS LONG ' RPC_STATUS
'/* client/server */
DECLARE FUNCTION RpcBindingToStringBindingA LIB "rpcrt4.dll" ALIAS "RpcBindingToStringBindingA" ( BYVAL Binding AS QUAD , BYREF StringBinding AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcBindingToStringBindingW LIB "rpcrt4.dll" ALIAS "RpcBindingToStringBindingW" ( BYVAL Binding AS QUAD , BYREF StringBinding AS QUAD ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcBindingToStringBinding = RpcBindingToStringBindingW
#ELSE
 MACRO RpcBindingToStringBinding = RpcBindingToStringBindingA
#ENDIF
'/* client/server */
DECLARE FUNCTION RpcBindingVectorFree LIB "rpcrt4.dll" ALIAS "RpcBindingVectorFree" ( BYREF BindingVector AS RPC_BINDING_VECTOR ) AS LONG ' RPC_STATUS
'/* client/server */
'#if !defined(_KRPCENV_)
DECLARE FUNCTION RpcStringBindingComposeA LIB "rpcrt4.dll" ALIAS "RpcStringBindingComposeA" ( BYREF ObjUuid AS ASCIIZ , BYREF Protseq AS ASCIIZ , BYREF NetworkAddr AS ASCIIZ , BYREF Endpoint AS ASCIIZ , BYREF Options AS ASCIIZ , BYREF StringBinding AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcStringBindingComposeW LIB "rpcrt4.dll" ALIAS "RpcStringBindingComposeW" ( BYREF ObjUuid AS WSTRINGZ , BYREF Protseq AS WSTRINGZ , BYREF NetworkAddr AS WSTRINGZ , BYREF Endpoint AS WSTRINGZ , BYREF Options AS WSTRINGZ , BYREF StringBinding AS QUAD ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcStringBindingCompose = RpcStringBindingComposeW
#ELSE
 MACRO RpcStringBindingCompose = RpcStringBindingComposeA
#ENDIF
'/* client/server */
DECLARE FUNCTION RpcStringBindingParseA LIB "rpcrt4.dll" ALIAS "RpcStringBindingParseA" ( BYREF StringBinding AS ASCIIZ , BYREF ObjUuid AS QUAD , BYREF Protseq AS QUAD , BYREF NetworkAddr AS QUAD , BYREF Endpoint AS QUAD , BYREF NetworkOptions AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcStringBindingParseW LIB "rpcrt4.dll" ALIAS "RpcStringBindingParseW" ( BYREF StringBinding AS WSTRINGZ , BYREF ObjUuid AS QUAD , BYREF Protseq AS QUAD , BYREF NetworkAddr AS QUAD , BYREF Endpoint AS QUAD , BYREF NetworkOptions AS QUAD ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcStringBindingParse = RpcStringBindingParseW
#ELSE
 MACRO RpcStringBindingParse = RpcStringBindingParseA
#ENDIF
'#endif /* _KRPCENV_ */
'/* client/server */
DECLARE FUNCTION RpcStringFreeA LIB "rpcrt4.dll" ALIAS "RpcStringFreeA" ( BYREF String AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcStringFreeW LIB "rpcrt4.dll" ALIAS "RpcStringFreeW" ( BYREF String AS QUAD ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcStringFree = RpcStringFreeW
#ELSE
 MACRO RpcStringFree = RpcStringFreeA
#ENDIF
'/* client/server */
DECLARE FUNCTION RpcIfInqId LIB "rpcrt4.dll" ALIAS "RpcIfInqId" ( BYVAL RpcIfHandle AS QUAD , BYREF RpcIfId AS RPC_IF_ID ) AS LONG ' RPC_STATUS
'/* client/server */
DECLARE FUNCTION RpcNetworkIsProtseqValidA LIB "rpcrt4.dll" ALIAS "RpcNetworkIsProtseqValidA" ( BYREF Protseq AS ASCIIZ ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcNetworkIsProtseqValidW LIB "rpcrt4.dll" ALIAS "RpcNetworkIsProtseqValidW" ( BYREF Protseq AS WSTRINGZ ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcNetworkIsProtseqValid = RpcNetworkIsProtseqValidW
#ELSE
 MACRO RpcNetworkIsProtseqValid = RpcNetworkIsProtseqValidA
#ENDIF
'/* client */
DECLARE FUNCTION RpcMgmtInqComTimeout LIB "rpcrt4.dll" ALIAS "RpcMgmtInqComTimeout" ( BYVAL Binding AS QUAD , BYREF Timeout AS QUAD ) AS LONG ' RPC_STATUS
'/* client */
DECLARE FUNCTION RpcMgmtSetComTimeout LIB "rpcrt4.dll" ALIAS "RpcMgmtSetComTimeout" ( BYVAL Binding AS QUAD , BYVAL Timeout AS QUAD ) AS LONG ' RPC_STATUS
'/* client */
DECLARE FUNCTION RpcMgmtSetCancelTimeout LIB "rpcrt4.dll" ALIAS "RpcMgmtSetCancelTimeout" ( BYVAL Timeout AS LONG ' long Timeout ) AS LONG ' RPC_STATUS
'/* server */
DECLARE FUNCTION RpcNetworkInqProtseqsA LIB "rpcrt4.dll" ALIAS "RpcNetworkInqProtseqsA" ( BYREF ProtseqVector AS RPC_PROTSEQ_VECTORA ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcNetworkInqProtseqsW LIB "rpcrt4.dll" ALIAS "RpcNetworkInqProtseqsW" ( BYREF ProtseqVector AS RPC_PROTSEQ_VECTORW ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcNetworkInqProtseqs = RpcNetworkInqProtseqsW
#ELSE
 MACRO RpcNetworkInqProtseqs = RpcNetworkInqProtseqsA
#ENDIF
'/* server */
DECLARE FUNCTION RpcObjectInqType LIB "rpcrt4.dll" ALIAS "RpcObjectInqType" ( BYREF ObjUuid AS GUID , BYREF TypeUuid AS GUID ) AS LONG ' RPC_STATUS
'/* server */
DECLARE FUNCTION RpcObjectSetInqFn LIB "rpcrt4.dll" ALIAS "RpcObjectSetInqFn" ( BYVAL InquiryFn AS QUAD ) AS LONG ' RPC_STATUS
'/* server */
DECLARE FUNCTION RpcObjectSetType LIB "rpcrt4.dll" ALIAS "RpcObjectSetType" ( BYREF ObjUuid AS GUID , BYREF TypeUuid AS GUID ) AS LONG ' RPC_STATUS
'/* server */
DECLARE FUNCTION RpcProtseqVectorFreeA LIB "rpcrt4.dll" ALIAS "RpcProtseqVectorFreeA" ( BYREF ProtseqVector AS RPC_PROTSEQ_VECTORA ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcProtseqVectorFreeW LIB "rpcrt4.dll" ALIAS "RpcProtseqVectorFreeW" ( BYREF ProtseqVector AS RPC_PROTSEQ_VECTORW ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcProtseqVectorFree = RpcProtseqVectorFreeW
#ELSE
 MACRO RpcProtseqVectorFree = RpcProtseqVectorFreeA
#ENDIF
'/* server */
DECLARE FUNCTION RpcServerInqBindings LIB "rpcrt4.dll" ALIAS "RpcServerInqBindings" ( BYREF BindingVector AS RPC_BINDING_VECTOR ) AS LONG ' RPC_STATUS
'/* server */
DECLARE FUNCTION RpcServerInqIf LIB "rpcrt4.dll" ALIAS "RpcServerInqIf" ( BYVAL IfSpec AS QUAD , BYREF MgrTypeUuid AS GUID , BYREF MgrEpv AS QUAD ) AS LONG ' RPC_STATUS
'/* server */
DECLARE FUNCTION RpcServerListen LIB "rpcrt4.dll" ALIAS "RpcServerListen" ( BYVAL MinimumCallThreads AS QUAD , BYVAL MaxCalls AS QUAD , BYVAL DontWait AS QUAD ) AS LONG ' RPC_STATUS
'/* server */
DECLARE FUNCTION RpcServerRegisterIf LIB "rpcrt4.dll" ALIAS "RpcServerRegisterIf" ( BYVAL IfSpec AS QUAD , BYREF MgrTypeUuid AS GUID , BYVAL MgrEpv AS QUAD ) AS LONG ' RPC_STATUS
'/* server */
DECLARE FUNCTION RpcServerRegisterIfEx LIB "rpcrt4.dll" ALIAS "RpcServerRegisterIfEx" ( BYVAL IfSpec AS QUAD , BYREF MgrTypeUuid AS GUID , BYVAL MgrEpv AS QUAD , BYVAL Flags AS QUAD , BYVAL MaxCalls AS QUAD , BYVAL IfCallback AS QUAD ) AS LONG ' RPC_STATUS
'/* server */
DECLARE FUNCTION RpcServerRegisterIf2 LIB "rpcrt4.dll" ALIAS "RpcServerRegisterIf2" ( BYVAL IfSpec AS QUAD , BYREF MgrTypeUuid AS GUID , BYVAL MgrEpv AS QUAD , BYVAL Flags AS QUAD , BYVAL MaxCalls AS QUAD , BYVAL MaxRpcSize AS QUAD , BYVAL IfCallback AS QUAD ) AS LONG ' RPC_STATUS
'/* server */
DECLARE FUNCTION RpcServerUnregisterIf LIB "rpcrt4.dll" ALIAS "RpcServerUnregisterIf" ( BYVAL IfSpec AS QUAD , BYREF MgrTypeUuid AS GUID , BYVAL WaitForCallsToComplete AS QUAD ) AS LONG ' RPC_STATUS
'/* server */
'#if (NTDDI_VERSION >= NTDDI_WINXP)
DECLARE FUNCTION RpcServerUnregisterIfEx LIB "rpcrt4.dll" ALIAS "RpcServerUnregisterIfEx" ( BYVAL IfSpec AS QUAD , BYREF MgrTypeUuid AS GUID , BYVAL RundownContextHandles AS QUAD ) AS LONG ' RPC_STATUS
'#endif // (NTDDI_VERSION >= NTDDI_WINXP)
'/* server */
DECLARE FUNCTION RpcServerUseAllProtseqs LIB "rpcrt4.dll" ALIAS "RpcServerUseAllProtseqs" ( BYVAL MaxCalls AS QUAD , BYVAL SecurityDescriptor AS QUAD ) AS LONG ' RPC_STATUS
'/* server */
DECLARE FUNCTION RpcServerUseAllProtseqsEx LIB "rpcrt4.dll" ALIAS "RpcServerUseAllProtseqsEx" ( BYVAL MaxCalls AS QUAD , BYVAL SecurityDescriptor AS QUAD , BYREF Policy AS RPC_POLICY ) AS LONG ' RPC_STATUS
'/* server */
DECLARE FUNCTION RpcServerUseAllProtseqsIf LIB "rpcrt4.dll" ALIAS "RpcServerUseAllProtseqsIf" ( BYVAL MaxCalls AS QUAD , BYVAL IfSpec AS QUAD , BYVAL SecurityDescriptor AS QUAD ) AS LONG ' RPC_STATUS
'/* server */
DECLARE FUNCTION RpcServerUseAllProtseqsIfEx LIB "rpcrt4.dll" ALIAS "RpcServerUseAllProtseqsIfEx" ( BYVAL MaxCalls AS QUAD , BYVAL IfSpec AS QUAD , BYVAL SecurityDescriptor AS QUAD , BYREF Policy AS RPC_POLICY ) AS LONG ' RPC_STATUS
'/* server */
DECLARE FUNCTION RpcServerUseProtseqA LIB "rpcrt4.dll" ALIAS "RpcServerUseProtseqA" ( BYREF Protseq AS ASCIIZ , BYVAL MaxCalls AS QUAD , BYVAL SecurityDescriptor AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcServerUseProtseqW LIB "rpcrt4.dll" ALIAS "RpcServerUseProtseqW" ( BYREF Protseq AS ASCIIZ , BYVAL MaxCalls AS QUAD , BYVAL SecurityDescriptor AS QUAD ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcServerUseProtseq = RpcServerUseProtseqW
#ELSE
 MACRO RpcServerUseProtseq = RpcServerUseProtseqA
#ENDIF
DECLARE FUNCTION RpcServerUseProtseqExA LIB "rpcrt4.dll" ALIAS "RpcServerUseProtseqExA" ( BYREF Protseq AS ASCIIZ , BYVAL MaxCalls AS QUAD , BYVAL SecurityDescriptor AS QUAD , BYREF Policy AS RPC_POLICY ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcServerUseProtseqExW LIB "rpcrt4.dll" ALIAS "RpcServerUseProtseqExW" ( BYREF Protseq AS WSTRINGZ , BYVAL MaxCalls AS QUAD , BYVAL SecurityDescriptor AS QUAD , BYREF Policy AS RPC_POLICY ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcServerUseProtseqEx = RpcServerUseProtseqExW
#ELSE
 MACRO RpcServerUseProtseqEx = RpcServerUseProtseqExA
#ENDIF
'/* server */
DECLARE FUNCTION RpcServerUseProtseqEpA LIB "rpcrt4.dll" ALIAS "RpcServerUseProtseqEpA" ( BYREF Protseq AS ASCIIZ , BYVAL MaxCalls AS QUAD , BYREF Endpoint AS ASCIIZ , BYVAL SecurityDescriptor AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcServerUseProtseqEpW LIB "rpcrt4.dll" ALIAS "RpcServerUseProtseqEpW" ( BYREF Protseq AS WSTRINGZ , BYVAL MaxCalls AS QUAD , BYREF Endpoint AS WSTRINGZ , BYVAL SecurityDescriptor AS QUAD ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcServerUseProtseqEp = RpcServerUseProtseqEpW
#ELSE
 MACRO RpcServerUseProtseqEp = RpcServerUseProtseqEpA
#ENDIF
DECLARE FUNCTION RpcServerUseProtseqEpExA LIB "rpcrt4.dll" ALIAS "RpcServerUseProtseqEpExA" ( BYREF Protseq AS ASCIIZ , BYVAL MaxCalls AS QUAD , BYREF Endpoint AS ASCIIZ , BYVAL SecurityDescriptor AS QUAD , BYREF Policy AS RPC_POLICY ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcServerUseProtseqEpExW LIB "rpcrt4.dll" ALIAS "RpcServerUseProtseqEpExW" ( BYREF Protseq AS WSTRINGZ , BYVAL MaxCalls AS QUAD , BYREF Endpoint AS WSTRINGZ , BYVAL SecurityDescriptor AS QUAD , BYREF Policy AS RPC_POLICY ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcServerUseProtseqEpEx = RpcServerUseProtseqEpExW
#ELSE
 MACRO RpcServerUseProtseqEpEx = RpcServerUseProtseqEpExA
#ENDIF
'/* server */
DECLARE FUNCTION RpcServerUseProtseqIfA LIB "rpcrt4.dll" ALIAS "RpcServerUseProtseqIfA" ( BYREF Protseq AS ASCIIZ , BYVAL MaxCalls AS QUAD , BYVAL IfSpec AS QUAD , BYVAL SecurityDescriptor AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcServerUseProtseqIfW LIB "rpcrt4.dll" ALIAS "RpcServerUseProtseqIfW" ( BYREF Protseq AS WSTRINGZ , BYVAL MaxCalls AS QUAD , BYVAL IfSpec AS QUAD , BYVAL SecurityDescriptor AS QUAD ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcServerUseProtseqIf = RpcServerUseProtseqIfW
#ELSE
 MACRO RpcServerUseProtseqIf = RpcServerUseProtseqIfA
#ENDIF
DECLARE FUNCTION RpcServerUseProtseqIfExA LIB "rpcrt4.dll" ALIAS "RpcServerUseProtseqIfExA" ( BYREF Protseq AS ASCIIZ , BYVAL MaxCalls AS QUAD , BYVAL IfSpec AS QUAD , BYVAL SecurityDescriptor AS QUAD , BYREF Policy AS RPC_POLICY ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcServerUseProtseqIfExW LIB "rpcrt4.dll" ALIAS "RpcServerUseProtseqIfExW" ( BYREF Protseq AS WSTRINGZ , BYVAL MaxCalls AS QUAD , BYVAL IfSpec AS QUAD , BYVAL SecurityDescriptor AS QUAD , BYREF Policy AS RPC_POLICY ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcServerUseProtseqIfEx = RpcServerUseProtseqIfExW
#ELSE
 MACRO RpcServerUseProtseqIfEx = RpcServerUseProtseqIfExA
#ENDIF
DECLARE SUB RpcServerYield LIB "rpcrt4.dll" ALIAS "RpcServerYield" () ' void
'/* server */
DECLARE FUNCTION RpcMgmtStatsVectorFree LIB "rpcrt4.dll" ALIAS "RpcMgmtStatsVectorFree" ( BYREF StatsVector AS RPC_STATS_VECTOR ) AS LONG ' RPC_STATUS
'/* server */
DECLARE FUNCTION RpcMgmtInqStats LIB "rpcrt4.dll" ALIAS "RpcMgmtInqStats" ( BYVAL Binding AS QUAD , BYREF Statistics AS RPC_STATS_VECTOR ) AS LONG ' RPC_STATUS
'/* server */
DECLARE FUNCTION RpcMgmtIsServerListening LIB "rpcrt4.dll" ALIAS "RpcMgmtIsServerListening" ( BYVAL Binding AS QUAD ) AS LONG ' RPC_STATUS
'/* server */
DECLARE FUNCTION RpcMgmtStopServerListening LIB "rpcrt4.dll" ALIAS "RpcMgmtStopServerListening" ( BYVAL Binding AS QUAD ) AS LONG ' RPC_STATUS
'/* server */
DECLARE SUB RpcMgmtWaitServerListen LIB "rpcrt4.dll" ALIAS "RpcMgmtWaitServerListen" () ' void
'/* server */
DECLARE FUNCTION RpcMgmtSetServerStackSize LIB "rpcrt4.dll" ALIAS "RpcMgmtSetServerStackSize" ( BYVAL ThreadStackSize AS QUAD ) AS LONG ' RPC_STATUS
'/* server */
DECLARE SUB RpcSsDontSerializeContext LIB "rpcrt4.dll" ALIAS "RpcSsDontSerializeContext" () ' void
'/* client */
DECLARE FUNCTION RpcMgmtEnableIdleCleanup LIB "rpcrt4.dll" ALIAS "RpcMgmtEnableIdleCleanup" ( ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcMgmtInqIfIds LIB "rpcrt4.dll" ALIAS "RpcMgmtInqIfIds" ( BYVAL Binding AS QUAD , BYREF IfIdVector AS RPC_IF_ID_VECTOR ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcIfIdVectorFree LIB "rpcrt4.dll" ALIAS "RpcIfIdVectorFree" ( BYREF IfIdVector AS RPC_IF_ID_VECTOR ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcMgmtInqServerPrincNameA LIB "rpcrt4.dll" ALIAS "RpcMgmtInqServerPrincNameA" ( BYVAL Binding AS QUAD , BYVAL AuthnSvc AS QUAD , BYREF ServerPrincName AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcMgmtInqServerPrincNameW LIB "rpcrt4.dll" ALIAS "RpcMgmtInqServerPrincNameW" ( BYVAL Binding AS QUAD , BYVAL AuthnSvc AS QUAD , BYREF ServerPrincName AS QUAD ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcMgmtInqServerPrincName = RpcMgmtInqServerPrincNameW
#ELSE
 MACRO RpcMgmtInqServerPrincName = RpcMgmtInqServerPrincNameA
#ENDIF
DECLARE FUNCTION RpcServerInqDefaultPrincNameA LIB "rpcrt4.dll" ALIAS "RpcServerInqDefaultPrincNameA" ( BYVAL AuthnSvc AS QUAD , BYREF PrincName AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcServerInqDefaultPrincNameW LIB "rpcrt4.dll" ALIAS "RpcServerInqDefaultPrincNameW" ( BYVAL AuthnSvc AS QUAD , BYREF PrincName AS QUAD ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcServerInqDefaultPrincName = RpcServerInqDefaultPrincNameW
#ELSE
 MACRO RpcServerInqDefaultPrincName = RpcServerInqDefaultPrincNameA
#ENDIF
'/* client */
DECLARE FUNCTION RpcEpResolveBinding LIB "rpcrt4.dll" ALIAS "RpcEpResolveBinding" ( BYVAL Binding AS QUAD , BYVAL IfSpec AS QUAD ) AS LONG ' RPC_STATUS
'/* client */
DECLARE FUNCTION RpcNsBindingInqEntryNameA LIB "rpcrt4.dll" ALIAS "RpcNsBindingInqEntryNameA" ( BYVAL Binding AS QUAD , BYVAL EntryNameSyntax AS QUAD , BYREF EntryName AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcNsBindingInqEntryNameW LIB "rpcrt4.dll" ALIAS "RpcNsBindingInqEntryNameW" ( BYVAL Binding AS QUAD , BYVAL EntryNameSyntax AS QUAD , BYREF EntryName AS QUAD ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcNsBindingInqEntryName = RpcNsBindingInqEntryNameW
#ELSE
 MACRO RpcNsBindingInqEntryName = RpcNsBindingInqEntryNameA
#ENDIF
%EQUATE `RPC_C_AUTHN_LEVEL_DEFAULT = 0
%EQUATE `RPC_C_AUTHN_LEVEL_NONE = 1
%EQUATE `RPC_C_AUTHN_LEVEL_CONNECT = 2
%EQUATE `RPC_C_AUTHN_LEVEL_CALL = 3
%EQUATE `RPC_C_AUTHN_LEVEL_PKT = 4
%EQUATE `RPC_C_AUTHN_LEVEL_PKT_INTEGRITY = 5
%EQUATE `RPC_C_AUTHN_LEVEL_PKT_PRIVACY = 6
%EQUATE `RPC_C_IMP_LEVEL_DEFAULT = 0
%EQUATE `RPC_C_IMP_LEVEL_ANONYMOUS = 1
%EQUATE `RPC_C_IMP_LEVEL_IDENTIFY = 2
%EQUATE `RPC_C_IMP_LEVEL_IMPERSONATE = 3
%EQUATE `RPC_C_IMP_LEVEL_DELEGATE = 4
%EQUATE `RPC_C_QOS_IDENTITY_STATIC = 0
%EQUATE `RPC_C_QOS_IDENTITY_DYNAMIC = 1
%EQUATE `RPC_C_QOS_CAPABILITIES_DEFAULT = &H0
%EQUATE `RPC_C_QOS_CAPABILITIES_MUTUAL_AUTH = &H1
%EQUATE `RPC_C_QOS_CAPABILITIES_MAKE_FULLSIC = &H2
%EQUATE `RPC_C_QOS_CAPABILITIES_ANY_AUTHORITY = &H4
'#if (NTDDI_VERSION >= NTDDI_WS03)
%EQUATE `RPC_C_QOS_CAPABILITIES_IGNORE_DELEGATE_FAILURE = &H8
%EQUATE `RPC_C_QOS_CAPABILITIES_LOCAL_MA_HINT = &H10
'#endif // (NTDDI_VERSION >= NTDDI_WS03)
'#if (NTDDI_VERSION >= NTDDI_VISTA)
%EQUATE `RPC_C_QOS_CAPABILITIES_SCHANNEL_FULL_AUTH_IDENTITY = &H20
'#endif // (NTDDI_VERSION >= NTDDI_VISTA)
%EQUATE `RPC_C_PROTECT_LEVEL_DEFAULT = %RPC_C_AUTHN_LEVEL_DEFAULT
%EQUATE `RPC_C_PROTECT_LEVEL_NONE = %RPC_C_AUTHN_LEVEL_NONE
%EQUATE `RPC_C_PROTECT_LEVEL_CONNECT = %RPC_C_AUTHN_LEVEL_CONNECT
%EQUATE `RPC_C_PROTECT_LEVEL_CALL = %RPC_C_AUTHN_LEVEL_CALL
%EQUATE `RPC_C_PROTECT_LEVEL_PKT = %RPC_C_AUTHN_LEVEL_PKT
%EQUATE `RPC_C_PROTECT_LEVEL_PKT_INTEGRITY = %RPC_C_AUTHN_LEVEL_PKT_INTEGRITY
%EQUATE `RPC_C_PROTECT_LEVEL_PKT_PRIVACY = %RPC_C_AUTHN_LEVEL_PKT_PRIVACY
%EQUATE `RPC_C_AUTHN_NONE = 0
%EQUATE `RPC_C_AUTHN_DCE_PRIVATE = 1
%EQUATE `RPC_C_AUTHN_DCE_PUBLIC = 2
%EQUATE `RPC_C_AUTHN_DEC_PUBLIC = 4
%EQUATE `RPC_C_AUTHN_GSS_NEGOTIATE = 9
%EQUATE `RPC_C_AUTHN_WINNT = 10
%EQUATE `RPC_C_AUTHN_GSS_SCHANNEL = 14
%EQUATE `RPC_C_AUTHN_GSS_KERBEROS = 16
%EQUATE `RPC_C_AUTHN_DPA = 17
%EQUATE `RPC_C_AUTHN_MSN = 18
'#if (NTDDI_VERSION >= WINXP)
%EQUATE `RPC_C_AUTHN_DIGEST = 21
'#endif // (NTDDI_VERSION >= WINXP)
'#if (NTDDI_VERSION >= NTDDI_WIN7)
%EQUATE `RPC_C_AUTHN_KERNEL = 20
'#endif // (NTDDI_VERSION >= NTDDI_WIN7)
%EQUATE `RPC_C_AUTHN_NEGO_EXTENDER = 30
%EQUATE `RPC_C_AUTHN_PKU2U = 31
%EQUATE `RPC_C_AUTHN_MQ = 100
%EQUATE `RPC_C_AUTHN_DEFAULT = &HFFFFFFFF
%EQUATE `RPC_C_NO_CREDENTIALS = %MAXUINT_PTR
%EQUATE `RPC_C_SECURITY_QOS_VERSION = 1
%EQUATE `RPC_C_SECURITY_QOS_VERSION_1 = 1
' // Size = 16 bytes
TYPE RPC_SECURITY_QOS DWORD
 Version AS DWORD ' unsigned long
 Capabilities AS DWORD ' unsigned long
 IdentityTracking AS DWORD ' unsigned long
 ImpersonationType AS DWORD ' unsigned long
END TYPE
#IF NOT %DEF(%AUTH_IDENTITY_DEFINED)
%EQUATE `AUTH_IDENTITY_DEFINED = 1
%EQUATE `SEC_WINNT_AUTH_IDENTITY_ANSI = &H1
%EQUATE `SEC_WINNT_AUTH_IDENTITY_UNICODE = &H2
' // Size = 28 bytes
TYPE SEC_WINNT_AUTH_IDENTITY_W DWORD
 User AS WSTRINGZ PTR ' unsigned short *
 UserLength AS DWORD ' unsigned long
 Domain AS WSTRINGZ PTR ' unsigned short *
 DomainLength AS DWORD ' unsigned long
 Password AS WSTRINGZ PTR ' unsigned short *
 PasswordLength AS DWORD ' unsigned long
 Flags AS DWORD ' unsigned long
END TYPE
' // Size = 28 bytes
TYPE SEC_WINNT_AUTH_IDENTITY_A DWORD
 User AS BYTE PTR ' unsigned char *
 UserLength AS DWORD ' unsigned long
 Domain AS BYTE PTR ' unsigned char *
 DomainLength AS DWORD ' unsigned long
 Password AS BYTE PTR ' unsigned char *
 PasswordLength AS DWORD ' unsigned long
 Flags AS DWORD ' unsigned long
END TYPE
#IF %DEF(%UNICODE)
 MACRO SEC_WINNT_AUTH_IDENTITY = SEC_WINNT_AUTH_IDENTITY_W
#ELSE
 MACRO SEC_WINNT_AUTH_IDENTITY = SEC_WINNT_AUTH_IDENTITY_A
#ENDIF
'#if (NTDDI_VERSION >= NTDDI_WINXP)
%EQUATE `RPC_C_SECURITY_QOS_VERSION_2 = 2
%EQUATE `RPC_C_AUTHN_INFO_TYPE_HTTP = 1
%EQUATE `RPC_C_HTTP_AUTHN_TARGET_SERVER = 1
'#if (NTDDI_VERSION >= NTDDI_VISTA)
%EQUATE `RPC_C_HTTP_AUTHN_TARGET_PROXY = 2
'#endif // (NTDDI_VERSION >= NTDDI_VISTA)
%EQUATE `RPC_C_HTTP_AUTHN_SCHEME_BASIC = &H00000001
%EQUATE `RPC_C_HTTP_AUTHN_SCHEME_NTLM = &H00000002
%EQUATE `RPC_C_HTTP_AUTHN_SCHEME_PASSPORT = &H00000004
%EQUATE `RPC_C_HTTP_AUTHN_SCHEME_DIGEST = &H00000008
%EQUATE `RPC_C_HTTP_AUTHN_SCHEME_NEGOTIATE = &H00000010
'#if (NTDDI_VERSION >= NTDDI_WS03)
%EQUATE `RPC_C_HTTP_AUTHN_SCHEME_CERT = &H00010000
'// &H00020000 and &H00040000 are reserved
'#endif // (NTDDI_VERSION >= NTDDI_WS03)
%EQUATE `RPC_C_HTTP_FLAG_USE_SSL = 1
%EQUATE `RPC_C_HTTP_FLAG_USE_FIRST_AUTH_SCHEME = 2
'#if (NTDDI_VERSION >= NTDDI_WS03)
%EQUATE `RPC_C_HTTP_FLAG_IGNORE_CERT_CN_INVALID = 8
'#endif // (NTDDI_VERSION >= NTDDI_WS03)
'#if (NTDDI_VERSION >= NTDDI_VISTASP1)
%EQUATE `RPC_C_HTTP_FLAG_ENABLE_CERT_REVOCATION_CHECK = 16
'#endif // (NTDDI_VERSION >= NTDDI_VISTASP1)
' // Size = 24 bytes
TYPE RPC_HTTP_TRANSPORT_CREDENTIALS_W DWORD
 TransportCredentials AS SEC_WINNT_AUTH_IDENTITY_W PTR ' SEC_WINNT_AUTH_IDENTITY_W *
 Flags AS DWORD ' unsigned long
 AuthenticationTarget AS DWORD ' unsigned long
 NumberOfAuthnSchemes AS DWORD ' unsigned long
 AuthnSchemes AS DWORD PTR ' unsigned long *
 ServerCertificateSubject AS WSTRINGZ PTR ' unsigned short *
END TYPE
' // Size = 24 bytes
TYPE RPC_HTTP_TRANSPORT_CREDENTIALS_A DWORD
 TransportCredentials AS SEC_WINNT_AUTH_IDENTITY_A PTR ' SEC_WINNT_AUTH_IDENTITY_A *
 Flags AS DWORD ' unsigned long
 AuthenticationTarget AS DWORD ' unsigned long
 NumberOfAuthnSchemes AS DWORD ' unsigned long
 AuthnSchemes AS DWORD PTR ' unsigned long *
 ServerCertificateSubject AS WSTRINGZ PTR ' unsigned short *
END TYPE
#IF %DEF(%UNICODE)
 MACRO RPC_HTTP_TRANSPORT_CREDENTIALS = RPC_HTTP_TRANSPORT_CREDENTIALS_W
#ELSE
 MACRO RPC_HTTP_TRANSPORT_CREDENTIALS = RPC_HTTP_TRANSPORT_CREDENTIALS_A
#ENDIF
'#if (NTDDI_VERSION >= NTDDI_VISTA)
' // Size = 36 bytes
TYPE RPC_HTTP_TRANSPORT_CREDENTIALS_V2_W DWORD
 TransportCredentials AS SEC_WINNT_AUTH_IDENTITY_W PTR ' SEC_WINNT_AUTH_IDENTITY_W*
 Flags AS DWORD ' unsigned long
 AuthenticationTarget AS DWORD ' unsigned long
 NumberOfAuthnSchemes AS DWORD ' unsigned long
 AuthnSchemes AS DWORD PTR ' unsigned long *
 ServerCertificateSubject AS WSTRINGZ PTR ' unsigned short*
 ProxyCredentials AS SEC_WINNT_AUTH_IDENTITY_W PTR ' SEC_WINNT_AUTH_IDENTITY_W * *
 NumberOfProxyAuthnSchemes AS DWORD ' unsigned long
 ProxyAuthnSchemes AS DWORD PTR ' unsigned long *
END TYPE
' // Size = 36 bytes
TYPE RPC_HTTP_TRANSPORT_CREDENTIALS_V2_A DWORD
 TransportCredentials AS SEC_WINNT_AUTH_IDENTITY_A PTR ' SEC_WINNT_AUTH_IDENTITY_A*
 Flags AS DWORD ' unsigned long
 AuthenticationTarget AS DWORD ' unsigned long
 NumberOfAuthnSchemes AS DWORD ' unsigned long
 AuthnSchemes AS DWORD PTR ' unsigned long *
 ServerCertificateSubject AS WSTRINGZ PTR ' unsigned short*
 ProxyCredentials AS SEC_WINNT_AUTH_IDENTITY_A PTR ' SEC_WINNT_AUTH_IDENTITY_A * *
 NumberOfProxyAuthnSchemes AS DWORD ' unsigned long
 ProxyAuthnSchemes AS DWORD PTR ' unsigned long *
END TYPE
#IF %DEF(%UNICODE)
 MACRO RPC_HTTP_TRANSPORT_CREDENTIALS_V2 = RPC_HTTP_TRANSPORT_CREDENTIALS_V2_W
#ELSE
 MACRO RPC_HTTP_TRANSPORT_CREDENTIALS_V2 = RPC_HTTP_TRANSPORT_CREDENTIALS_V2_A
#ENDIF
'#endif // (NTDDI_VERSION >= NTDDI_VISTA)
'#if (NTDDI_VERSION >= NTDDI_WIN7)
' // Size = 36 bytes
TYPE RPC_HTTP_TRANSPORT_CREDENTIALS_V3_W DWORD
 TransportCredentials AS DWORD ' RPC_AUTH_IDENTITY_HANDLE
 Flags AS DWORD ' unsigned long
 AuthenticationTarget AS DWORD ' unsigned long
 NumberOfAuthnSchemes AS DWORD ' unsigned long
 AuthnSchemes AS DWORD PTR
 ServerCertificateSubject AS WSTRINGZ PTR ' unsigned short __RPC_FAR *
 ProxyCredentials AS DWORD ' RPC_AUTH_IDENTITY_HANDLE
 NumberOfProxyAuthnSchemes AS DWORD ' unsigned long
 ProxyAuthnSchemes AS DWORD PTR
END TYPE
' // Size = 36 bytes
TYPE RPC_HTTP_TRANSPORT_CREDENTIALS_V3_A DWORD
 TransportCredentials AS DWORD ' RPC_AUTH_IDENTITY_HANDLE
 Flags AS DWORD ' unsigned long
 AuthenticationTarget AS DWORD ' unsigned long
 NumberOfAuthnSchemes AS DWORD ' unsigned long
 AuthnSchemes AS DWORD PTR
 ServerCertificateSubject AS ASCIIZ PTR ' unsigned char __RPC_FAR *
 ProxyCredentials AS DWORD ' RPC_AUTH_IDENTITY_HANDLE
 NumberOfProxyAuthnSchemes AS DWORD ' unsigned long
 ProxyAuthnSchemes AS DWORD PTR
END TYPE
#IF %DEF(%UNICODE)
 MACRO RPC_HTTP_TRANSPORT_CREDENTIALS_V3 = RPC_HTTP_TRANSPORT_CREDENTIALS_V3_W
#ELSE
 MACRO RPC_HTTP_TRANSPORT_CREDENTIALS_V3 = RPC_HTTP_TRANSPORT_CREDENTIALS_V3_A
#ENDIF
'#endif // (NTDDI_VERSION >= NTDDI_WIN7)
'typedef struct _RPC_SECURITY_QOS_V2_W {
' unsigned long Version;
' unsigned long Capabilities;
' unsigned long IdentityTracking;
' unsigned long ImpersonationType;
' unsigned long AdditionalSecurityInfoType;
' union
' {
' RPC_HTTP_TRANSPORT_CREDENTIALS_W *HttpCredentials;
' } u;
'} RPC_SECURITY_QOS_V2_W, *PRPC_SECURITY_QOS_V2_W;
' // Size = 24 bytes
TYPE RPC_SECURITY_QOS_V2_W DWORD
 Version AS DWORD ' unsigned long
 Capabilities AS DWORD ' unsigned long
 IdentityTracking AS DWORD ' unsigned long
 ImpersonationType AS DWORD ' unsigned long
 AdditionalSecurityInfoType AS DWORD ' unsigned long
 HttpCredentials AS RPC_HTTP_TRANSPORT_CREDENTIALS_W PTR ' RPC_HTTP_TRANSPORT_CREDENTIALS_W *
END TYPE
' // Size = 24 bytes
TYPE RPC_SECURITY_QOS_V2_A DWORD
 Version AS DWORD ' unsigned long
 Capabilities AS DWORD ' unsigned long
 IdentityTracking AS DWORD ' unsigned long
 ImpersonationType AS DWORD ' unsigned long
 AdditionalSecurityInfoType AS DWORD ' unsigned long
 HttpCredentials AS RPC_HTTP_TRANSPORT_CREDENTIALS_A PTR ' RPC_HTTP_TRANSPORT_CREDENTIALS_A *
END TYPE
#IF %DEF(%UNICODE)
 MACRO RPC_SECURITY_QOS_V2 = RPC_SECURITY_QOS_V2_W
#ELSE
 MACRO RPC_SECURITY_QOS_V2 = RPC_SECURITY_QOS_V2_A
#ENDIF
'#if (NTDDI_VERSION >= NTDDI_WS03)
%EQUATE `RPC_C_SECURITY_QOS_VERSION_3 = 3
' // Size = 28 bytes
TYPE RPC_SECURITY_QOS_V3_W DWORD
 Version AS DWORD ' unsigned long
 Capabilities AS DWORD ' unsigned long
 IdentityTracking AS DWORD ' unsigned long
 ImpersonationType AS DWORD ' unsigned long
 AdditionalSecurityInfoType AS DWORD ' unsigned long
 HttpCredentials AS RPC_HTTP_TRANSPORT_CREDENTIALS_W PTR ' RPC_HTTP_TRANSPORT_CREDENTIALS_W *
 Sid AS DWORD ' void *Sid
END TYPE
' // Size = 28 bytes
TYPE RPC_SECURITY_QOS_V3_A DWORD
 Version AS DWORD ' unsigned long
 Capabilities AS DWORD ' unsigned long
 IdentityTracking AS DWORD ' unsigned long
 ImpersonationType AS DWORD ' unsigned long
 AdditionalSecurityInfoType AS DWORD ' unsigned long
 HttpCredentials AS RPC_HTTP_TRANSPORT_CREDENTIALS_A PTR ' RPC_HTTP_TRANSPORT_CREDENTIALS_A *
 Sid AS DWORD ' void *Sid
END TYPE
#IF %DEF(%UNICODE)
 MACRO RPC_SECURITY_QOS_V3 = RPC_SECURITY_QOS_V3_W
#ELSE
 MACRO RPC_SECURITY_QOS_V3 = RPC_SECURITY_QOS_V3_A
#ENDIF
'#endif // (NTDDI_VERSION >= NTDDI_WS03)
'#if (NTDDI_VERSION >= NTDDI_VISTA)
%EQUATE `RPC_C_SECURITY_QOS_VERSION_4 = 4
' // Size = 32 bytes
TYPE RPC_SECURITY_QOS_V4_W DWORD
 Version AS DWORD ' unsigned long
 Capabilities AS DWORD ' unsigned long
 IdentityTracking AS DWORD ' unsigned long
 ImpersonationType AS DWORD ' unsigned long
 AdditionalSecurityInfoType AS DWORD ' unsigned long
 HttpCredentials AS RPC_HTTP_TRANSPORT_CREDENTIALS_W PTR ' RPC_HTTP_TRANSPORT_CREDENTIALS_W *
 Sid AS DWORD ' void *Sid
 EffectiveOnly AS DWORD ' unsigned int
END TYPE
' // Size = 32 bytes
TYPE RPC_SECURITY_QOS_V4_A DWORD
 Version AS DWORD ' unsigned long
 Capabilities AS DWORD ' unsigned long
 IdentityTracking AS DWORD ' unsigned long
 ImpersonationType AS DWORD ' unsigned long
 AdditionalSecurityInfoType AS DWORD ' unsigned long
 HttpCredentials AS RPC_HTTP_TRANSPORT_CREDENTIALS_A PTR ' RPC_HTTP_TRANSPORT_CREDENTIALS_A *
 Sid AS DWORD ' void *Sid
 EffectiveOnly AS DWORD ' unsigned int
END TYPE
#IF %DEF(%UNICODE)
 MACRO RPC_SECURITY_QOS_V4 = RPC_SECURITY_QOS_V4_W
#ELSE
 MACRO RPC_SECURITY_QOS_V4 = RPC_SECURITY_QOS_V4_A
#ENDIF
'#endif // NTDDI_WINXP
#ENDIF ' //_AUTH_IDENTITY_DEFINED
'#endif // (NTDDI_VERSION >= NTDDI_VISTA)
'#if (NTDDI_VERSION >= WINXP)
'#ifdef UNICODE
'#define RPC_SECURITY_QOS_V2 RPC_SECURITY_QOS_V2_W
'#define PRPC_SECURITY_QOS_V2 PRPC_SECURITY_QOS_V2_W
'#define _RPC_SECURITY_QOS_V2 _RPC_SECURITY_QOS_V2_W
'#define RPC_HTTP_TRANSPORT_CREDENTIALS RPC_HTTP_TRANSPORT_CREDENTIALS_W
'#define PRPC_HTTP_TRANSPORT_CREDENTIALS PRPC_HTTP_TRANSPORT_CREDENTIALS_W
'#define _RPC_HTTP_TRANSPORT_CREDENTIALS _RPC_HTTP_TRANSPORT_CREDENTIALS_W
'#if (NTDDI_VERSION >= NTDDI_VISTA)
'#define RPC_HTTP_TRANSPORT_CREDENTIALS_V2 RPC_HTTP_TRANSPORT_CREDENTIALS_V2_W
'#define PRPC_HTTP_TRANSPORT_CREDENTIALS_V2 PRPC_HTTP_TRANSPORT_CREDENTIALS_V2_W
'#define _RPC_HTTP_TRANSPORT_CREDENTIALS_V2 _RPC_HTTP_TRANSPORT_CREDENTIALS_V2_W
'#endif // (NTDDI_VERSION >= NTDDI_VISTA)
'#if (NTDDI_VERSION >= NTDDI_WIN7)
'#define RPC_HTTP_TRANSPORT_CREDENTIALS_V3 RPC_HTTP_TRANSPORT_CREDENTIALS_V3_W
'#define PRPC_HTTP_TRANSPORT_CREDENTIALS_V3 PRPC_HTTP_TRANSPORT_CREDENTIALS_V3_W
'#define _RPC_HTTP_TRANSPORT_CREDENTIALS_V3 _RPC_HTTP_TRANSPORT_CREDENTIALS_V3_W
'#endif // (NTDDI_VERSION >= NTDDI_WIN7)
'#if (NTDDI_VERSION >= NTDDI_WS03)
'#define RPC_SECURITY_QOS_V3 RPC_SECURITY_QOS_V3_W
'#define PRPC_SECURITY_QOS_V3 PRPC_SECURITY_QOS_V3_W
'#define _RPC_SECURITY_QOS_V3 _RPC_SECURITY_QOS_V3_W
'#endif // (NTDDI_VERSION >= NTDDI_WS03)
'#if (NTDDI_VERSION >= NTDDI_VISTA)
'#define RPC_SECURITY_QOS_V4 RPC_SECURITY_QOS_V4_W
'#define PRPC_SECURITY_QOS_V4 PRPC_SECURITY_QOS_V4_W
'#define _RPC_SECURITY_QOS_V4 _RPC_SECURITY_QOS_V4_W
'#endif // (NTDDI_VERSION >= NTDDI_VISTA)
'#else // UNICODE
'#define RPC_SECURITY_QOS_V2 RPC_SECURITY_QOS_V2_A
'#define PRPC_SECURITY_QOS_V2 PRPC_SECURITY_QOS_V2_A
'#define _RPC_SECURITY_QOS_V2 _RPC_SECURITY_QOS_V2_A
'#define RPC_HTTP_TRANSPORT_CREDENTIALS RPC_HTTP_TRANSPORT_CREDENTIALS_A
'#define PRPC_HTTP_TRANSPORT_CREDENTIALS PRPC_HTTP_TRANSPORT_CREDENTIALS_A
'#define _RPC_HTTP_TRANSPORT_CREDENTIALS _RPC_HTTP_TRANSPORT_CREDENTIALS_A
'#if (NTDDI_VERSION >= NTDDI_VISTA)
'#define RPC_HTTP_TRANSPORT_CREDENTIALS_V2 RPC_HTTP_TRANSPORT_CREDENTIALS_V2_A
'#define PRPC_HTTP_TRANSPORT_CREDENTIALS_V2 PRPC_HTTP_TRANSPORT_CREDENTIALS_V2_A
'#define _RPC_HTTP_TRANSPORT_CREDENTIALS_V2 _RPC_HTTP_TRANSPORT_CREDENTIALS_V2_A
'#endif // (NTDDI_VERSION >= NTDDI_VISTA)
'#if (NTDDI_VERSION >= NTDDI_WIN7)
'#define RPC_HTTP_TRANSPORT_CREDENTIALS_V3 RPC_HTTP_TRANSPORT_CREDENTIALS_V3_A
'#define PRPC_HTTP_TRANSPORT_CREDENTIALS_V3 PRPC_HTTP_TRANSPORT_CREDENTIALS_V3_A
'#define _RPC_HTTP_TRANSPORT_CREDENTIALS_V3 _RPC_HTTP_TRANSPORT_CREDENTIALS_V3_A
'#endif // (NTDDI_VERSION >= NTDDI_WIN7)
'#if (NTDDI_VERSION >= NTDDI_WS03)
'#define RPC_SECURITY_QOS_V3 RPC_SECURITY_QOS_V3_A
'#define PRPC_SECURITY_QOS_V3 PRPC_SECURITY_QOS_V3_A
'#define _RPC_SECURITY_QOS_V3 _RPC_SECURITY_QOS_V3_A
'#endif // (NTDDI_VERSION >= NTDDI_WS03)
'#if (NTDDI_VERSION >= NTDDI_VISTA)
'#define RPC_SECURITY_QOS_V4 RPC_SECURITY_QOS_V4_A
'#define PRPC_SECURITY_QOS_V4 PRPC_SECURITY_QOS_V4_A
'#define _RPC_SECURITY_QOS_V4 _RPC_SECURITY_QOS_V4_A
'#endif // (NTDDI_VERSION >= NTDDI_VISTA)
'#endif // UNICODE
'#if (NTDDI_VERSION >= NTDDI_VISTA)
%EQUATE `RPC_PROTSEQ_TCP = &H1
%EQUATE `RPC_PROTSEQ_NMP = &H2
%EQUATE `RPC_PROTSEQ_LRPC = &H3
%EQUATE `RPC_PROTSEQ_HTTP = &H4
%EQUATE `RPC_BHT_OBJECT_UUID_VALID = &H1
%EQUATE `RPC_BHO_NONCAUSAL = &H1
%EQUATE `RPC_BHO_DONTLINGER = &H2
%EQUATE `RPC_BHO_EXCLUSIVE_AND_GUARANTEED = &H4
' // Size = 4 bytes
UNION RPC_BINDING_HANDLE_TEMPLATE_V1_W_UNION DWORD
 Reserved AS WORD PTR ' unsigned short *
END UNION
' // Size = 40 bytes
TYPE RPC_BINDING_HANDLE_TEMPLATE_V1_W DWORD
 Version AS DWORD ' unsigned long
 Flags AS DWORD ' unsigned long
 ProtocolSequence AS DWORD ' unsigned long
 NetworkAddress AS WSTRINGZ PTR ' unsigned short *
 StringEndpoint AS WSTRINGZ PTR ' unsigned short *
 u1 AS RPC_BINDING_HANDLE_TEMPLATE_V1_W_UNION
 ObjectUuid AS GUID ' UUID
END TYPE
' // Size = 4 bytes
UNION RPC_BINDING_HANDLE_TEMPLATE_V1_A_UNION DWORD
 Reserved AS BYTE PTR ' unsigned char *
END UNION
' // Size = 40 bytes
TYPE RPC_BINDING_HANDLE_TEMPLATE_V1_A DWORD
 Version AS DWORD ' unsigned long
 Flags AS DWORD ' unsigned long
 ProtocolSequence AS DWORD ' unsigned long
 NetworkAddress AS WSTRINGZ PTR ' unsigned short *
 StringEndpoint AS WSTRINGZ PTR ' unsigned short *
 u1 AS RPC_BINDING_HANDLE_TEMPLATE_V1_A_UNION
 ObjectUuid AS GUID ' UUID
END TYPE
#IF %DEF(%UNICODE)
 MACRO RPC_BINDING_HANDLE_TEMPLATE_V1 = RPC_BINDING_HANDLE_TEMPLATE_V1_W
#ELSE
 MACRO RPC_BINDING_HANDLE_TEMPLATE_V1 = RPC_BINDING_HANDLE_TEMPLATE_V1_A
#ENDIF
' // Size = 24 bytes
TYPE RPC_BINDING_HANDLE_SECURITY_V1_W DWORD
 Version AS DWORD ' unsigned long
 ServerPrincName AS WSTRINGZ PTR ' unsigned short *
 AuthnLevel AS DWORD ' unsigned long
 AuthnSvc AS DWORD ' unsigned long
 AuthIdentity AS SEC_WINNT_AUTH_IDENTITY_W PTR ' SEC_WINNT_AUTH_IDENTITY_W *
 SecurityQos AS RPC_SECURITY_QOS PTR ' RPC_SECURITY_QOS *
END TYPE
'#ifdef _AUTH_IDENTITY_A_DEFINED
' // Size = 24 bytes
TYPE RPC_BINDING_HANDLE_SECURITY_V1_A DWORD
 Version AS DWORD ' unsigned long
 ServerPrincName AS WSTRINGZ PTR ' unsigned char *
 AuthnLevel AS DWORD ' unsigned long
 AuthnSvc AS DWORD ' unsigned long
 AuthIdentity AS SEC_WINNT_AUTH_IDENTITY_A PTR ' SEC_WINNT_AUTH_IDENTITY_A
 SecurityQos AS RPC_SECURITY_QOS PTR ' RPC_SECURITY_QOS *
END TYPE
#IF %DEF(%UNICODE)
 MACRO RPC_BINDING_HANDLE_SECURITY_V1 = RPC_BINDING_HANDLE_SECURITY_V1_W
#ELSE
 MACRO RPC_BINDING_HANDLE_SECURITY_V1 = RPC_BINDING_HANDLE_SECURITY_V1_A
#ENDIF
'#endif // _AUTH_IDENTITY_A_DEFINED
' // Size = 16 bytes
TYPE RPC_BINDING_HANDLE_OPTIONS_V1 DWORD
 Version AS DWORD ' unsigned long
 Flags AS DWORD ' unsigned long
 ComTimeout AS DWORD ' unsigned long
 CallTimeout AS DWORD ' unsigned long
END TYPE
'#ifdef _AUTH_IDENTITY_A_DEFINED
DECLARE FUNCTION RpcBindingCreateA LIB "rpcrt4.dll" ALIAS "RpcBindingCreateA" ( BYREF Template AS RPC_BINDING_HANDLE_TEMPLATE_V1_A , BYREF Security AS RPC_BINDING_HANDLE_SECURITY_V1_A , BYREF Options AS RPC_BINDING_HANDLE_OPTIONS_V1 , BYREF Binding AS QUAD ) AS LONG ' RPC_STATUS
'#endif // _AUTH_IDENTITY_A_DEFINED
DECLARE FUNCTION RpcBindingCreateW LIB "rpcrt4.dll" ALIAS "RpcBindingCreateW" ( BYREF Template AS RPC_BINDING_HANDLE_TEMPLATE_V1_W , BYREF Security AS RPC_BINDING_HANDLE_SECURITY_V1_W , BYREF Options AS RPC_BINDING_HANDLE_OPTIONS_V1 , BYREF Binding AS QUAD ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcBindingCreate = RpcBindingCreateW
#ELSE
 MACRO RpcBindingCreate = RpcBindingCreateA
#ENDIF
DECLARE FUNCTION RpcBindingGetTrainingContextHandle LIB "rpcrt4.dll" ALIAS "RpcBindingGetTrainingContextHandle" ( BYVAL Binding AS QUAD , BYREF ContextHandle AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcServerInqBindingHandle LIB "rpcrt4.dll" ALIAS "RpcServerInqBindingHandle" ( BYREF Binding AS QUAD ) AS LONG ' RPC_STATUS
'#endif // (NTDDI_VERSION >= NTDDI_VISTA)
'#if (NTDDI_VERSION >= NTDDI_WS03)
' RPC_HTTP_REDIRECTOR_STAGE enum
%EQUATE `RPCHTTP_RS_REDIRECT = 1
%EQUATE `RPCHTTP_RS_ACCESS_1 = 2
%EQUATE `RPCHTTP_RS_SESSION = 3
%EQUATE `RPCHTTP_RS_ACCESS_2 = 4
%EQUATE `RPCHTTP_RS_INTERFACE = 5
'#endif // (NTDDI_VERSION >= NTDDI_WS03)
'#if (NTDDI_VERSION >= NTDDI_WS03)
'typedef RPC_STATUS
'(__RPC_USER * RPC_NEW_HTTP_PROXY_CHANNEL) (
' );
'#else
'typedef RPC_STATUS
'(__RPC_USER * RPC_NEW_HTTP_PROXY_CHANNEL) (
' );
'#endif // (NTDDI_VERSION >= NTDDI_WS03)
'typedef void
'(__RPC_USER * RPC_HTTP_PROXY_FREE_STRING) (
' );
'#endif // (NTDDI_VERSION >= NTDDI_WINXP)
%EQUATE `RPC_C_AUTHZ_NONE = 0
%EQUATE `RPC_C_AUTHZ_NAME = 1
%EQUATE `RPC_C_AUTHZ_DCE = 2
%EQUATE `RPC_C_AUTHZ_DEFAULT = &Hffffffff
DECLARE FUNCTION RpcImpersonateClient LIB "rpcrt4.dll" ALIAS "RpcImpersonateClient" ( BYVAL BindingHandle AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcRevertToSelfEx LIB "rpcrt4.dll" ALIAS "RpcRevertToSelfEx" ( BYVAL BindingHandle AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcRevertToSelf LIB "rpcrt4.dll" ALIAS "RpcRevertToSelf" ( ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcBindingInqAuthClientA LIB "rpcrt4.dll" ALIAS "RpcBindingInqAuthClientA" ( BYVAL ClientBinding AS QUAD , BYREF Privs AS QUAD , BYREF ServerPrincName AS QUAD , BYREF AuthnLevel AS QUAD , BYREF AuthnSvc AS QUAD , BYREF AuthzSvc AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcBindingInqAuthClientW LIB "rpcrt4.dll" ALIAS "RpcBindingInqAuthClientW" ( BYVAL ClientBinding AS QUAD , BYREF Privs AS QUAD , BYREF ServerPrincName AS QUAD , BYREF AuthnLevel AS QUAD , BYREF AuthnSvc AS QUAD , BYREF AuthzSvc AS QUAD ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcBindingInqAuthClient = RpcBindingInqAuthClientW
#ELSE
 MACRO RpcBindingInqAuthClient = RpcBindingInqAuthClientA
#ENDIF
DECLARE FUNCTION RpcBindingInqAuthClientExA LIB "rpcrt4.dll" ALIAS "RpcBindingInqAuthClientExA" ( BYVAL ClientBinding AS QUAD , BYREF Privs AS QUAD , BYREF ServerPrincName AS QUAD , BYREF AuthnLevel AS QUAD , BYREF AuthnSvc AS QUAD , BYREF AuthzSvc AS QUAD , BYVAL Flags AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcBindingInqAuthClientExW LIB "rpcrt4.dll" ALIAS "RpcBindingInqAuthClientExW" ( BYVAL ClientBinding AS QUAD , BYREF Privs AS QUAD , BYREF ServerPrincName AS QUAD , BYREF AuthnLevel AS QUAD , BYREF AuthnSvc AS QUAD , BYREF AuthzSvc AS QUAD , BYVAL Flags AS QUAD ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcBindingInqAuthClientEx = RpcBindingInqAuthClientExW
#ELSE
 MACRO RpcBindingInqAuthClientEx = RpcBindingInqAuthClientExA
#ENDIF
DECLARE FUNCTION RpcBindingInqAuthInfoA LIB "rpcrt4.dll" ALIAS "RpcBindingInqAuthInfoA" ( BYVAL Binding AS QUAD , BYREF ServerPrincName AS QUAD , BYREF AuthnLevel AS QUAD , BYREF AuthnSvc AS QUAD , BYREF AuthIdentity AS QUAD , BYREF AuthzSvc AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcBindingInqAuthInfoW LIB "rpcrt4.dll" ALIAS "RpcBindingInqAuthInfoW" ( BYVAL Binding AS QUAD , BYREF ServerPrincName AS QUAD , BYREF AuthnLevel AS QUAD , BYREF AuthnSvc AS QUAD , BYREF AuthIdentity AS QUAD , BYREF AuthzSvc AS QUAD ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcBindingInqAuthInfo = RpcBindingInqAuthInfoW
#ELSE
 MACRO RpcBindingInqAuthInfo = RpcBindingInqAuthInfoA
#ENDIF
DECLARE FUNCTION RpcBindingSetAuthInfoA LIB "rpcrt4.dll" ALIAS "RpcBindingSetAuthInfoA" ( BYVAL Binding AS QUAD , BYREF ServerPrincName AS ASCIIZ , BYVAL AuthnLevel AS QUAD , BYVAL AuthnSvc AS QUAD , BYVAL AuthIdentity AS QUAD , BYVAL AuthzSvc AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcBindingSetAuthInfoW LIB "rpcrt4.dll" ALIAS "RpcBindingSetAuthInfoW" ( BYVAL Binding AS QUAD , BYREF ServerPrincName AS WSTRINGZ , BYVAL AuthnLevel AS QUAD , BYVAL AuthnSvc AS QUAD , BYVAL AuthIdentity AS QUAD , BYVAL AuthzSvc AS QUAD ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcBindingSetAuthInfo = RpcBindingSetAuthInfoW
#ELSE
 MACRO RpcBindingSetAuthInfo = RpcBindingSetAuthInfoA
#ENDIF
DECLARE FUNCTION RpcBindingSetAuthInfoExA LIB "rpcrt4.dll" ALIAS "RpcBindingSetAuthInfoExA" ( BYVAL Binding AS QUAD , BYREF ServerPrincName AS ASCIIZ , BYVAL AuthnLevel AS QUAD , BYVAL AuthnSvc AS QUAD , BYVAL AuthIdentity AS QUAD , BYVAL AuthzSvc AS QUAD , BYREF SecurityQos AS RPC_SECURITY_QOS ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcBindingSetAuthInfoExW LIB "rpcrt4.dll" ALIAS "RpcBindingSetAuthInfoExW" ( BYVAL Binding AS QUAD , BYREF ServerPrincName AS WSTRINGZ , BYVAL AuthnLevel AS QUAD , BYVAL AuthnSvc AS QUAD , BYVAL AuthIdentity AS QUAD , BYVAL AuthzSvc AS QUAD , BYREF SecurityQos AS RPC_SECURITY_QOS ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcBindingSetAuthInfoEx = RpcBindingSetAuthInfoExW
#ELSE
 MACRO RpcBindingSetAuthInfoEx = RpcBindingSetAuthInfoExA
#ENDIF
DECLARE FUNCTION RpcBindingInqAuthInfoExA LIB "rpcrt4.dll" ALIAS "RpcBindingInqAuthInfoExA" ( BYVAL Binding AS QUAD , BYREF ServerPrincName AS QUAD , BYREF AuthnLevel AS QUAD , BYREF AuthnSvc AS QUAD , BYREF AuthIdentity AS QUAD , BYREF AuthzSvc AS QUAD , BYVAL RpcQosVersion AS QUAD , BYREF SecurityQos AS RPC_SECURITY_QOS ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcBindingInqAuthInfoExW LIB "rpcrt4.dll" ALIAS "RpcBindingInqAuthInfoExW" ( BYVAL Binding AS QUAD , BYREF ServerPrincName AS QUAD , BYREF AuthnLevel AS QUAD , BYREF AuthnSvc AS QUAD , BYREF AuthIdentity AS QUAD , BYREF AuthzSvc AS QUAD , BYVAL RpcQosVersion AS QUAD , BYREF SecurityQos AS RPC_SECURITY_QOS ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcBindingInqAuthInfoEx = RpcBindingInqAuthInfoExW
#ELSE
 MACRO RpcBindingInqAuthInfoEx = RpcBindingInqAuthInfoExA
#ENDIF
'typedef void
'(__RPC_USER * RPC_AUTH_KEY_RETRIEVAL_FN) (
' );
'DECLARE FUNCTION RpcServerCompleteSecurityCallback LIB "rpcrt4.dll" ALIAS "RpcServerCompleteSecurityCallback" ( ' BYVAL BindingHandle AS DWORD
' , BYVAL Status AS DWORD
' ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcServerRegisterAuthInfoA LIB "rpcrt4.dll" ALIAS "RpcServerRegisterAuthInfoA" ( BYREF ServerPrincName AS ASCIIZ , BYVAL AuthnSvc AS QUAD , BYVAL GetKeyFn AS QUAD , BYVAL Arg AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcServerRegisterAuthInfoW LIB "rpcrt4.dll" ALIAS "RpcServerRegisterAuthInfoW" ( BYREF ServerPrincName AS WSTRINGZ , BYVAL AuthnSvc AS QUAD , BYVAL GetKeyFn AS QUAD , BYVAL Arg AS QUAD ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcServerRegisterAuthInfo = RpcServerRegisterAuthInfoW
#ELSE
 MACRO RpcServerRegisterAuthInfo = RpcServerRegisterAuthInfoA
#ENDIF
'#if !defined(_M_IA64)
'typedef struct {
' unsigned char * UserName;
' unsigned char * ComputerName;
' unsigned short Privilege;
' unsigned long AuthFlags;
'} RPC_CLIENT_INFORMATION1, * PRPC_CLIENT_INFORMATION1;
'#endif
DECLARE FUNCTION RpcBindingServerFromClient LIB "rpcrt4.dll" ALIAS "RpcBindingServerFromClient" ( BYVAL ClientBinding AS QUAD , BYREF ServerBinding AS QUAD ) AS LONG ' RPC_STATUS
DECLARE SUB RpcRaiseException LIB "rpcrt4.dll" ALIAS "RpcRaiseException" ( BYVAL exception AS QUAD ) ' void
DECLARE FUNCTION RpcTestCancel LIB "rpcrt4.dll" ALIAS "RpcTestCancel" ( ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcServerTestCancel LIB "rpcrt4.dll" ALIAS "RpcServerTestCancel" ( BYVAL BindingHandle AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcCancelThread LIB "rpcrt4.dll" ALIAS "RpcCancelThread" ( BYVAL Thread AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcCancelThreadEx LIB "rpcrt4.dll" ALIAS "RpcCancelThreadEx" ( BYVAL Thread AS QUAD , BYVAL Timeout AS LONG ) AS LONG ' RPC_STATUS
'/* client/server */
DECLARE FUNCTION UuidCreate LIB "rpcrt4.dll" ALIAS "UuidCreate" ( BYREF Uuid AS GUID ) AS LONG ' RPC_STATUS
'/* client/server */
DECLARE FUNCTION UuidCreateSequential LIB "rpcrt4.dll" ALIAS "UuidCreateSequential" ( BYREF Uuid AS GUID ) AS LONG ' RPC_STATUS
'/* client/server */
DECLARE FUNCTION UuidToStringA LIB "rpcrt4.dll" ALIAS "UuidToStringA" ( BYREF Uuid AS GUID , BYREF StringUuid AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION UuidToStringW LIB "rpcrt4.dll" ALIAS "UuidToStringW" ( BYREF Uuid AS GUID , BYREF StringUuid AS QUAD ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO UuidToString = UuidToStringW
#ELSE
 MACRO UuidToString = UuidToStringA
#ENDIF
'/* client/server */
DECLARE FUNCTION UuidFromStringA LIB "rpcrt4.dll" ALIAS "UuidFromStringA" ( BYREF StringUuid AS ASCIIZ , BYREF Uuid AS GUID ) AS LONG ' RPC_STATUS
'/* client/server */
DECLARE FUNCTION UuidFromStringW LIB "rpcrt4.dll" ALIAS "UuidFromStringW" ( BYREF StringUuid AS WSTRINGZ , BYREF Uuid AS GUID ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO UuidFromString = UuidFromStringW
#ELSE
 MACRO UuidFromString = UuidFromStringA
#ENDIF
DECLARE FUNCTION UuidCompare LIB "rpcrt4.dll" ALIAS "UuidCompare" ( BYREF Uuid1 AS GUID , BYREF Uuid2 AS GUID , BYREF Status AS QUAD ) AS LONG ' signed int
DECLARE FUNCTION UuidCreateNil LIB "rpcrt4.dll" ALIAS "UuidCreateNil" ( BYREF NilUuid AS GUID ) AS LONG ' RPC_STATUS
DECLARE FUNCTION UuidEqual LIB "rpcrt4.dll" ALIAS "UuidEqual" ( BYREF Uuid1 AS GUID , BYREF Uuid2 AS GUID , BYREF Status AS QUAD ) AS LONG ' int
DECLARE FUNCTION UuidHash LIB "rpcrt4.dll" ALIAS "UuidHash" ( BYREF Uuid AS GUID , BYREF Status AS QUAD ) AS WORD ' unsigned short
DECLARE FUNCTION UuidIsNil LIB "rpcrt4.dll" ALIAS "UuidIsNil" ( BYREF Uuid1 AS GUID , BYREF Status AS QUAD ) AS LONG ' int
DECLARE FUNCTION RpcEpRegisterNoReplaceA LIB "rpcrt4.dll" ALIAS "RpcEpRegisterNoReplaceA" ( BYVAL IfSpec AS QUAD , BYREF BindingVector AS RPC_BINDING_VECTOR , BYREF UuidVector AS UUID_VECTOR , BYREF Annotation AS ASCIIZ ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcEpRegisterNoReplaceW LIB "rpcrt4.dll" ALIAS "RpcEpRegisterNoReplaceW" ( BYVAL IfSpec AS QUAD , BYREF BindingVector AS RPC_BINDING_VECTOR , BYREF UuidVector AS UUID_VECTOR , BYREF Annotation AS WSTRINGZ ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcEpRegisterNoReplace = RpcEpRegisterNoReplaceW
#ELSE
 MACRO RpcEpRegisterNoReplace = RpcEpRegisterNoReplaceA
#ENDIF
DECLARE FUNCTION RpcEpRegisterA LIB "rpcrt4.dll" ALIAS "RpcEpRegisterA" ( BYVAL IfSpec AS QUAD , BYREF BindingVector AS RPC_BINDING_VECTOR , BYREF UuidVector AS UUID_VECTOR , BYREF Annotation AS ASCIIZ ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcEpRegisterW LIB "rpcrt4.dll" ALIAS "RpcEpRegisterW" ( BYVAL IfSpec AS QUAD , BYREF BindingVector AS RPC_BINDING_VECTOR , BYREF UuidVector AS UUID_VECTOR , BYREF Annotation AS WSTRINGZ ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcEpRegister = RpcEpRegisterW
#ELSE
 MACRO RpcEpRegister = RpcEpRegisterA
#ENDIF
DECLARE FUNCTION RpcEpUnregister LIB "rpcrt4.dll" ALIAS "RpcEpUnregister" ( BYVAL IfSpec AS QUAD , BYREF BindingVector AS RPC_BINDING_VECTOR , BYREF UuidVector AS UUID_VECTOR ) AS LONG ' RPC_STATUS
%EQUATE `DCE_C_ERROR_STRING_LEN = 256
DECLARE FUNCTION DceErrorInqTextA LIB "rpcrt4.dll" ALIAS "DceErrorInqTextA" ( BYVAL RpcStatus AS QUAD , BYREF ErrorText AS ASCIIZ ) AS LONG ' RPC_STATUS
DECLARE FUNCTION DceErrorInqTextW LIB "rpcrt4.dll" ALIAS "DceErrorInqTextW" ( BYVAL RpcStatus AS QUAD , BYREF ErrorText AS WSTRINGZ ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO DceErrorInqText = DceErrorInqTextW
#ELSE
 MACRO DceErrorInqText = DceErrorInqTextA
#ENDIF
'typedef I_RPC_HANDLE * RPC_EP_INQ_HANDLE;
%EQUATE `RPC_C_EP_ALL_ELTS = 0
%EQUATE `RPC_C_EP_MATCH_BY_IF = 1
%EQUATE `RPC_C_EP_MATCH_BY_OBJ = 2
%EQUATE `RPC_C_EP_MATCH_BY_BOTH = 3
%EQUATE `RPC_C_VERS_ALL = 1
%EQUATE `RPC_C_VERS_COMPATIBLE = 2
%EQUATE `RPC_C_VERS_EXACT = 3
%EQUATE `RPC_C_VERS_MAJOR_ONLY = 4
%EQUATE `RPC_C_VERS_UPTO = 5
DECLARE FUNCTION RpcMgmtEpEltInqBegin LIB "rpcrt4.dll" ALIAS "RpcMgmtEpEltInqBegin" ( BYVAL EpBinding AS QUAD , BYVAL InquiryType AS QUAD , BYREF IfId AS RPC_IF_ID , BYVAL VersOption AS QUAD , BYREF ObjectUuid AS GUID , BYREF InquiryContext AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcMgmtEpEltInqDone LIB "rpcrt4.dll" ALIAS "RpcMgmtEpEltInqDone" ( BYREF InquiryContext AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcMgmtEpEltInqNextA LIB "rpcrt4.dll" ALIAS "RpcMgmtEpEltInqNextA" ( BYVAL InquiryContext AS QUAD , BYREF IfId AS QUAD , BYREF Binding AS QUAD , BYREF ObjectUuid AS GUID , BYREF Annotation AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcMgmtEpEltInqNextW LIB "rpcrt4.dll" ALIAS "RpcMgmtEpEltInqNextW" ( BYVAL InquiryContext AS QUAD , BYREF IfId AS QUAD , BYREF Binding AS QUAD , BYREF ObjectUuid AS GUID , BYREF Annotation AS QUAD ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcMgmtEpEltInqNext = RpcMgmtEpEltInqNextW
#ELSE
 MACRO RpcMgmtEpEltInqNext = RpcMgmtEpEltInqNextA
#ENDIF
DECLARE FUNCTION RpcMgmtEpUnregister LIB "rpcrt4.dll" ALIAS "RpcMgmtEpUnregister" ( BYVAL EpBinding AS QUAD , BYREF IfId AS RPC_IF_ID , BYVAL Binding AS QUAD , BYREF ObjectUuid AS GUID ) AS LONG ' RPC_STATUS
'typedef int
'(__RPC_API * RPC_MGMT_AUTHORIZATION_FN) (
' IN RPC_BINDING_HANDLE ClientBinding,
' IN unsigned long RequestedMgmtOperation,
' OUT RPC_STATUS __RPC_FAR * Status
' );
%EQUATE `RPC_C_MGMT_INQ_IF_IDS = 0
%EQUATE `RPC_C_MGMT_INQ_PRINC_NAME = 1
%EQUATE `RPC_C_MGMT_INQ_STATS = 2
%EQUATE `RPC_C_MGMT_IS_SERVER_LISTEN = 3
%EQUATE `RPC_C_MGMT_STOP_SERVER_LISTEN = 4
DECLARE FUNCTION RpcMgmtSetAuthorizationFn LIB "rpcrt4.dll" ALIAS "RpcMgmtSetAuthorizationFn" ( BYVAL AuthorizationFn AS QUAD ) AS LONG ' RPC_STATUS
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION RpcExceptionFilter LIB "rpcrt4.dll" ALIAS "RpcExceptionFilter" ( BYVAL ExceptionCode AS QUAD ) AS LONG ' int
'#endif // (NTDDI_VERSION >= NTDDI_VISTA)
%EQUATE `RPC_C_PARM_MAX_PACKET_LENGTH = 1
%EQUATE `RPC_C_PARM_BUFFER_LENGTH = 2
%EQUATE `RPC_IF_AUTOLISTEN = &H0001
%EQUATE `RPC_IF_OLE = &H0002
%EQUATE `RPC_IF_ALLOW_UNKNOWN_AUTHORITY = &H0004
%EQUATE `RPC_IF_ALLOW_SECURE_ONLY = &H0008
%EQUATE `RPC_IF_ALLOW_CALLBACKS_WITH_NO_AUTH = &H0010
%EQUATE `RPC_IF_ALLOW_LOCAL_ONLY = &H0020
%EQUATE `RPC_IF_SEC_NO_CACHE = &H0040
'#if (NTDDI_VERSION >= NTDDI_VISTA)
%EQUATE `RPC_IF_SEC_CACHE_PER_PROC = &H0080
%EQUATE `RPC_IF_ASYNC_CALLBACK = &H0100
'#endif // (NTDDI_VERSION >= NTDDI_VISTA)
'#if (NTDDI_VERSION >= NTDDI_VISTA)
%EQUATE `RPC_FW_IF_FLAG_DCOM = &H0001
'#endif // (NTDDI_VERSION >= NTDDI_VISTA)
#INCLUDE ONCE "Legacy/Network/RpcDceP.inc"
#ENDIF
