MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / Render

Method Render

KBotExt/SettingsTab.h:10–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8{
9public:
10 static void Render()
11 {
12 using tRegCreateKeyExA = LSTATUS(WINAPI*)(HKEY hKey, LPCSTR lpSubKey, DWORD Reserved, LPSTR lpClass,
13 DWORD dwOptions, REGSAM samDesired, LPSECURITY_ATTRIBUTES lpSecurityAttributes, PHKEY phkResult,
14 LPDWORD lpdwDisposition);
15 static auto RegCreateKeyExA = reinterpret_cast<tRegCreateKeyExA>(GetProcAddress(LoadLibraryW(L"advapi32.dll"), "RegCreateKeyExA"));
16
17 using tRegOpenKeyExA = LSTATUS(WINAPI*)(HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions,
18 REGSAM samDesired, PHKEY phkResult);
19 static auto RegOpenKeyExA = reinterpret_cast<tRegOpenKeyExA>(GetProcAddress(LoadLibraryW(L"advapi32.dll"), "RegOpenKeyExA"));
20
21 using tRegQueryValueExA = LSTATUS(WINAPI*)(HKEY hKey, LPCSTR lpValueName,
22 LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbDatan);
23 static auto RegQueryValueExA = reinterpret_cast<tRegQueryValueExA>(GetProcAddress(LoadLibraryW(L"advapi32.dll"), "RegQueryValueExA"));
24
25 using tRegSetValueExA = LSTATUS(WINAPI*)(HKEY hKey, LPCSTR lpValueName, DWORD Reserved,
26 DWORD dwType, const BYTE* lpData, DWORD cbData);
27 static auto RegSetValueExA = reinterpret_cast<tRegSetValueExA>(GetProcAddress(LoadLibraryW(L"advapi32.dll"), "RegSetValueExA"));
28
29 using tRegDeleteValueA = LSTATUS(WINAPI*)(HKEY hKey, LPCSTR lpValueName);
30 static auto RegDeleteValueA = reinterpret_cast<tRegDeleteValueA>(GetProcAddress(LoadLibraryW(L"advapi32.dll"), "RegDeleteValueA"));
31
32 using tRegCloseKey = LSTATUS(WINAPI*)(HKEY hKe);
33 static auto RegCloseKey = reinterpret_cast<tRegCloseKey>(GetProcAddress(LoadLibraryW(L"advapi32.dll"), "RegCloseKey"));
34
35 static bool once = true;
36 if (ImGui::BeginTabItem("Settings"))
37 {
38 if (once)
39 {
40 once = false;
41 HKEY hkResult;
42 if (RegOpenKeyExA(
43 HKEY_LOCAL_MACHINE, R"(Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\LeagueClientUx.exe)", 0,
44 KEY_READ, &hkResult) == ERROR_SUCCESS)
45 {
46 char buffer[MAX_PATH];
47 DWORD dwLen = sizeof(buffer);
48 if (const LSTATUS regQuery = RegQueryValueExA(hkResult, "debugger", nullptr, nullptr, reinterpret_cast<LPBYTE>(buffer), &dwLen);
49 regQuery == ERROR_SUCCESS)
50 {
51 S.currentDebugger = std::string(buffer, dwLen);
52 }
53 else if (regQuery == ERROR_FILE_NOT_FOUND)
54 {
55 S.currentDebugger = "Nothing";
56 S.debugger = false;
57 }
58 else
59 {
60 S.currentDebugger = "Failed, error code " + regQuery;
61 }
62 RegCloseKey(hkResult);
63 }
64 else
65 S.currentDebugger = "Error";
66 }
67 static std::string result;

Callers

nothing calls this directly

Calls 6

HelpMarkerFunction · 0.85
TextURLFunction · 0.85
c_strMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected