-// -*- Mode: C++ -*-
+
// vss.cpp -- Interface to Volume Shadow Copies (VSS)
//
// Copyright transferred from MATRIX-Computer GmbH to
VSSClient::VSSClient()
{
m_bCoInitializeCalled = false;
+ m_bCoInitializeSecurityCalled = false;
m_dwContext = 0; // VSS_CTX_BACKUP;
m_bDuringRestore = false;
m_bBackupIsInitialized = false;
m_pVectorWriterStates = new vector<int>;
m_pVectorWriterInfo = new vector<string>;
m_uidCurrentSnapshotSet = GUID_NULL;
- memset (m_wszUniqueVolumeName,0,sizeof (m_wszUniqueVolumeName));
- memset (m_szShadowCopyName,0,sizeof (m_szShadowCopyName));
+ memset(m_wszUniqueVolumeName,0, sizeof(m_wszUniqueVolumeName));
+ memset(m_szShadowCopyName,0, sizeof(m_szShadowCopyName));
}
// Destructor
BOOL VSSClient::InitializeForBackup()
{
//return Initialize (VSS_CTX_BACKUP);
- return Initialize (0);
+ return Initialize(0);
}
-BOOL VSSClient::GetShadowPath (const char *szFilePath, char *szShadowPath, int nBuflen)
+BOOL VSSClient::GetShadowPath(const char *szFilePath, char *szShadowPath, int nBuflen)
{
if (!m_bBackupIsInitialized)
return FALSE;
- /* check for valid pathname -- note, allow simple drive letter too */
+ /* check for valid pathname */
BOOL bIsValidName;
- bIsValidName = strlen(szFilePath) >= 2;
+ bIsValidName = strlen(szFilePath) > 3;
if (bIsValidName)
bIsValidName &= isalpha (szFilePath[0]) &&
- szFilePath[1]==':';
+ szFilePath[1]==':' &&
+ szFilePath[2] == '\\';
if (bIsValidName) {
int nDriveIndex = toupper(szFilePath[0])-'A';
}
strncpy(szShadowPath, szFilePath, nBuflen);
+ errno = EINVAL;
return FALSE;
}