static struct context_handle_entry *get_context_entry(NDR_CCONTEXT CContext)
{
- struct context_handle_entry *che = (struct context_handle_entry*) CContext;
+ struct context_handle_entry *che = CContext;
if (che->magic != NDR_CONTEXT_HANDLE_MAGIC)
return NULL;
LeaveCriticalSection(&ndr_context_cs);
if (!handle)
+ {
+ ERR("invalid handle %p\n", CContext);
RpcRaiseException(ERROR_INVALID_HANDLE);
+ }
return handle;
}
}
else
{
- ndr_context_handle *wire_data = (ndr_context_handle *)pBuff;
+ ndr_context_handle *wire_data = pBuff;
wire_data->attributes = 0;
wire_data->uuid = GUID_NULL;
}
che->magic = NDR_CONTEXT_HANDLE_MAGIC;
RpcBindingCopy(hBinding, &che->handle);
list_add_tail(&context_handle_list, &che->entry);
- memcpy(&che->wire_data, chi, sizeof *chi);
+ che->wire_data = *chi;
}
*CContext = che;
RpcBinding *binding = hBinding;
NDR_SCONTEXT SContext;
RPC_STATUS status;
+ const ndr_context_handle *context_ndr = pBuff;
TRACE("(%p %p %08x %p %u)\n",
hBinding, pBuff, DataRepresentation, CtxGuard, Flags);
if (Flags & RPC_CONTEXT_HANDLE_FLAGS)
FIXME("unimplemented flags: 0x%x\n", Flags & RPC_CONTEXT_HANDLE_FLAGS);
- if (!pBuff)
+ if (!pBuff || (!context_ndr->attributes &&
+ UuidIsNil((UUID *)&context_ndr->uuid, &status)))
status = RpcServerAssoc_AllocateContextHandle(binding->Assoc, CtxGuard,
&SContext);
else
{
- const ndr_context_handle *context_ndr = pBuff;
if (context_ndr->attributes)
{
ERR("non-null attributes 0x%x\n", context_ndr->attributes);