| 65 | } |
| 66 | |
| 67 | bool RegistryUtils::SetOnlyUseLatestCLR(bool enable) { |
| 68 | HKEY hKey; |
| 69 | LPCWSTR subKey = L"SOFTWARE\\Microsoft\\.NETFramework"; |
| 70 | LPCWSTR valueName = L"OnlyUseLatestCLR"; |
| 71 | |
| 72 | LONG result = RegCreateKeyEx(HKEY_LOCAL_MACHINE, subKey, 0, nullptr, |
| 73 | REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &hKey, nullptr); |
| 74 | if (result != ERROR_SUCCESS) return false; |
| 75 | |
| 76 | DWORD data = enable ? 1 : 0; |
| 77 | result = RegSetValueEx(hKey, valueName, 0, REG_DWORD, |
| 78 | reinterpret_cast<const BYTE*>(&data), sizeof(data)); |
| 79 | RegCloseKey(hKey); |
| 80 | return result == ERROR_SUCCESS; |
| 81 | } |
| 82 | |
| 83 | bool RegistryUtils::CleanOnlyUseLatestCLR() { |
| 84 | HKEY hKey; |
nothing calls this directly
no outgoing calls
no test coverage detected