From 23117e3649762ca3b3a06bafa15db3f5ee1ffdc7 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 9 Jan 2009 17:10:51 +0000 Subject: [PATCH] kes Add more debug output to VSS init. 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 | 26 ++++++++++++------------- bacula/src/lib/berrno.h | 5 +---- bacula/src/win32/filed/vss_generic.cpp | 27 +++++++++++++------------- bacula/technotes-2.5 | 3 +++ 4 files changed, 29 insertions(+), 32 deletions(-) diff --git a/bacula/src/lib/berrno.c b/bacula/src/lib/berrno.c index c7d1499235..b7669efd65 100644 --- a/bacula/src/lib/berrno.c +++ b/bacula/src/lib/berrno.c @@ -1,7 +1,7 @@ /* 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. @@ -51,6 +51,7 @@ const char *berrno::bstrerror() { #ifdef HAVE_WIN32 if (m_berrno & b_errno_win32) { + format_win32_message(); return (const char *)m_buf; } #else @@ -92,19 +93,16 @@ void berrno::format_win32_message() { #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 } diff --git a/bacula/src/lib/berrno.h b/bacula/src/lib/berrno.h index 200347caa4..ee392ea549 100644 --- a/bacula/src/lib/berrno.h +++ b/bacula/src/lib/berrno.h @@ -1,7 +1,7 @@ /* 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. @@ -75,9 +75,6 @@ inline berrno::berrno(int pool) { m_berrno = errno; m_buf = get_pool_memory(pool); -#ifdef HAVE_WIN32 - format_win32_message(); -#endif errno = m_berrno; } diff --git a/bacula/src/win32/filed/vss_generic.cpp b/bacula/src/win32/filed/vss_generic.cpp index 26bcb209b6..cdcf288456 100644 --- a/bacula/src/win32/filed/vss_generic.cpp +++ b/bacula/src/win32/filed/vss_generic.cpp @@ -111,12 +111,12 @@ class IXMLDOMDocument; #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 +#ifdef HAVE_VSS64 +/* 64 bit entrypoint name */ +#define VSSVBACK_ENTRY "?CreateVssBackupComponents@@YAJPEAPEAVIVssBackupComponents@@@Z" +#else /* 32 bit entrypoint name */ #define VSSVBACK_ENTRY "?CreateVssBackupComponents@@YGJPAPAVIVssBackupComponents@@@Z" -/* 64 bit entrypoint name */ -#define VSSVBACK64_ENTRY "?CreateVssBackupComponents@@YAJPEAPEAVIVssBackupComponents@@@Z" - +#endif VSSClientGeneric::VSSClientGeneric() { @@ -215,11 +217,6 @@ VSSClientGeneric::VSSClientGeneric() 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"); } @@ -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)) { - 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; } diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index 23fe5d0d0d..649a93bcc8 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -11,6 +11,9 @@ mixed priorities 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() -- 2.39.5