/*
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.
{
#ifdef HAVE_WIN32
if (m_berrno & b_errno_win32) {
+ format_win32_message();
return (const char *)m_buf;
}
#else
{
#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
}
/*
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.
{
m_berrno = errno;
m_buf = get_pool_memory(pool);
-#ifdef HAVE_WIN32
- format_win32_message();
-#endif
errno = m_berrno;
}
#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;
// 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()
{
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");
}
// 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;
}