Skip to content

Commit

Permalink
Disable hooks before exiting
Browse files Browse the repository at this point in the history
  • Loading branch information
OpenByteDev committed Jun 9, 2022
1 parent 6f1dd55 commit 2f8b2b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions burnt-sushi-blocker/src/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ pub fn enable(
}

pub fn disable() -> Result<(), Box<dyn std::error::Error>> {
unsafe { GetAddrInfoHook.disable()? };
unsafe { CefUrlRequestCreateHook.disable()? };
if GetAddrInfoHook.is_enabled() {
unsafe { GetAddrInfoHook.disable() }?;
}
if CefUrlRequestCreateHook.is_enabled() {
unsafe { CefUrlRequestCreateHook.disable()? };
}
Ok(())
}

Expand Down
1 change: 1 addition & 0 deletions burnt-sushi-blocker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ dll_syringe::payload_procedure! {
fn stop_rpc() {
let mut state = RPC_STATE.lock().unwrap();
if let Some(state) = state.take() {
hooks::disable().unwrap();
state.rpc_disconnector.send(()).unwrap();
state.rpc_thread.join().unwrap();
}
Expand Down

0 comments on commit 2f8b2b8

Please sign in to comment.