2 Bacula® - The Network Backup Solution
4 Copyright (C) 2008-2008 Free Software Foundation Europe e.V.
6 The main author of Bacula is Kern Sibbald, with contributions from
7 many others, a complete list can be found in the file AUTHORS.
8 This program is Free Software; you can redistribute it and/or
9 modify it under the terms of version two of the GNU General Public
10 License as published by the Free Software Foundation, which is
11 listed in the file LICENSE.
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 Bacula® is a registered trademark of Kern Sibbald.
24 The licensor of Bacula is the Free Software Foundation Europe
25 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26 Switzerland, email:ftf@fsfeurope.org.
29 * Written by James Harper, October 2008
32 #include "exchange-fd.h"
34 HrESEBackupRestoreGetNodes_t HrESEBackupRestoreGetNodes;
35 HrESEBackupPrepare_t HrESEBackupPrepare;
36 HrESEBackupGetLogAndPatchFiles_t HrESEBackupGetLogAndPatchFiles;
37 HrESEBackupTruncateLogs_t HrESEBackupTruncateLogs;
38 HrESEBackupEnd_t HrESEBackupEnd;
39 HrESEBackupSetup_t HrESEBackupSetup;
40 HrESEBackupInstanceEnd_t HrESEBackupInstanceEnd;
41 HrESEBackupOpenFile_t HrESEBackupOpenFile;
42 HrESEBackupReadFile_t HrESEBackupReadFile;
43 HrESEBackupCloseFile_t HrESEBackupCloseFile;
45 HrESERestoreOpen_t HrESERestoreOpen;
46 HrESERestoreReopen_t HrESERestoreReopen;
47 HrESERestoreComplete_t HrESERestoreComplete;
48 HrESERestoreClose_t HrESERestoreClose;
49 HrESERestoreGetEnvironment_t HrESERestoreGetEnvironment;
50 HrESERestoreSaveEnvironment_t HrESERestoreSaveEnvironment;
51 HrESERestoreAddDatabase_t HrESERestoreAddDatabase;
52 HrESERestoreOpenFile_t HrESERestoreOpenFile;
64 status = RegOpenKeyW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\BackupRestore\\DLLPaths", &key_handle);
65 if (status != ERROR_SUCCESS)
67 _JobMessageNull(M_ERROR, "Cannot get key for Exchange DLL path, result = %08x\n", status);
72 status = RegQueryValueExW(key_handle, L"esebcli2", NULL, &type, NULL, &buf_len);
73 if (status != ERROR_SUCCESS)
75 _JobMessageNull(M_ERROR, "Cannot get key for Exchange DLL path, result = %08x\n", status);
79 buf = new WCHAR[buf_len];
82 status = RegQueryValueExW(key_handle, L"esebcli2", NULL, &type, (LPBYTE)buf, &buf_len);
83 if (status != ERROR_SUCCESS)
85 _JobMessageNull(M_ERROR, "Cannot get key for Exchange DLL path, result = %08x\n", status);
90 printf("Got value %S\n", buf);
92 // strictly speaking, a REG_EXPAND_SZ should be run through ExpandEnvironmentStrings
94 h = LoadLibraryW(buf);
99 HrESEBackupRestoreGetNodes = (HrESEBackupRestoreGetNodes_t)GetProcAddress(h, "HrESEBackupRestoreGetNodes");
100 HrESEBackupPrepare = (HrESEBackupPrepare_t)GetProcAddress(h, "HrESEBackupPrepare");
101 HrESEBackupEnd = (HrESEBackupEnd_t)GetProcAddress(h, "HrESEBackupEnd");
102 HrESEBackupSetup = (HrESEBackupSetup_t)GetProcAddress(h, "HrESEBackupSetup");
103 HrESEBackupGetLogAndPatchFiles = (HrESEBackupGetLogAndPatchFiles_t)GetProcAddress(h, "HrESEBackupGetLogAndPatchFiles");
104 HrESEBackupTruncateLogs = (HrESEBackupTruncateLogs_t)GetProcAddress(h, "HrESEBackupTruncateLogs");
105 HrESEBackupInstanceEnd = (HrESEBackupInstanceEnd_t)GetProcAddress(h, "HrESEBackupInstanceEnd");
106 HrESEBackupOpenFile = (HrESEBackupOpenFile_t)GetProcAddress(h, "HrESEBackupOpenFile");
107 HrESEBackupReadFile = (HrESEBackupReadFile_t)GetProcAddress(h, "HrESEBackupReadFile");
108 HrESEBackupCloseFile = (HrESEBackupCloseFile_t)GetProcAddress(h, "HrESEBackupCloseFile");
109 HrESERestoreOpen = (HrESERestoreOpen_t)GetProcAddress(h, "HrESERestoreOpen");
110 HrESERestoreReopen = (HrESERestoreReopen_t)GetProcAddress(h, "HrESERestoreReopen");
111 HrESERestoreComplete = (HrESERestoreComplete_t)GetProcAddress(h, "HrESERestoreComplete");
112 HrESERestoreClose = (HrESERestoreClose_t)GetProcAddress(h, "HrESERestoreClose");
113 HrESERestoreSaveEnvironment = (HrESERestoreSaveEnvironment_t)GetProcAddress(h, "HrESERestoreSaveEnvironment");
114 HrESERestoreGetEnvironment = (HrESERestoreGetEnvironment_t)GetProcAddress(h, "HrESERestoreGetEnvironment");
115 HrESERestoreAddDatabase = (HrESERestoreAddDatabase_t)GetProcAddress(h, "HrESERestoreAddDatabase");
116 HrESERestoreOpenFile = (HrESERestoreOpenFile_t)GetProcAddress(h, "HrESERestoreOpenFile");
121 ESEErrorMessage(HRESULT result)
127 case hrLogfileHasBadSignature:
128 return "Log file has bad signature. Check that no stale files are left in the Exchange data/log directories.";
129 case hrCBDatabaseInUse:
130 return "Database in use. Make sure database is dismounted.";
131 case hrRestoreAtFileLevel:
132 return "File must be restored using Windows file I/O calls.";
133 case hrMissingFullBackup:
134 return "Exchange reports that no previous full backup has been done.";
135 case hrBackupInProgress:
136 return "Exchange backup already in progress.";
137 case hrLogfileNotContiguous:
138 return "Existing log file is not contiguous. Check that no stale files are left in the Exchange data/log directories.";
140 return "Unknown error.";