Skip to content
This repository was archived by the owner on Oct 21, 2023. It is now read-only.

Commit 467d52a

Browse files
author
LaoLittle
committed
fastfault dont save jmp
1 parent f407ed1 commit 467d52a

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/contact/member.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ impl AnonymousMember {
210210
}
211211

212212
mod imp {
213-
use crate::contact::group::{Group, WeakGroup};
213+
use crate::contact::group::WeakGroup;
214214
use crate::message::meta::Anonymous;
215215
use crate::GroupMemberInfo;
216216

src/plugin/ffi/rt.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ pub extern "C" fn plugin_manager_spawn(
1212
) -> FFIFuture<FFIResult<Managed>> {
1313
let manager: &PluginManager = cast_ref(manager);
1414
let handle = manager.async_runtime().spawn(async move {
15-
unsafe {
16-
save_jmp();
15+
if crate::service::plugin::is_rec_enabled() {
16+
unsafe {
17+
save_jmp();
18+
}
1719
}
1820

1921
future.await

src/signal/sys/windows.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ const GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS: DWORD = 0x00000004;
137137
#[cfg(target_arch = "x86_64")]
138138
mod x64 {
139139
use std::cell::RefCell;
140+
use std::mem::MaybeUninit;
140141
use std::sync::atomic::{AtomicU32, Ordering};
141142
use winapi::um::winnt::{RtlCaptureContext, RtlRestoreContext, CONTEXT};
142143
thread_local! {
@@ -145,12 +146,14 @@ mod x64 {
145146
}
146147

147148
pub unsafe fn save_jmp() {
148-
let mut buf = std::mem::zeroed::<CONTEXT>();
149+
let mut buf = MaybeUninit::uninit();
149150

150151
unsafe {
151-
RtlCaptureContext(&mut buf);
152+
RtlCaptureContext(buf.as_mut_ptr());
152153
}
153154

155+
let buf = buf.assume_init();
156+
154157
let status = STATUS.with(|r| r.load(Ordering::Relaxed));
155158
if status != 0 {
156159
panic!("exception occurred, status: 0x{status:x}");

0 commit comments

Comments
 (0)