|
10 | 10 | #include "nanovg.h" |
11 | 11 | #include "shell/config.h" |
12 | 12 | #include "shell/entry.h" |
| 13 | +#include "shell/hook_registry.h" |
13 | 14 | #include "shell/utils.h" |
14 | 15 |
|
15 | 16 | #include "blook/blook.h" |
@@ -343,6 +344,8 @@ void sync_native_menu_item_update(HMENU hMenu, UINT item, BOOL fByPosition, |
343 | 344 | BODY; \ |
344 | 345 | return result; \ |
345 | 346 | }); \ |
| 347 | + hook_registry::register_uninstaller( \ |
| 348 | + []() { HOOK_NAME##Hook->uninstall(); }); \ |
346 | 349 | } while (false) |
347 | 350 |
|
348 | 351 | void mb_shell::context_menu_hooks::set_active_root_menu_widget( |
@@ -541,6 +544,8 @@ void mb_shell::context_menu_hooks::install_NtUserTrackPopupMenuEx_hook() { |
541 | 544 | mb_shell::context_menu_hooks::block_js_reload.fetch_sub(1); |
542 | 545 | return (int32_t)selected_menu.value_or(0); |
543 | 546 | }); |
| 547 | + hook_registry::register_uninstaller( |
| 548 | + []() { NtUserTrackHook->uninstall(); }); |
544 | 549 | } |
545 | 550 |
|
546 | 551 | void mb_shell::context_menu_hooks::install_menu_mutation_hooks() { |
@@ -804,6 +809,8 @@ void mb_shell::context_menu_hooks::install_SHCreateDefaultContextMenu_hook() { |
804 | 809 | } |
805 | 810 | return res; |
806 | 811 | }); |
| 812 | + hook_registry::register_uninstaller( |
| 813 | + []() { CreateWindowExWHook->uninstall(); }); |
807 | 814 |
|
808 | 815 | /** |
809 | 816 | prototype: SHSTDAPI SHCreateDefaultContextMenu( |
@@ -870,6 +877,8 @@ void mb_shell::context_menu_hooks::install_SHCreateDefaultContextMenu_hook() { |
870 | 877 |
|
871 | 878 | return res; |
872 | 879 | }); |
| 880 | + hook_registry::register_uninstaller( |
| 881 | + []() { SHCreateDefaultContextMenuHook->uninstall(); }); |
873 | 882 | } |
874 | 883 |
|
875 | 884 | #pragma optimize("", off) |
@@ -993,5 +1002,7 @@ HRESULT GetUIObjectOf( |
993 | 1002 |
|
994 | 1003 | return res; |
995 | 1004 | }); |
| 1005 | + hook_registry::register_uninstaller( |
| 1006 | + []() { GetUIObjectOfHook->uninstall(); }); |
996 | 1007 | spdlog::info("GetUIObjectOf hook installed"); |
997 | 1008 | } |
0 commit comments