From 29b3061bfa2dda03b556a85f343307978929e2cb Mon Sep 17 00:00:00 2001 From: Ove Kaaven Date: Fri, 9 Aug 2002 01:11:39 +0000 Subject: [PATCH] Some more RPC definitions. --- dlls/rpcrt4/rpcrt4_main.c | 8 +-- include/rpc.h | 2 + include/rpcdce.h | 80 +++++++++++++++++++++++--- include/rpcdcep.h | 116 +++++++++++++++++++++++++++++++++++++- include/rpcndr.h | 39 ++++++++++++- include/rpcproxy.h | 36 ++++++++++++ 6 files changed, 267 insertions(+), 14 deletions(-) diff --git a/dlls/rpcrt4/rpcrt4_main.c b/dlls/rpcrt4/rpcrt4_main.c index d10dd976b49..735134f6342 100644 --- a/dlls/rpcrt4/rpcrt4_main.c +++ b/dlls/rpcrt4/rpcrt4_main.c @@ -308,7 +308,7 @@ RPC_STATUS WINAPI UuidCreateSequential(UUID *Uuid) * * S_OK if successful. */ -RPC_STATUS WINAPI RpcStringFreeA(unsigned char** String) +RPC_STATUS WINAPI RpcStringFreeA(LPSTR* String) { HeapFree( GetProcessHeap(), 0, *String); @@ -342,7 +342,7 @@ unsigned short WINAPI UuidHash(UUID *uuid, RPC_STATUS *Status) * S_OK if successful. * S_OUT_OF_MEMORY if unsucessful. */ -RPC_STATUS WINAPI UuidToStringA(UUID *Uuid, unsigned char** StringUuid) +RPC_STATUS WINAPI UuidToStringA(UUID *Uuid, LPSTR* StringUuid) { *StringUuid = HeapAlloc( GetProcessHeap(), 0, sizeof(char) * 37); @@ -361,7 +361,7 @@ RPC_STATUS WINAPI UuidToStringA(UUID *Uuid, unsigned char** StringUuid) /*********************************************************************** * UuidFromStringA (RPCRT4.@) */ -RPC_STATUS WINAPI UuidFromStringA(unsigned char *str, UUID *uuid) +RPC_STATUS WINAPI UuidFromStringA(LPSTR str, UUID *uuid) { FIXME("%s %p\n",debugstr_a(str),uuid); return RPC_S_INVALID_STRING_UUID; @@ -370,7 +370,7 @@ RPC_STATUS WINAPI UuidFromStringA(unsigned char *str, UUID *uuid) /*********************************************************************** * UuidFromStringW (RPCRT4.@) */ -RPC_STATUS WINAPI UuidFromStringW(unsigned short *str, UUID *uuid) +RPC_STATUS WINAPI UuidFromStringW(LPWSTR str, UUID *uuid) { FIXME("%s %p\n",debugstr_w(str),uuid); return RPC_S_INVALID_STRING_UUID; diff --git a/include/rpc.h b/include/rpc.h index f553073571b..b79ada6cd36 100644 --- a/include/rpc.h +++ b/include/rpc.h @@ -25,6 +25,8 @@ #ifndef __WINE_RPC_H #define __WINE_RPC_H +#define __RPC_WIN32__ + #define __RPC_FAR #define __RPC_API WINAPI #define __RPC_USER WINAPI diff --git a/include/rpcdce.h b/include/rpcdce.h index f6d6b64fa3f..062f35353ad 100644 --- a/include/rpcdce.h +++ b/include/rpcdce.h @@ -90,6 +90,11 @@ typedef struct _RPC_POLICY ULONG NICFlags; } RPC_POLICY, *PRPC_POLICY; +/* RpcServerRegisterIfEx Flags */ +#define RPC_IF_AUTOLISTEN 0x1 +#define RPC_IF_OLE 0x2 +#define RPC_IF_ALLOW_UNKNOWN_AUTHORITY 0x4 +#define RPC_IF_ALLOW_SECURE_ONLY 0x8 RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingCopy( RPC_BINDING_HANDLE SourceBinding, RPC_BINDING_HANDLE* DestinationBinding ); @@ -97,6 +102,13 @@ RPCRTAPI RPC_STATUS RPC_ENTRY RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingFree( RPC_BINDING_HANDLE* Binding ); +RPCRTAPI RPC_STATUS RPC_ENTRY + RpcBindingInqObject( RPC_BINDING_HANDLE Binding, UUID* ObjectUuid ); +RPCRTAPI RPC_STATUS RPC_ENTRY + RpcBindingReset( RPC_BINDING_HANDLE Binding ); +RPCRTAPI RPC_STATUS RPC_ENTRY + RpcBindingSetObject( RPC_BINDING_HANDLE Binding, UUID* ObjectUuid ); + RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingFromStringBindingA( LPSTR StringBinding, RPC_BINDING_HANDLE* Binding ); RPCRTAPI RPC_STATUS RPC_ENTRY @@ -112,6 +124,45 @@ RPCRTAPI RPC_STATUS RPC_ENTRY RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingVectorFree( RPC_BINDING_VECTOR** BindingVector ); +RPCRTAPI RPC_STATUS RPC_ENTRY + RpcStringBindingComposeA( LPSTR ObjUuid, LPSTR Protseq, LPSTR NetworkAddr, + LPSTR Endpoint, LPSTR Options, LPSTR* StringBinding ); +RPCRTAPI RPC_STATUS RPC_ENTRY + RpcStringBindingComposeW( LPWSTR ObjUuid, LPWSTR Protseq, LPWSTR NetworkAddr, + LPWSTR Endpoint, LPWSTR Options, LPWSTR* StringBinding ); +#define RpcStringBindingCompose WINELIB_NAME_AW(RpcStringBindingCompose) + +RPCRTAPI RPC_STATUS RPC_ENTRY + RpcStringBindingParseA( LPSTR StringBinding, LPSTR* ObjUuid, LPSTR* Protseq, + LPSTR* NetworkAddr, LPSTR* Endpoint, LPSTR* NetworkOptions ); +RPCRTAPI RPC_STATUS RPC_ENTRY + RpcStringBindingParseW( LPWSTR StringBinding, LPWSTR* ObjUuid, LPWSTR* Protseq, + LPWSTR* NetworkAddr, LPWSTR* Endpoint, LPWSTR* NetworkOptions ); +#define RpcStringBindingParse WINELIB_NAME_AW(RpcStringBindingParse) + +RPCRTAPI RPC_STATUS RPC_ENTRY + RpcEpResolveBinding( RPC_BINDING_HANDLE Binding, RPC_IF_HANDLE IfSpec ); + +RPCRTAPI RPC_STATUS RPC_ENTRY + RpcEpRegisterA( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector, + UUID_VECTOR* UuidVector, LPSTR Annotation ); +RPCRTAPI RPC_STATUS RPC_ENTRY + RpcEpRegisterW( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector, + UUID_VECTOR* UuidVector, LPWSTR Annotation ); +#define RpcEpRegister WINELIB_NAME_AW(RpcEpRegister) + +RPCRTAPI RPC_STATUS RPC_ENTRY + RpcEpRegisterNoReplaceA( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector, + UUID_VECTOR* UuidVector, LPSTR Annotation ); +RPCRTAPI RPC_STATUS RPC_ENTRY + RpcEpRegisterNoReplaceW( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector, + UUID_VECTOR* UuidVector, LPWSTR Annotation ); +#define RpcEpRegisterNoReplace WINELIB_NAME_AW(RpcEpRegisterNoReplace) + +RPCRTAPI RPC_STATUS RPC_ENTRY + RpcEpUnregister( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector, + UUID_VECTOR* UuidVector ); + RPCRTAPI RPC_STATUS RPC_ENTRY RpcServerInqBindings( RPC_BINDING_VECTOR** BindingVector ); @@ -163,22 +214,37 @@ RPCRTAPI RPC_STATUS RPC_ENTRY #define RpcStringBindingCompose WINELIB_NAME_AW(RpcStringBindingCompose) RPCRTAPI RPC_STATUS RPC_ENTRY - RpcStringFreeA(unsigned char** String); + RpcStringFreeA(LPSTR* String); RPCRTAPI RPC_STATUS RPC_ENTRY - RpcStringFreeW(unsigned short** String); + RpcStringFreeW(LPWSTR* String); #define RpcStringFree WINELIB_NAME_AW(RpcStringFree) RPCRTAPI RPC_STATUS RPC_ENTRY - UuidCreate( UUID* Uuid ); - + UuidToStringA( UUID* Uuid, LPSTR* StringUuid ); RPCRTAPI RPC_STATUS RPC_ENTRY - UuidToStringA( UUID* Uuid, unsigned char** StringUuid ); -RPCRTAPI RPC_STATUS RPC_ENTRY - UuidToStringW( UUID* Uuid, unsigned short** StringUuid ); + UuidToStringW( UUID* Uuid, LPWSTR* StringUuid ); #define UuidToString WINELIB_NAME_AW(UuidToString) +RPCRTAPI RPC_STATUS RPC_ENTRY + UuidFromStringA( LPSTR StringUuid, UUID* Uuid ); +RPCRTAPI RPC_STATUS RPC_ENTRY + UuidFromStringW( LPWSTR StringUuid, UUID* Uuid ); +#define UuidFromString WINELIB_NAME_AW(UuidFromString) + +RPCRTAPI RPC_STATUS RPC_ENTRY + UuidCreate( UUID* Uuid ); +RPCRTAPI RPC_STATUS RPC_ENTRY + UuidCreateSequential( UUID* Uuid ); +RPCRTAPI RPC_STATUS RPC_ENTRY + UuidCreateNil( UUID* Uuid ); +RPCRTAPI signed int RPC_ENTRY + UuidCompare( UUID* Uuid1, UUID* Uuid2, RPC_STATUS* Status_ ); +RPCRTAPI int RPC_ENTRY + UuidEqual( UUID* Uuid1, UUID* Uuid2, RPC_STATUS* Status_ ); RPCRTAPI unsigned short RPC_ENTRY UuidHash(UUID* Uuid, RPC_STATUS* Status_ ); +RPCRTAPI int RPC_ENTRY + UuidIsNil( UUID* Uuid, RPC_STATUS* Status_ ); #include "rpcdcep.h" diff --git a/include/rpcdcep.h b/include/rpcdcep.h index eaf0a7594bd..6fe4bfac51e 100644 --- a/include/rpcdcep.h +++ b/include/rpcdcep.h @@ -19,7 +19,6 @@ #ifndef __WINE_RPCDCEP_H #define __WINE_RPCDCEP_H - typedef struct _RPC_VERSION { unsigned short MajorVersion; unsigned short MinorVersion; @@ -45,4 +44,117 @@ typedef struct _RPC_MESSAGE unsigned long RpcFlags; } RPC_MESSAGE, *PRPC_MESSAGE; -#endif /*__WINE_RPCDCE_H */ +typedef void __RPC_STUB (*RPC_DISPATCH_FUNCTION)(PRPC_MESSAGE Message); + +typedef struct +{ + unsigned int DispatchTableCount; + RPC_DISPATCH_FUNCTION* DispatchTable; + LONG_PTR Reserved; +} RPC_DISPATCH_TABLE, *PRPC_DISPATCH_TABLE; + +typedef struct _RPC_PROTSEQ_ENDPOINT +{ + unsigned char* RpcProtocolSequence; + unsigned char* Endpoint; +} RPC_PROTSEQ_ENDPOINT, *PRPC_PROTSEQ_ENDPOINT; + +#define NT351_INTERFACE_SIZE 0x40 +#define RPC_INTERFACE_HAS_PIPES 0x0001 + +typedef struct _RPC_SERVER_INTERFACE +{ + unsigned int Length; + RPC_SYNTAX_IDENTIFIER InterfaceId; + RPC_SYNTAX_IDENTIFIER TransferSyntax; + PRPC_DISPATCH_TABLE DispatchTable; + unsigned int RpcProtseqEndpointCount; + PRPC_PROTSEQ_ENDPOINT RpcProtseqEndpoint; + RPC_MGR_EPV* DefaultManagerEpv; + void const* InterpreterInfo; + unsigned int Flags; +} RPC_SERVER_INTERFACE, *PRPC_SERVER_INTERFACE; + +typedef struct _RPC_CLIENT_INTERFACE +{ + unsigned int Length; + RPC_SYNTAX_IDENTIFIER InterfaceId; + RPC_SYNTAX_IDENTIFIER TransferSyntax; + PRPC_DISPATCH_TABLE DispatchTable; + unsigned int RpcProtseqEndpointCount; + PRPC_PROTSEQ_ENDPOINT RpcProtseqEndpoint; + ULONG_PTR Reserved; + void const* InterpreterInfo; + unsigned int Flags; +} RPC_CLIENT_INTERFACE, *PRPC_CLIENT_INTERFACE; + +#define TRANSPORT_TYPE_CN 0x01 +#define TRANSPORT_TYPE_DG 0x02 +#define TRANSPORT_TYPE_LPC 0x04 +#define TRANSPORT_TYPE_WMSG 0x08 + +#ifdef WINNT +typedef RPC_STATUS (*RPC_BLOCKING_FN)(void* hWnd, void* Context, HANDLE hSyncEvent); +#else +typedef RPC_STATUS (*RPC_BLOCKING_FN)(void* hWnd, void* Context, void* hSyncEvent); +#endif + +RPCRTAPI RPC_STATUS RPC_ENTRY + I_RpcGetBuffer( RPC_MESSAGE* Message ); +RPCRTAPI RPC_STATUS RPC_ENTRY + I_RpcGetBufferWithObject( RPC_MESSAGE* Message, UUID* ObjectUuid ); +RPCRTAPI RPC_STATUS RPC_ENTRY + I_RpcSendReceive( RPC_MESSAGE* Message ); +RPCRTAPI RPC_STATUS RPC_ENTRY + I_RpcFreeBuffer( RPC_MESSAGE* Message ); +RPCRTAPI RPC_STATUS RPC_ENTRY + I_RpcSend( RPC_MESSAGE* Message ); +RPCRTAPI RPC_STATUS RPC_ENTRY + I_RpcReceive( RPC_MESSAGE* Message ); + +RPCRTAPI void* RPC_ENTRY + I_RpcAllocate( unsigned int Size ); +RPCRTAPI void RPC_ENTRY + I_RpcFree( void* Object ); + +RPCRTAPI RPC_BINDING_HANDLE RPC_ENTRY + I_RpcGetCurrentCallHandle( void ); + +RPCRTAPI RPC_STATUS RPC_ENTRY + I_RpcServerStartListening( void* hWnd ); +RPCRTAPI RPC_STATUS RPC_ENTRY + I_RpcServerStopListening( void ); +/* WINNT */ +RPCRTAPI RPC_STATUS RPC_ENTRY + I_GetThreadWindowHandle( HWND* hWnd ); +RPCRTAPI RPC_STATUS RPC_ENTRY + I_RpcAsyncSendReceive( RPC_MESSAGE* Message, void* Context, HWND hWnd ); + +#ifdef WINNT +RPCRTAPI RPC_STATUS RPC_ENTRY + I_RpcBindingSetAsync( RPC_BINDING_HANDLE Binding, RPC_BLOCKING_FN BlockingFn ); +#else +RPCRTAPI RPC_STATUS RPC_ENTRY + I_RpcBindingSetAsync( RPC_BINDING_HANDLE Binding, RPC_BLOCKING_FN BlockingFn, unsigned long ServerTid ); +#endif + +/* WIN9x */ +RPCRTAPI RPC_STATUS RPC_ENTRY + I_RpcSetThreadParams( int fClientFree, void* Context, void* hWndClient ); + +#ifdef WINNT +RPCRTAPI LONG RPC_ENTRY + I_RpcWindowProc( HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam ); +#else +RPCRTAPI unsigned int RPC_ENTRY + I_RpcWindowProc( void* hWnd, unsigned int Message, unsigned int wParam, unsigned long lParam ); +#endif + +/* WINNT */ +RPCRTAPI RPC_STATUS RPC_ENTRY + I_RpcSetWMsgEndpoint( WCHAR* Endpoint ); + +RPCRTAPI RPC_STATUS RPC_ENTRY + I_RpcBindingInqTransportType( RPC_BINDING_HANDLE Binding, unsigned int* Type ); + +#endif /*__WINE_RPCDCEP_H */ diff --git a/include/rpcndr.h b/include/rpcndr.h index 3813a66bdc7..1358f824e75 100644 --- a/include/rpcndr.h +++ b/include/rpcndr.h @@ -22,7 +22,10 @@ #ifndef __RPCNDR_H_VERSION__ /* FIXME: I'm not sure what version though */ #define __RPCNDR_H_VERSION__ -#endif // __RPCNDR_H_VERSION__ +#endif + +#define TARGET_IS_NT40_OR_LATER 1 +#define TARGET_IS_NT351_OR_WIN95_OR_LATER 1 typedef unsigned char byte; typedef __int64 hyper; @@ -31,6 +34,9 @@ typedef __uint64 MIDL_uhyper; typedef unsigned char _wine_boolean; /* typedef _wine_boolean boolean; */ +#define __RPC_CALLEE WINAPI +#define RPC_VAR_ENTRY WINAPIV + typedef struct { void *pad[2]; @@ -195,6 +201,22 @@ typedef struct _MIDL_SERVER_INFO_ const unsigned short *LocalFmtStringOffset; } MIDL_SERVER_INFO, *PMIDL_SERVER_INFO; +typedef struct _MIDL_STUBLESS_PROXY_INFO +{ + PMIDL_STUB_DESC pStubDesc; + PFORMAT_STRING ProcFormatString; + const unsigned short *FormatStringOffset; + PFORMAT_STRING LocalFormatTypes; + PFORMAT_STRING LocalProcStrings; + const unsigned short *LocalFmtStringOffset; +} MIDL_STUBLESS_PROXY_INFO, *PMIDL_STUBLESS_PROXY_INFO; + +typedef union _CLIENT_CALL_RETURN +{ + void *Pointer; + LONG_PTR Simple; +} CLIENT_CALL_RETURN; + typedef enum { STUB_UNMARSHAL, STUB_CALL_SERVER, @@ -254,6 +276,21 @@ RPCRTAPI void RPC_ENTRY RPCRTAPI void RPC_ENTRY NdrConvert( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat ); +CLIENT_CALL_RETURN RPC_VAR_ENTRY + NdrClientCall2( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... ); +CLIENT_CALL_RETURN RPC_VAR_ENTRY + NdrClientCall( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... ); + +RPCRTAPI void RPC_ENTRY + NdrServerCall2( PRPC_MESSAGE pRpcMsg ); +RPCRTAPI void RPC_ENTRY + NdrServerCall( PRPC_MESSAGE pRpcMsg ); + +RPCRTAPI long RPC_ENTRY + NdrStubCall2( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, LPDWORD pdwStubPhase ); +RPCRTAPI long RPC_ENTRY + NdrStubCall( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, LPDWORD pdwStubPhase ); + RPCRTAPI void* RPC_ENTRY NdrOleAllocate( size_t Size ); RPCRTAPI void RPC_ENTRY diff --git a/include/rpcproxy.h b/include/rpcproxy.h index 90b5fefa674..70c4a002d82 100644 --- a/include/rpcproxy.h +++ b/include/rpcproxy.h @@ -19,8 +19,16 @@ #ifndef __WINE_RPCPROXY_H #define __WINE_RPCPROXY_H +#ifndef __RPCPROXY_H_VERSION__ +/* FIXME: I'm not sure what version though */ +#define __RPCPROXY_H_VERSION__ +#endif + #include "basetsd.h" #include "guiddef.h" +#include "winnt.h" +#include "rpc.h" +#include "rpcndr.h" #include "rpc.h" #include "rpcndr.h" @@ -146,6 +154,32 @@ void WINAPI CStdStubBuffer_DebugServerQueryInterface, \ CStdStubBuffer_DebugServerRelease +RPCRTAPI void RPC_ENTRY + NdrProxyInitialize( void *This, PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg, + PMIDL_STUB_DESC pStubDescriptor, unsigned int ProcNum ); +RPCRTAPI void RPC_ENTRY + NdrProxyGetBuffer( void *This, PMIDL_STUB_MESSAGE pStubMsg ); +RPCRTAPI void RPC_ENTRY + NdrProxySendReceive( void *This, PMIDL_STUB_MESSAGE pStubMsg ); +RPCRTAPI void RPC_ENTRY + NdrProxyFreeBuffer( void *This, PMIDL_STUB_MESSAGE pStubMsg ); +RPCRTAPI HRESULT RPC_ENTRY + NdrProxyErrorHandler( DWORD dwExceptionCode ); + +RPCRTAPI void RPC_ENTRY + NdrStubInitialize( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg, + PMIDL_STUB_DESC pStubDescriptor, IRpcChannelBuffer *pRpcChannelBuffer ); +RPCRTAPI void RPC_ENTRY + NdrStubInitializePartial( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg, + PMIDL_STUB_DESC pStubDescriptor, IRpcChannelBuffer *pRpcChannelBuffer, + unsigned long RequestedBufferSize ); +void __RPC_STUB NdrStubForwardingFunction( IRpcStubBuffer *This, IRpcChannelBuffer *pChannel, + PRPC_MESSAGE pMsg, DWORD *pdwStubPhase ); +RPCRTAPI void RPC_ENTRY + NdrStubGetBuffer( IRpcStubBuffer *This, IRpcChannelBuffer *pRpcChannelBuffer, PMIDL_STUB_MESSAGE pStubMsg ); +RPCRTAPI HRESULT RPC_ENTRY + NdrStubErrorHandler( DWORD dwExceptionCode ); + RPCRTAPI HRESULT RPC_ENTRY NdrDllGetClassObject( REFCLSID rclsid, REFIID riid, void **ppv, const ProxyFileInfo **pProxyFileList, const CLSID *pclsid, CStdPSFactoryBuffer *pPSFactoryBuffer ); @@ -161,6 +195,8 @@ RPCRTAPI HRESULT RPC_ENTRY ULONG WINAPI CStdStubBuffer_Release(IRpcStubBuffer *This) \ { return NdrCStdStubBuffer_Release(This, (IPSFactoryBuffer *)pFactory); } +#define IID_GENERIC_CHECK_IID(name,pIID,index) memcmp(pIID, name##_ProxyVtblList[index]->header.piid, sizeof(IID)) + #if defined(__WINE__) && defined(__WINE_WINE_OBJ_OLEAUT_H) /* see http://msdn.microsoft.com/library/en-us/dnmsj99/html/com0199.asp?frame=true */