mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-12-05 04:59:05 +08:00
remove another transmute_copy
This commit is contained in:
parent
4c9dadc41a
commit
e8182e762d
800
Cargo.lock
generated
800
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -34,7 +34,7 @@ fn mouse_event(flags: u32, data: u32, dx: i32, dy: i32) -> DWORD {
|
|||||||
dwExtraInfo: ENIGO_INPUT_EXTRA_VALUE,
|
dwExtraInfo: ENIGO_INPUT_EXTRA_VALUE,
|
||||||
};
|
};
|
||||||
let src_ptr = (&m as *const _) as *const u8;
|
let src_ptr = (&m as *const _) as *const u8;
|
||||||
std::ptr::copy_nonoverlapping(src_ptr, dst_ptr, std::mem::size_of::<MOUSEINPUT>());
|
std::ptr::copy_nonoverlapping(src_ptr, dst_ptr, size_of::<MOUSEINPUT>());
|
||||||
}
|
}
|
||||||
unsafe { SendInput(1, &mut input as LPINPUT, size_of::<INPUT>() as c_int) }
|
unsafe { SendInput(1, &mut input as LPINPUT, size_of::<INPUT>() as c_int) }
|
||||||
}
|
}
|
||||||
@ -52,18 +52,20 @@ fn keybd_event(flags: u32, vk: u16, scan: u16) -> DWORD {
|
|||||||
scan = MapVirtualKeyExW(vk as _, 0, LAYOUT) as _;
|
scan = MapVirtualKeyExW(vk as _, 0, LAYOUT) as _;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let mut input = INPUT {
|
let mut input: INPUT = unsafe { std::mem::MaybeUninit::zeroed().assume_init() };
|
||||||
type_: INPUT_KEYBOARD,
|
input.type_ = INPUT_KEYBOARD;
|
||||||
u: unsafe {
|
unsafe {
|
||||||
transmute_copy(&KEYBDINPUT {
|
let dst_ptr = (&mut input.u as *mut _) as *mut u8;
|
||||||
wVk: vk,
|
let k = KEYBDINPUT {
|
||||||
wScan: scan,
|
wVk: vk,
|
||||||
dwFlags: flags,
|
wScan: scan,
|
||||||
time: 0,
|
dwFlags: flags,
|
||||||
dwExtraInfo: ENIGO_INPUT_EXTRA_VALUE,
|
time: 0,
|
||||||
})
|
dwExtraInfo: ENIGO_INPUT_EXTRA_VALUE,
|
||||||
},
|
};
|
||||||
};
|
let src_ptr = (&k as *const _) as *const u8;
|
||||||
|
std::ptr::copy_nonoverlapping(src_ptr, dst_ptr, size_of::<KEYBDINPUT>());
|
||||||
|
}
|
||||||
unsafe { SendInput(1, &mut input as LPINPUT, size_of::<INPUT>() as c_int) }
|
unsafe { SendInput(1, &mut input as LPINPUT, size_of::<INPUT>() as c_int) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user