Comments (7)
External hooks require you to inject your hook function into the process's memory space beforehand. I generally don't recommend doing it, because it's very easy to get it wrong. Also, internal allows you to work with the target process with much more ease.
Ah, except this was using the internal method, with the DLL injected, so it should of worked it seems like without any issues.
I'm on Arch Linux and doing everything by cross-compiling the DLL via MSVC, then injecting it via a custom injector.
from libmem.
This seems to be a Windows problem. Looking into it.
from libmem.
What is the code of your hook function? You have to use C types instead of Rust times if you want to extract information from the parameters. Also, IIRC, some (not many TBH) Assault Cube functions have weird calling conventions, so you might have to do inline ASM.
from libmem.
Sorry for the late response.
I'm not currently using Assault Cube, switched to a different game to test and it's experiencing deadlocks when calling additional logic inside of the target function, which is being used for the hook.
Here's the game I'm currently using: https://www.swisstransfer.com/d/a2eb7459-6ebd-46ef-b3b0-3c45ffdcb422
Function Address: 0x004935d0
Parameters: *const i8, c_int, c_int
I've been hooking this function using retour-rs for several months, and it's been working just fine. But I need to go external for several other games, and decided to try and hook the function above and it just locks upon receiving calls.
The additional code I had in it wasn't anything special, it would deadlock from simply just having a for-loop in it and a println!(), then calling the original function after everything was done.
from libmem.
Oh, I just remembered. I actually have a working hook with Rust for AssaultCube on Linux (don't mind the messy code BTW, this was just a test):
https://github.com/rdbo/rustycube/blob/master/src/lib.rs#L57-L64
This is a hook for gl_drawframe
tested on Linux.
But I need to go external for several other games, and decided to try and hook the function above and it just locks upon receiving calls.
External hooks require you to inject your hook function into the process's memory space beforehand. I generally don't recommend doing it, because it's very easy to get it wrong. Also, internal allows you to work with the target process with much more ease.
from libmem.
Maybe this is a Windows problem? I'll have to check it out.
from libmem.
The hooking tests have passed on Windows now - the Windows error that was happening before was "unrelated" (MSVC generates a dummy function, so the hook was being placed in the wrong address). On Linux, hooks have been working from the start. I will close this for now.
from libmem.
Related Issues (20)
- Consider adding function to retrieve page size (and rewrite code that retrieves page size)
- Clean up files
- Do better cross compiling (remove `LIBMEM_ARCH` option)
- Remove mounting procfs in FreeBSD on README HOT 2
- Include Capstone's detail in `lm_inst_t` HOT 4
- Skip undefined symbols on LM_EnumSymbols HOT 1
- Error build on ubuntu 22 aarch64
- Add methods for comparing memory, similar to memcmp
- Add function for getting page size HOT 1
- Make `LM_DeepPointer(Ex)` 1:1 to Cheat Engine's pointer maps/pointer scans HOT 1
- rust build fails HOT 8
- Rust: no access to `lm_inst_t` properties. HOT 2
- Fix `liblibmem.so` issue on Unix-likes HOT 2
- `lm_time_t` is private HOT 1
- Small doc correction for Rust LM_FindSymbolAddress HOT 1
- Add basic debug logging HOT 1
- Add helper functions for Python to avoid manual unpacking all the time
- Deprecate `LM_` suffix in Python bindings HOT 2
- Figure out a way to allow more assembler/disassembler modes HOT 3
- Reconsider uses of `process->bits` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libmem.