Skip to main content
GameDev.net gamedev.net
🔒 Locked

[java] Getting a Process Handle and Modifying memory address values?

Started by Ang88 Nov 9, 2004 at 5:40 PM 6 replies 1k views
Original Post
Ang88
Ang88
I am fairly new to java, and i am learning it in school. I am trying to learn how to get a process handle, then modify the value of certain memory addresses within that process. The process is an outside process. So far i have found this site (http://www.jniwrapper.com/docs/javadoc/winpack/com/jniwrapper/win32/process/Process.html ) that seems to help, but im not sure how to go about doing it. If anyone knows how to do this in java that would be great
<(''<) <('')> (>'')>Ang88 Signing OFF...
Ang88
Ang88
Quote:
Original post by Anonymous Poster
I read that title and thought 'wft, did I accidentally click on the C forum, circa gamedev 1995?'.....


hmm ok, but it would be nice if someone could get me started in the right direction

my aim is aporto88
<(''<) <('')> (>'')>Ang88 Signing OFF...
Palidine
Palidine
i don't know if you can do any of this in java. i suppose you could with some embedded C code or something or perhaps there's a nice lib out there somewhere. anyway here's how to enumerate the currently active processes on your machine:

http://www.codeproject.com/threads/enumprocnt5.asp?df=100&forumid=4071&exp=0&select=658622

getting into the process memory should be pretty tough on a win2000/XP machine as they are supposed to be protected memory environments (clicky). however, one of the fields of the structs in there is a heap ID so perhaps you could get in that way. dunno, this is fairly far above my head ATM. my feeling however, is that the design of the windows system is such that this shouldn't be possible so you'd probably have to exploit some bug in the windows code to get what you want. and that's bad. DON'T DO IT!

-me

p.s. that java function you found creates new processes, it does not create a handle to existing processes.
TheBluMage
TheBluMage
I agree with the above posts. Java just wasn't designed with a whole lot of "under the hood" stuff in mind. The JNI is an option, but a majority of your programming won't be in Java, it will be spent writing the native library. You'll probably want to be looking into a language/runtime that gets a little more low-level.

If you don't want to struggle a whole lot with a new language's syntax and the lack of a garbage collector, you could try C#, which is pretty similar to Java as far as the language goes, but it has a few nice things tossed in, like easy-to-use interop and optional pointers. I know the .NET Framework has support for getting the handle of a process, but I'm not sure about modifying another process's memory, so you might need to use interop for that part. Of course, you'll have a new dependancy, the .NET Framework.

Otherwise, C++ is probably your best bet to accomplish what you want to do.
Ang88
Ang88
alright, well, thanks for the info, it sounds a little more advanced then i thought, so once i get around to that level, i will probably try it using some of the things suggested

<(''<) <('')> (>'')>Ang88 Signing OFF...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.