ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi! I run games in Wine. I also enjoy hacking games. One of the problems I have when hacking games is that windows makes it rather difficult to hook the program and make your hacks more sneaky, and to do so you must (from my knowledge) create a kernel module: Windows kernel module coding is suicide.
I read up on wine a while ago and found that it actually maps the process memory very similar (if not identical) to how other processes in linux do. My goal was now to write the hack in linux and completely circumvent the win32 api all together. This will work wonders for reading data, which is all I want to do, and I'll leave writing data, breakpoints, etc. for a later time.
I am currently using ptrace (man ptrace(2)) to peek/poke memory. This is rather unfortunate because my hack exists in a separate address space, and communicating between the two seems dumb. I wish to somehow use another process's memory map in some way, hopefully by remapping some segment of my process. Is this possible, or is there a better way(tm)?
Some ideas I had where to investigate or use /proc/<pid>/map or /proc/<pid>/mem in some way.
Some ideas I had where to investigate or use /proc/<pid>/map or /proc/<pid>/mem in some way.
Once you start to ptrace a process, you are granted permission to use /proc/$PID/mem directly. You can even mmap() it and have access to matching structs and classes through your own variables.
Thanks, I'll be sure to look into using mmap. Does anyone know much about using shared libraries to attach to a process, similar to DLL injection on win32? I've read about dlopen, libdl, and injectso, but seems rather poorly documented (especially the stuff about the lib entry point) and obscure.
Does anyone know much about using shared libraries to attach to a process, similar to DLL injection on win32?
I think the closes thing we have to that is LD_PRELOAD, which lets you specify libraries which override default libraries when looking up symbols (e.g., if you have the symbol fopen, and the C library has the symbol fopen, yours will be given precedence when the target application tries to resolve the symbol, effectively giving you control). The library itself still has the ability to use the C library functions however.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.