本文整理汇总了C++中LW_SAFE_FREE_MEMORY函数的典型用法代码示例。如果您正苦于以下问题:C++ LW_SAFE_FREE_MEMORY函数的具体用法?C++ LW_SAFE_FREE_MEMORY怎么用?C++ LW_SAFE_FREE_MEMORY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LW_SAFE_FREE_MEMORY函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: ADProviderFreeProviderData
VOID
ADProviderFreeProviderData(
IN OUT PAD_PROVIDER_DATA pData
)
{
ADProviderFreeCellList(pData->pCellList);
LW_SAFE_FREE_MEMORY(pData);
}
开发者ID:borland667,项目名称:pbis,代码行数:9,代码来源:providerstate.c
示例17: ADCacheFreePasswordVerifier
void
ADCacheFreePasswordVerifier(
IN OUT PLSA_PASSWORD_VERIFIER pVerifier
)
{
LW_SAFE_FREE_STRING(pVerifier->pszObjectSid);
LW_SECURE_FREE_STRING(pVerifier->pszPasswordVerifier);
LW_SAFE_FREE_MEMORY(pVerifier);
}
开发者ID:borland667,项目名称:pbis,代码行数:9,代码来源:adcache.c
示例18: LsaNssAllocateGroupFromInfo0
DWORD
LsaNssAllocateGroupFromInfo0(
PLSA_GROUP_INFO_0 pInfo,
struct group** ppResult
)
{
DWORD dwError = LW_ERROR_SUCCESS;
// Do not free directly. Free pStartMem instead on error
struct group* pResult = NULL;
void *pStartMem = NULL;
// Do not free
PBYTE pMem = NULL;
size_t sRequiredSize = 0;
size_t sLen = 0;
sRequiredSize += sizeof(struct group);
sRequiredSize += strlen(pInfo->pszName) + 1;
sRequiredSize += 2;
dwError = LwAllocateMemory(
sRequiredSize,
&pStartMem);
BAIL_ON_LSA_ERROR(dwError);
pMem = pStartMem;
pResult = (struct group *)pMem;
pMem += sizeof(struct group);
pResult->gr_mem = NULL;
sLen = strlen(pInfo->pszName);
pResult->gr_name = (char *)pMem;
memcpy(pResult->gr_name, pInfo->pszName, sLen + 1);
pMem += sLen + 1;
sLen = 1;
pResult->gr_passwd = (char *)pMem;
memcpy(pResult->gr_passwd, "*", sLen + 1);
pMem += sLen + 1;
pResult->gr_gid = pInfo->gid;
assert(pMem == pStartMem + sRequiredSize);
*ppResult = pResult;
cleanup:
return dwError;
error:
*ppResult = NULL;
LW_SAFE_FREE_MEMORY(pStartMem);
goto cleanup;
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:57,代码来源:lam-group.c
示例19: LwpsLegacyGetJoinedDomainTrustEnumerationWaitTime
DWORD
LwpsLegacyGetJoinedDomainTrustEnumerationWaitTime(
IN PLWPS_LEGACY_STATE pContext,
IN OPTIONAL PCSTR pszDomainName,
OUT PDWORD* ppdwTrustEnumerationWaitSeconds,
OUT PDWORD* ppdwTrustEnumerationWaitEnabled
)
{
DWORD dwError = 0;
int EE = 0;
PSTR pszRegistryPath = NULL;
PVOID dwValue = NULL;
PVOID dwValue1 = NULL;
REG_DATA_TYPE readType = 0;
DWORD dwValueSize = 0;
DWORD dwValueSize1 = 0;
if (pszDomainName)
{
dwError = LwAllocateStringPrintf(
&pszRegistryPath,
"%s\\%s",
PSTOREDB_REGISTRY_AD_KEY,
pszDomainName);
GOTO_CLEANUP_ON_WINERROR_EE(dwError, EE);
dwError = RegUtilGetValue(
pContext->hReg,
HKEY_THIS_MACHINE,
pszRegistryPath,
NULL,
PSTOREDB_REGISTRY_TRUSTENUMERATIONWAIT_VALUE,
&readType,
&dwValue,
&dwValueSize);
GOTO_CLEANUP_ON_WINERROR_EE(dwError, EE);
dwError = RegUtilGetValue(
pContext->hReg,
HKEY_THIS_MACHINE,
pszRegistryPath,
NULL,
PSTOREDB_REGISTRY_TRUSTENUMERATIONWAITSECONDS_VALUE,
&readType,
&dwValue1,
&dwValueSize1);
GOTO_CLEANUP_ON_WINERROR_EE(dwError, EE);
*ppdwTrustEnumerationWaitSeconds = (PDWORD) dwValue1;
*ppdwTrustEnumerationWaitEnabled = (PDWORD) dwValue;
}
cleanup:
LW_SAFE_FREE_MEMORY(pszRegistryPath);
LSA_PSTORE_LOG_LEAVE_ERROR_EE(dwError, EE);
return dwError;
}
开发者ID:virtual-void,项目名称:pbis,代码行数:56,代码来源:lsapstore-backend-legacy-internal.c
示例20: FreeStringArray
static
VOID
FreeStringArray(
DWORD dwCount,
PWSTR* ppwszArray
)
{
DWORD dwIndex = 0;
if (ppwszArray)
{
for (dwIndex = 0; dwIndex < dwCount; dwIndex++)
{
LW_SAFE_FREE_MEMORY(ppwszArray[dwIndex]);
}
LW_SAFE_FREE_MEMORY(ppwszArray);
}
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:19,代码来源:main.c
注:本文中的LW_SAFE_FREE_MEMORY函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论