|
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( |
@@ -510,6 +513,8 @@ void mb_shell::context_menu_hooks::install_NtUserTrackPopupMenuEx_hook() { |
510 | 513 | mb_shell::context_menu_hooks::block_js_reload.fetch_sub(1); |
511 | 514 | return (int32_t)selected_menu.value_or(0); |
512 | 515 | }); |
| 516 | + hook_registry::register_uninstaller( |
| 517 | + []() { NtUserTrackHook->uninstall(); }); |
513 | 518 | } |
514 | 519 |
|
515 | 520 | void mb_shell::context_menu_hooks::install_menu_mutation_hooks() { |
@@ -773,6 +778,8 @@ void mb_shell::context_menu_hooks::install_SHCreateDefaultContextMenu_hook() { |
773 | 778 | } |
774 | 779 | return res; |
775 | 780 | }); |
| 781 | + hook_registry::register_uninstaller( |
| 782 | + []() { CreateWindowExWHook->uninstall(); }); |
776 | 783 |
|
777 | 784 | /** |
778 | 785 | prototype: SHSTDAPI SHCreateDefaultContextMenu( |
@@ -839,6 +846,8 @@ void mb_shell::context_menu_hooks::install_SHCreateDefaultContextMenu_hook() { |
839 | 846 |
|
840 | 847 | return res; |
841 | 848 | }); |
| 849 | + hook_registry::register_uninstaller( |
| 850 | + []() { SHCreateDefaultContextMenuHook->uninstall(); }); |
842 | 851 | } |
843 | 852 |
|
844 | 853 | #pragma optimize("", off) |
@@ -962,5 +971,7 @@ HRESULT GetUIObjectOf( |
962 | 971 |
|
963 | 972 | return res; |
964 | 973 | }); |
| 974 | + hook_registry::register_uninstaller( |
| 975 | + []() { GetUIObjectOfHook->uninstall(); }); |
965 | 976 | spdlog::info("GetUIObjectOf hook installed"); |
966 | 977 | } |
0 commit comments