-// -*- Mode: C++ -*-
+
// vss.cpp -- Interface to Volume Shadow Copies (VSS)
//
// Copyright transferred from MATRIX-Computer GmbH to
// Kern Sibbald by express permission.
//
-// Copyright (C) 2004-2005 Kern Sibbald
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
+// Copyright (C) 2005 Kern Sibbald
//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// version 2 as amended with additional clauses defined in the
+// file LICENSE in the main source directory.
//
-// You should have received a copy of the GNU General Public
-// License along with this program; if not, write to the Free
-// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-// MA 02111-1307, USA.
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// the file LICENSE for additional details.
//
+//
// Author : Thorsten Engel
-// Created On : Fri May 06 21:44:00 2006
+// Created On : Fri May 06 21:44:00 2005
#include <stdio.h>
VSSClient::VSSClient()
{
m_bCoInitializeCalled = false;
+ m_bCoInitializeSecurityCalled = false;
m_dwContext = 0; // VSS_CTX_BACKUP;
m_bDuringRestore = false;
m_bBackupIsInitialized = false;
m_pVssObject = NULL;
- memset (m_wszUniqueVolumeName,0,sizeof (m_wszUniqueVolumeName));
- memset (m_szShadowCopyName,0,sizeof (m_szShadowCopyName));
+ 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));
}
// Destructor
m_pVssObject = NULL;
}
+ if (m_pVectorWriterStates)
+ delete (m_pVectorWriterStates);
+
+ if (m_pVectorWriterInfo)
+ delete (m_pVectorWriterInfo);
+
// Call CoUninitialize if the CoInitialize was performed sucesfully
if (m_bCoInitializeCalled)
CoUninitialize();
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 */
BOOL bIsValidName;
- bIsValidName = strlen (szFilePath) > 3;
+ bIsValidName = strlen(szFilePath) > 3;
if (bIsValidName)
bIsValidName &= isalpha (szFilePath[0]) &&
szFilePath[1]==':' &&
- szFilePath[2]=='\\';
+ szFilePath[2] == '\\';
if (bIsValidName) {
int nDriveIndex = toupper(szFilePath[0])-'A';
if (m_szShadowCopyName[nDriveIndex][0] != 0) {
- strncpy (szShadowPath, m_szShadowCopyName[nDriveIndex], nBuflen);
- nBuflen -= (int) strlen (m_szShadowCopyName[nDriveIndex]);
- strncat (szShadowPath, szFilePath+2,nBuflen);
-
+ strncpy(szShadowPath, m_szShadowCopyName[nDriveIndex], nBuflen);
+ nBuflen -= (int)strlen(m_szShadowCopyName[nDriveIndex]);
+ strncat(szShadowPath, szFilePath+2, nBuflen);
return TRUE;
}
}
- strncpy (szShadowPath, szFilePath, nBuflen);
+ strncpy(szShadowPath, szFilePath, nBuflen);
+ errno = EINVAL;
return FALSE;
-}
\ No newline at end of file
+}
+
+
+const size_t VSSClient::GetWriterCount()
+{
+ vector<int>* pV = (vector<int>*) m_pVectorWriterStates;
+ return pV->size();
+}
+
+const char* VSSClient::GetWriterInfo(size_t nIndex)
+{
+ vector<string>* pV = (vector<string>*) m_pVectorWriterInfo;
+ return pV->at(nIndex).c_str();
+}
+
+
+const int VSSClient::GetWriterState(size_t nIndex)
+{
+ vector<int>* pV = (vector<int>*) m_pVectorWriterStates;
+ return pV->at(nIndex);
+}