| 110 | } |
| 111 | |
| 112 | static std::string GetNSISInstallPath(void) |
| 113 | { |
| 114 | HKEY hKey; |
| 115 | //TODO: Change hardcoded key |
| 116 | if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Icinga Development Team\\ICINGA2", 0, |
| 117 | KEY_QUERY_VALUE | KEY_WOW64_32KEY, &hKey) == ERROR_SUCCESS) { |
| 118 | BYTE pvData[MAX_PATH]; |
| 119 | DWORD cbData = sizeof(pvData) - 1; |
| 120 | DWORD lType; |
| 121 | if (RegQueryValueEx(hKey, nullptr, nullptr, &lType, pvData, &cbData) == ERROR_SUCCESS && lType == REG_SZ) { |
| 122 | pvData[cbData] = '\0'; |
| 123 | |
| 124 | return (char *)pvData; |
| 125 | } |
| 126 | |
| 127 | RegCloseKey(hKey); |
| 128 | } |
| 129 | |
| 130 | return ""; |
| 131 | } |
| 132 | |
| 133 | static bool CopyDirectory(const std::string& source, const std::string& destination) |
| 134 | { |