rdbo / libmem

Advanced Game Hacking Library for C, Modern C++, Rust and Python (Windows/Linux/FreeBSD) (Process/Memory Hacking) (Hooking/Detouring) (Cross Platform) (x86/x64/ARM/ARM64) (DLL/SO Injection) (Internal/External) (Assembler/Disassembler)
GNU Affero General Public License v3.0
788 stars 91 forks source link

suggestions: unprotecting memory, installing patches #17

Closed alextwothousand closed 3 years ago

alextwothousand commented 3 years ago

I wanted to suggest the ability to:

I would be more than happy to assist, if need be?

rdbo commented 3 years ago

These are all already possible on version 3.3.3 They will also be possible on V4.0 once I finish it. The respective API calls are gonna be: LM_ProtectMemory(Ex) LM_SetMemory(Ex) LM_DetourCode(Ex)

LM_ProtectMemory allows you to protect memory and save the old protection so you can restore it later LM_SetMemory sets a memory region to a single byte (in the case of x86 NOP'ing, you have to set to 0x90) LM_DetourCode allows you to place a hook somewhere with multiple methods, such as JMP, CALL, RET

The version 3 API calls are: mem_(in/ex)_protect mem_(in/ex)_set mem_(in/ex)_detour

By the way, I appreciate the help, you are the first one to offer. Just gotta finish porting V3 to V4, adding support to ARM/ARM64, documentation, etc. I think I might finish V4 soon, so stayed tuned

alextwothousand commented 3 years ago

Thank you! and not a worry at all.

Could you provide me with an example for mem_in_detour? I'm not so sure if its able to install a RETN patch - the confusing part is what I should use as the destination, haha

alextwothousand commented 3 years ago

Never mind, was able to figure it out!