2 Bacula® - The Network Backup Solution
4 Copyright (C) 2008-2010 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 three of the GNU Affero 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 Affero 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_FATAL, "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_FATAL, "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_FATAL, "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);
97 _JobMessageNull(M_FATAL, "Cannot load Exchange DLL\n");
100 HrESEBackupRestoreGetNodes = (HrESEBackupRestoreGetNodes_t)GetProcAddress(h, "HrESEBackupRestoreGetNodes");
101 HrESEBackupPrepare = (HrESEBackupPrepare_t)GetProcAddress(h, "HrESEBackupPrepare");
102 HrESEBackupEnd = (HrESEBackupEnd_t)GetProcAddress(h, "HrESEBackupEnd");
103 HrESEBackupSetup = (HrESEBackupSetup_t)GetProcAddress(h, "HrESEBackupSetup");
104 HrESEBackupGetLogAndPatchFiles = (HrESEBackupGetLogAndPatchFiles_t)GetProcAddress(h, "HrESEBackupGetLogAndPatchFiles");
105 HrESEBackupTruncateLogs = (HrESEBackupTruncateLogs_t)GetProcAddress(h, "HrESEBackupTruncateLogs");
106 HrESEBackupInstanceEnd = (HrESEBackupInstanceEnd_t)GetProcAddress(h, "HrESEBackupInstanceEnd");
107 HrESEBackupOpenFile = (HrESEBackupOpenFile_t)GetProcAddress(h, "HrESEBackupOpenFile");
108 HrESEBackupReadFile = (HrESEBackupReadFile_t)GetProcAddress(h, "HrESEBackupReadFile");
109 HrESEBackupCloseFile = (HrESEBackupCloseFile_t)GetProcAddress(h, "HrESEBackupCloseFile");
110 HrESERestoreOpen = (HrESERestoreOpen_t)GetProcAddress(h, "HrESERestoreOpen");
111 HrESERestoreReopen = (HrESERestoreReopen_t)GetProcAddress(h, "HrESERestoreReopen");
112 HrESERestoreComplete = (HrESERestoreComplete_t)GetProcAddress(h, "HrESERestoreComplete");
113 HrESERestoreClose = (HrESERestoreClose_t)GetProcAddress(h, "HrESERestoreClose");
114 HrESERestoreSaveEnvironment = (HrESERestoreSaveEnvironment_t)GetProcAddress(h, "HrESERestoreSaveEnvironment");
115 HrESERestoreGetEnvironment = (HrESERestoreGetEnvironment_t)GetProcAddress(h, "HrESERestoreGetEnvironment");
116 HrESERestoreAddDatabase = (HrESERestoreAddDatabase_t)GetProcAddress(h, "HrESERestoreAddDatabase");
117 HrESERestoreOpenFile = (HrESERestoreOpenFile_t)GetProcAddress(h, "HrESERestoreOpenFile");
122 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.";
139 case hrErrorFromESECall:
140 return "Error returned from ESE function call. Check the Windows Event Logs for more information.";
141 case hrCBDatabaseNotFound:
142 return "Database not found. Check that the Database you are trying to restore actually exists in the Storage Group you are restoring to.";
144 return "Unknown error.";