STDMETHODIMP_(LPTSTR) CKpUtilitiesImpl::MakeRelativePath(LPCTSTR lpBaseFile,
	LPCTSTR lpTargetFile)
{
	if((lpBaseFile == NULL) || (lpTargetFile == NULL)) return NULL;
	CString str = MakeRelativePathEx(lpBaseFile, lpTargetFile);
	return _TcsSafeDupAlloc((LPCTSTR)str);
}
示例#2
0
KP_SHARE BOOL PG_SetName(PW_GROUP *pGroup, LPCTSTR lpName)
{
	ASSERT(pGroup != NULL); if(pGroup == NULL) return FALSE;
	SAFE_DELETE_ARRAY(pGroup->pszGroupName);
	pGroup->pszGroupName = _TcsSafeDupAlloc(lpName);
	return TRUE;
}
示例#3
0
KP_SHARE BOOL PE_SetBinaryDesc(PW_ENTRY *pEntry, LPCTSTR lpDesc)
{
	ASSERT(pEntry != NULL); if(pEntry == NULL) return FALSE;
	SAFE_DELETE_ARRAY(pEntry->pszBinaryDesc);
	pEntry->pszBinaryDesc = _TcsSafeDupAlloc(lpDesc);
	return TRUE;
}
示例#4
0
KP_SHARE BOOL PE_SetNotes(PW_ENTRY *pEntry, LPCTSTR lpNotes)
{
	ASSERT(pEntry != NULL); if(pEntry == NULL) return FALSE;
	SAFE_DELETE_ARRAY(pEntry->pszAdditional);
	pEntry->pszAdditional = _TcsSafeDupAlloc(lpNotes);
	return TRUE;
}
示例#5
0
KP_SHARE BOOL PE_SetUserName(PW_ENTRY *pEntry, LPCTSTR lpUserName)
{
	ASSERT(pEntry != NULL); if(pEntry == NULL) return FALSE;
	SAFE_DELETE_ARRAY(pEntry->pszUserName);
	pEntry->pszUserName = _TcsSafeDupAlloc(lpUserName);
	return TRUE;
}
STDMETHODIMP_(LPTSTR) CKpUtilitiesImpl::GetQuotedPath(LPCTSTR lpPath)
{
	if(lpPath == NULL) return NULL;

	const std::basic_string<TCHAR> str = lpPath;
	const std::basic_string<TCHAR> strPath = SU_GetQuotedPath(str);
	return _TcsSafeDupAlloc(strPath.c_str());
}
示例#7
0
LPCTSTR CStringSetEx::Add(LPCTSTR lpString)
{
	if(lpString == NULL) { ASSERT(FALSE); return NULL; }

	const size_t uStringCount = m_vStrings.size();
	for(size_t i = 0; i < uStringCount; ++i)
	{
		if(_tcscmp(m_vStrings[i], lpString) == 0)
			return m_vStrings[i];
	}

	LPTSTR lp = _TcsSafeDupAlloc(lpString);
	m_vStrings.push_back(lp);
	return lp;
}
示例#8
0
BOOL CPwUtil::MemAllocCopyEntry(_In_ const PW_ENTRY *pExisting,
	_Out_ PW_ENTRY *pDestination)
{
	ASSERT_ENTRY(pExisting); ASSERT(pDestination != NULL);
	if((pExisting == NULL) || (pDestination == NULL)) return FALSE;

	ZeroMemory(pDestination, sizeof(PW_ENTRY));

	pDestination->uBinaryDataLen = pExisting->uBinaryDataLen;
	if(pExisting->pBinaryData != NULL)
	{
		pDestination->pBinaryData = new BYTE[pExisting->uBinaryDataLen + 1];
		ASSERT(pDestination->pBinaryData != NULL); if(pDestination->pBinaryData == NULL) return FALSE;
		pDestination->pBinaryData[pExisting->uBinaryDataLen] = 0;
		memcpy(pDestination->pBinaryData, pExisting->pBinaryData, pExisting->uBinaryDataLen);
	}

	pDestination->pszAdditional = _TcsSafeDupAlloc(pExisting->pszAdditional);
	pDestination->pszBinaryDesc = _TcsSafeDupAlloc(pExisting->pszBinaryDesc);
	pDestination->pszPassword = _TcsCryptDupAlloc(pExisting->pszPassword);
	pDestination->pszTitle = _TcsSafeDupAlloc(pExisting->pszTitle);
	pDestination->pszURL = _TcsSafeDupAlloc(pExisting->pszURL);
	pDestination->pszUserName = _TcsSafeDupAlloc(pExisting->pszUserName);

	pDestination->tCreation = pExisting->tCreation;
	pDestination->tExpire = pExisting->tExpire;
	pDestination->tLastAccess = pExisting->tLastAccess;
	pDestination->tLastMod = pExisting->tLastMod;

	pDestination->uGroupId = pExisting->uGroupId;
	pDestination->uImageId = pExisting->uImageId;
	pDestination->uPasswordLen = pExisting->uPasswordLen;
	memcpy(pDestination->uuid, pExisting->uuid, 16);

	return TRUE;
}
STDMETHODIMP_(LPTSTR) CKpUtilitiesImpl::GetShortestAbsolutePath(LPCTSTR lpFilePath)
{
	if(lpFilePath == NULL) return NULL;
	CString str = ::GetShortestAbsolutePath(lpFilePath);
	return _TcsSafeDupAlloc((LPCTSTR)str);
}