Communicating between programs

Ok, I'm not entirely sure how this is done. I'm not talking about network code. What I have in mind is more sending say a function to a running program. I'm thinking it probably wont be easy either. I want to send keycodes to an old dos game that i don't have the source to, while it's running, from another program. If there is any way to do this please (not plz that shortened version of please kinda annoys me :) help me out. (i'm pretty sure there is a way to do this, that's how game trainers work. If there is some sourcecode out there for a game trainer that might work too.)

Thanks
HL

Comments

  • : Ok, I'm not entirely sure how this is done. I'm not talking about network code. What I have in mind is more sending say a function to a running program. I'm thinking it probably wont be easy either. I want to send keycodes to an old dos game that i don't have the source to, while it's running, from another program. If there is any way to do this please (not plz that shortened version of please kinda annoys me :) help me out. (i'm pretty sure there is a way to do this, that's how game trainers work. If there is some sourcecode out there for a game trainer that might work too.)
    :
    If it expects keyboard input on standard in, and you are on the Windows platform (DOS game suggests so), you may be able to do something like:-

    1) Use CreatePipe, setting the security attributes so the pipe is inherited. You get two handles, one for the read end of the pipe and one for the write end.

    2) Use CreateProccess. In the startup info structure you have to fill for it, you set hStdInput to the handle of the read end of the pipe you created. Again make sure flags are set to handles are inherited.

    3) After the CreateProccess call, call CloseHandle on the read end of the pipe in your app - you don't need to read from it, only the target app.

    4) To send data, use the WriteFile API, using the write handle for the pipe as your handle. Check the return value for broken pipe errors etc.

    Give it a go, MSDN is your friend - the documentation on these functions isn't *too* bad. If these don't work too well you may have to look at some other console APIs. I think they will do what you want, though.

    Good luck,

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion