| 3 | #include "Registry.h" |
| 4 | |
| 5 | bool RegExportImport::Export(PCWSTR keyPath, PCWSTR path) const { |
| 6 | auto hFile = ::CreateFile(path, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, 0, nullptr); |
| 7 | if (hFile == INVALID_HANDLE_VALUE) |
| 8 | return false; |
| 9 | |
| 10 | WriteString(hFile, L"Windows Registry Editor Version 5.00\n\n"); |
| 11 | |
| 12 | auto key = Registry::OpenKey(keyPath, KEY_READ); |
| 13 | if (!key) |
| 14 | return false; |
| 15 | |
| 16 | bool success = ExportKeys(key, hFile, keyPath); |
| 17 | ::CloseHandle(hFile); |
| 18 | return success; |
| 19 | } |
| 20 | |
| 21 | bool RegExportImport::ExportKeys(HKEY hKey, HANDLE hFile, PCWSTR section) const { |
| 22 | ExportKey(hKey, hFile, section); |