MCPcopy Create free account
hub / github.com/crosire/reshade / uninstall

Method uninstall

source/hook_manager.cpp:476–515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

474 return install_internal(name, hook, hook_method::vtable_hook);
475}
476void reshade::hooks::uninstall()
477{
478 log::message(log::level::info, "Uninstalling %zu hook(s) ...", s_hooks.size());
479
480 // Disable all hooks in a single batch job
481 for (named_hook &hook : s_hooks)
482 hook.disable();
483
484 hook::apply_queued_actions();
485
486 // Afterwards uninstall and remove all hooks from the list
487 for (named_hook &hook : s_hooks)
488 uninstall_internal(hook.name, hook, hook.method);
489
490 s_hooks.clear();
491
492#ifndef RESHADE_TEST_APPLICATION
493 if (s_dll_notification_cookie && s_dll_notification_cookie != reinterpret_cast<PVOID>(-1))
494 {
495 const auto ntdll_module = GetModuleHandleW(L"ntdll.dll");
496 assert(ntdll_module != nullptr);
497
498 const auto LdrUnregisterDllNotification = reinterpret_cast<LONG(NTAPI *)(PVOID Cookie)>(GetProcAddress(ntdll_module, "LdrUnregisterDllNotification"));
499 if (LdrUnregisterDllNotification != nullptr)
500 LdrUnregisterDllNotification(s_dll_notification_cookie);
501 }
502
503 s_dll_notification_cookie = nullptr;
504#endif
505
506 // Free reference to the module loaded for export hooks
507 // Otherwise a subsequent call to 'LoadLibrary' could return the handle to the still loaded export module, instead of loading the ReShade module again
508 // Unfortunately this is not technically safe to call from 'DllMain' ...
509 if (g_export_module_handle)
510 {
511 if (!FreeLibrary(g_export_module_handle))
512 log::message(log::level::warning, "Failed to unload '%s' with error code %lu!", s_export_module_path.u8string().c_str(), GetLastError());
513 g_export_module_handle = nullptr;
514 }
515}
516
517void reshade::hooks::register_module(const std::filesystem::path &target_path)
518{

Callers 1

uninstall_internalFunction · 0.45

Calls 4

messageFunction · 0.85
uninstall_internalFunction · 0.85
disableMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected