Alexandre Julliard : rpcrt4: Add a wrapper for NdrAsyncClientCall too.

Alexandre Julliard julliard at winehq.org
Thu Jun 16 14:28:49 CDT 2011


Module: wine
Branch: master
Commit: a75402af9643065b648e906ca9a5301e276864fa
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a75402af9643065b648e906ca9a5301e276864fa

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Jun 15 17:30:49 2011 +0200

rpcrt4: Add a wrapper for NdrAsyncClientCall too.

---

 dlls/rpcrt4/ndr_stubless.c |   43 ++++++++++++++++++++++++++++++++++---------
 dlls/rpcrt4/ndr_stubless.h |    2 ++
 2 files changed, 36 insertions(+), 9 deletions(-)

diff --git a/dlls/rpcrt4/ndr_stubless.c b/dlls/rpcrt4/ndr_stubless.c
index 1f34b76..bbc9c19 100644
--- a/dlls/rpcrt4/ndr_stubless.c
+++ b/dlls/rpcrt4/ndr_stubless.c
@@ -1773,8 +1773,7 @@ struct async_call_data
     ULONG_PTR NdrCorrCache[256];
 };
 
-CLIENT_CALL_RETURN WINAPIV NdrAsyncClientCall(PMIDL_STUB_DESC pStubDesc,
-  PFORMAT_STRING pFormat, ...)
+LONG_PTR CDECL ndr_async_client_call( PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pFormat, void **stack_top )
 {
     /* pointer to start of stack where arguments start */
     PRPC_MESSAGE pRpcMsg;
@@ -1793,8 +1792,6 @@ CLIENT_CALL_RETURN WINAPIV NdrAsyncClientCall(PMIDL_STUB_DESC pStubDesc,
     const NDR_PROC_HEADER * pProcHeader = (const NDR_PROC_HEADER *)&pFormat[0];
     /* -Oif or -Oicf generated format */
     BOOL bV2Format = FALSE;
-    LONG_PTR RetVal;
-    __ms_va_list args;
 
     TRACE("pStubDesc %p, pFormat %p, ...\n", pStubDesc, pFormat);
 
@@ -1847,9 +1844,7 @@ CLIENT_CALL_RETURN WINAPIV NdrAsyncClientCall(PMIDL_STUB_DESC pStubDesc,
 
     /* needed for conformance of top-level objects */
     pStubMsg->StackTop = I_RpcAllocate(async_call_data->stack_size);
-    __ms_va_start( args, pFormat );
-    memcpy(pStubMsg->StackTop, va_arg( args, unsigned char * ), async_call_data->stack_size);
-    __ms_va_end( args );
+    memcpy(pStubMsg->StackTop, stack_top, async_call_data->stack_size);
 
     pAsync = *(RPC_ASYNC_STATE **)pStubMsg->StackTop;
     pAsync->StubInfo = async_call_data;
@@ -1984,8 +1979,7 @@ CLIENT_CALL_RETURN WINAPIV NdrAsyncClientCall(PMIDL_STUB_DESC pStubDesc,
 
 done:
     TRACE("returning 0\n");
-    RetVal = 0;
-    return *(CLIENT_CALL_RETURN *)&RetVal;
+    return 0;
 }
 
 RPC_STATUS NdrpCompleteAsyncClientCall(RPC_ASYNC_STATE *pAsync, void *Reply)
@@ -2087,6 +2081,37 @@ cleanup:
     return status;
 }
 
+#ifdef __x86_64__
+
+__ASM_GLOBAL_FUNC( NdrAsyncClientCall,
+                   "movq %r8,0x18(%rsp)\n\t"
+                   "movq %r9,0x20(%rsp)\n\t"
+                   "leaq 0x18(%rsp),%r8\n\t"
+                   "subq $0x28,%rsp\n\t"
+                   __ASM_CFI(".cfi_adjust_cfa_offset 0x28\n\t")
+                   "call " __ASM_NAME("ndr_async_client_call") "\n\t"
+                   "addq $0x28,%rsp\n\t"
+                   __ASM_CFI(".cfi_adjust_cfa_offset -0x28\n\t")
+                   "ret" );
+
+#else  /* __x86_64__ */
+
+/***********************************************************************
+ *            NdrAsyncClientCall [RPCRT4.@]
+ */
+CLIENT_CALL_RETURN WINAPIV NdrAsyncClientCall( PMIDL_STUB_DESC desc, PFORMAT_STRING format, ... )
+{
+    __ms_va_list args;
+    LONG_PTR ret;
+
+    __ms_va_start( args, format );
+    ret = ndr_async_client_call( desc, format, va_arg( args, void ** ));
+    __ms_va_end( args );
+    return *(CLIENT_CALL_RETURN *)&ret;
+}
+
+#endif  /* __x86_64__ */
+
 RPCRTAPI LONG RPC_ENTRY NdrAsyncStubCall(struct IRpcStubBuffer* pThis,
     struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg,
     DWORD * pdwStubPhase)
diff --git a/dlls/rpcrt4/ndr_stubless.h b/dlls/rpcrt4/ndr_stubless.h
index 3fa0922..942c007 100644
--- a/dlls/rpcrt4/ndr_stubless.h
+++ b/dlls/rpcrt4/ndr_stubless.h
@@ -238,6 +238,8 @@ typedef struct _NDR_EHD_CONTEXT
 
 LONG_PTR CDECL ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pFormat,
                                 void **stack_top, void **fpu_stack ) DECLSPEC_HIDDEN;
+LONG_PTR CDECL ndr_async_client_call( PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pFormat,
+                                      void **stack_top ) DECLSPEC_HIDDEN;
 void client_do_args_old_format(PMIDL_STUB_MESSAGE pStubMsg,
     PFORMAT_STRING pFormat, int phase, unsigned char *args,
     unsigned short stack_size, unsigned char *pRetVal, BOOL object_proc,




More information about the wine-cvs mailing list