' ########################################################################################
' Microsoft Windows
' File: RpcAsync.inc
' Contents: RPC runtime APIs needed to use [async] RPC features
' 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_RpcAsync_PBI)
#DEFINE PBX_RpcAsync_PBI
%EQUATE `RPCASYNC_INC = 1
#INCLUDE ONCE "Core/Windows.inc"
#INCLUDE ONCE "Legacy/Network/RpcDce.inc"
'#if defined(_KRPCENV_)
'#include <ntddk.h>
'#endif // _KRPCENV_
'#if defined(RPC_NO_WINDOWS_H) || defined(_KRPCENV_)
'// We've gotta have windef.h--can't live without it.
'#include <windef.h>
'#endif // RPC_NO_WINDOWS_H || _KRPCENV_
'#define RPC_ASYNC_VERSION_1_0 sizeof(RPC_ASYNC_STATE)
' RPC_NOTIFICATION_TYPES enum
%EQUATE `RpcNotificationTypeNone = 0
%EQUATE `RpcNotificationTypeEvent = 1
'#if !defined(_KRPCENV_)
%EQUATE `RpcNotificationTypeApc = 2
%EQUATE `RpcNotificationTypeIoc = 3
%EQUATE `RpcNotificationTypeHwnd = 4
'#endif
%EQUATE `RpcNotificationTypeCallback = 5
' RPC_ASYNC_EVENT enum
%EQUATE `RpcCallComplete = 0
%EQUATE `RpcSendComplete = 1
%EQUATE `RpcReceiveComplete = 2
'struct _RPC_ASYNC_STATE;
'typedef void RPC_ENTRY
'RPCNOTIFICATION_ROUTINE (
' struct _RPC_ASYNC_STATE *pAsync,
' void *Context,
' RPC_ASYNC_EVENT Event);
'typedef RPCNOTIFICATION_ROUTINE *PFN_RPCNOTIFICATION_ROUTINE;
'typedef union _RPC_ASYNC_NOTIFICATION_INFO {
'#if !defined(_KRPCENV_)
' //
' // Notification by APC
' //
' struct {
' PFN_RPCNOTIFICATION_ROUTINE NotificationRoutine;
' HANDLE hThread;
' } APC;
'#if !defined(RPC_NO_WINDOWS_H) || defined (_WINBASE_)
' //
' // Notification by IO completion port
' //
' struct {
' HANDLE hIOPort;
' DWORD dwNumberOfBytesTransferred;
' DWORD_PTR dwCompletionKey;
' LPOVERLAPPED lpOverlapped;
' } IOC;
'#endif // !RPC_NO_WINDOWS_H || _WINBASE_
'#if !defined(RPC_NO_WINDOWS_H)
' //
' // Notification by window message
' //
' struct {
' HWND hWnd;
' UINT Msg;
' } HWND;
'#endif // RPC_NO_WINDOWS_H
'#endif // _KRPCENV_
' #if !defined(_KRPCENV_)
' //
' // Notification by event
' //
' HANDLE hEvent;
' #else // _KRPCENV_
' //
' // Notification by event
' //
' PKEVENT Event;
' #endif // _KRPCENV_
' //
' // Notification by callback function
' //
' // This option is available only to OLE
' //
' PFN_RPCNOTIFICATION_ROUTINE NotificationRoutine;
'} RPC_ASYNC_NOTIFICATION_INFO, *PRPC_ASYNC_NOTIFICATION_INFO;
' // Size = 8 bytes
TYPE RPC_ASYNC_NOTIFICATION_INFO_APC DWORD
 NotificationRoutine AS DWORD ' PFN_RPCNOTIFICATION_ROUTINE
 hThread AS DWORD
END TYPE
' // Size = 16 bytes
TYPE RPC_ASYNC_NOTIFICATION_INFO_IOC DWORD
 hIOPort AS DWORD
 dwNumberOfBytesTransferred AS DWORD
 dwCompletionKey AS DWORD ' DWORD_PTR
 lpOverlapped AS OVERLAPPED PTR
END TYPE
' // Size = 8 bytes
TYPE RPC_ASYNC_NOTIFICATION_INFO_HWND DWORD
 hWnd AS DWORD
 Msg AS DWORD ' UINT
END TYPE
' // Size = 16 bytes
UNION RPC_ASYNC_NOTIFICATION_INFO DWORD
'#if !defined(_KRPCENV_)
 ' // Notification by APC
 APC AS RPC_ASYNC_NOTIFICATION_INFO_APC
 ' // Notification by IO completion port
 IOC AS RPC_ASYNC_NOTIFICATION_INFO_IOC
 ' // Notification by window message
 HWND AS RPC_ASYNC_NOTIFICATION_INFO_HWND
'#endif // _KRPCENV_
'#if !defined(_KRPCENV_)
 ' // Notification by event
 ' HANDLE hEvent;
'#else // _KRPCENV_
 ' // Notification by event
 ' PKEVENT Event;
'#endif // _KRPCENV_
 hEvent AS DWORD
 ' // Notification by callback function
 ' // This option is available only to OLE
 NotificationRoutine AS DWORD ' PFN_RPCNOTIFICATION_ROUTINE
END UNION
'typedef struct _RPC_ASYNC_STATE {
' unsigned int Size; // size of this structure
' unsigned long Signature;
' long Lock;
' unsigned long Flags;
' void *StubInfo;
' void *UserInfo;
' void *RuntimeInfo;
' RPC_ASYNC_EVENT Event;
' RPC_NOTIFICATION_TYPES NotificationType;
' union {
' //
' // Notification by APC
' //
' struct {
' PFN_RPCNOTIFICATION_ROUTINE NotificationRoutine;
' HANDLE hThread;
' } APC;
' //
' // Notification by IO completion port
' //
' struct {
' HANDLE hIOPort;
' DWORD dwNumberOfBytesTransferred;
' DWORD_PTR dwCompletionKey;
' LPOVERLAPPED lpOverlapped;
' } IOC;
' //
' // Notification by window message
' //
' struct {
' HWND hWnd;
' UINT Msg;
' } HWND;
' //
' // Notification by event
' //
' HANDLE hEvent;
' //
' // Notification by callback function
' //
' // This option is available only to OLE
' //
' PFN_RPCNOTIFICATION_ROUTINE NotificationRoutine;
' } u;
' LONG_PTR Reserved[4];
' } RPC_ASYNC_STATE, *PRPC_ASYNC_STATE;
' // Size = 8 bytes
TYPE RPC_ASYNC_STATE_APC DWORD
 NotificationRoutine AS DWORD ' PFN_RPCNOTIFICATION_ROUTINE
 hThread AS DWORD
END TYPE
' // Size = 16 bytes
TYPE RPC_ASYNC_STATE_IOC DWORD
 hIOPort AS DWORD
 dwNumberOfBytesTransferred AS DWORD
 dwCompletionKey AS DWORD ' DWORD_PTR
 lpOverlapped AS OVERLAPPED PTR
END TYPE
' // Size = 8 bytes
TYPE RPC_ASYNC_STATE_HWND DWORD
 hWnd AS DWORD
 Msg AS DWORD ' UINT
END TYPE
' // Size = 16 bytes
UNION RPC_ASYNC_STATE_UNION DWORD
 APC AS RPC_ASYNC_STATE_APC
 IOC AS RPC_ASYNC_STATE_IOC
 HWND AS RPC_ASYNC_STATE_HWND
 hEvent AS DWORD
 NotificationRoutine AS DWORD ' PFN_RPCNOTIFICATION_ROUTINE
END UNION
' // Size = 68 bytes
TYPE RPC_ASYNC_STATE DWORD
 Size AS DWORD ' unsigned int // size of this structure
 Signature AS DWORD ' unsigned long
 Lock AS LONG ' long
 Flags AS DWORD ' unsigned long
 StubInfo AS DWORD ' void *
 UserInfo AS DWORD ' void *
 RuntimeInfo AS DWORD ' void *
 Event AS LONG ' RPC_ASYNC_EVENT enum
 NotificationType AS LONG ' RPC_NOTIFICATION_TYPES enum
 RPC_ASYNC_STATE_UNION
 Reserved(3) AS DWORD ' LONG_PTR[4]
END TYPE
'// Possible values for Flags
%EQUATE `RPC_C_NOTIFY_ON_SEND_COMPLETE = &H1
%EQUATE `RPC_C_INFINITE_TIMEOUT = &HFFFFFFFF ' %INFINITE
'#define RpcAsyncGetCallHandle(pAsync) (((PRPC_ASYNC_STATE) pAsync)->RuntimeInfo)
DECLARE FUNCTION RpcAsyncInitializeHandle LIB "rpcrt4.dll" ALIAS "RpcAsyncInitializeHandle" ( BYREF pAsync AS RPC_ASYNC_STATE , BYVAL Size AS QUAD ) AS LONG ' RPC_STATUS
'#if !defined(_KRPCENV_)
DECLARE FUNCTION RpcAsyncRegisterInfo LIB "rpcrt4.dll" ALIAS "RpcAsyncRegisterInfo" ( BYREF pAsync AS RPC_ASYNC_STATE ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcAsyncGetCallStatus LIB "rpcrt4.dll" ALIAS "RpcAsyncGetCallStatus" ( BYREF pAsync AS RPC_ASYNC_STATE ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcAsyncCompleteCall LIB "rpcrt4.dll" ALIAS "RpcAsyncCompleteCall" ( BYREF pAsync AS RPC_ASYNC_STATE , BYVAL Reply AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcAsyncAbortCall LIB "rpcrt4.dll" ALIAS "RpcAsyncAbortCall" ( BYREF pAsync AS RPC_ASYNC_STATE , BYVAL ExceptionCode AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcAsyncCancelCall LIB "rpcrt4.dll" ALIAS "RpcAsyncCancelCall" ( BYREF pAsync AS RPC_ASYNC_STATE , BYVAL fAbort AS LONG ) AS LONG ' RPC_STATUS
'#if (NTDDI_VERSION >= NTDDI_WINXP)
'// EEINFO needs k-mode or needs winbase.h
'#if !defined(RPC_NO_WINDOWS_H) || defined(_KRPCENV_) || defined(_WINBASE_)
' ExtendedErrorParamTypes enum
%EQUATE `eeptAnsiString = 1
%EQUATE `eeptUnicodeString = 2
%EQUATE `eeptLongVal = 3
%EQUATE `eeptShortVal = 4
%EQUATE `eeptPointerVal = 5
%EQUATE `eeptNone = 6
%EQUATE `eeptBinary = 7
%EQUATE `MaxNumberOfEEInfoParams = 4
%EQUATE `RPC_EEINFO_VERSION = 1
' // Size = 8 bytes
TYPE BinaryParam DWORD
 Buffer AS DWORD ' void *
 Size AS INTEGER ' short
END TYPE
' // Size = 8 bytes
UNION RPC_EE_INFO_PARAM_UNION
 AnsiString AS ASCIIZ PTR
 UnicodeString AS WSTRINGZ PTR
 LVal AS LONG ' long
 SVal AS INTEGER ' short
 PVal AS QUAD ' ULONGLONG
 BVal AS BinaryParam ' BinaryParam
END UNION
' // Size = 16 bytes
TYPE RPC_EE_INFO_PARAM ' Must be 8 byte aligned
 ParameterType AS LONG ' ExtendedErrorParamTypes enum
 alignment__ AS DWORD
 RPC_EE_INFO_PARAM_UNION
END TYPE
%EQUATE `EEInfoPreviousRecordsMissing = 1
%EQUATE `EEInfoNextRecordsMissing = 2
%EQUATE `EEInfoUseFileTime = 4
%EQUATE `EEInfoGCCOM = 11
'#if (NTDDI_VERSION >= NTDDI_WS03)
%EQUATE `EEInfoGCFRS = 12
'#endif // (NTDDI_VERSION >= NTDDI_WS03)
' // Size = 16 bytes
UNION RPC_EXTENDED_ERROR_INFO_UNION
'#if !defined(_KRPCENV_)
' SYSTEMTIME SystemTime;
' FILETIME FileTime;
'#else // _KRPCENV_
' LARGE_INTEGER KernelTime;
'#endif // _KRPCENV_
 SystemTime AS SYSTEMTIME
 FileTime AS FILETIME
END UNION
' // Size = 112 bytes
TYPE RPC_EXTENDED_ERROR_INFO ' Must be 8 byte aligned
 Version AS DWORD ' ULONG
 ComputerName AS WSTRINGZ PTR
 ProcessID AS DWORD ' ULONG
 RPC_EXTENDED_ERROR_INFO_UNION
 GeneratingComponent AS DWORD ' ULONG
 Status AS DWORD ' ULONG
 DetectionLocation AS WORD ' USHORT
 Flags AS WORD ' USHORT
 NumberOfParameters AS LONG ' int
 alignment__ AS DWORD
 Parameters(%MaxNumberOfEEInfoParams - 1) AS RPC_EE_INFO_PARAM
END TYPE
' // Size = 12 bytes
TYPE RPC_ERROR_ENUM_HANDLE DWORD
 Signature AS DWORD ' ULONG
 CurrentPos AS DWORD ' void *
 Head AS DWORD ' void *
END TYPE
DECLARE FUNCTION RpcErrorStartEnumeration LIB "rpcrt4.dll" ALIAS "RpcErrorStartEnumeration" ( BYREF EnumHandle AS RPC_ERROR_ENUM_HANDLE ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcErrorGetNextRecord LIB "rpcrt4.dll" ALIAS "RpcErrorGetNextRecord" ( BYREF EnumHandle AS RPC_ERROR_ENUM_HANDLE , BYVAL CopyStrings AS LONG , BYREF ErrorInfo AS RPC_EXTENDED_ERROR_INFO ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcErrorEndEnumeration LIB "rpcrt4.dll" ALIAS "RpcErrorEndEnumeration" ( BYREF EnumHandle AS RPC_ERROR_ENUM_HANDLE ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcErrorResetEnumeration LIB "rpcrt4.dll" ALIAS "RpcErrorResetEnumeration" ( BYREF EnumHandle AS RPC_ERROR_ENUM_HANDLE ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcErrorGetNumberOfRecords LIB "rpcrt4.dll" ALIAS "RpcErrorGetNumberOfRecords" ( BYREF EnumHandle AS RPC_ERROR_ENUM_HANDLE , BYREF Records AS LONG ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcErrorSaveErrorInfo LIB "rpcrt4.dll" ALIAS "RpcErrorSaveErrorInfo" ( BYREF EnumHandle AS RPC_ERROR_ENUM_HANDLE , BYREF ErrorBlob AS ANY , BYREF BlobSize AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcErrorLoadErrorInfo LIB "rpcrt4.dll" ALIAS "RpcErrorLoadErrorInfo" ( BYVAL ErrorBlob AS QUAD , BYVAL BlobSize AS QUAD , BYREF EnumHandle AS RPC_ERROR_ENUM_HANDLE ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcErrorAddRecord LIB "rpcrt4.dll" ALIAS "RpcErrorAddRecord" ( BYREF ErrorInfo AS RPC_ERROR_ENUM_HANDLE ) AS LONG ' RPC_STATUS
DECLARE SUB RpcErrorClearInformation LIB "rpcrt4.dll" ALIAS "RpcErrorClearInformation" () ' void
'#endif // !RPC_NO_WINDOWS_H || _KRPCENV_ || _WINBASE_
'#if !defined(_KRPCENV_)
DECLARE FUNCTION RpcAsyncCleanupThread LIB "rpcrt4.dll" ALIAS "RpcAsyncCleanupThread" ( BYVAL dwTimeout AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcGetAuthorizationContextForClient LIB "rpcrt4.dll" ALIAS "RpcGetAuthorizationContextForClient" ( BYVAL ClientBinding AS QUAD , BYVAL ImpersonateOnReturn AS LONG , BYVAL Reserved1 AS QUAD , BYREF pExpirationTime AS ANY , BYVAL Reserved2 AS QUAD , BYVAL Reserved3 AS QUAD , BYVAL Reserved4 AS QUAD , BYREF pAuthzClientContext AS ANY ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcFreeAuthorizationContext LIB "rpcrt4.dll" ALIAS "RpcFreeAuthorizationContext" ( BYVAL pAuthzClientContext AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcSsContextLockExclusive LIB "rpcrt4.dll" ALIAS "RpcSsContextLockExclusive" ( BYVAL ServerBindingHandle AS QUAD , BYVAL UserContext AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcSsContextLockShared LIB "rpcrt4.dll" ALIAS "RpcSsContextLockShared" ( BYVAL ServerBindingHandle AS QUAD , BYVAL UserContext AS QUAD ) AS LONG ' RPC_STATUS
'#if (NTDDI_VERSION >= NTDDI_VISTA)
' enum tagRpcLocalAddressFormat
%EQUATE `rlafInvalid = 0
%EQUATE `rlafIPv4 = 1
%EQUATE `rlafIPv6 = 2
' // Size = 16 bytes
TYPE RPC_CALL_LOCAL_ADDRESS_V1 DWORD
 Version AS DWORD ' unsigned int
 Buffer AS DWORD ' void *
 BufferSize AS DWORD ' unsigned long
 AddressFormat AS LONG ' RpcLocalAddressFormat enum
END TYPE
'%RPC_CALL_ATTRIBUTES_VERSION = 2
%EQUATE `RPC_QUERY_SERVER_PRINCIPAL_NAME = &H02
%EQUATE `RPC_QUERY_CLIENT_PRINCIPAL_NAME = &H04
%EQUATE `RPC_QUERY_CALL_LOCAL_ADDRESS = &H08
%EQUATE `RPC_QUERY_CLIENT_PID = &H10
%EQUATE `RPC_QUERY_IS_CLIENT_LOCAL = &H20
%EQUATE `RPC_QUERY_NO_AUTH_REQUIRED = &H40
'#endif // (NTDDI_VERSION >= NTDDI_VISTA)
'#if ( (NTDDI_VERSION >= NTDDI_WINXP) && (NTDDI_VERSION < NTDDI_VISTA) )
'%RPC_CALL_ATTRIBUTES_VERSION = 1
'%RPC_QUERY_SERVER_PRINCIPAL_NAME = 2
'%RPC_QUERY_CLIENT_PRINCIPAL_NAME = 4
%EQUATE `RPC_CALL_ATTRIBUTES_VERSION = 1
%EQUATE `RPC_QUERY_SERVER_PRINCIPAL_NAME = 2
%EQUATE `RPC_QUERY_CLIENT_PRINCIPAL_NAME = 4
'#endif // ( (NTDDI_VERSION >= NTDDI_WINXP) && (NTDDI_VERSION < NTDDI_VISTA) )
' // Size = 36 bytes
TYPE RPC_CALL_ATTRIBUTES_V1_W DWORD
 Version AS DWORD ' unsigned int
 Flags AS DWORD ' unsigned long
 ServerPrincipalNameBufferLength AS DWORD ' unsigned long
 ServerPrincipalName AS WSTRINGZ PTR ' unsigned short *
 ClientPrincipalNameBufferLength AS DWORD ' unsigned long
 ClientPrincipalName AS WSTRINGZ PTR ' unsigned short *
 AuthenticationLevel AS DWORD ' unsigned long
 AuthenticationService AS DWORD ' unsigned long
 NullSession AS LONG
END TYPE
' // Size = 36 bytes
TYPE RPC_CALL_ATTRIBUTES_V1_A DWORD
 Version AS DWORD ' unsigned int
 Flags AS DWORD ' unsigned long
 ServerPrincipalNameBufferLength AS DWORD ' unsigned long
 ServerPrincipalName AS ASCIIZ PTR ' unsigned short *
 ClientPrincipalNameBufferLength AS DWORD ' unsigned long
 ClientPrincipalName AS ASCIIZ PTR ' unsigned short *
 AuthenticationLevel AS DWORD ' unsigned long
 AuthenticationService AS DWORD ' unsigned long
 NullSession AS LONG
END TYPE
MACRO RPC_CALL_ATTRIBUTES_V1 = RPC_CALL_ATTRIBUTES_V1_A
'#if (NTDDI_VERSION >= NTDDI_VISTA)
'// CallStatus bit fields
%EQUATE `RPC_CALL_STATUS_CANCELLED = &H01
%EQUATE `RPC_CALL_STATUS_DISCONNECTED = &H02
' enum RpcCallType
%EQUATE `rctInvalid = 0
%EQUATE `rctNormal = 1
%EQUATE `rctTraining = 2
%EQUATE `rctGuaranteed = 3
' enum RpcCallClientLocality
%EQUATE `rcclInvalid = 0
%EQUATE `rcclLocal = 1
%EQUATE `rcclRemote = 2
%EQUATE `rcclClientUnknownLocality = 3
' // Size = 84 bytes
TYPE RPC_CALL_ATTRIBUTES_V2_W DWORD
 Version AS DWORD ' unsigned int
 Flags AS DWORD ' unsigned long
 ServerPrincipalNameBufferLength AS DWORD ' unsigned long
 ServerPrincipalName AS WSTRINGZ PTR ' unsigned short *
 ClientPrincipalNameBufferLength AS DWORD ' unsigned long
 ClientPrincipalName AS WSTRINGZ PTR ' unsigned short *
 AuthenticationLevel AS DWORD ' unsigned long
 AuthenticationService AS DWORD ' unsigned long
 NullSession AS LONG
 KernelModeCaller AS LONG
 ProtocolSequence AS DWORD ' unsigned long
 IsClientLocal AS LONG ' RpcCallClientLocality enum
 ClientPID AS DWORD
 CallStatus AS DWORD ' unsigned long
 CallType AS LONG ' RpcCallType
 CallLocalAddress AS RPC_CALL_LOCAL_ADDRESS_V1 PTR ' RPC_CALL_LOCAL_ADDRESS_V1* // one of the CallLocalAddress flavors
 OpNum AS WORD ' unsigned short
 InterfaceUuid AS GUID ' UUID
END TYPE
' // Size = 84 bytes
TYPE RPC_CALL_ATTRIBUTES_V2_A DWORD
 Version AS DWORD ' unsigned int
 Flags AS DWORD ' unsigned long
 ServerPrincipalNameBufferLength AS DWORD ' unsigned long
 ServerPrincipalName AS ASCIIZ PTR ' unsigned char *
 ClientPrincipalNameBufferLength AS DWORD ' unsigned long
 ClientPrincipalName AS ASCIIZ PTR ' unsigned char *
 AuthenticationLevel AS DWORD ' unsigned long
 AuthenticationService AS DWORD ' unsigned long
 NullSession AS LONG
 KernelModeCaller AS LONG
 ProtocolSequence AS DWORD ' unsigned long
 IsClientLocal AS DWORD ' unsigned long
 ClientPID AS DWORD
 CallStatus AS DWORD ' unsigned long
 CallType AS LONG ' RpcCallType
 CallLocalAddress AS RPC_CALL_LOCAL_ADDRESS_V1 PTR ' RPC_CALL_LOCAL_ADDRESS_V1* // one of the CallLocalAddress flavors
 OpNum AS WORD ' unsigned short
 InterfaceUuid AS GUID ' UUID
END TYPE
'#endif // (NTDDI_VERSION >= NTDDI_VISTA)
'#if (NTDDI_VERSION >= NTDDI_VISTA)
'typedef RPC_CALL_ATTRIBUTES_V2 RPC_CALL_ATTRIBUTES;
'#else
'typedef RPC_CALL_ATTRIBUTES_V1 RPC_CALL_ATTRIBUTES;
'#endif // (NTDDI_VERSION >= NTDDI_VISTA)
#IF %WINVER >= &H0600
MACRO RPC_CALL_ATTRIBUTES = RPC_CALL_ATTRIBUTES_V2_A
#ELSE
MACRO RPC_CALL_ATTRIBUTES = RPC_CALL_ATTRIBUTES_V1_A
#ENDIF
DECLARE FUNCTION RpcServerInqCallAttributesW LIB "rpcrt4.dll" ALIAS "RpcServerInqCallAttributesW" ( BYVAL ClientBinding AS QUAD , BYREF RpcCallAttributes AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcServerInqCallAttributesA LIB "rpcrt4.dll" ALIAS "RpcServerInqCallAttributesA" ( BYVAL ClientBinding AS QUAD , BYREF RpcCallAttributes AS QUAD ) AS LONG ' RPC_STATUS
#IF %DEF(%UNICODE)
 MACRO RpcServerInqCallAttributes = RpcServerInqCallAttributesW
#ELSE
 MACRO RpcServerInqCallAttributes = RpcServerInqCallAttributesA
#ENDIF
'#if (NTDDI_VERSION >= NTDDI_VISTA)
'// can be used as flags in a bitmask too
' enum RPC_NOTIFICATIONS
%EQUATE `RpcNotificationCallNone = 0
%EQUATE `RpcNotificationClientDisconnect = 1
%EQUATE `RpcNotificationCallCancel = 2 ' // internal for Windows
%EQUATE `RpcNotificationCallStatusChange = %RpcNotificationClientDisconnect
DECLARE FUNCTION RpcServerSubscribeForNotification LIB "rpcrt4.dll" ALIAS "RpcServerSubscribeForNotification" ( BYVAL Binding AS QUAD , BYVAL Notification AS LONG , BYVAL NotificationType AS LONG , BYREF NotificationInfo AS RPC_ASYNC_NOTIFICATION_INFO ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcServerUnsubscribeForNotification LIB "rpcrt4.dll" ALIAS "RpcServerUnsubscribeForNotification" ( BYVAL Binding AS QUAD , BYVAL Notification AS LONG , BYREF NotificationsQueued AS QUAD ) AS LONG ' RPC_STATUS
'#endif // (NTDDI_VERSION >= NTDDI_VISTA)
'#endif // _KRPCENV_
'#if (NTDDI_VERSION >= NTDDI_VISTA)
DECLARE FUNCTION RpcBindingBind LIB "rpcrt4.dll" ALIAS "RpcBindingBind" ( BYREF pAsync AS RPC_ASYNC_STATE , BYVAL Binding AS QUAD , BYVAL IfSpec AS QUAD ) AS LONG ' RPC_STATUS
DECLARE FUNCTION RpcBindingUnbind LIB "rpcrt4.dll" ALIAS "RpcBindingUnbind" ( BYVAL Binding AS QUAD ) AS LONG ' RPC_STATUS
'#if !defined(RPC_NO_WINDOWS_H) || defined(_KRPCENV_) || defined(_WINBASE_)
%EQUATE `RPC_DE_USE_CURRENT_EEINFO = 1
DECLARE FUNCTION RpcDiagnoseError LIB "rpcrt4.dll" ALIAS "RpcDiagnoseError" ( BYVAL BindingHandle AS QUAD , BYVAL IfSpec AS QUAD , BYVAL RpcStatus AS QUAD , BYREF EnumHandle AS RPC_ERROR_ENUM_HANDLE , BYVAL Options AS QUAD , BYVAL ParentWindow AS QUAD ) AS LONG ' RPC_STATUS
'#endif // !RPC_NO_WINDOWS_H || _KRPCENV_ || _WINBASE_
'#endif // (NTDDI_VERSION >= NTDDI_VISTA)
'#endif // (NTDDI_VERSION >= NTDDI_WINXP)
'//
'// Internal APIs
'//
DECLARE FUNCTION I_RpcAsyncSetHandle LIB "rpcrt4.dll" ALIAS "I_RpcAsyncSetHandle" ( BYREF Message AS RPC_MESSAGE , BYREF pAsync AS RPC_ASYNC_STATE ) AS LONG ' RPC_STATUS
DECLARE FUNCTION I_RpcAsyncAbortCall LIB "rpcrt4.dll" ALIAS "I_RpcAsyncAbortCall" ( BYREF pAsync AS RPC_ASYNC_STATE , BYVAL ExceptionCode AS QUAD ) AS LONG ' RPC_STATUS
'#if (NTDDI_VERSION >= NTDDI_WXP)
DECLARE FUNCTION I_RpcExceptionFilter LIB "rpcrt4.dll" ALIAS "I_RpcExceptionFilter" ( BYVAL ExceptionCode AS QUAD ' unsigned long ExceptionCode ) AS LONG ' int
'#endif // (NTDDI_VERSION >= NTDDI_WXP)
'#if defined(__RPC_WIN64__)
'#include <poppack.h>
'#endif
#ENDIF
