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


C++ LW_SAFE_FREE_MEMORY函数代码示例

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


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

示例1: LsaInitBindingDefault

NTSTATUS
LsaInitBindingDefault(
    OUT PLSA_BINDING   phBinding,
    IN  PCWSTR         pwszHostname,
    IN  PIO_CREDS      pCreds
    )
{
    NTSTATUS ntStatus = STATUS_SUCCESS;
    DWORD dwError = ERROR_SUCCESS;
    PSTR pszHostname = NULL;

    if (pwszHostname)
    {
        dwError = LwWc16sToMbs(pwszHostname, &pszHostname);
        BAIL_ON_WIN_ERROR(dwError);
    }

    ntStatus = LsaInitBindingDefaultA(phBinding,
                                      pszHostname,
                                      pCreds);
    BAIL_ON_NT_STATUS(ntStatus);

cleanup:
    LW_SAFE_FREE_MEMORY(pszHostname);

    return ntStatus;

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

示例2: LsaNssClearState

void
LsaNssClearState(
    PVOID pState
    )
{
    PLSA_NSS_STATE pNssState = (PLSA_NSS_STATE)pState;

    LSA_LOG_PAM_DEBUG("Clearing LAM state");

    if (pNssState != NULL)
    {
        LW_SAFE_FREE_MEMORY(pNssState->pLastGroup);
        LW_SAFE_FREE_MEMORY(pNssState->pLastUser);
        LW_SAFE_FREE_STRING(pNssState->pszRegistryName);
    }
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:16,代码来源:lam-main.c

示例3: LsaNssFreeLastGroup

void
LsaNssFreeLastGroup(
        VOID
        )
{
    LW_SAFE_FREE_MEMORY(gNssState.pLastGroup);
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:7,代码来源:lam-group.c

示例4: 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

示例5: LwSmFreeLogTarget

VOID
LwSmFreeLogTarget(
    PSTR pszTarget
    )
{
    LW_SAFE_FREE_MEMORY(pszTarget);
}
开发者ID:bhanug,项目名称:likewise-open,代码行数:7,代码来源:client.c

示例6: LsaFreeStatus

VOID
LsaFreeStatus(
    PLSASTATUS pLsaStatus
    )
{
    DWORD iCount = 0;

    for (iCount = 0; iCount < pLsaStatus->dwCount; iCount++)
    {
       PLSA_AUTH_PROVIDER_STATUS pStatus = 
                 &pLsaStatus->pAuthProviderStatusList[iCount];

       LW_SAFE_FREE_STRING(pStatus->pszId);
       LW_SAFE_FREE_STRING(pStatus->pszDomain);
       LW_SAFE_FREE_STRING(pStatus->pszForest);
       LW_SAFE_FREE_STRING(pStatus->pszSite);
       LW_SAFE_FREE_STRING(pStatus->pszCell);
       
       if (pStatus->pTrustedDomainInfoArray)
       {
           LsaFreeDomainInfoArray(
                           pStatus->dwNumTrustedDomains,
                           pStatus->pTrustedDomainInfoArray);
       }
    }

    LW_SAFE_FREE_MEMORY(pLsaStatus->pAuthProviderStatusList);

    LwFreeMemory(pLsaStatus);
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:30,代码来源:lsastatus.c

示例7: ADCacheSafeFreeGroupMembership

void
ADCacheSafeFreeGroupMembership(
        PLSA_GROUP_MEMBERSHIP* ppMembership)
{
    ADCacheFreeGroupMembershipContents(*ppMembership);
    LW_SAFE_FREE_MEMORY(*ppMembership);
}
开发者ID:borland667,项目名称:pbis,代码行数:7,代码来源:adcache.c

示例8: AuthorizationPluginCreate

extern OSStatus
AuthorizationPluginCreate(
    const AuthorizationCallbacks        *pAuthCallbacks,
    AuthorizationPluginRef              *ppPlugin,
    const AuthorizationPluginInterface  **ppPluginInterface
    )
{
    LW_AUTH_PLUGIN *pPlugin = NULL;
    OSStatus osStatus = noErr;
    DWORD dwError = LW_ERROR_SUCCESS;

    LwRtlLogSetCallback(LogCallback, NULL);

    dwError = AUTH_PLUGIN_ALLOCATE(pPlugin);
    BAIL_ON_LSA_ERROR(dwError);

    pPlugin->pAuthCallbacks = pAuthCallbacks;

    *ppPlugin = pPlugin;
    *ppPluginInterface = &gPluginInterface;

cleanup:
    return osStatus;

error:
    LW_SAFE_FREE_MEMORY(pPlugin);

    /*
     * The documentation says all errors should return
     * errAuthorizationInternal.
     */
    osStatus = errAuthorizationInternal;
    goto cleanup;
}
开发者ID:bhanug,项目名称:likewise-open,代码行数:34,代码来源:AuthPlugin.c

示例9: Del

static
DWORD
Del(
    int argc,
    char** ppszArgv
    )
{
    DWORD dwError = 0;
    PWSTR pwszShareName = NULL;

    dwError = LwMbsToWc16s(ppszArgv[1], &pwszShareName);
    BAIL_ON_SRVSVC_ERROR(dwError);

    dwError = NetShareDel(
        gState.pwszServerName,
        pwszShareName,
        0);
    BAIL_ON_SRVSVC_ERROR(dwError);

cleanup:

    LW_SAFE_FREE_MEMORY(pwszShareName);

    return dwError;

error:

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

示例10: LwSmQueryServiceDependencyClosureHelper

static
DWORD
LwSmQueryServiceDependencyClosureHelper(
    LW_SERVICE_HANDLE hHandle,
    PWSTR** pppwszServiceList
    )
{
    DWORD dwError = 0;
    PLW_SERVICE_INFO pInfo = NULL;
    LW_SERVICE_HANDLE hDepHandle = NULL;
    PWSTR pwszDepName = NULL;
    size_t i = 0;

    dwError = LwSmQueryServiceInfo(hHandle, &pInfo);
    BAIL_ON_ERROR(dwError);

    for (i = 0; pInfo->ppwszDependencies[i]; i++)
    {
        dwError = LwSmAcquireServiceHandle(pInfo->ppwszDependencies[i], &hDepHandle);
        BAIL_ON_ERROR(dwError);

        dwError = LwSmQueryServiceDependencyClosureHelper(hDepHandle, pppwszServiceList);
        BAIL_ON_ERROR(dwError);

        if (!LwSmStringListContains(*pppwszServiceList, pInfo->ppwszDependencies[i]))
        {
            dwError = LwAllocateWc16String(&pwszDepName,  pInfo->ppwszDependencies[i]);
            BAIL_ON_ERROR(dwError);

            dwError = LwSmStringListAppend(pppwszServiceList, pwszDepName);
            BAIL_ON_ERROR(dwError);

            pwszDepName = NULL;
        }
        
        LwSmReleaseServiceHandle(hDepHandle);
        hDepHandle = NULL;
    }

cleanup:
    
    LW_SAFE_FREE_MEMORY(pwszDepName);
    
    if (pInfo)
    {
        LwSmCommonFreeServiceInfo(pInfo);
    }

    if (hDepHandle)
    {
        LwSmReleaseServiceHandle(hDepHandle);
    }

    return dwError;

error:

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

示例11: AuthPluginDestroy

static OSStatus
AuthPluginDestroy(
        IN AuthorizationPluginRef pPluginRef
        )
{
    LW_SAFE_FREE_MEMORY(pPluginRef);
    return noErr;
}
开发者ID:bhanug,项目名称:likewise-open,代码行数:8,代码来源:AuthPlugin.c

示例12: AdtNetUserDelete

/**
 * Delete AD user.
 *
 * @param appContext Application context reference.
 * @param userNameC User name.
 * @return 0 on success; error code on failure.
 */
DWORD
AdtNetUserDelete(
    IN AppContextTP appContext,
    IN PSTR userNameC
)
{
    DWORD dwError = ERROR_SUCCESS;
    PWSTR hostName = NULL;
    PWSTR userName = NULL;
    PSTR  userNameN = NULL;

    dwError = NormalizeUserName(userNameC, appContext->workConn->domainName, &userNameN);
    ADT_BAIL_ON_ERROR_NP(dwError);

    dwError = LwMbsToWc16s((PCSTR) (appContext->workConn->serverName), &hostName);
    ADT_BAIL_ON_ALLOC_FAILURE_NP(!dwError);

    dwError = LwMbsToWc16s((PCSTR) userNameN, &userName);
    ADT_BAIL_ON_ALLOC_FAILURE_NP(!dwError);

    PrintStderr(appContext, LogLevelTrace, "%s: Deleting user %s ...\n",
                appContext->actionName, userNameN);

    /* Perform the delete operation. */
    if(!appContext->gopts.isReadOnly) {
        dwError = NetUserDel((PCWSTR) hostName, (PCWSTR) userName);
    }

    if (dwError) {
        dwError += ADT_WIN_ERR_BASE;
        ADT_BAIL_ON_ERROR_NP(dwError);
    }

    PrintStderr(appContext, LogLevelTrace, "%s: Done deleting user %s\n",
                appContext->actionName, userNameN);

    cleanup:
        LW_SAFE_FREE_MEMORY(hostName);
        LW_SAFE_FREE_MEMORY(userName);
        LW_SAFE_FREE_MEMORY(userNameN);

        return dwError;

    error:
        goto cleanup;
}
开发者ID:borland667,项目名称:pbis,代码行数:53,代码来源:net.c

示例13: LsaSrvQueryAccountSecurity

static
NTSTATUS
LsaSrvQueryAccountSecurity(
    PLSAR_ACCOUNT_CONTEXT pAccountContext,
    SECURITY_INFORMATION SecurityInformation,
    PSECURITY_DESCRIPTOR_RELATIVE *ppSecurityDescRelative,
    PDWORD pSecurityDescRelativeSize
    )
{
    NTSTATUS ntStatus = STATUS_SUCCESS;
    DWORD err = ERROR_SUCCESS;
    PSECURITY_DESCRIPTOR_RELATIVE pSecDescRelative = NULL;
    DWORD secDescRelativeSize = 0;
    PSECURITY_DESCRIPTOR_RELATIVE pSecurityDescRelative = NULL;

    err = LsaSrvPrivsGetAccountSecurity(
                        NULL,
                        pAccountContext->pPolicyCtx->pUserToken,
                        pAccountContext->pAccountContext,
                        SecurityInformation,
                        &pSecDescRelative,
                        &secDescRelativeSize);
    BAIL_ON_LSA_ERROR(err);

    ntStatus = LsaSrvAllocateMemory(
                        OUT_PPVOID(&pSecurityDescRelative),
                        secDescRelativeSize);
    BAIL_ON_NT_STATUS(ntStatus);

    memcpy(pSecurityDescRelative,
           pSecDescRelative,
           secDescRelativeSize);

    *ppSecurityDescRelative    = pSecurityDescRelative;
    *pSecurityDescRelativeSize = secDescRelativeSize;

error:
    if (err || ntStatus)
    {
        if (pSecurityDescRelative)
        {
            LsaSrvFreeMemory(pSecurityDescRelative);
        }

        *ppSecurityDescRelative    = NULL;
        *pSecurityDescRelativeSize = 0;
    }

    LW_SAFE_FREE_MEMORY(pSecDescRelative);

    if (ntStatus == STATUS_SUCCESS &&
        err != ERROR_SUCCESS)
    {
        ntStatus = LwWin32ErrorToNtStatus(err);
    }

    return ntStatus;
}
开发者ID:bhanug,项目名称:likewise-open,代码行数:58,代码来源:lsa_querysecurity.c

示例14: KtLdapBind

static
DWORD
KtLdapBind(
    LDAP  **ppLd,
    PCSTR   pszDc
    )
{
    const int version = LDAP_VERSION3;
    DWORD dwError = ERROR_SUCCESS;
    int lderr = 0;
    PSTR pszUrl = NULL;
    LDAP *pLd = NULL;

    dwError = LwAllocateStringPrintf(&pszUrl,
                                     "ldap://%s",
                                     pszDc);
    BAIL_ON_LSA_ERROR(dwError);

    lderr = ldap_initialize(&pLd,
                            pszUrl);
    BAIL_ON_LDAP_ERROR(lderr);

    lderr = ldap_set_option(pLd,
                            LDAP_OPT_PROTOCOL_VERSION,
                            &version);
    BAIL_ON_LDAP_ERROR(lderr);

    lderr = ldap_set_option(pLd,
                            LDAP_OPT_REFERRALS,
                            LDAP_OPT_OFF);
    BAIL_ON_LDAP_ERROR(lderr);

    dwError = LwLdapBindDirectorySasl(pLd, pszDc, FALSE);
    BAIL_ON_LSA_ERROR(dwError);

    *ppLd = pLd;

cleanup:
    LW_SAFE_FREE_MEMORY(pszUrl);

    if (dwError == ERROR_SUCCESS &&
        lderr != LDAP_SUCCESS)
    {
        dwError = LwMapLdapErrorToLwError(lderr);
    }

    return dwError;

error:
    if (pLd)
    {
        ldap_memfree(pLd);
    }

    *ppLd = NULL;

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

示例15: AdtNetGroupAdd

/**
 * Add AD local group with default properties.
 *
 * @param appContext Application context reference.
 * @param aliasNameC Group name.
 * @return 0 on success; error code on failure.
 */
DWORD
AdtNetGroupAdd(
    IN AppContextTP appContext,
    IN PSTR aliasNameC
)
{
    DWORD dwError = ERROR_SUCCESS;
    LOCALGROUP_INFO_0 Info = { 0 };
    DWORD parmError = 0;
    PWSTR hostName = NULL;
    PWSTR aliasName = NULL;

    dwError = LwMbsToWc16s((PCSTR) (appContext->workConn->serverName), &hostName);
    ADT_BAIL_ON_ALLOC_FAILURE_NP(!dwError);

    dwError = LwMbsToWc16s((PCSTR) aliasNameC, &aliasName);
    ADT_BAIL_ON_ALLOC_FAILURE_NP(!dwError);

    Info.lgrpi0_name = aliasName;

    PrintStderr(appContext, LogLevelTrace, "%s: Adding group %s ...\n",
                appContext->actionName, aliasNameC);

    /* Perform the delete operation. */
    if(!appContext->gopts.isReadOnly) {
        dwError = NetLocalGroupAdd((PCWSTR) hostName, 0, (PVOID) &Info, &parmError);
    }

    if (dwError) {
        dwError += ADT_WIN_ERR_BASE;
        ADT_BAIL_ON_ERROR_NP(dwError);
    }

    PrintStderr(appContext, LogLevelTrace, "%s: Done adding group %s\n",
                appContext->actionName, aliasNameC);

    cleanup:
        LW_SAFE_FREE_MEMORY(hostName);
        LW_SAFE_FREE_MEMORY(aliasName);

        return dwError;

    error:
        goto cleanup;
}
开发者ID:borland667,项目名称:pbis,代码行数:52,代码来源:net.c


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