2 Bacula(R) - The Network Backup Solution
4 Copyright (C) 2000-2018 Kern Sibbald
6 The original author of Bacula is Kern Sibbald, with contributions
7 from many others, a complete list can be found in the file AUTHORS.
9 You may use this file and others of this release according to the
10 license defined in the LICENSE file, which includes the Affero General
11 Public License, v3.0 ("AGPLv3") and some additional permissions and
12 terms pursuant to its AGPLv3 Section 7.
14 This notice must be preserved when any source code is
15 conveyed and/or propagated.
17 Bacula(R) is a registered trademark of Kern Sibbald.
20 * Written by James Harper, July 2010
22 * Used only in "old Exchange plugin" now deprecated.
25 #include "exchange-fd.h"
27 HrESEBackupRestoreGetNodes_t HrESEBackupRestoreGetNodes;
28 HrESEBackupPrepare_t HrESEBackupPrepare;
29 HrESEBackupGetLogAndPatchFiles_t HrESEBackupGetLogAndPatchFiles;
30 HrESEBackupTruncateLogs_t HrESEBackupTruncateLogs;
31 HrESEBackupEnd_t HrESEBackupEnd;
32 HrESEBackupSetup_t HrESEBackupSetup;
33 HrESEBackupInstanceEnd_t HrESEBackupInstanceEnd;
34 HrESEBackupOpenFile_t HrESEBackupOpenFile;
35 HrESEBackupReadFile_t HrESEBackupReadFile;
36 HrESEBackupCloseFile_t HrESEBackupCloseFile;
38 HrESERestoreOpen_t HrESERestoreOpen;
39 HrESERestoreReopen_t HrESERestoreReopen;
40 HrESERestoreComplete_t HrESERestoreComplete;
41 HrESERestoreClose_t HrESERestoreClose;
42 HrESERestoreGetEnvironment_t HrESERestoreGetEnvironment;
43 HrESERestoreSaveEnvironment_t HrESERestoreSaveEnvironment;
44 HrESERestoreAddDatabase_t HrESERestoreAddDatabase;
45 HrESERestoreOpenFile_t HrESERestoreOpenFile;
57 status = RegOpenKeyW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\BackupRestore\\DLLPaths", &key_handle);
58 if (status != ERROR_SUCCESS)
60 _JobMessageNull(M_FATAL, "Cannot get key for Exchange DLL path, result = %08x\n", status);
65 status = RegQueryValueExW(key_handle, L"esebcli2", NULL, &type, NULL, &buf_len);
66 if (status != ERROR_SUCCESS)
68 _JobMessageNull(M_FATAL, "Cannot get key for Exchange DLL path, result = %08x\n", status);
72 buf = new WCHAR[buf_len];
75 status = RegQueryValueExW(key_handle, L"esebcli2", NULL, &type, (LPBYTE)buf, &buf_len);
76 if (status != ERROR_SUCCESS)
78 _JobMessageNull(M_FATAL, "Cannot get key for Exchange DLL path, result = %08x\n", status);
83 printf("Got value %S\n", buf);
85 // strictly speaking, a REG_EXPAND_SZ should be run through ExpandEnvironmentStrings
87 h = LoadLibraryW(buf);
90 _JobMessageNull(M_FATAL, "Cannot load Exchange DLL\n");
93 HrESEBackupRestoreGetNodes = (HrESEBackupRestoreGetNodes_t)GetProcAddress(h, "HrESEBackupRestoreGetNodes");
94 HrESEBackupPrepare = (HrESEBackupPrepare_t)GetProcAddress(h, "HrESEBackupPrepare");
95 HrESEBackupEnd = (HrESEBackupEnd_t)GetProcAddress(h, "HrESEBackupEnd");
96 HrESEBackupSetup = (HrESEBackupSetup_t)GetProcAddress(h, "HrESEBackupSetup");
97 HrESEBackupGetLogAndPatchFiles = (HrESEBackupGetLogAndPatchFiles_t)GetProcAddress(h, "HrESEBackupGetLogAndPatchFiles");
98 HrESEBackupTruncateLogs = (HrESEBackupTruncateLogs_t)GetProcAddress(h, "HrESEBackupTruncateLogs");
99 HrESEBackupInstanceEnd = (HrESEBackupInstanceEnd_t)GetProcAddress(h, "HrESEBackupInstanceEnd");
100 HrESEBackupOpenFile = (HrESEBackupOpenFile_t)GetProcAddress(h, "HrESEBackupOpenFile");
101 HrESEBackupReadFile = (HrESEBackupReadFile_t)GetProcAddress(h, "HrESEBackupReadFile");
102 HrESEBackupCloseFile = (HrESEBackupCloseFile_t)GetProcAddress(h, "HrESEBackupCloseFile");
103 HrESERestoreOpen = (HrESERestoreOpen_t)GetProcAddress(h, "HrESERestoreOpen");
104 HrESERestoreReopen = (HrESERestoreReopen_t)GetProcAddress(h, "HrESERestoreReopen");
105 HrESERestoreComplete = (HrESERestoreComplete_t)GetProcAddress(h, "HrESERestoreComplete");
106 HrESERestoreClose = (HrESERestoreClose_t)GetProcAddress(h, "HrESERestoreClose");
107 HrESERestoreSaveEnvironment = (HrESERestoreSaveEnvironment_t)GetProcAddress(h, "HrESERestoreSaveEnvironment");
108 HrESERestoreGetEnvironment = (HrESERestoreGetEnvironment_t)GetProcAddress(h, "HrESERestoreGetEnvironment");
109 HrESERestoreAddDatabase = (HrESERestoreAddDatabase_t)GetProcAddress(h, "HrESERestoreAddDatabase");
110 HrESERestoreOpenFile = (HrESERestoreOpenFile_t)GetProcAddress(h, "HrESERestoreOpenFile");
115 ESEErrorMessage(HRESULT result)
120 case hrLogfileHasBadSignature:
121 return "Log file has bad signature. Check that no stale files are left in the Exchange data/log directories.";
122 case hrCBDatabaseInUse:
123 return "Database in use. Make sure database is dismounted.";
124 case hrRestoreAtFileLevel:
125 return "File must be restored using Windows file I/O calls.";
126 case hrMissingFullBackup:
127 return "Exchange reports that no previous full backup has been done.";
128 case hrBackupInProgress:
129 return "Exchange backup already in progress.";
130 case hrLogfileNotContiguous:
131 return "Existing log file is not contiguous. Check that no stale files are left in the Exchange data/log directories.";
132 case hrErrorFromESECall:
133 return "Error returned from ESE function call. Check the Windows Event Logs for more information.";
134 case hrCBDatabaseNotFound:
135 return "Database not found. Check that the Database you are trying to restore actually exists in the Storage Group you are restoring to.";
137 return "Unknown error.";