Coder Social home page Coder Social logo

Function Hooking deadlocks about libmem HOT 7 OPEN

vars1ty avatar vars1ty commented on June 6, 2024
Function Hooking deadlocks

from libmem.

Comments (7)

vars1ty avatar vars1ty commented on June 6, 2024 1

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.

rdbo avatar rdbo commented on June 6, 2024 1

This seems to be a Windows problem. Looking into it.

from libmem.

rdbo avatar rdbo commented on June 6, 2024

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.

vars1ty avatar vars1ty commented on June 6, 2024

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.

rdbo avatar rdbo commented on June 6, 2024

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.

rdbo avatar rdbo commented on June 6, 2024

Maybe this is a Windows problem? I'll have to check it out.

from libmem.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.