Closed brandonros closed 1 year ago
unsafe
functions and those with ABIs other than "Rust"
(the default one) do not implement Fn
traits. Try wrapping it in a closure, e.g. |a, b, c, d| unsafe { our_GetSystemFirmwareTable(a, b, c, d) }
error[E0277]: expected a `Fn<(*const IWbemClassObject, *const u16, i32, *mut VARIANT, *mut i32, *mut i32)>` closure, found `extern "thiscall" fn(*const IWbemClassObject, *const u16, i32, *mut VARIANT, *mut i32, *mut i32) -> i32 {our_CWbemObjectGet}`
--> fnpss-wmi-hook\src\lib.rs:132:55
132 | CWbemObjectGetHook.initialize(ori_CWbemObjectGet, our_CWbemObjectGet).unwrap();
| ---------- ^^^^^^^^^^^^^^^^^^ expected an `Fn<(*const IWbemClassObject, *const u16, i32, *mut VARIANT, *mut i32, *mut i32)>` closure, found `extern "thiscall" fn(*const IWbemClassObject, *const u16, i32, *mut VARIANT, *mut i32, *mut i32) -> i32 {our_CWbemObjectGet}`
| |
| required by a bound introduced by this call
I don't think I can do closure for thiscall
, can I?
0x180028BA0: "public: virtual long __cdecl CWbemObject::Get(unsigned short const * __ptr64,long,struct tagVARIANT * __ptr64,long * __ptr64,long * __ptr64) __ptr64" ?Get@CWbemObject@@UEAAJPEBGJPEAUtagVARIANT@@PEAJ2@Z