MCPcopy Create free account
hub / github.com/TranslucentTB/TranslucentTB / Install

Method Install

ExplorerHooks/swcadetour.cpp:38–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38void SWCADetour::Install() noexcept
39{
40 if (!s_User32)
41 {
42 s_User32.reset(LoadLibraryEx(L"user32.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32));
43 FAIL_FAST_LAST_ERROR_IF_NULL(s_User32);
44 }
45
46 if (!SetWindowCompositionAttribute)
47 {
48 SetWindowCompositionAttribute = reinterpret_cast<PFN_SET_WINDOW_COMPOSITION_ATTRIBUTE>(GetProcAddress(s_User32.get(), UTIL_STRINGIFY_UTF8(SetWindowCompositionAttribute)));
49 FAIL_FAST_LAST_ERROR_IF(!SetWindowCompositionAttribute);
50 }
51
52 if (!s_RequestAttribute)
53 {
54 s_RequestAttribute = RegisterWindowMessage(WM_TTBHOOKREQUESTREFRESH.c_str());
55 FAIL_FAST_LAST_ERROR_IF(!s_RequestAttribute);
56 }
57
58 if (!s_DetourInstalled)
59 {
60 DetourTransaction transaction;
61 transaction.update_all_threads();
62 transaction.attach(SetWindowCompositionAttribute, FunctionDetour);
63 transaction.commit();
64
65 s_DetourInstalled = true;
66 }
67}
68
69void SWCADetour::Uninstall() noexcept
70{

Callers

nothing calls this directly

Calls 5

getMethod · 0.80
c_strMethod · 0.80
update_all_threadsMethod · 0.80
attachMethod · 0.80
commitMethod · 0.80

Tested by

no test coverage detected