/*********************************************************************** * NDRCContextUnmarshall */ void WINAPI NDRCContextUnmarshall(NDR_CCONTEXT *pCContext, RPC_BINDING_HANDLE hBinding, void *pBuff, unsigned long DataRepresentation ) { CContextHandle *ctx = (CContextHandle*)*pCContext; ContextHandleNdr *ndr = (ContextHandleNdr*)pBuff; RPC_STATUS status; if(UuidIsNil(&ndr->uuid, &status)) { if(ctx) { RPCRT4_DestroyBinding(ctx->Binding); HeapFree(GetProcessHeap(), 0, ctx); } *pCContext = NULL; } else { ctx = HeapAlloc(GetProcessHeap(), 0, sizeof(CContextHandle)); if(!ctx) RpcRaiseException(ERROR_OUTOFMEMORY); status = RpcBindingCopy(hBinding, (RPC_BINDING_HANDLE*) &ctx->Binding); if(status != RPC_S_OK) RpcRaiseException(status); memcpy(&ctx->Ndr, ndr, sizeof(ContextHandleNdr)); *pCContext = (NDR_CCONTEXT)ctx; } }
static RPC_STATUS ndr_update_context_handle(NDR_CCONTEXT *CContext, RPC_BINDING_HANDLE hBinding, const ndr_context_handle *chi) { struct context_handle_entry *che = NULL; /* a null UUID means we should free the context handle */ if (IsEqualGUID(&chi->uuid, &GUID_NULL)) { if (*CContext) { che = get_context_entry(*CContext); if (!che) return RPC_X_SS_CONTEXT_MISMATCH; list_remove(&che->entry); RpcBindingFree(&che->handle); HeapFree(GetProcessHeap(), 0, che); che = NULL; } } /* if there's no existing entry matching the GUID, allocate one */ else if (!(che = context_entry_from_guid(&chi->uuid))) { che = HeapAlloc(GetProcessHeap(), 0, sizeof *che); if (!che) return RPC_X_NO_MEMORY; che->magic = NDR_CONTEXT_HANDLE_MAGIC; RpcBindingCopy(hBinding, &che->handle); list_add_tail(&context_handle_list, &che->entry); che->wire_data = *chi; } *CContext = che; return RPC_S_OK; }
static RPC_STATUS get_epm_handle_client(RPC_BINDING_HANDLE handle, RPC_BINDING_HANDLE *epm_handle) { RpcBinding *bind = handle; const char * pszEndpoint = NULL; RPC_STATUS status; RpcBinding* epm_bind; unsigned int i; if (bind->server) return RPC_S_INVALID_BINDING; for (i = 0; i < sizeof(epm_endpoints)/sizeof(epm_endpoints[0]); i++) if (!strcmp(bind->Protseq, epm_endpoints[i].protseq)) pszEndpoint = epm_endpoints[i].endpoint; if (!pszEndpoint) { FIXME("no endpoint for the endpoint-mapper found for protseq %s\n", debugstr_a(bind->Protseq)); return RPC_S_PROTSEQ_NOT_SUPPORTED; } status = RpcBindingCopy(handle, epm_handle); if (status != RPC_S_OK) return status; epm_bind = *epm_handle; if (epm_bind->AuthInfo) { /* don't bother with authenticating against the EPM by default * (see EnableAuthEpResolution registry value) */ RpcAuthInfo_Release(epm_bind->AuthInfo); epm_bind->AuthInfo = NULL; } RPCRT4_ResolveBinding(epm_bind, pszEndpoint); TRACE("RPC_S_OK\n"); return RPC_S_OK; }