From 9369aea260e144f12d95c6b6386f095a58a031db Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 4 Apr 2020 18:15:30 -0500 Subject: [PATCH] rpcrt4: Implement NdrClientCall3(). Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45699 Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/rpcrt4/ndr_stubless.c | 63 ++++++++++++++++++++++++++++++++++++++ dlls/rpcrt4/rpcrt4.spec | 1 + include/rpcndr.h | 4 ++- 3 files changed, 67 insertions(+), 1 deletion(-) diff --git a/dlls/rpcrt4/ndr_stubless.c b/dlls/rpcrt4/ndr_stubless.c index 0ef421daf2c..13a60522fea 100644 --- a/dlls/rpcrt4/ndr_stubless.c +++ b/dlls/rpcrt4/ndr_stubless.c @@ -2210,3 +2210,66 @@ RPC_STATUS NdrpCompleteAsyncServerCall(RPC_ASYNC_STATE *pAsync, void *Reply) return S_OK; } + +static const RPC_SYNTAX_IDENTIFIER ndr_syntax_id = + {{0x8a885d04, 0x1ceb, 0x11c9, {0x9f, 0xe8, 0x08, 0x00, 0x2b, 0x10, 0x48, 0x60}}, {2, 0}}; + +LONG_PTR CDECL DECLSPEC_HIDDEN ndr64_client_call( MIDL_STUBLESS_PROXY_INFO *info, + ULONG proc, void *retval, void **stack_top, void **fpu_stack ) +{ + ULONG_PTR i; + + TRACE("info %p, proc %u, retval %p, stack_top %p, fpu_stack %p\n", + info, proc, retval, stack_top, fpu_stack); + + for (i = 0; i < info->nCount; ++i) + { + const MIDL_SYNTAX_INFO *syntax_info = &info->pSyntaxInfo[i]; + const RPC_SYNTAX_IDENTIFIER *id = &syntax_info->TransferSyntax; + + TRACE("Found syntax %s, version %u.%u.\n", debugstr_guid(&id->SyntaxGUID), + id->SyntaxVersion.MajorVersion, id->SyntaxVersion.MinorVersion); + if (!memcmp(id, &ndr_syntax_id, sizeof(RPC_SYNTAX_IDENTIFIER))) + { + if (retval) + FIXME("Complex return types are not supported.\n"); + + return ndr_client_call( info->pStubDesc, + syntax_info->ProcString + syntax_info->FmtStringOffset[proc], stack_top, fpu_stack ); + } + } + + FIXME("NDR64 syntax is not supported.\n"); + return 0; +} + +#ifdef __x86_64__ + +__ASM_GLOBAL_FUNC( NdrClientCall3, + "movq %r9,0x20(%rsp)\n\t" + "leaq 0x20(%rsp),%r9\n\t" + "pushq $0\n\t" + "subq $0x20,%rsp\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset 0x28\n\t") + "call " __ASM_NAME("ndr64_client_call") "\n\t" + "addq $0x28,%rsp\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset -0x28\n\t") + "ret" ); + +#elif defined(_WIN64) + +/*********************************************************************** + * NdrClientCall3 [RPCRT4.@] + */ +CLIENT_CALL_RETURN WINAPIV NdrClientCall3( MIDL_STUBLESS_PROXY_INFO *info, ULONG proc, void *retval, ... ) +{ + __ms_va_list args; + LONG_PTR ret; + + __ms_va_start( args, retval ); + ret = ndr64_client_call( info, proc, retval, va_arg( args, void ** ), NULL ); + __ms_va_end( args ); + return *(CLIENT_CALL_RETURN *)&ret; +} + +#endif diff --git a/dlls/rpcrt4/rpcrt4.spec b/dlls/rpcrt4/rpcrt4.spec index 5d558bff753..2673771ef57 100644 --- a/dlls/rpcrt4/rpcrt4.spec +++ b/dlls/rpcrt4/rpcrt4.spec @@ -128,6 +128,7 @@ @ stdcall NdrClearOutParameters(ptr ptr ptr) @ varargs NdrClientCall2(ptr ptr) @ varargs -arch=i386 NdrClientCall(ptr ptr) NdrClientCall2 +@ varargs -arch=win64 NdrClientCall3(ptr long ptr) @ stdcall NdrClientContextMarshall(ptr ptr long) @ stdcall NdrClientContextUnmarshall(ptr ptr ptr) @ stub NdrClientInitialize diff --git a/include/rpcndr.h b/include/rpcndr.h index ac9da115ca8..729b881c9bc 100644 --- a/include/rpcndr.h +++ b/include/rpcndr.h @@ -663,10 +663,12 @@ RPCRTAPI void RPC_ENTRY RPCRTAPI unsigned char* RPC_ENTRY NdrUserMarshalSimpleTypeConvert( ULONG *pFlags, unsigned char *pBuffer, unsigned char FormatChar ); +CLIENT_CALL_RETURN RPC_VAR_ENTRY + NdrClientCall( PMIDL_STUB_DESC pStubDescriptor, 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, ... ); + NdrClientCall3( MIDL_STUBLESS_PROXY_INFO *info, ULONG proc, void *retval, ... ); CLIENT_CALL_RETURN RPC_VAR_ENTRY NdrAsyncClientCall( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... ); CLIENT_CALL_RETURN RPC_VAR_ENTRY