]> git.sur5r.net Git - bacula/bacula/commitdiff
kes Add more debug output to VSS init.
authorKern Sibbald <kern@sibbald.com>
Fri, 9 Jan 2009 17:10:51 +0000 (17:10 +0000)
committerKern Sibbald <kern@sibbald.com>
Fri, 9 Jan 2009 17:10:51 +0000 (17:10 +0000)
kes  Attempt to correct win32 debug in berrno.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8346 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/lib/berrno.c
bacula/src/lib/berrno.h
bacula/src/win32/filed/vss_generic.cpp
bacula/technotes-2.5

index c7d14992353b6b9749931a439ac696919cf7a609..b7669efd654198908ddde553bd9fa69152a1921a 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2004-2007 Free Software Foundation Europe e.V.
+   Copyright (C) 2004-2009 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.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -51,6 +51,7 @@ const char *berrno::bstrerror()
 {
 #ifdef HAVE_WIN32
    if (m_berrno & b_errno_win32) {
 {
 #ifdef HAVE_WIN32
    if (m_berrno & b_errno_win32) {
+      format_win32_message();
       return (const char *)m_buf;
    }
 #else
       return (const char *)m_buf;
    }
 #else
@@ -92,19 +93,16 @@ void berrno::format_win32_message()
 {
 #ifdef HAVE_WIN32
    LPVOID msg;
 {
 #ifdef HAVE_WIN32
    LPVOID msg;
-   if (m_berrno & b_errno_win32) {
-      FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
-          FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
-          NULL,
-          GetLastError(),
-          MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-          (LPTSTR)&msg,
-          0,
-          NULL);
-
-      pm_strcpy(&m_buf, (const char *)msg);
-      LocalFree(msg);
-   }
+   FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+       FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+       NULL,
+       GetLastError(),
+       MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+       (LPTSTR)&msg,
+       0,
+       NULL);
+   pm_strcpy(&m_buf, (const char *)msg);
+   LocalFree(msg);
 #endif
 }
 
 #endif
 }
 
index 200347caa4ec2a961df8acdaceb89bf88358e2e7..ee392ea549543841c4b1c1ba4a54e93710cbfe6f 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2004-2007 Free Software Foundation Europe e.V.
+   Copyright (C) 2004-2009 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.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -75,9 +75,6 @@ inline berrno::berrno(int pool)
 {
    m_berrno = errno;
    m_buf = get_pool_memory(pool);
 {
    m_berrno = errno;
    m_buf = get_pool_memory(pool);
-#ifdef HAVE_WIN32
-   format_win32_message();
-#endif
    errno = m_berrno;
 }
 
    errno = m_berrno;
 }
 
index 26bcb209b623882c1db102828b29f9128cb3c177..cdcf2884562edd0f6895cd590b46d61c29e2df69 100644 (file)
@@ -111,12 +111,12 @@ class IXMLDOMDocument;
    #include "inc/Win2003/vsbackup.h"
 #endif
    
    #include "inc/Win2003/vsbackup.h"
 #endif
    
-   /* In VSSAPI.DLL */
-   typedef HRESULT (STDAPICALLTYPE* t_CreateVssBackupComponents)(OUT IVssBackupComponents **);
-   typedef void (APIENTRY* t_VssFreeSnapshotProperties)(IN VSS_SNAPSHOT_PROP*);
+/* 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;
+static t_CreateVssBackupComponents p_CreateVssBackupComponents = NULL;
+static t_VssFreeSnapshotProperties p_VssFreeSnapshotProperties = NULL;
 
 
 
 
 
 
@@ -203,11 +203,13 @@ inline const wchar_t* GetStringFromWriterStatus(VSS_WRITER_STATE eWriterStatus)
 
 // Constructor
 
 
 // Constructor
 
+#ifdef HAVE_VSS64
+/* 64 bit entrypoint name */
+#define VSSVBACK_ENTRY "?CreateVssBackupComponents@@YAJPEAPEAVIVssBackupComponents@@@Z"
+#else
 /* 32 bit entrypoint name */
 #define VSSVBACK_ENTRY "?CreateVssBackupComponents@@YGJPAPAVIVssBackupComponents@@@Z"
 /* 32 bit entrypoint name */
 #define VSSVBACK_ENTRY "?CreateVssBackupComponents@@YGJPAPAVIVssBackupComponents@@@Z"
-/* 64 bit entrypoint name */
-#define VSSVBACK64_ENTRY "?CreateVssBackupComponents@@YAJPEAPEAVIVssBackupComponents@@@Z"
-
+#endif
 
 VSSClientGeneric::VSSClientGeneric()
 {
 
 VSSClientGeneric::VSSClientGeneric()
 {
@@ -215,11 +217,6 @@ VSSClientGeneric::VSSClientGeneric()
    if (m_hLib) {      
       p_CreateVssBackupComponents = (t_CreateVssBackupComponents)
          GetProcAddress(m_hLib, VSSVBACK_ENTRY);
    if (m_hLib) {      
       p_CreateVssBackupComponents = (t_CreateVssBackupComponents)
          GetProcAddress(m_hLib, VSSVBACK_ENTRY);
-      /* If we don't find it try the 64 bit entry point */
-      if (!p_CreateVssBackupComponents) {
-         p_CreateVssBackupComponents = (t_CreateVssBackupComponents)
-           GetProcAddress(m_hLib, VSSVBACK64_ENTRY);
-      }
       p_VssFreeSnapshotProperties = (t_VssFreeSnapshotProperties)
           GetProcAddress(m_hLib, "VssFreeSnapshotProperties");      
    } 
       p_VssFreeSnapshotProperties = (t_VssFreeSnapshotProperties)
           GetProcAddress(m_hLib, "VssFreeSnapshotProperties");      
    } 
@@ -287,7 +284,9 @@ BOOL VSSClientGeneric::Initialize(DWORD dwContext, BOOL bDuringRestore)
    // Create the internal backup components object
    hr = p_CreateVssBackupComponents((IVssBackupComponents**) &m_pVssObject);
    if (FAILED(hr)) {
    // Create the internal backup components object
    hr = p_CreateVssBackupComponents((IVssBackupComponents**) &m_pVssObject);
    if (FAILED(hr)) {
-      Dmsg1(0, "VSSClientGeneric::Initialize: CreateVssBackupComponents returned 0x%08X\n", hr);
+      berrno be;
+      Dmsg2(0, "VSSClientGeneric::Initialize: CreateVssBackupComponents returned 0x%08X. ERR=%s\n",
+            hr, be.bstrerror(b_errno_win32));
       errno = b_errno_win32;
       return FALSE;
    }
       errno = b_errno_win32;
       return FALSE;
    }
index 23fe5d0d0d4dc372967988fa418f2cf87d9bb778..649a93bcc80528ab9a0a10b281b41d17e432573b 100644 (file)
@@ -11,6 +11,9 @@ mixed priorities
 
 General:
 09Jan09
 
 General:
 09Jan09
+kes  Add more debug output to VSS init.
+kes  Attempt to correct win32 debug in berrno.
+09Jan09
 kes  Fix bug reported by Dan where make fails in clean of src/win32. 
 07Jan09
 kes  Fix bug #1212, SD is unable to recycle purged volumes. fstat()
 kes  Fix bug reported by Dan where make fails in clean of src/win32. 
 07Jan09
 kes  Fix bug #1212, SD is unable to recycle purged volumes. fstat()