本文整理汇总了C++中IsNullOrEmptyString函数的典型用法代码示例。如果您正苦于以下问题:C++ IsNullOrEmptyString函数的具体用法?C++ IsNullOrEmptyString怎么用?C++ IsNullOrEmptyString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsNullOrEmptyString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SrvPathGetFileName
PCSTR
SrvPathGetFileName(
PCSTR pszPath
)
{
PCSTR pszCursor = pszPath;
size_t sLen = 0;
CHAR szBackSlash[] = { '\\', 0 };
CHAR szFwdSlash[] = { '/', 0 };
if (pszPath && (sLen = strlen(pszPath)))
{
pszCursor = pszPath + sLen - 1;
while (!IsNullOrEmptyString(pszCursor) && (pszCursor != pszPath))
{
if ((*pszCursor == szBackSlash[0]) || (*pszCursor == szFwdSlash[0]))
{
pszCursor++;
break;
}
pszCursor--;
}
}
return pszCursor;
}
示例2: VmDirSchemaAttrIdMapGetAttrId
DWORD
VmDirSchemaAttrIdMapGetAttrId(
PVDIR_SCHEMA_ATTR_ID_MAP pAttrIdMap,
PSTR pszAttrName,
USHORT* pusAttrId
)
{
DWORD dwError = 0;
uintptr_t pAttrId = 0;
if (!pAttrIdMap || IsNullOrEmptyString(pszAttrName))
{
dwError = ERROR_INVALID_PARAMETER;
BAIL_ON_VMDIR_ERROR(dwError);
}
dwError = LwRtlHashMapFindKey(pAttrIdMap->pStoredIds,
(PVOID*)&pAttrId, pszAttrName);
if (dwError)
{
dwError = LwRtlHashMapFindKey(pAttrIdMap->pNewIds,
(PVOID*)&pAttrId, pszAttrName);
}
BAIL_ON_VMDIR_ERROR(dwError);
if (pusAttrId)
{
*pusAttrId = (USHORT)pAttrId;
}
error:
return dwError;
}
示例3: 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;
}
示例4: VmDirSimpleEntryDeleteAttribute
DWORD
VmDirSimpleEntryDeleteAttribute(
PCSTR pszDN,
PCSTR pszAttr
)
{
DWORD dwError = 0;
size_t dnlen = 0;
size_t attrlen = 0;
VDIR_OPERATION ldapOp = {0};
if (IsNullOrEmptyString(pszDN) || IsNullOrEmptyString(pszAttr))
{
BAIL_WITH_VMDIR_ERROR(dwError, VMDIR_ERROR_INVALID_PARAMETER);
}
dwError = VmDirInitStackOperation(
&ldapOp,
VDIR_OPERATION_TYPE_INTERNAL,
LDAP_REQ_MODIFY,
NULL);
BAIL_ON_VMDIR_ERROR(dwError);
dnlen = VmDirStringLenA(pszDN);
attrlen = VmDirStringLenA(pszAttr);
ldapOp.pBEIF = VmDirBackendSelect(NULL);
ldapOp.reqDn.lberbv_val = (PSTR)pszDN;
ldapOp.reqDn.lberbv_len = dnlen;
ldapOp.request.modifyReq.dn.lberbv_val = ldapOp.reqDn.lberbv_val;
ldapOp.request.modifyReq.dn.lberbv_len = ldapOp.reqDn.lberbv_len;
dwError = VmDirAppendAMod(
&ldapOp, MOD_OP_DELETE, pszAttr, attrlen, NULL, 0);
BAIL_ON_VMDIR_ERROR(dwError);
dwError = VmDirInternalModifyEntry(&ldapOp);
BAIL_ON_VMDIR_ERROR(dwError);
cleanup:
VmDirFreeOperationContent(&ldapOp);
return dwError;
error:
goto cleanup;
}
示例5: ADUSMBGetFile
DWORD
ADUSMBGetFile(
PSTR pszDomainName,
PSTR pszSourcePath,
PSTR pszDestPath
)
{
DWORD dwError = MAC_AD_ERROR_SUCCESS;
PSTR pszFQSrcPath = NULL;
PSTR pszDCHostname = NULL;
if (IsNullOrEmptyString(pszDomainName) ||
IsNullOrEmptyString(pszSourcePath) ||
IsNullOrEmptyString(pszDestPath))
{
dwError = MAC_AD_ERROR_INVALID_PARAMETER;
BAIL_ON_MAC_ERROR(dwError);
}
dwError = GetPreferredDCAddress(
pszDomainName,
&pszDCHostname);
BAIL_ON_MAC_ERROR(dwError);
dwError = LwAllocateStringPrintf(
&pszFQSrcPath,
"//%s/sysvol/%s",
pszDCHostname,
*pszSourcePath == '/' ? pszSourcePath+1 : pszSourcePath);
BAIL_ON_MAC_ERROR(dwError);
LOG("Calling ADUCopyFileFromRemote(Src:%s, Dest:%s)", pszFQSrcPath, pszDestPath);
dwError = ADUCopyFileFromRemote(pszFQSrcPath, pszDestPath);
BAIL_ON_MAC_ERROR(dwError);
cleanup:
LW_SAFE_FREE_STRING(pszFQSrcPath);
LW_SAFE_FREE_STRING(pszDCHostname);
return dwError;
error:
goto cleanup;
}
示例6: VmDirGetKrbMasterKey
DWORD
VmDirGetKrbMasterKey(
PSTR pszFQDN, // [in] FQDN
PBYTE* ppKeyBlob,
DWORD* pSize
)
{
DWORD dwError = 0;
PBYTE pRetMasterKey = NULL;
if (IsNullOrEmptyString(pszFQDN)
|| !ppKeyBlob
|| !pSize
)
{
dwError = VMDIR_ERROR_INVALID_PARAMETER;
BAIL_ON_VMDIR_ERROR(dwError);
}
// Currently, we only support single krb realm.
// Global cache gVmdirKrbGlobals is initialized during startup stage.
if (VmDirStringCompareA( pszFQDN, VDIR_SAFE_STRING(gVmdirKrbGlobals.pszRealm), FALSE) != 0)
{
dwError = VMDIR_ERROR_INVALID_REALM;
BAIL_ON_VMDIR_ERROR(dwError);
}
dwError = VmDirAllocateMemory(
gVmdirKrbGlobals.bervMasterKey.lberbv.bv_len,
(PVOID*)&pRetMasterKey
);
BAIL_ON_VMDIR_ERROR(dwError);
dwError = VmDirCopyMemory (
pRetMasterKey,
gVmdirKrbGlobals.bervMasterKey.lberbv.bv_len,
gVmdirKrbGlobals.bervMasterKey.lberbv.bv_val,
gVmdirKrbGlobals.bervMasterKey.lberbv.bv_len
);
BAIL_ON_VMDIR_ERROR(dwError);
*ppKeyBlob = pRetMasterKey;
*pSize = (DWORD) gVmdirKrbGlobals.bervMasterKey.lberbv.bv_len;
pRetMasterKey = NULL;
cleanup:
return dwError;
error:
VMDIR_LOG_ERROR( LDAP_DEBUG_RPC, "VmDirGetKrbMasterKey failed. (%u)(%s)",
dwError, VDIR_SAFE_STRING(pszFQDN));
VMDIR_SAFE_FREE_MEMORY(pRetMasterKey);
goto cleanup;
}
示例7: LWNetDnsGetSrvRecordQuestion
DWORD
LWNetDnsGetSrvRecordQuestion(
OUT PSTR* ppszQuestion,
IN PCSTR pszDomainName,
IN OPTIONAL PCSTR pszSiteName,
IN DWORD dwDsFlags
)
{
DWORD dwError = 0;
PSTR question = NULL;
PCSTR kind = "dc";
PCSTR service = "_ldap";
if (dwDsFlags & DS_PDC_REQUIRED)
{
kind = "pdc";
service = "_ldap";
}
else if (dwDsFlags & DS_GC_SERVER_REQUIRED)
{
kind = "gc";
service = "_ldap";
}
else if (dwDsFlags & DS_KDC_REQUIRED)
{
kind = "dc";
service = "_kerberos";
}
else
{
kind = "dc";
service = "_ldap";
}
if (IsNullOrEmptyString(pszSiteName))
{
dwError = LwAllocateStringPrintf(&question,
"%s._tcp.%s._msdcs.%s",
service, kind,
pszDomainName);
BAIL_ON_LWNET_ERROR(dwError);
}
else
{
dwError = LwAllocateStringPrintf(&question,
"%s._tcp.%s._sites.%s._msdcs.%s",
service, pszSiteName, kind,
pszDomainName);
BAIL_ON_LWNET_ERROR(dwError);
}
error:
if (dwError)
{
LWNET_SAFE_FREE_STRING(question);
}
*ppszQuestion = question;
return dwError;
}
示例8: LwCALockDN
DWORD
LwCALockDN(
PLWCA_POST_HANDLE pHandle,
PCSTR pcszDN,
PSTR *ppszUuid
)
{
DWORD dwError = 0;
PSTR pszUuid = NULL;
ULONG currTime = 0;
DWORD dwAttempt = 0;
struct timespec ts = {0};
if (IsNullOrEmptyString(pcszDN) || !ppszUuid || !pHandle)
{
dwError = LWCA_ERROR_INVALID_PARAMETER;
BAIL_ON_LWCA_ERROR(dwError);
}
dwError = LwCAUuidGenerate(&pszUuid);
BAIL_ON_LWCA_ERROR(dwError);
ts.tv_nsec = LWCA_LOCK_SLEEP_NS;
while (dwAttempt < LWCA_LOCK_MAX_ATTEMPT)
{
dwError = _LwCAGetCurrentTime(&currTime);
BAIL_ON_LWCA_ERROR(dwError);
dwError = _LwCALockDNImpl(pHandle, pszUuid, currTime, pcszDN);
if (dwError == LWCA_LOCK_APPLY_FAILED)
{
dwAttempt += 1;
nanosleep(&ts, NULL);
continue;
}
BAIL_ON_LWCA_ERROR(dwError);
break;
}
if (dwAttempt >= LWCA_LOCK_MAX_ATTEMPT)
{
dwError = LWCA_LOCK_APPLY_FAILED;
BAIL_ON_LWCA_ERROR(dwError);
}
*ppszUuid = pszUuid;
cleanup:
return dwError;
error:
LWCA_SAFE_FREE_STRINGA(pszUuid);
if (ppszUuid)
{
*ppszUuid = NULL;
}
goto cleanup;
}
示例9: SrvGetTreeRelativePath
NTSTATUS
SrvGetTreeRelativePath(
PWSTR pwszOriginalPath,
PWSTR* ppwszSpecificPath
)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
wchar16_t wszBackSlash[] = { '\\', 0 };
wchar16_t wszFwdSlash[] = { '/', 0 };
if ((*pwszOriginalPath != wszBackSlash[0]) &&
(*pwszOriginalPath != wszFwdSlash[0]))
{
ntStatus = STATUS_INVALID_PARAMETER;
BAIL_ON_NT_STATUS(ntStatus);
}
pwszOriginalPath++;
// Skip the device name
while (!IsNullOrEmptyString(pwszOriginalPath) &&
(*pwszOriginalPath != wszBackSlash[0]) &&
(*pwszOriginalPath != wszFwdSlash[0]))
{
pwszOriginalPath++;
}
if (IsNullOrEmptyString(pwszOriginalPath) ||
((*pwszOriginalPath != wszBackSlash[0]) &&
(*pwszOriginalPath != wszFwdSlash[0])))
{
ntStatus = STATUS_INVALID_PARAMETER;
BAIL_ON_NT_STATUS(ntStatus);
}
*ppwszSpecificPath = pwszOriginalPath;
cleanup:
return ntStatus;
error:
*ppwszSpecificPath = NULL;
goto cleanup;
}
示例10: VmwDeploySetupServerPartner
static
DWORD
VmwDeploySetupServerPartner(
PVMW_IC_SETUP_PARAMS pParams
)
{
DWORD dwError = 0;
PCSTR ppszServices[]=
{
VMW_DCERPC_SVC_NAME,
VMW_VMDNS_SVC_NAME,
VMW_VMAFD_SVC_NAME,
VMW_DIR_SVC_NAME,
VMW_VMCA_SVC_NAME
};
int iSvc = 0;
VMW_DEPLOY_LOG_INFO("Setting up system as Infrastructure partner node");
dwError = VmwDeployValidateHostname(pParams->pszHostname);
BAIL_ON_DEPLOY_ERROR(dwError);
dwError = VmwDeployValidatePartnerCredentials(
pParams->pszServer,
pParams->pszPassword,
pParams->pszDomainName);
BAIL_ON_DEPLOY_ERROR(dwError);
dwError = VmwDeployValidateSiteName(pParams->pszSite);
BAIL_ON_DEPLOY_ERROR(dwError);
if (!IsNullOrEmptyString(pParams->pszDNSForwarders))
{
dwError = VmwDeployValidateDNSForwarders(pParams->pszDNSForwarders);
BAIL_ON_DEPLOY_ERROR(dwError);
}
for (; iSvc < sizeof(ppszServices)/sizeof(ppszServices[0]); iSvc++)
{
PCSTR pszService = ppszServices[iSvc];
VMW_DEPLOY_LOG_INFO("Starting service [%s]", pszService);
dwError = VmwDeployStartService(pszService);
BAIL_ON_DEPLOY_ERROR(dwError);
}
dwError = VmwDeploySetupServerCommon(pParams);
BAIL_ON_DEPLOY_ERROR(dwError);
cleanup:
return dwError;
error:
goto cleanup;
}
示例11: VmAfWinCfgOpenRootKey
DWORD
VmAfWinCfgOpenRootKey(
PVMAF_CFG_CONNECTION pConnection,
PCSTR pszKeyName,
DWORD dwOptions,
DWORD dwAccess,
PVMAF_CFG_KEY* ppKey
)
{
DWORD dwError = 0;
PVMAF_CFG_KEY pKey = NULL;
VMAF_CFG_KEY rootKey = {0};
if (!pConnection || IsNullOrEmptyString(pszKeyName) || !ppKey)
{
dwError = ERROR_INVALID_PARAMETER;
BAIL_ON_VMAFD_ERROR(dwError);
}
if (!strcmp(pszKeyName, "HKEY_LOCAL_MACHINE"))
{
rootKey.hKey = HKEY_LOCAL_MACHINE;
}
else
{
dwError = ERROR_NOT_SUPPORTED;
BAIL_ON_VMAFD_ERROR(dwError);
}
dwError = VmAfWinCfgOpenKey(
pConnection,
&rootKey,
NULL,
dwOptions,
dwAccess,
&pKey);
BAIL_ON_VMAFD_ERROR(dwError);
*ppKey = pKey;
cleanup:
return dwError;
error:
if (ppKey)
{
*ppKey = NULL;
}
// if (pKey)
// {
// VmAfWinCfgCloseKey(pKey);
// }
goto cleanup;
}
示例12: DJFixLoginConfigFile
DWORD
DJFixLoginConfigFile(
PCSTR pszPath
)
{
DWORD ceError = ERROR_SUCCESS;
PCSTR pszFilePath = NULL;
PSTR pszTmpPath = NULL;
PSTR pszFinalPath = NULL;
BOOLEAN bFileExists = FALSE;
FILE* fp = NULL;
FILE* fp_new = NULL;
DynamicArray lines;
PSTR currentSystem = NULL;
memset(&lines, 0, sizeof(lines));
if (IsNullOrEmptyString(pszPath))
pszFilePath = LOGIN_CONFIG_PATH;
else
pszFilePath = pszPath;
GCE(ceError = CTGetFileTempPath(
pszFilePath,
&pszFinalPath,
&pszTmpPath));
GCE(ceError = CTCheckFileExists(pszFinalPath, &bFileExists));
if (!bFileExists)
goto cleanup;
GCE(ceError = CTOpenFile(pszFinalPath, "r", &fp));
GCE(ceError = CTReadLines(fp, &lines));
GCE(ceError = CTSafeCloseFile(&fp));
GCE(ceError = GetAuthType(&lines, ¤tSystem));
if(!strcmp(currentSystem, "PAM_AUTH"))
goto cleanup;
GCE(ceError = SetAuthType(&lines, "PAM_AUTH"));
GCE(ceError = CTOpenFile(pszTmpPath, "w", &fp_new));
GCE(ceError = CTWriteLines(fp_new, &lines));
GCE(ceError = CTSafeCloseFile(&fp_new));
GCE(ceError = CTSafeReplaceFile(pszFilePath, pszTmpPath));
cleanup:
CTSafeCloseFile(&fp);
CTSafeCloseFile(&fp_new);
CT_SAFE_FREE_STRING(currentSystem);
CT_SAFE_FREE_STRING(pszTmpPath);
CT_SAFE_FREE_STRING(pszFinalPath);
CTFreeLines(&lines);
return ceError;
}
示例13: VmwDeployValidatePassword
DWORD
VmwDeployValidatePassword(
PCSTR pszPassword
)
{
DWORD dwError = 0;
size_t iCh = 0;
size_t nUpper = 0;
size_t nLower = 0;
size_t nDigit = 0;
size_t nSpecial = 0;
size_t sLen = 0;
VMW_DEPLOY_LOG_DEBUG("Validating password");
if (IsNullOrEmptyString(pszPassword) || (sLen = strlen(pszPassword)) < 8)
{
dwError = ERROR_PASSWORD_RESTRICTION;
BAIL_ON_DEPLOY_ERROR(dwError);
}
// We are looking for at least one upper case, one lower case, one digit and
// one special case character. Added illegal chars check
for (iCh = 0; iCh < sLen; iCh++)
{
int ch = pszPassword[iCh];
if (isdigit(ch))
{
nDigit++;
}
else if (islower(ch))
{
nLower++;
}
else if (isupper(ch))
{
nUpper++;
}
else if (ispunct(ch))
{
nSpecial++;
}
}
if (!nUpper || !nLower || !nDigit || !nSpecial)
{
VMW_DEPLOY_LOG_ERROR("Password complexity requirement not satisfied");
dwError = ERROR_PASSWORD_RESTRICTION;
BAIL_ON_DEPLOY_ERROR(dwError);
}
error:
return dwError;
}
示例14: VmDirMetaDataCreate
DWORD
VmDirMetaDataCreate(
USN localUsn,
UINT64 version,
PCSTR pszOrigInvoId,
PCSTR pszOrigTimeStamp,
USN origUsn,
PVMDIR_ATTRIBUTE_METADATA* ppMetaData
)
{
DWORD dwError = 0;
PVMDIR_ATTRIBUTE_METADATA pMetaData = NULL;
if (!ppMetaData ||
IsNullOrEmptyString(pszOrigInvoId) ||
IsNullOrEmptyString(pszOrigTimeStamp))
{
BAIL_WITH_VMDIR_ERROR(dwError, VMDIR_ERROR_INVALID_PARAMETER);
}
dwError = VmDirAllocateMemory(sizeof(VMDIR_ATTRIBUTE_METADATA), (PVOID*) &pMetaData);
BAIL_ON_VMDIR_ERROR(dwError);
pMetaData->localUsn = localUsn;
pMetaData->version = version;
dwError = VmDirAllocateStringA(pszOrigInvoId, &pMetaData->pszOrigInvoId);
BAIL_ON_VMDIR_ERROR(dwError);
dwError = VmDirAllocateStringA(pszOrigTimeStamp, &pMetaData->pszOrigTime);
BAIL_ON_VMDIR_ERROR(dwError);
pMetaData->origUsn = origUsn;
*ppMetaData = pMetaData;
cleanup:
return dwError;
error:
VmDirFreeMetaData(pMetaData);
VMDIR_LOG_ERROR(VMDIR_LOG_MASK_ALL, "failed, error (%d)", dwError);
goto cleanup;
}
示例15: VmDirValidateUserCreateParamsW
static
DWORD
VmDirValidateUserCreateParamsW(
PVMDIR_USER_CREATE_PARAMS_W pCreateParams
)
{
DWORD dwError = 0;
if (!pCreateParams ||
IsNullOrEmptyString(pCreateParams->pwszAccount) ||
IsNullOrEmptyString(pCreateParams->pwszFirstname) ||
IsNullOrEmptyString(pCreateParams->pwszLastname) ||
IsNullOrEmptyString(pCreateParams->pwszPassword))
{
dwError = ERROR_INVALID_PARAMETER;
}
return dwError;
}