msxml/tests: Use VariantInit, not VariantClear, to initialize new variants.
[wine/multimedia.git] / dlls / rpcrt4 / rpc_async.c
blob4ff86a34a561e96ef64cdd4fbd6868fa9a403b7c
1 /*
2 * Asynchronous Call Support Functions
4 * Copyright 2007 Robert Shearman (for CodeWeavers)
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include <stdarg.h>
24 #include "rpc.h"
25 #include "rpcndr.h"
26 #include "rpcasync.h"
28 #include "wine/debug.h"
30 #include "rpc_binding.h"
31 #include "rpc_message.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(rpc);
35 #define RPC_ASYNC_SIGNATURE 0x43595341
37 /***********************************************************************
38 * RpcAsyncInitializeHandle [RPCRT4.@]
40 * Initialises an asynchronous state so it can be used in other asynchronous
41 * functions and for use in asynchronous calls.
43 * PARAMS
44 * pAsync [I] Asynchronous state to initialise.
45 * Size [I] Size of the memory pointed to by pAsync.
47 * RETURNS
48 * Success: RPC_S_OK.
49 * Failure: Any error code.
51 RPC_STATUS WINAPI RpcAsyncInitializeHandle(PRPC_ASYNC_STATE pAsync, unsigned int Size)
53 TRACE("(%p, %d)\n", pAsync, Size);
55 if (Size != sizeof(*pAsync))
57 ERR("invalid Size %d\n", Size);
58 return ERROR_INVALID_PARAMETER;
61 pAsync->Size = sizeof(*pAsync);
62 pAsync->Signature = RPC_ASYNC_SIGNATURE;
63 pAsync->Lock = 0;
64 pAsync->Flags = 0;
65 pAsync->StubInfo = NULL;
66 pAsync->RuntimeInfo = NULL;
67 memset(&pAsync->Reserved, 0, sizeof(*pAsync) - FIELD_OFFSET(RPC_ASYNC_STATE, Reserved));
69 return RPC_S_OK;
72 /***********************************************************************
73 * RpcAsyncGetCallStatus [RPCRT4.@]
75 * Retrieves the current status of the asynchronous call taking place.
77 * PARAMS
78 * pAsync [I] Asynchronous state to initialise.
80 * RETURNS
81 * RPC_S_OK - The call was successfully completed.
82 * RPC_S_INVALID_ASYNC_HANDLE - The asynchronous structure is not valid.
83 * RPC_S_ASYNC_CALL_PENDING - The call is still in progress and has not been completed.
84 * Any other error code - The call failed.
86 RPC_STATUS WINAPI RpcAsyncGetCallStatus(PRPC_ASYNC_STATE pAsync)
88 FIXME("(%p): stub\n", pAsync);
89 return RPC_S_INVALID_ASYNC_HANDLE;
92 /***********************************************************************
93 * RpcAsyncCompleteCall [RPCRT4.@]
95 * Completes a client or server asynchronous call.
97 * PARAMS
98 * pAsync [I] Asynchronous state to initialise.
99 * Reply [I] The return value of the asynchronous function.
101 * RETURNS
102 * Success: RPC_S_OK.
103 * Failure: Any error code.
105 RPC_STATUS WINAPI RpcAsyncCompleteCall(PRPC_ASYNC_STATE pAsync, void *Reply)
107 FIXME("(%p, %p): stub\n", pAsync, Reply);
108 return RPC_S_INVALID_ASYNC_HANDLE;
111 /***********************************************************************
112 * RpcAsyncAbortCall [RPCRT4.@]
114 * Aborts the asynchronous server call taking place.
116 * PARAMS
117 * pAsync [I] Asynchronous server state to abort.
118 * ExceptionCode [I] Exception code to return to the client in a fault packet.
120 * RETURNS
121 * Success: RPC_S_OK.
122 * Failure: Any error code.
124 RPC_STATUS WINAPI RpcAsyncAbortCall(PRPC_ASYNC_STATE pAsync, ULONG ExceptionCode)
126 FIXME("(%p, %d/0x%x): stub\n", pAsync, ExceptionCode, ExceptionCode);
127 return RPC_S_INVALID_ASYNC_HANDLE;
130 /***********************************************************************
131 * RpcAsyncCancelCall [RPCRT4.@]
133 * Cancels the asynchronous client call taking place.
135 * PARAMS
136 * pAsync [I] Asynchronous client state to abort.
137 * fAbortCall [I] If TRUE, then send a cancel to the server, otherwise
138 * just wait for the call to complete.
140 * RETURNS
141 * Success: RPC_S_OK.
142 * Failure: Any error code.
144 RPC_STATUS WINAPI RpcAsyncCancelCall(PRPC_ASYNC_STATE pAsync, BOOL fAbortCall)
146 FIXME("(%p, %s): stub\n", pAsync, fAbortCall ? "TRUE" : "FALSE");
147 return RPC_S_INVALID_ASYNC_HANDLE;