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
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.
44 * pAsync [I] Asynchronous state to initialise.
45 * Size [I] Size of the memory pointed to by pAsync.
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;
65 pAsync->StubInfo = NULL;
66 pAsync->RuntimeInfo = NULL;
67 memset(pAsync->Reserved, 0, sizeof(*pAsync) - FIELD_OFFSET(RPC_ASYNC_STATE, Reserved));
72 /***********************************************************************
73 * RpcAsyncGetCallStatus [RPCRT4.@]
75 * Retrieves the current status of the asynchronous call taking place.
78 * pAsync [I] Asynchronous state to initialise.
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.
98 * pAsync [I] Asynchronous state to initialise.
99 * Reply [I] The return value of the asynchronous function.
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.
117 * pAsync [I] Asynchronous server state to abort.
118 * ExceptionCode [I] Exception code to return to the client in a fault packet.
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.
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.
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;