Dmsg2(100, "rt=%s adj=%s\n", edit_uint64(rt, ed1), edit_uint64(bt_adj, ed2));
adj = btime_to_utime(bt_adj);
since_time += adj; /* adjust for clock difference */
- if (adj != 0) {
+ /* Don't notify if time within 3 seconds */
+ if (adj > 3 || adj < -3) {
int type;
if (adj > 600 || adj < -600) {
type = M_WARNING;
if (!privs) {
privs = enable_backup_privileges(NULL, 1);
}
- len = Mmsg(msg, "Priv 0x%x\n", privs);
+ len = Mmsg(msg, "VSS=%s Priv 0x%x\n", g_pVSSClient?"yes":"no", privs);
sendit(msg.c_str(), len, arg);
len = Mmsg(msg, "APIs=%sOPT,%sATP,%sLPV,%sCFA,%sCFW,\n",
p_OpenProcessToken?"":"!",
*/
#undef VERSION
-#define VERSION "2.1.20"
-#define BDATE "20 June 2007"
-#define LSMDATE "20Jun07"
+#define VERSION "2.1.21"
+#define BDATE "21 June 2007"
+#define LSMDATE "21Jun07"
#define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n"
#define BYEAR "2007" /* year for copyright messages in progs */
$(OBJDIR)/print.o \
$(OBJDIR)/vss.o \
$(OBJDIR)/vss_XP.o \
- $(OBJDIR)/vss_W2K3.o
+ $(OBJDIR)/vss_W2K3.o \
+ $(OBJDIR)/vss_Vista.o
######################################################################
osvinfo.dwMajorVersion,
osvinfo.dwMinorVersion);
snprintf(WIN_RAWVERSION, sizeof(WIN_RAWVERSION), "Windows %#08x", ver);
- switch (ver)
+ switch (ver)
{
case MS_WINDOWS_95: (version = "Windows 95"); break;
case MS_WINDOWS_98: (version = "Windows 98"); break;
-/*
- * Windows APIs that are different for each system.
- * We use pointers to the entry points so that a
- * single binary will run on all Windows systems.
- *
- * Kern Sibbald MMIII
- */
/*
Bacula® - The Network Backup Solution
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ * Windows APIs that are different for each system.
+ * We use pointers to the entry points so that a
+ * single binary will run on all Windows systems.
+ *
+ * Kern Sibbald MMIII
+ */
#include "bacula.h"
// init with win9x, but maybe set to NT in InitWinAPI
DWORD g_platform_id = VER_PLATFORM_WIN32_WINDOWS;
DWORD g_MinorVersion = 0;
+DWORD g_MajorVersion = 0;
/* API Pointers */
// Get the current OS version
if (!GetVersionEx(&osversioninfo)) {
g_platform_id = 0;
- g_MinorVersion = 0;
} else {
g_platform_id = osversioninfo.dwPlatformId;
g_MinorVersion = osversioninfo.dwMinorVersion;
+ g_MajorVersion = osversioninfo.dwMajorVersion;
}
HMODULE hLib = LoadLibraryA("KERNEL32.DLL");
$(OBJDIR)/vss.o \
$(OBJDIR)/vss_XP.o \
$(OBJDIR)/vss_W2K3.o \
+ $(OBJDIR)/vss_Vista.o \
$(OBJDIR)/winabout.o \
$(OBJDIR)/winservice.o \
$(OBJDIR)/winstat.o \
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2005-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2005-2007 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
VSSClient *g_pVSSClient;
+// {b5946137-7b9f-4925-af80-51abd60b20d5}
+
+static const GUID VSS_SWPRV_ProviderID =
+ { 0xb5946137, 0x7b9f, 0x4925, { 0xaf, 0x80, 0x51, 0xab, 0xd6, 0x0b, 0x20, 0xd5 } };
+
+
void
VSSCleanup()
{
- if (g_pVSSClient)
+ if (g_pVSSClient) {
delete (g_pVSSClient);
+ }
}
-void
-VSSInit()
+void VSSInit()
{
/* decide which vss class to initialize */
- switch (g_MinorVersion) {
+ if (g_MajorVersion == 5) {
+ switch (g_MinorVersion) {
case 1:
g_pVSSClient = new VSSClientXP();
atexit(VSSCleanup);
- break;
+ return;
case 2:
g_pVSSClient = new VSSClient2003();
atexit(VSSCleanup);
- break;
+ return;
+ }
+ /* Vista or Longhorn */
+ } else if (g_MajorVersion == 6 && g_MinorVersion == 0) {
+ /* Probably will not work */
+ g_pVSSClient = new VSSClientVista();
+ atexit(VSSCleanup);
+ return;
}
}
-/* -*- Mode: C -*-
- * vss.h --
- */
-//
-// Copyright transferred from MATRIX-Computer GmbH to
-// Kern Sibbald by express permission.
-/*
- *
- * Author : Thorsten Engel
- * Created On : Fri May 06 21:44:00 2006
- */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2006-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2006-2007 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/* -*- Mode: C -*-
+ * vss.h --
+ */
+//
+// Copyright transferred from MATRIX-Computer GmbH to
+// Kern Sibbald by express permission.
+/*
+ *
+ * Author : Thorsten Engel
+ * Created On : Fri May 06 21:44:00 2006
+ */
#ifndef __VSS_H_
#define __VSS_H_
BOOL CheckWriterStatus();
};
+class VSSClientVista:public VSSClient
+{
+public:
+ VSSClientVista();
+ virtual ~VSSClientVista();
+ virtual BOOL CreateSnapshots(char* szDriveLetters);
+ virtual BOOL CloseBackup();
+ virtual const char* GetDriverName() { return "VSS Vista"; };
+private:
+ virtual BOOL Initialize(DWORD dwContext, BOOL bDuringRestore);
+ virtual BOOL WaitAndCheckForAsyncOperation(IVssAsync* pAsync);
+ virtual void QuerySnapshotSet(GUID snapshotSetID);
+ BOOL CheckWriterStatus();
+};
+
+
extern VSSClient *g_pVSSClient;
#endif /* WIN32_VSS */
/*
-we need one class per OS as Microsofts API
-differs only by calling convention and some
-function we don't use.
-
-vss_generic will handle all versions and
-switch between different headers to include.
+ * We need one class per OS as Microsofts API
+ * differs only by calling convention and some
+ * function we don't use.
+ *
+ * vss_generic will handle all versions and
+ * switch between different headers to include.
*/
#ifdef WIN32_VSS
-// -*- Mode: C++ -*-
-// vss.cpp -- Interface to Volume Shadow Copies (VSS)
-//
-// Copyright transferred from MATRIX-Computer GmbH to
-// Kern Sibbald by express permission.
-//
-// Author : Thorsten Engel
-// Created On : Fri May 06 21:44:00 2005
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2005-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2005-2007 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+// -*- Mode: C++ -*-
+// vss.cpp -- Interface to Volume Shadow Copies (VSS)
+//
+// Copyright transferred from MATRIX-Computer GmbH to
+// Kern Sibbald by express permission.
+//
+// Author : Thorsten Engel
+// Created On : Fri May 06 21:44:00 2005
#ifdef WIN32_VSS
#include "ms_atl.h"
#include <objbase.h>
+/*
+ * Kludges to get Vista code to compile.
+ * KES - June 2007
+ */
+#define __in IN
+#define __out OUT
+#define __RPC_unique_pointer
+#define __RPC_string
+#define __RPC__out_ecount_part(x, y)
+#define __RPC__deref_inout_opt
+#define __RPC__out
+
#if !defined(ENABLE_NLS)
#define setlocale(p, d)
#endif
class IXMLDOMDocument;
#endif
+/* Reduce compiler warnings from Windows vss code */
+#define uuid(x)
+
#ifdef B_VSS_XP
#pragma message("compile VSS for Windows XP")
#define VSSClientGeneric VSSClientXP
#include "inc/WinXP/vss.h"
#include "inc/WinXP/vswriter.h"
#include "inc/WinXP/vsbackup.h"
-
- /* In VSSAPI.DLL */
- typedef HRESULT (STDAPICALLTYPE* t_CreateVssBackupComponents)(OUT IVssBackupComponents **);
- typedef void (APIENTRY* t_VssFreeSnapshotProperties)(IN VSS_SNAPSHOT_PROP*);
-
- static t_CreateVssBackupComponents p_CreateVssBackupComponents = NULL;
- static t_VssFreeSnapshotProperties p_VssFreeSnapshotProperties = NULL;
- #define VSSVBACK_ENTRY "?CreateVssBackupComponents@@YGJPAPAVIVssBackupComponents@@@Z"
#endif
#ifdef B_VSS_W2K3
#include "inc/Win2003/vss.h"
#include "inc/Win2003/vswriter.h"
#include "inc/Win2003/vsbackup.h"
+#endif
+
+#ifdef B_VSS_VISTA
+ #pragma message("compile VSS for Vista")
+ #define VSSClientGeneric VSSClientVista
+
+ #include "inc/Win2003/vss.h"
+ #include "inc/Win2003/vswriter.h"
+ #include "inc/Win2003/vsbackup.h"
+#endif
/* In VSSAPI.DLL */
typedef HRESULT (STDAPICALLTYPE* t_CreateVssBackupComponents)(OUT IVssBackupComponents **);
static t_VssFreeSnapshotProperties p_VssFreeSnapshotProperties = NULL;
#define VSSVBACK_ENTRY "?CreateVssBackupComponents@@YGJPAPAVIVssBackupComponents@@@Z"
-#endif
+
#include "vss.h"
return FALSE;
}
-#ifdef B_VSS_W2K3
+#if defined(B_VSS_W2K3) || defined(B_VSS_VISTA)
if (dwContext != VSS_CTX_BACKUP) {
hr = ((IVssBackupComponents*) m_pVssObject)->SetContext(dwContext);
if (FAILED(hr)) {
case VSS_WS_FAILED_AT_BACKUP_COMPLETE:
case VSS_WS_FAILED_AT_PRE_RESTORE:
case VSS_WS_FAILED_AT_POST_RESTORE:
- #ifdef B_VSS_W2K3
+ #if defined(B_VSS_W2K3) || defined(B_VSS_VISTA)
case VSS_WS_FAILED_AT_BACKUPSHUTDOWN:
#endif
/* failed */
// init with win9x, but maybe set to NT in InitWinAPI
extern DWORD DLL_IMP_EXP g_platform_id;
extern DWORD DLL_IMP_EXP g_MinorVersion;
+extern DWORD DLL_IMP_EXP g_MajorVersion;
/* In ADVAPI32.DLL */
typedef BOOL (WINAPI * t_OpenProcessToken)(HANDLE, DWORD, PHANDLE);
Technical notes on version 2.1
General:
+21Jun07
+kes Don't print clock skew message in FD if less than 3 seconds diff.
+kes Add a bit of VSS info to status client.
+kes Make a gross first cut of Vista VSS, using Win2003 code.
+
+Release: 2.1.18 beta
20Jun07
kes Fixed bug #886 (multidrive autochanger: SD doesn't use drive with
loaded tape but uses first drive).