darfink / detour-rs

A cross-platform detour library written in Rust
Other
389 stars 71 forks source link

detour function from dll not working? #27

Open matteopolak opened 2 years ago

matteopolak commented 2 years ago

This example panics with could not find 'MessageBoxW' address for me. Is it still functional, or am I using this incorrectly?

I compile it as a cdylib, and use libloading to load the library in another program. Is this the best way to call the dll for it to override functions? Does it override them for all processes, or no? I'm trying to intercept calls to RegQueryValueExA in the Advapi32.dll library.

Thanks

SK83RJOSH commented 2 years ago

It only overrides it for the process it's been injected into unless you shadow a system dll by placing yourself in the path and detour that way. Also your error is most likely due to the library for message box (User32.dll) not being loaded in your target or the export doesn't exist. I'm sure you've solved this by now though, just answering for any future readers. 🙂