Home | Info | Community | Development | myReactOS | Contact Us
[static]
Definition at line 1438 of file rpc.c.
{ struct dispatch_params *params; APARTMENT *apt; IPID ipid; HRESULT hr; RpcBindingInqObject(msg->Handle, &ipid); TRACE("ipid = %s, iMethod = %d\n", debugstr_guid(&ipid), msg->ProcNum); params = HeapAlloc(GetProcessHeap(), 0, sizeof(*params)); if (!params) { RpcRaiseException(E_OUTOFMEMORY); return; } hr = ipid_get_dispatch_params(&ipid, &apt, ¶ms->stub, ¶ms->chan, ¶ms->iid, ¶ms->iface); if (hr != S_OK) { ERR("no apartment found for ipid %s\n", debugstr_guid(&ipid)); HeapFree(GetProcessHeap(), 0, params); RpcRaiseException(hr); return; } params->msg = (RPCOLEMESSAGE *)msg; params->status = RPC_S_OK; params->hr = S_OK; params->handle = NULL; params->bypass_rpcrt = FALSE; /* Note: this is the important difference between STAs and MTAs - we * always execute RPCs to STAs in the thread that originally created the * apartment (i.e. the one that pumps messages to the window) */ if (!apt->multi_threaded) { params->handle = CreateEventW(NULL, FALSE, FALSE, NULL); TRACE("Calling apartment thread 0x%08x...\n", apt->tid); if (PostMessageW(apartment_getwindow(apt), DM_EXECUTERPC, 0, (LPARAM)params)) WaitForSingleObject(params->handle, INFINITE); else { ERR("PostMessage failed with error %u\n", GetLastError()); IRpcChannelBuffer_Release(params->chan); IRpcStubBuffer_Release(params->stub); } CloseHandle(params->handle); } else { BOOL joined = FALSE; if (!COM_CurrentInfo()->apt) { apartment_joinmta(); joined = TRUE; } RPC_ExecuteCall(params); if (joined) { apartment_release(COM_CurrentInfo()->apt); COM_CurrentInfo()->apt = NULL; } } hr = params->hr; if (params->chan) IRpcChannelBuffer_Release(params->chan); if (params->stub) IRpcStubBuffer_Release(params->stub); HeapFree(GetProcessHeap(), 0, params); apartment_release(apt); /* if IRpcStubBuffer_Invoke fails, we should raise an exception to tell * the RPC runtime that the call failed */ if (hr) RpcRaiseException(hr); }