2 Bacula® - The Network Backup Solution
4 Copyright (C) 2008-2009 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)
126 case hrLogfileHasBadSignature:
127 return "Log file has bad signature. Check that no stale files are left in the Exchange data/log directories.";
128 case hrCBDatabaseInUse:
129 return "Database in use. Make sure database is dismounted.";
130 case hrRestoreAtFileLevel:
131 return "File must be restored using Windows file I/O calls.";
132 case hrMissingFullBackup:
133 return "Exchange reports that no previous full backup has been done.";
134 case hrBackupInProgress:
135 return "Exchange backup already in progress.";
136 case hrLogfileNotContiguous:
137 return "Existing log file is not contiguous. Check that no stale files are left in the Exchange data/log directories.";
138 case hrErrorFromESECall:
139 return "Error returned from ESE function call. Check the Windows Event Logs for more information.";
140 case hrCBDatabaseNotFound:
141 return "Database not found. Check that the Database you are trying to restore actually exists in the Storage Group you are restoring to.";
143 return "Unknown error.";