5 // Copyright transferred from MATRIX-Computer GmbH to
6 // Kern Sibbald by express permission.
8 // Copyright (C) 2005-2006 Kern Sibbald
10 // This program is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU General Public License
12 // version 2 as amended with additional clauses defined in the
13 // file LICENSE in the main source directory.
15 // This program is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // the file LICENSE for additional details.
23 * Author : Thorsten Engel
24 * Created On : Fri May 06 21:44:00 2006
31 #define b_errno_win32 (1<<29)
36 // some forward declarations
46 BOOL InitializeForBackup();
47 virtual BOOL CreateSnapshots(char* szDriveLetters) = 0;
48 virtual BOOL CloseBackup() = 0;
49 virtual const char* GetDriverName() = 0;
50 BOOL GetShadowPath (const char* szFilePath, char* szShadowPath, int nBuflen);
51 BOOL GetShadowPathW (const wchar_t* szFilePath, wchar_t* szShadowPath, int nBuflen); /* nBuflen in characters */
53 const size_t GetWriterCount();
54 const char* GetWriterInfo(int nIndex);
55 const int GetWriterState(int nIndex);
56 void DestroyWriterInfo();
57 void AppendWriterInfo(int nState, const char* pszInfo);
58 const BOOL IsInitialized() { return m_bBackupIsInitialized; };
61 virtual BOOL Initialize(DWORD dwContext, BOOL bDuringRestore = FALSE) = 0;
62 virtual BOOL WaitAndCheckForAsyncOperation(IVssAsync* pAsync) = 0;
63 virtual void QuerySnapshotSet(GUID snapshotSetID) = 0;
68 BOOL m_bCoInitializeCalled;
69 BOOL m_bCoInitializeSecurityCalled;
72 IUnknown* m_pVssObject;
73 GUID m_uidCurrentSnapshotSet;
74 // TRUE if we are during restore
75 BOOL m_bDuringRestore;
76 BOOL m_bBackupIsInitialized;
78 // drive A will be stored on position 0,Z on pos. 25
79 wchar_t m_wszUniqueVolumeName[26][MAX_PATH]; // approx. 7 KB
80 wchar_t m_szShadowCopyName[26][MAX_PATH]; // approx. 7 KB
82 void* m_pAlistWriterState;
83 void* m_pAlistWriterInfoText;
86 class VSSClientXP:public VSSClient
90 virtual ~VSSClientXP();
91 virtual BOOL CreateSnapshots(char* szDriveLetters);
92 virtual BOOL CloseBackup();
93 virtual const char* GetDriverName() { return "VSS WinXP"; };
95 virtual BOOL Initialize(DWORD dwContext, BOOL bDuringRestore);
96 virtual BOOL WaitAndCheckForAsyncOperation(IVssAsync* pAsync);
97 virtual void QuerySnapshotSet(GUID snapshotSetID);
98 BOOL CheckWriterStatus();
101 class VSSClient2003:public VSSClient
105 virtual ~VSSClient2003();
106 virtual BOOL CreateSnapshots(char* szDriveLetters);
107 virtual BOOL CloseBackup();
108 virtual const char* GetDriverName() { return "VSS Win 2003"; };
110 virtual BOOL Initialize(DWORD dwContext, BOOL bDuringRestore);
111 virtual BOOL WaitAndCheckForAsyncOperation(IVssAsync* pAsync);
112 virtual void QuerySnapshotSet(GUID snapshotSetID);
113 BOOL CheckWriterStatus();
116 extern VSSClient *g_pVSSClient;
118 #endif /* WIN32_VSS */
120 #endif /* __VSS_H_ */