[LT2013]
[reactos.git] / dll / win32 / rpcrt4 / rpc_async.c
index 33fdc77..eb81b54 100644 (file)
  *
  */
 
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+
 #include <stdarg.h>
 
-#include "rpc.h"
-#include "rpcndr.h"
-#include "rpcasync.h"
+#include <windef.h>
+#include <winbase.h>
+#include <rpc.h>
+#include <rpcndr.h>
+//#include "rpcasync.h"
 
-#include "wine/debug.h"
+#include <wine/debug.h>
 
-#include "rpc_binding.h"
-#include "rpc_message.h"
+//#include "rpc_binding.h"
+//#include "rpc_message.h"
+#include "ndr_stubless.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(rpc);
 
 #define RPC_ASYNC_SIGNATURE 0x43595341
 
+static inline BOOL valid_async_handle(PRPC_ASYNC_STATE pAsync)
+{
+    return pAsync->Signature == RPC_ASYNC_SIGNATURE;
+}
+
 /***********************************************************************
  *           RpcAsyncInitializeHandle [RPCRT4.@]
  *
@@ -104,8 +115,14 @@ RPC_STATUS WINAPI RpcAsyncGetCallStatus(PRPC_ASYNC_STATE pAsync)
  */
 RPC_STATUS WINAPI RpcAsyncCompleteCall(PRPC_ASYNC_STATE pAsync, void *Reply)
 {
-    FIXME("(%p, %p): stub\n", pAsync, Reply);
-    return RPC_S_INVALID_ASYNC_HANDLE;
+    TRACE("(%p, %p)\n", pAsync, Reply);
+
+    if (!valid_async_handle(pAsync))
+        return RPC_S_INVALID_ASYNC_HANDLE;
+
+    /* FIXME: check completed */
+
+    return NdrpCompleteAsyncClientCall(pAsync, Reply);
 }
 
 /***********************************************************************