From 36c5adca377dada3e86a765e4ba5b2fdb000eb19 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 4 Apr 2020 18:15:31 -0500 Subject: [PATCH] rpcrt4: Implement Ndr64AsyncClientCall(). 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 | 60 ++++++++++++++++++++++++++++++++++++++ dlls/rpcrt4/rpcrt4.spec | 1 + include/rpcndr.h | 2 ++ 3 files changed, 63 insertions(+) diff --git a/dlls/rpcrt4/ndr_stubless.c b/dlls/rpcrt4/ndr_stubless.c index 13a60522fea..3a38137f7f4 100644 --- a/dlls/rpcrt4/ndr_stubless.c +++ b/dlls/rpcrt4/ndr_stubless.c @@ -2273,3 +2273,63 @@ CLIENT_CALL_RETURN WINAPIV NdrClientCall3( MIDL_STUBLESS_PROXY_INFO *info, ULONG } #endif + +LONG_PTR CDECL DECLSPEC_HIDDEN ndr64_async_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_async_client_call( info->pStubDesc, + syntax_info->ProcString + syntax_info->FmtStringOffset[proc], stack_top ); + } + } + + FIXME("NDR64 syntax is not supported.\n"); + return 0; +} + +#ifdef __x86_64__ + +__ASM_GLOBAL_FUNC( Ndr64AsyncClientCall, + "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_async_client_call") "\n\t" + "addq $0x28,%rsp\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset -0x28\n\t") + "ret" ); + +#elif defined(_WIN64) + +/*********************************************************************** + * Ndr64AsyncClientCall [RPCRT4.@] + */ +CLIENT_CALL_RETURN WINAPIV Ndr64AsyncClientCall( MIDL_STUBLESS_PROXY_INFO *info, ULONG proc, void *retval, ... ) +{ + __ms_va_list args; + LONG_PTR ret; + + __ms_va_start( args, retval ); + ret = ndr64_async_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 2673771ef57..04927764efe 100644 --- a/dlls/rpcrt4/rpcrt4.spec +++ b/dlls/rpcrt4/rpcrt4.spec @@ -115,6 +115,7 @@ @ stdcall NDRSContextUnmarshall(ptr long) @ stdcall NDRSContextUnmarshallEx(ptr ptr long) @ stub NDRcopy +@ varargs -arch=win64 Ndr64AsyncClientCall(ptr long ptr) @ stdcall NdrAllocate(ptr long) @ varargs NdrAsyncClientCall(ptr ptr) @ stdcall NdrAsyncServerCall(ptr) diff --git a/include/rpcndr.h b/include/rpcndr.h index 729b881c9bc..86cbe5f6c6d 100644 --- a/include/rpcndr.h +++ b/include/rpcndr.h @@ -671,6 +671,8 @@ CLIENT_CALL_RETURN RPC_VAR_ENTRY 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 + Ndr64AsyncClientCall( MIDL_STUBLESS_PROXY_INFO *info, ULONG proc, void *retval, ... ); CLIENT_CALL_RETURN RPC_VAR_ENTRY NdrDcomAsyncClientCall( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );