Commit 0810db96 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

rpcrt4: Use RPC_* error code names.

parent 1a200508
......@@ -91,7 +91,7 @@ RPC_BINDING_HANDLE WINAPI NDRCContextBinding(NDR_CCONTEXT CContext)
if (!handle)
{
ERR("invalid handle %p\n", CContext);
RpcRaiseException(ERROR_INVALID_HANDLE);
RpcRaiseException(RPC_X_SS_CONTEXT_MISMATCH);
}
return handle;
}
......@@ -165,7 +165,7 @@ void WINAPI RpcSsDestroyClientContext(void **ContextHandle)
FIXME("stub\n");
}
static UINT ndr_update_context_handle(NDR_CCONTEXT *CContext,
static RPC_STATUS ndr_update_context_handle(NDR_CCONTEXT *CContext,
RPC_BINDING_HANDLE hBinding,
const ndr_context_handle *chi)
{
......@@ -178,7 +178,7 @@ static UINT ndr_update_context_handle(NDR_CCONTEXT *CContext,
{
che = get_context_entry(*CContext);
if (!che)
return ERROR_INVALID_HANDLE;
return RPC_X_SS_CONTEXT_MISMATCH;
list_remove(&che->entry);
RpcBindingFree(&che->handle);
HeapFree(GetProcessHeap(), 0, che);
......@@ -190,7 +190,7 @@ static UINT ndr_update_context_handle(NDR_CCONTEXT *CContext,
{
che = HeapAlloc(GetProcessHeap(), 0, sizeof *che);
if (!che)
return ERROR_NOT_ENOUGH_MEMORY;
return RPC_X_NO_MEMORY;
che->magic = NDR_CONTEXT_HANDLE_MAGIC;
RpcBindingCopy(hBinding, &che->handle);
list_add_tail(&context_handle_list, &che->entry);
......@@ -199,7 +199,7 @@ static UINT ndr_update_context_handle(NDR_CCONTEXT *CContext,
*CContext = che;
return ERROR_SUCCESS;
return RPC_S_OK;
}
/***********************************************************************
......@@ -209,16 +209,16 @@ void WINAPI NDRCContextUnmarshall(NDR_CCONTEXT *CContext,
RPC_BINDING_HANDLE hBinding,
void *pBuff, ULONG DataRepresentation)
{
UINT r;
RPC_STATUS status;
TRACE("*%p=(%p) %p %p %08x\n",
CContext, *CContext, hBinding, pBuff, DataRepresentation);
EnterCriticalSection(&ndr_context_cs);
r = ndr_update_context_handle(CContext, hBinding, pBuff);
status = ndr_update_context_handle(CContext, hBinding, pBuff);
LeaveCriticalSection(&ndr_context_cs);
if (r)
RpcRaiseException(r);
if (status)
RpcRaiseException(status);
}
/***********************************************************************
......@@ -263,7 +263,7 @@ void WINAPI NDRSContextMarshall2(RPC_BINDING_HANDLE hBinding,
hBinding, SContext, pBuff, userRunDownIn, CtxGuard, Flags);
if (!binding->server || !binding->Assoc)
RpcRaiseException(ERROR_INVALID_HANDLE);
RpcRaiseException(RPC_S_INVALID_BINDING);
if (Flags & RPC_CONTEXT_HANDLE_FLAGS)
FIXME("unimplemented flags: 0x%x\n", Flags & RPC_CONTEXT_HANDLE_FLAGS);
......@@ -282,7 +282,7 @@ void WINAPI NDRSContextMarshall2(RPC_BINDING_HANDLE hBinding,
else
{
if (!RpcContextHandle_IsGuardCorrect(SContext, CtxGuard))
RpcRaiseException(ERROR_INVALID_HANDLE);
RpcRaiseException(RPC_X_SS_CONTEXT_MISMATCH);
memset(ndr, 0, sizeof(*ndr));
RPCRT4_RemoveThreadContextHandle(SContext);
......@@ -337,7 +337,7 @@ NDR_SCONTEXT WINAPI NDRSContextUnmarshall2(RPC_BINDING_HANDLE hBinding,
hBinding, pBuff, DataRepresentation, CtxGuard, Flags);
if (!binding->server || !binding->Assoc)
RpcRaiseException(ERROR_INVALID_HANDLE);
RpcRaiseException(RPC_S_INVALID_BINDING);
if (Flags & RPC_CONTEXT_HANDLE_FLAGS)
FIXME("unimplemented flags: 0x%x\n", Flags & RPC_CONTEXT_HANDLE_FLAGS);
......@@ -351,7 +351,7 @@ NDR_SCONTEXT WINAPI NDRSContextUnmarshall2(RPC_BINDING_HANDLE hBinding,
if (context_ndr->attributes)
{
ERR("non-null attributes 0x%x\n", context_ndr->attributes);
status = ERROR_INVALID_HANDLE;
status = RPC_X_SS_CONTEXT_MISMATCH;
}
else
status = RpcServerAssoc_FindContextHandle(binding->Assoc,
......
......@@ -57,7 +57,7 @@ RPC_STATUS WINAPI MesEncodeIncrementalHandleCreate(
pEsMsg = HeapAlloc(GetProcessHeap(), 0, sizeof(*pEsMsg));
if (!pEsMsg)
return ERROR_OUTOFMEMORY;
return RPC_S_OUT_OF_MEMORY;
init_MIDL_ES_MESSAGE(pEsMsg);
......@@ -84,7 +84,7 @@ RPC_STATUS WINAPI MesDecodeIncrementalHandleCreate(
pEsMsg = HeapAlloc(GetProcessHeap(), 0, sizeof(*pEsMsg));
if (!pEsMsg)
return ERROR_OUTOFMEMORY;
return RPC_S_OUT_OF_MEMORY;
init_MIDL_ES_MESSAGE(pEsMsg);
......@@ -144,7 +144,7 @@ RPC_STATUS RPC_ENTRY MesEncodeFixedBufferHandleCreate(
pEsMsg = HeapAlloc(GetProcessHeap(), 0, sizeof(*pEsMsg));
if (!pEsMsg)
return ERROR_OUTOFMEMORY;
return RPC_S_OUT_OF_MEMORY;
init_MIDL_ES_MESSAGE(pEsMsg);
......@@ -181,7 +181,7 @@ RPC_STATUS RPC_ENTRY MesDecodeBufferHandleCreate(
pEsMsg = HeapAlloc(GetProcessHeap(), 0, sizeof(*pEsMsg));
if (!pEsMsg)
return ERROR_OUTOFMEMORY;
return RPC_S_OUT_OF_MEMORY;
init_MIDL_ES_MESSAGE(pEsMsg);
......@@ -205,7 +205,7 @@ static void es_data_alloc(MIDL_ES_MESSAGE *pEsMsg, ULONG size)
if (tmpsize < size)
{
ERR("not enough bytes allocated - requested %d, got %d\n", size, tmpsize);
RpcRaiseException(ERROR_OUTOFMEMORY);
RpcRaiseException(RPC_S_OUT_OF_MEMORY);
}
}
else if (pEsMsg->HandleStyle == MES_FIXED_BUFFER_HANDLE)
......@@ -226,7 +226,7 @@ static void es_data_read(MIDL_ES_MESSAGE *pEsMsg, ULONG size)
if (tmpsize < size)
{
ERR("not enough bytes read - requested %d, got %d\n", size, tmpsize);
RpcRaiseException(ERROR_OUTOFMEMORY);
RpcRaiseException(RPC_S_OUT_OF_MEMORY);
}
}
else
......
......@@ -395,7 +395,7 @@ typedef struct _NDR_MEMORY_LIST
*
* NOTES
* The memory block is always 8-byte aligned.
* If the function is unable to allocate memory an ERROR_OUTOFMEMORY
* If the function is unable to allocate memory an RPC_X_NO_MEMORY
* exception is raised.
*/
void * WINAPI NdrAllocate(MIDL_STUB_MESSAGE *pStubMsg, SIZE_T len)
......@@ -415,7 +415,7 @@ void * WINAPI NdrAllocate(MIDL_STUB_MESSAGE *pStubMsg, SIZE_T len)
}
p = pStubMsg->pfnAllocate(adjusted_len);
if (!p) RpcRaiseException(ERROR_OUTOFMEMORY);
if (!p) RpcRaiseException(RPC_X_NO_MEMORY);
mem_list = (NDR_MEMORY_LIST *)((char *)p + aligned_len);
mem_list->magic = MEML_MAGIC;
......@@ -4614,7 +4614,7 @@ RPC_STATUS RPC_ENTRY NdrGetUserMarshalInfo(ULONG *flags, ULONG level, NDR_USER_M
if (umcb->pStubMsg->Buffer < buffer_start ||
umcb->pStubMsg->Buffer > buffer_end)
return ERROR_INVALID_USER_BUFFER;
return RPC_X_INVALID_BUFFER;
umi->u1.Level1.Buffer = umcb->pStubMsg->Buffer;
umi->u1.Level1.BufferSize = buffer_end - umcb->pStubMsg->Buffer;
......
......@@ -1512,7 +1512,7 @@ LONG_PTR CDECL ndr_async_client_call( PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING
}
async_call_data = I_RpcAllocate(sizeof(*async_call_data) + sizeof(MIDL_STUB_MESSAGE) + sizeof(RPC_MESSAGE));
if (!async_call_data) RpcRaiseException(ERROR_OUTOFMEMORY);
if (!async_call_data) RpcRaiseException(RPC_X_NO_MEMORY);
async_call_data->pProcHeader = pProcHeader;
async_call_data->pStubMsg = pStubMsg = (PMIDL_STUB_MESSAGE)(async_call_data + 1);
......
......@@ -341,7 +341,7 @@ static RPC_STATUS RpcAssoc_BindConnection(const RpcAssoc *assoc, RpcConnection *
break;
case REJECT_INVALID_CHECKSUM:
ERR("invalid checksum\n");
status = ERROR_ACCESS_DENIED;
status = RPC_S_ACCESS_DENIED;
break;
default:
ERR("rejected bind for reason %d\n", response_hdr->bind_nack.reject_reason);
......@@ -443,7 +443,7 @@ RPC_STATUS RpcServerAssoc_AllocateContextHandle(RpcAssoc *assoc, void *CtxGuard,
context_handle = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*context_handle));
if (!context_handle)
return ERROR_OUTOFMEMORY;
return RPC_S_OUT_OF_MEMORY;
context_handle->ctx_guard = CtxGuard;
RtlInitializeResource(&context_handle->rw_lock);
......
......@@ -1120,7 +1120,7 @@ RPC_STATUS RpcAuthInfo_Create(ULONG AuthnLevel, ULONG AuthnSvc,
{
RpcAuthInfo *AuthInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(*AuthInfo));
if (!AuthInfo)
return ERROR_OUTOFMEMORY;
return RPC_S_OUT_OF_MEMORY;
AuthInfo->refs = 1;
AuthInfo->AuthnLevel = AuthnLevel;
......@@ -1140,7 +1140,7 @@ RPC_STATUS RpcAuthInfo_Create(ULONG AuthnLevel, ULONG AuthnSvc,
if (!AuthInfo->nt_identity)
{
HeapFree(GetProcessHeap(), 0, AuthInfo);
return ERROR_OUTOFMEMORY;
return RPC_S_OUT_OF_MEMORY;
}
AuthInfo->nt_identity->Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
......@@ -1169,7 +1169,7 @@ RPC_STATUS RpcAuthInfo_Create(ULONG AuthnLevel, ULONG AuthnSvc,
HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->Password);
HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity);
HeapFree(GetProcessHeap(), 0, AuthInfo);
return ERROR_OUTOFMEMORY;
return RPC_S_OUT_OF_MEMORY;
}
}
else
......@@ -1493,7 +1493,7 @@ RpcBindingInqAuthInfoExA( RPC_BINDING_HANDLE Binding, RPC_CSTR *ServerPrincName,
{
*ServerPrincName = (RPC_CSTR)RPCRT4_strdupWtoA(principal);
RpcStringFreeW(&principal);
if (!*ServerPrincName) return ERROR_OUTOFMEMORY;
if (!*ServerPrincName) return RPC_S_OUT_OF_MEMORY;
}
return status;
......@@ -1525,7 +1525,7 @@ RpcBindingInqAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR *ServerPrincName,
if (bind->AuthInfo->server_principal_name)
{
*ServerPrincName = RPCRT4_strdupW(bind->AuthInfo->server_principal_name);
if (!*ServerPrincName) return ERROR_OUTOFMEMORY;
if (!*ServerPrincName) return RPC_S_OUT_OF_MEMORY;
}
else *ServerPrincName = NULL;
}
......@@ -1606,7 +1606,7 @@ RpcBindingInqAuthClientExA( RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *
if (status == RPC_S_OK && ServerPrincName)
{
*ServerPrincName = (RPC_CSTR)RPCRT4_strdupWtoA(principal);
if (!*ServerPrincName && principal) status = ERROR_OUTOFMEMORY;
if (!*ServerPrincName && principal) status = RPC_S_OUT_OF_MEMORY;
RpcStringFreeW(&principal);
}
......@@ -1751,7 +1751,7 @@ RpcBindingSetAuthInfoExA( RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName,
else
{
RpcAuthInfo_Release(new_auth_info);
r = ERROR_OUTOFMEMORY;
r = RPC_S_OUT_OF_MEMORY;
}
}
else
......@@ -1882,7 +1882,7 @@ RpcBindingSetAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName,
else
{
RpcAuthInfo_Release(new_auth_info);
r = ERROR_OUTOFMEMORY;
r = RPC_S_OUT_OF_MEMORY;
}
}
else
......@@ -1936,7 +1936,7 @@ RPC_STATUS WINAPI RpcBindingSetOption(RPC_BINDING_HANDLE BindingHandle, ULONG Op
int len = MultiByteToWideChar(CP_ACP, 0, cookie->Buffer, cookie->BufferSize, NULL, 0);
WCHAR *str;
if (!(str = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR)))) return ERROR_OUTOFMEMORY;
if (!(str = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR)))) return RPC_S_OUT_OF_MEMORY;
MultiByteToWideChar(CP_ACP, 0, cookie->Buffer, cookie->BufferSize, str, len);
str[len] = 0;
HeapFree(GetProcessHeap(), 0, binding->CookieAuth);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment