| 2 | #include "registry_utils.h" |
| 3 | |
| 4 | bool RegistryUtils::SetDcomReflectionEnabled(bool enable) { |
| 5 | HKEY hKey; |
| 6 | LPCWSTR subKey = L"SOFTWARE\\Microsoft\\.NETFramework"; |
| 7 | LPCWSTR valueName = L"AllowDCOMReflection"; |
| 8 | |
| 9 | LONG result = RegCreateKeyEx(HKEY_LOCAL_MACHINE, subKey, 0, nullptr, |
| 10 | REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &hKey, nullptr); |
| 11 | if (result != ERROR_SUCCESS) return false; |
| 12 | |
| 13 | DWORD data = enable ? 1 : 0; |
| 14 | result = RegSetValueEx(hKey, valueName, 0, REG_DWORD, |
| 15 | reinterpret_cast<const BYTE*>(&data), sizeof(data)); |
| 16 | RegCloseKey(hKey); |
| 17 | return result == ERROR_SUCCESS; |
| 18 | } |
| 19 | |
| 20 | bool RegistryUtils::CleanDcomReflection() { |
| 21 | HKEY hKey; |
nothing calls this directly
no outgoing calls
no test coverage detected