本文整理汇总了C++中BAIL_ON_INVALID_PTR函数的典型用法代码示例。如果您正苦于以下问题:C++ BAIL_ON_INVALID_PTR函数的具体用法?C++ BAIL_ON_INVALID_PTR怎么用?C++ BAIL_ON_INVALID_PTR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BAIL_ON_INVALID_PTR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PvfsListAddTail
NTSTATUS
PvfsListAddTail(
PPVFS_LIST pList,
PLW_LIST_LINKS pItem
)
{
NTSTATUS ntError = STATUS_UNSUCCESSFUL;
BAIL_ON_INVALID_PTR(pList, ntError);
BAIL_ON_INVALID_PTR(pItem, ntError);
/* Using >= here to be safe. Technically, == should
be fine */
if (PvfsListIsFull(pList)) {
ntError = STATUS_INSUFFICIENT_RESOURCES;
BAIL_ON_NT_STATUS(ntError);
}
LwListInsertTail(&pList->DataList, pItem);
pList->CurrentSize++;
ntError = STATUS_SUCCESS;
cleanup:
return ntError;
error:
goto cleanup;
}
示例2: NetrAllocateRidWithAttribute
static
NTSTATUS
NetrAllocateRidWithAttribute(
OUT PRID_WITH_ATTRIBUTE pOut,
IN OUT PDWORD pdwOffset,
IN OUT PDWORD pdwSpaceLeft,
IN PRID_WITH_ATTRIBUTE pRids,
IN OUT PDWORD pdwSize
)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
DWORD dwError = ERROR_SUCCESS;
PVOID pBuffer = pOut;
BAIL_ON_INVALID_PTR(pdwOffset, ntStatus);
BAIL_ON_INVALID_PTR(pRids, ntStatus);
BAIL_ON_INVALID_PTR(pdwSize, ntStatus);
LWBUF_ALLOC_DWORD(pBuffer, pRids->dwRid);
LWBUF_ALLOC_DWORD(pBuffer, pRids->dwAttributes);
cleanup:
if (ntStatus == STATUS_SUCCESS &&
dwError != ERROR_SUCCESS)
{
ntStatus = LwWin32ErrorToNtStatus(dwError);
}
return ntStatus;
error:
goto cleanup;
}
示例3: LsaSetSecurity
NTSTATUS
LsaSetSecurity(
IN LSA_BINDING hBinding,
IN void *hObject,
IN DWORD SecurityInfo,
IN PSECURITY_DESCRIPTOR_RELATIVE pSecDesc,
IN DWORD SecDescLen
)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
LSA_SECURITY_DESCRIPTOR_BUFFER SecurityDescBuffer = {0};
BAIL_ON_INVALID_PTR(hBinding, ntStatus);
BAIL_ON_INVALID_PTR(hObject, ntStatus);
BAIL_ON_INVALID_PTR(pSecDesc, ntStatus);
SecurityDescBuffer.BufferLen = SecDescLen;
SecurityDescBuffer.pBuffer = (PBYTE)pSecDesc;
DCERPC_CALL(ntStatus, cli_LsaSetSecurity(
(handle_t)hBinding,
hObject,
SecurityInfo,
&SecurityDescBuffer));
BAIL_ON_NT_STATUS(ntStatus);
error:
return ntStatus;
}
示例4: PvfsListRemoveItem
NTSTATUS
PvfsListRemoveItem(
PPVFS_LIST pList,
PLW_LIST_LINKS pItem
)
{
NTSTATUS ntError = STATUS_UNSUCCESSFUL;
BAIL_ON_INVALID_PTR(pList, ntError);
BAIL_ON_INVALID_PTR(pItem, ntError);
if (PvfsListIsEmpty(pList))
{
ntError = STATUS_NOT_FOUND;
BAIL_ON_NT_STATUS(ntError);
}
LwListRemove(pItem);
pList->CurrentSize--;
ntError = STATUS_SUCCESS;
cleanup:
return ntError;
error:
goto cleanup;
}
示例5: LsaSrvClose
NTSTATUS
LsaSrvClose(
/* [in] */ handle_t hBinding,
/* [out, context_handle] */ void **phInOut
)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
PLSA_GENERIC_CONTEXT pContext = NULL;
BAIL_ON_INVALID_PTR(phInOut);
BAIL_ON_INVALID_PTR(*phInOut);
pContext = (PLSA_GENERIC_CONTEXT)(*phInOut);
switch (pContext->Type)
{
case LsaContextPolicy:
ntStatus = LsaSrvPolicyContextClose((PPOLICY_CONTEXT)pContext);
break;
default:
/* Something is seriously wrong if we get a context
we haven't created */
ntStatus = STATUS_INTERNAL_ERROR;
}
BAIL_ON_NTSTATUS_ERROR(ntStatus);
*phInOut = NULL;
cleanup:
return ntStatus;
error:
goto cleanup;
}
示例6: DsrAllocateDsRoleInfo
DWORD
DsrAllocateDsRoleInfo(
OUT PDSR_ROLE_INFO pOut,
IN OUT PDWORD pdwOffset,
IN OUT PDWORD pdwSpaceLeft,
IN PDSR_ROLE_INFO pIn,
IN WORD swLevel,
IN OUT PDWORD pdwSize
)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
DWORD dwError = ERROR_SUCCESS;
PVOID pBuffer = pOut;
BAIL_ON_INVALID_PTR(pdwOffset, ntStatus);
BAIL_ON_INVALID_PTR(pIn, ntStatus);
BAIL_ON_INVALID_PTR(pdwSize, ntStatus);
switch(swLevel)
{
case DS_ROLE_BASIC_INFORMATION:
LWBUF_ALLOC_DWORD(pBuffer, pIn->Basic.dwRole);
LWBUF_ALLOC_DWORD(pBuffer, pIn->Basic.dwFlags);
LWBUF_ALLOC_PWSTR(pBuffer, pIn->Basic.pwszDomain);
LWBUF_ALLOC_PWSTR(pBuffer, pIn->Basic.pwszDnsDomain);
LWBUF_ALLOC_PWSTR(pBuffer, pIn->Basic.pwszForest);
LWBUF_ALLOC_BLOB(pBuffer,
sizeof(pIn->Basic.DomainGuid),
&pIn->Basic.DomainGuid);
break;
case DS_ROLE_UPGRADE_STATUS:
LWBUF_ALLOC_WORD(pBuffer, pIn->Upgrade.swUpgradeStatus);
LWBUF_ALIGN_TYPE(pdwOffset, pdwSize, pdwSpaceLeft, DWORD);
LWBUF_ALLOC_DWORD(pBuffer, pIn->Upgrade.dwPrevious);
break;
case DS_ROLE_OP_STATUS:
LWBUF_ALLOC_WORD(pBuffer, pIn->OpStatus.swStatus);
break;
default:
ntStatus = STATUS_INVALID_PARAMETER;
break;
}
BAIL_ON_WIN_ERROR(dwError);
cleanup:
if (dwError == ERROR_SUCCESS &&
ntStatus != STATUS_SUCCESS)
{
dwError = LwNtStatusToWin32Error(dwError);
}
return dwError;
error:
goto cleanup;
}
示例7: LsaAllocateSecurityDescriptor
NTSTATUS
LsaAllocateSecurityDescriptor(
OUT PSECURITY_DESCRIPTOR_RELATIVE *ppOut,
IN PLSA_SECURITY_DESCRIPTOR_BUFFER pIn
)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
PSECURITY_DESCRIPTOR_RELATIVE pSecDesc = NULL;
BAIL_ON_INVALID_PTR(ppOut, ntStatus);
BAIL_ON_INVALID_PTR(pIn, ntStatus);
ntStatus = LsaRpcAllocateMemory(OUT_PPVOID(&pSecDesc),
pIn->BufferLen);
BAIL_ON_NT_STATUS(ntStatus);
memcpy(pSecDesc, pIn->pBuffer, pIn->BufferLen);
*ppOut = pSecDesc;
cleanup:
return ntStatus;
error:
if (pSecDesc)
{
LsaRpcFreeMemory(pSecDesc);
}
*ppOut = NULL;
goto cleanup;
}
示例8: WkssAllocateNetrWkstaUserInfo1
static
DWORD
WkssAllocateNetrWkstaUserInfo1(
OUT PVOID pOut,
IN OUT PDWORD pdwOffset,
IN OUT PDWORD pdwSpaceLeft,
IN PNETR_WKSTA_USER_INFO_1 pIn,
IN OUT PDWORD pdwSize
)
{
DWORD dwError = ERROR_SUCCESS;
NTSTATUS ntStatus = STATUS_SUCCESS;
PVOID pBuffer = pOut;
BAIL_ON_INVALID_PTR(pdwOffset, ntStatus);
BAIL_ON_INVALID_PTR(pIn, ntStatus);
BAIL_ON_INVALID_PTR(pdwSize, ntStatus);
LWBUF_ALLOC_WC16STR(pBuffer, pIn->wkui1_username);
LWBUF_ALLOC_WC16STR(pBuffer, pIn->wkui1_logon_domain);
LWBUF_ALLOC_WC16STR(pBuffer, pIn->wkui1_oth_domains);
LWBUF_ALLOC_WC16STR(pBuffer, pIn->wkui1_logon_server);
cleanup:
if (ntStatus == STATUS_SUCCESS &&
dwError != ERROR_SUCCESS)
{
ntStatus = LwWin32ErrorToNtStatus(dwError);
}
return dwError;
error:
goto cleanup;
}
示例9: NetrAllocateSamInfo2
static
NTSTATUS
NetrAllocateSamInfo2(
OUT NetrSamInfo2 *pOut,
IN OUT PDWORD pdwOffset,
IN OUT PDWORD pdwSpaceLeft,
IN NetrSamInfo2 *pIn,
IN OUT PDWORD pdwSize
)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
PVOID pBuffer = pOut;
BAIL_ON_INVALID_PTR(pdwOffset, ntStatus);
BAIL_ON_INVALID_PTR(pIn, ntStatus);
BAIL_ON_INVALID_PTR(pdwSize, ntStatus);
ntStatus = NetrInitSamBaseInfo(pBuffer,
pdwOffset,
pdwSpaceLeft,
&pIn->base,
pdwSize);
BAIL_ON_NT_STATUS(ntStatus);
cleanup:
return ntStatus;
error:
goto cleanup;
}
示例10: NetrAllocateSidAttr
static
NTSTATUS
NetrAllocateSidAttr(
OUT NetrSidAttr *pOut,
IN OUT PDWORD pdwOffset,
IN OUT PDWORD pdwSpaceLeft,
IN NetrSidAttr *pIn,
IN OUT PDWORD pdwSize
)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
DWORD dwError = ERROR_SUCCESS;
PVOID pBuffer = pOut;
BAIL_ON_INVALID_PTR(pdwOffset, ntStatus);
BAIL_ON_INVALID_PTR(pIn, ntStatus);
BAIL_ON_INVALID_PTR(pdwSize, ntStatus);
LWBUF_ALLOC_PSID(pBuffer, pIn->sid);
LWBUF_ALLOC_DWORD(pBuffer, pIn->attribute);
LWBUF_ALIGN(pdwOffset, pdwSize, pdwSpaceLeft);
cleanup:
if (ntStatus == STATUS_SUCCESS &&
dwError != ERROR_SUCCESS)
{
ntStatus = LwWin32ErrorToNtStatus(dwError);
}
return ntStatus;
error:
goto cleanup;
}
示例11: LsaQuerySecurity
NTSTATUS
LsaQuerySecurity(
IN LSA_BINDING hBinding,
IN void *hObject,
IN DWORD SecurityInfo,
OUT PSECURITY_DESCRIPTOR_RELATIVE *ppSecDesc,
OUT PDWORD pSecDescLen
)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
PLSA_SECURITY_DESCRIPTOR_BUFFER pSecurityDescBuffer = NULL;
PSECURITY_DESCRIPTOR_RELATIVE pSecurityDesc = NULL;
BAIL_ON_INVALID_PTR(hBinding, ntStatus);
BAIL_ON_INVALID_PTR(hObject, ntStatus);
BAIL_ON_INVALID_PTR(ppSecDesc, ntStatus);
BAIL_ON_INVALID_PTR(pSecDescLen, ntStatus);
DCERPC_CALL(ntStatus, cli_LsaQuerySecurity(
(handle_t)hBinding,
hObject,
SecurityInfo,
&pSecurityDescBuffer));
BAIL_ON_NT_STATUS(ntStatus);
ntStatus = LsaAllocateSecurityDescriptor(
&pSecurityDesc,
pSecurityDescBuffer);
BAIL_ON_NT_STATUS(ntStatus);
*ppSecDesc = pSecurityDesc;
*pSecDescLen = pSecurityDescBuffer->BufferLen;
cleanup:
if (pSecurityDescBuffer)
{
LsaFreeStubSecurityDescriptorBuffer(pSecurityDescBuffer);
}
return ntStatus;
error:
if (pSecurityDesc)
{
LsaRpcFreeMemory(pSecurityDesc);
}
if (ppSecDesc)
{
*ppSecDesc = NULL;
}
if (pSecDescLen)
{
*pSecDescLen = 0;
}
goto cleanup;
}
示例12: LsaAllocateTranslatedSids3
NTSTATUS
LsaAllocateTranslatedSids3(
OUT TranslatedSid3 *pOut,
IN OUT PDWORD pdwOffset,
IN OUT PDWORD pdwSpaceLeft,
IN TranslatedSidArray3 *pIn,
IN OUT PDWORD pdwSize
)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
DWORD dwError = ERROR_SUCCESS;
PVOID pBuffer = pOut;
DWORD iTransSid = 0;
BAIL_ON_INVALID_PTR(pdwOffset, ntStatus);
BAIL_ON_INVALID_PTR(pIn, ntStatus);
BAIL_ON_INVALID_PTR(pdwSize, ntStatus);
for (iTransSid = 0; iTransSid < pIn->count; iTransSid++)
{
LWBUF_ALLOC_WORD(pBuffer, pIn->sids[iTransSid].type);
LWBUF_ALIGN_PTR(pdwOffset, pdwSize, pdwSpaceLeft);
if (pIn->sids[iTransSid].sid)
{
LWBUF_ALLOC_PSID(pBuffer, pIn->sids[iTransSid].sid);
}
else if (pIn->sids[iTransSid].type == SID_TYPE_DOMAIN ||
pIn->sids[iTransSid].type == SID_TYPE_INVALID ||
pIn->sids[iTransSid].type == SID_TYPE_UNKNOWN)
{
LWBUF_ALLOC_PSID(pBuffer, NULL);
}
else
{
ntStatus = STATUS_INVALID_SID;
BAIL_ON_NT_STATUS(ntStatus);
}
LWBUF_ALLOC_DWORD(pBuffer, pIn->sids[iTransSid].index);
LWBUF_ALLOC_DWORD(pBuffer, pIn->sids[iTransSid].unknown1);
}
cleanup:
if (ntStatus == STATUS_SUCCESS &&
dwError != ERROR_SUCCESS)
{
ntStatus = LwWin32ErrorToNtStatus(dwError);
}
return ntStatus;
error:
goto cleanup;
}
示例13: LsaEnumPrivilegesAccount
NTSTATUS
LsaEnumPrivilegesAccount(
IN LSA_BINDING hBinding,
IN LSAR_ACCOUNT_HANDLE hAccount,
OUT PPRIVILEGE_SET *ppPrivileges
)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
size_t privilegesSize = 0;
PPRIVILEGE_SET pPrivs = NULL;
PPRIVILEGE_SET pPrivileges = NULL;
BAIL_ON_INVALID_PTR(hBinding, ntStatus);
BAIL_ON_INVALID_PTR(hAccount, ntStatus);
BAIL_ON_INVALID_PTR(ppPrivileges, ntStatus);
DCERPC_CALL(ntStatus, cli_LsaEnumPrivilegesAccount(
(handle_t)hBinding,
hAccount,
&pPrivs));
BAIL_ON_NT_STATUS(ntStatus);
privilegesSize = RtlLengthPrivilegeSet(pPrivs);
ntStatus = LsaRpcAllocateMemory(
OUT_PPVOID(&pPrivileges),
privilegesSize);
BAIL_ON_NT_STATUS(ntStatus);
ntStatus = RtlCopyPrivilegeSet(
privilegesSize,
pPrivileges,
pPrivs);
BAIL_ON_NT_STATUS(ntStatus);
*ppPrivileges = pPrivileges;
error:
if (ntStatus)
{
if (ppPrivileges)
{
LW_SAFE_FREE_MEMORY(pPrivileges);
*ppPrivileges = NULL;
}
}
if (pPrivs)
{
LsaFreeStubPrivilegeSet(pPrivs);
}
return ntStatus;
}
示例14: PvfsRead
NTSTATUS
PvfsRead(
PPVFS_IRP_CONTEXT pIrpContext
)
{
NTSTATUS ntError = STATUS_UNSUCCESSFUL;
IRP_ARGS_READ_WRITE Args = pIrpContext->pIrp->Args.ReadWrite;
PPVFS_CCB pCcb = NULL;
ntError = PvfsAcquireCCB(pIrpContext->pIrp->FileHandle, &pCcb);
BAIL_ON_NT_STATUS(ntError);
if (!IsSetFlag(pCcb->Flags, PVFS_CCB_FLAG_CREATE_COMPLETE))
{
ntError = STATUS_INVALID_PARAMETER;
BAIL_ON_NT_STATUS(ntError);
}
switch (pIrpContext->pIrp->Args.ReadWrite.ZctOperation)
{
case IRP_ZCT_OPERATION_NONE:
ntError = PvfsReadInternal(pIrpContext);
break;
case IRP_ZCT_OPERATION_PREPARE:
BAIL_ON_INVALID_PTR(Args.Zct, ntError);
ntError = PvfsReadInternal(pIrpContext);
break;
case IRP_ZCT_OPERATION_COMPLETE:
BAIL_ON_INVALID_PTR(Args.ZctCompletionContext, ntError);
ntError = PvfsZctCompleteRead(pIrpContext);
break;
default:
ntError = STATUS_INVALID_PARAMETER;
BAIL_ON_NT_STATUS(ntError);
}
cleanup:
if (pCcb)
{
PvfsReleaseCCB(pCcb);
}
return ntError;
error:
goto cleanup;
}
示例15: NetrFileGetInfo
NET_API_STATUS
NetrFileGetInfo(
PSRVSVC_CONTEXT pContext, /* IN */
PCWSTR pwszServername, /* IN OPTIONAL */
DWORD dwFileId, /* IN */
DWORD dwInfoLevel, /* IN */
PBYTE* ppBuffer /* OUT */
)
{
NET_API_STATUS status = ERROR_SUCCESS;
srvsvc_NetFileInfo info;
BAIL_ON_INVALID_PTR(pContext, status);
BAIL_ON_INVALID_PTR(ppBuffer, status);
memset(&info, 0, sizeof(info));
*ppBuffer = NULL;
TRY
{
status = _NetrFileGetInfo(
pContext->hBinding,
(PWSTR)pwszServername,
dwFileId,
dwInfoLevel,
&info);
}
CATCH_ALL(pDceException)
{
NTSTATUS ntStatus = LwRpcStatusToNtStatus(pDceException->match.value);
status = LwNtStatusToWin32Error(ntStatus);
}
ENDTRY;
BAIL_ON_WIN_ERROR(status);
status = SrvSvcCopyNetFileInfo(dwInfoLevel, &info, ppBuffer);
BAIL_ON_WIN_ERROR(status);
cleanup:
SrvSvcClearNetFileInfo(dwInfoLevel, &info);
return status;
error:
goto cleanup;
}