当前位置: 首页>>代码示例>>C++>>正文


C++ LwNtStatusToWin32Error函数代码示例

本文整理汇总了C++中LwNtStatusToWin32Error函数的典型用法代码示例。如果您正苦于以下问题:C++ LwNtStatusToWin32Error函数的具体用法?C++ LwNtStatusToWin32Error怎么用?C++ LwNtStatusToWin32Error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LwNtStatusToWin32Error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LwSmDriverGetStatus

static
DWORD
LwSmDriverGetStatus(
    PLW_SERVICE_OBJECT pObject,
    PLW_SERVICE_STATUS pStatus
    )
{
    DWORD dwError = 0;
    LWIO_DRIVER_STATE driverState = 0;
    PDRIVER_STATE pState = LwSmGetServiceObjectData(pObject);

    pStatus->home = LW_SERVICE_HOME_IO_MANAGER;

    dwError = LwNtStatusToWin32Error(LwIoGetPid(&pStatus->pid));
    if (dwError)
    {
        pStatus->pid = -1;
    }
    
    dwError = LwNtStatusToWin32Error(LwIoQueryStateDriver(pState->pName, &driverState));
    if (dwError || driverState != LWIO_DRIVER_STATE_LOADED)
    {
        LwInterlockedCompareExchange(&pState->State, LW_SERVICE_STATE_DEAD, LW_SERVICE_STATE_RUNNING);
    }

    pStatus->state = LwInterlockedRead(&pState->State);
    
    return 0;
}
开发者ID:twistround,项目名称:pbis,代码行数:29,代码来源:driver.c

示例2: LsaUnjoinDomain

static
DWORD
LsaUnjoinDomain(
    IN PCWSTR pwszDnsDomainName,
    IN PCWSTR pwszMachineSamAccountName,
    IN OPTIONAL PCWSTR pwszUserName,
    IN OPTIONAL PCWSTR pwszUserDomain,
    IN OPTIONAL PCWSTR pwszUserPassword,
    IN DWORD dwUnjoinFlags
    )
{
    DWORD dwError = ERROR_SUCCESS;
    NTSTATUS ntStatus = STATUS_SUCCESS;
    PWSTR pwszDCName = NULL;
    PIO_CREDS pCreds = NULL;

    dwError = LsaGetRwDcName(pwszDnsDomainName,
                             FALSE,
                             &pwszDCName);
    BAIL_ON_LSA_ERROR(dwError);

    /* disable the account only if requested */
    if (dwUnjoinFlags & LSAJOIN_ACCT_DELETE)
    {
        if (pwszUserName && pwszUserPassword)
        {
            ntStatus = LwIoCreatePlainCredsW(pwszUserName,
                                             pwszUserDomain,
                                             pwszUserPassword,
                                             &pCreds);
            dwError = LwNtStatusToWin32Error(ntStatus);
            BAIL_ON_LSA_ERROR(dwError);
        }
        else
        {
            ntStatus = LwIoGetActiveCreds(NULL,
                                          &pCreds);
            dwError = LwNtStatusToWin32Error(ntStatus);
            BAIL_ON_LSA_ERROR(dwError);
        }

        ntStatus = LsaDisableMachineAccount(pwszDCName,
                                            pCreds,
                                            pwszMachineSamAccountName);
        dwError = LwNtStatusToWin32Error(ntStatus);
        BAIL_ON_LSA_ERROR(dwError);
    }

error:
    LSA_ASSERT(!ntStatus || dwError);

    LW_SAFE_FREE_MEMORY(pwszDCName);

    if (pCreds)
    {
        LwIoDeleteCreds(pCreds);
    }

    return dwError;
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:60,代码来源:leave.c

示例3: MapSidToName

static
DWORD
MapSidToName(
    HANDLE hLsa,
    PSID pSid,
    PWSTR* ppwszName
    )
{
    DWORD dwError = 0;
    PSTR pszSid = NULL;
    LSA_QUERY_LIST QueryList;
    PLSA_SECURITY_OBJECT* ppObjects = NULL;

    dwError = LwNtStatusToWin32Error(
        RtlAllocateCStringFromSid(&pszSid, pSid));
    BAIL_ON_SRVSVC_ERROR(dwError);

    QueryList.ppszStrings = (PCSTR*) &pszSid;

    dwError = LsaFindObjects(
        hLsa,
        NULL,
        0,
        LSA_OBJECT_TYPE_UNDEFINED,
        LSA_QUERY_TYPE_BY_SID,
        1,
        QueryList,
        &ppObjects);
    BAIL_ON_SRVSVC_ERROR(dwError);

    if (ppObjects[0] == NULL)
    {
        dwError = LW_ERROR_NO_SUCH_OBJECT;
        BAIL_ON_SRVSVC_ERROR(dwError);
    }

    dwError = LwNtStatusToWin32Error(
        LwRtlWC16StringAllocatePrintfW(
            ppwszName,
            L"%s\\%s",
            ppObjects[0]->pszNetbiosDomainName,
            ppObjects[0]->pszSamAccountName));
    BAIL_ON_SRVSVC_ERROR(dwError);

cleanup:

    LsaFreeSecurityObjectList(1, ppObjects);

    LW_SAFE_FREE_STRING(pszSid);

    return dwError;

error:

    *ppwszName = NULL;

    goto cleanup;
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:58,代码来源:main.c

示例4: LsaPstoreGetJoinedDomainsA

DWORD
LsaPstoreGetJoinedDomainsA(
    OUT PSTR** DnsDomainNames,
    OUT PDWORD Count
    )
{
    DWORD dwError = 0;
    int EE = 0;
    PSTR* dnsDomainNames = NULL;
    DWORD count = 0;
    PWSTR* dnsDomainNamesW = NULL;
    DWORD countW = 0;

    dwError = LsaPstoreGetJoinedDomainsW(
                    &dnsDomainNamesW,
                    &countW);
    GOTO_CLEANUP_ON_WINERROR_EE(dwError, EE);

    if (!countW)
    {
        GOTO_CLEANUP_EE(EE);
    }

    dwError = LwNtStatusToWin32Error(LW_RTL_ALLOCATE(
                    &dnsDomainNames,
                    VOID,
                    countW * sizeof(dnsDomainNames[0])));
    GOTO_CLEANUP_ON_WINERROR_EE(dwError, EE);

    for (count = 0; count < countW; count++)
    {
        dwError = LwNtStatusToWin32Error(LwRtlCStringAllocateFromWC16String(
                        &dnsDomainNames[count],
                        dnsDomainNamesW[count]));
        GOTO_CLEANUP_ON_WINERROR_EE(dwError, EE);
    }

cleanup:
    if (dwError)
    {
        LSA_PSTORE_FREE_STRING_ARRAY_A(&dnsDomainNames, &count);
    }

    LSA_PSTORE_FREE_STRING_ARRAY_W(&dnsDomainNamesW, &countW);

    *DnsDomainNames = dnsDomainNames;
    *Count = count;

    LSA_PSTORE_LOG_LEAVE_ERROR_EE(dwError, EE);
    return dwError;
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:51,代码来源:lsapstore-main-a.c

示例5: LsaPstorepBackendDeletePasswordInfoW

DWORD
LsaPstorepBackendDeletePasswordInfoW(
    IN PLSA_PSTORE_BACKEND_STATE State,
    IN PCWSTR DnsDomainName
    )
{
    DWORD dwError = 0;
    int EE = 0;
    PSTR dnsDomainNameA = NULL;

    dwError = LwNtStatusToWin32Error(LwRtlCStringAllocateFromWC16String(
                    &dnsDomainNameA,
                    DnsDomainName));
    GOTO_CLEANUP_ON_WINERROR_EE(dwError, EE);

    dwError = LwpsLegacyDeletePassword(
                    State->OldStoreHandle,
                    dnsDomainNameA);
    GOTO_CLEANUP_ON_WINERROR_EE(dwError, EE);

cleanup:
    LW_RTL_FREE(&dnsDomainNameA);

    LSA_PSTORE_LOG_LEAVE_ERROR_EE(dwError, EE);
    return dwError;
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:26,代码来源:lsapstore-backend-legacy.c

示例6: EVTAddAllowAces

static
DWORD
EVTAddAllowAces(
    PACL pDacl,
    DWORD dwCount,
    PSID* ppSidArray,
    ACCESS_MASK dwAccessMask
    )
{
    DWORD dwInputIndex = 0;
    DWORD dwError = 0;

    for (dwInputIndex = 0; dwInputIndex < dwCount; dwInputIndex++)
    {
        dwError = LwNtStatusToWin32Error(
            RtlAddAccessAllowedAceEx(pDacl,
                                            ACL_REVISION,
                                            0,
                                            dwAccessMask,
                                            ppSidArray[dwInputIndex]));
        BAIL_ON_EVT_ERROR(dwError);
    }

cleanup:
    return dwError;

error:
    goto cleanup;
}
开发者ID:FarazShaikh,项目名称:likewise-open,代码行数:29,代码来源:main.c

示例7: LsaPstoreGetDefaultDomainA

DWORD
LsaPstoreGetDefaultDomainA(
    OUT PSTR* DnsDomainName
    )
{
    DWORD dwError = 0;
    int EE = 0;
    PWSTR dnsDomainNameW = NULL;
    PSTR dnsDomainName = NULL;

    dwError = LsaPstoreGetDefaultDomainW(&dnsDomainNameW);
    GOTO_CLEANUP_ON_WINERROR_EE(dwError, EE);

    dwError = LwNtStatusToWin32Error(LwRtlCStringAllocateFromWC16String(
                    &dnsDomainName,
                    dnsDomainNameW));
    GOTO_CLEANUP_ON_WINERROR_EE(dwError, EE);

cleanup:
    if (dwError)
    {
        LW_RTL_FREE(&dnsDomainName);
    }

    LSA_PSTORE_FREE(&dnsDomainNameW);

    *DnsDomainName = dnsDomainName;

    LSA_PSTORE_LOG_LEAVE_ERROR_EE(dwError, EE);
    return dwError;
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:31,代码来源:lsapstore-main-a.c

示例8: LsaPstorepBackendGetDefaultDomainW

DWORD
LsaPstorepBackendGetDefaultDomainW(
    IN PLSA_PSTORE_BACKEND_STATE State,
    OUT PWSTR* DnsDomainName
    )
{
    DWORD dwError = 0;
    int EE = 0;
    PSTR dnsDomainNameA = NULL;
    PWSTR dnsDomainName = NULL;

    dwError = LwpsLegacyGetDefaultJoinedDomain(
                    State->OldStoreHandle,
                    &dnsDomainNameA);
    GOTO_CLEANUP_ON_WINERROR_EE(dwError, EE);

    dwError = LwNtStatusToWin32Error(LwRtlWC16StringAllocateFromCString(
                    &dnsDomainName,
                    dnsDomainNameA));
    GOTO_CLEANUP_ON_WINERROR_EE(dwError, EE);

cleanup:
    if (dwError)
    {
        LW_RTL_FREE(&dnsDomainName);
    }

    LW_RTL_FREE(&dnsDomainNameA);

    *DnsDomainName = dnsDomainName;

    LSA_PSTORE_LOG_LEAVE_ERROR_EE(dwError, EE);
    return dwError;
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:34,代码来源:lsapstore-backend-legacy.c

示例9: NetrFileClose

NET_API_STATUS
NetrFileClose(
    PSRVSVC_CONTEXT pContext,
    const wchar16_t *servername,
    UINT32 fileid
    )
{
    NET_API_STATUS status = ERROR_SUCCESS;

    BAIL_ON_INVALID_PTR(pContext, status);

    TRY
    {
        status = _NetrFileClose(
                    pContext->hBinding,
                    (wchar16_t *)servername,
                    fileid);
    }
    CATCH_ALL(pDceException)
    {
        NTSTATUS ntStatus = LwRpcStatusToNtStatus(pDceException->match.value);
        status = LwNtStatusToWin32Error(ntStatus);
    }
    ENDTRY;
    BAIL_ON_WIN_ERROR(status);

cleanup:
    return status;

error:
    goto cleanup;
}
开发者ID:bhanug,项目名称:likewise-open,代码行数:32,代码来源:netr_fileclose.c

示例10: 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;
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:60,代码来源:dsr_memory.c

示例11: VmDirPagedSearchCacheInit

DWORD
VmDirPagedSearchCacheInit(
    VOID
    )
{
    DWORD dwError = 0;

    dwError = VmDirAllocateMutex(&gPagedSearchCache.mutex);
    BAIL_ON_VMDIR_ERROR(dwError);

    dwError = LwRtlCreateHashTable(
                    &gPagedSearchCache.pHashTbl,
                    PagedSearchRecordGetKey,
                    LwRtlHashDigestPstr,
                    LwRtlHashEqualPstr,
                    NULL,
                    VMDIR_PAGED_SEARCH_CACHE_HASH_TABLE_SIZE);
    dwError = LwNtStatusToWin32Error(dwError);
    BAIL_ON_VMDIR_ERROR(dwError);

cleanup:
    return dwError;
error:
    VmDirPagedSearchCacheFree();
    goto cleanup;
}
开发者ID:vmware,项目名称:lightwave,代码行数:26,代码来源:pscache.c

示例12: VmDirPagedSearchCacheFind

static
PVDIR_PAGED_SEARCH_RECORD
VmDirPagedSearchCacheFind(
    PCSTR pszCookie
    )
{
    DWORD dwError = 0;
    PLW_HASHTABLE_NODE pNode = NULL;
    PVDIR_PAGED_SEARCH_RECORD pSearchRecord = NULL;
    BOOLEAN bInLock = FALSE;

    if (IsNullOrEmptyString(pszCookie))
    {
        BAIL_WITH_VMDIR_ERROR(dwError, VMDIR_ERROR_INVALID_PARAMETER);
    }

    VMDIR_LOCK_MUTEX(bInLock, gPagedSearchCache.mutex);
    dwError = LwRtlHashTableFindKey(
                    gPagedSearchCache.pHashTbl,
                    &pNode,
                    (PVOID)pszCookie);
    dwError = LwNtStatusToWin32Error(dwError);
    BAIL_ON_VMDIR_ERROR(dwError);

    pSearchRecord = LW_STRUCT_FROM_FIELD(pNode, VDIR_PAGED_SEARCH_RECORD, Node);
    _RefPagedSearchRecord(pSearchRecord);

cleanup:
    VMDIR_UNLOCK_MUTEX(bInLock, gPagedSearchCache.mutex);
    return pSearchRecord;
error:
    goto cleanup;
}
开发者ID:vmware,项目名称:lightwave,代码行数:33,代码来源:pscache.c

示例13: LsaPstorepBackendSetDefaultDomainW

DWORD
LsaPstorepBackendSetDefaultDomainW(
    IN PLSA_PSTORE_BACKEND_STATE State,
    IN OPTIONAL PCWSTR DnsDomainName
    )
{
    DWORD dwError = 0;
    int EE = 0;
    PSTR dnsDomainNameA = NULL;

    if (DnsDomainName)
    {
        dwError = LwNtStatusToWin32Error(LwRtlCStringAllocateFromWC16String(
                        &dnsDomainNameA,
                        DnsDomainName));
        GOTO_CLEANUP_ON_WINERROR_EE(dwError, EE);
    }

    dwError = LwpsLegacySetDefaultJoinedDomain(
                    State->OldStoreHandle,
                    dnsDomainNameA);
    GOTO_CLEANUP_ON_WINERROR_EE(dwError, EE);

cleanup:
    LW_RTL_FREE(&dnsDomainNameA);

    LSA_PSTORE_LOG_LEAVE_ERROR_EE(dwError, EE);
    return dwError;
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:29,代码来源:lsapstore-backend-legacy.c

示例14: LwSmDriverStop

static
DWORD
LwSmDriverStop(
    PLW_SERVICE_OBJECT pObject
    )
{
    DWORD dwError = 0;
    PDRIVER_STATE pState = LwSmGetServiceObjectData(pObject);

    if (LwInterlockedCompareExchange(&pState->State, LW_SERVICE_STATE_STOPPING, LW_SERVICE_STATE_RUNNING) == LW_SERVICE_STATE_RUNNING)
    {
        dwError = LwNtStatusToWin32Error(LwIoUnloadDriver(pState->pName));
        BAIL_ON_ERROR(dwError);

        pState->State = LW_SERVICE_STATE_STOPPED;
        LwSmNotifyServiceObjectStateChange(pObject, LW_SERVICE_STATE_STOPPED);
    }

cleanup:

    return dwError;

error:

    goto cleanup;
}
开发者ID:twistround,项目名称:pbis,代码行数:26,代码来源:driver.c

示例15: LsaPstoreSetDefaultDomainA

DWORD
LsaPstoreSetDefaultDomainA(
    IN OPTIONAL PCSTR DnsDomainName
    )
{
    DWORD dwError = 0;
    int EE = 0;
    PWSTR dnsDomainNameW = NULL;

    if (DnsDomainName)
    {
        dwError = LwNtStatusToWin32Error(LwRtlWC16StringAllocateFromCString(
                        &dnsDomainNameW,
                        DnsDomainName));
        GOTO_CLEANUP_ON_WINERROR_EE(dwError, EE);
    }

    dwError = LsaPstoreSetDefaultDomainW(dnsDomainNameW);
    GOTO_CLEANUP_ON_WINERROR_EE(dwError, EE);

cleanup:
    LW_RTL_FREE(&dnsDomainNameW);

    LSA_PSTORE_LOG_LEAVE_ERROR_EE(dwError, EE);
    return dwError;
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:26,代码来源:lsapstore-main-a.c


注:本文中的LwNtStatusToWin32Error函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。