How to make 2 programs interact?

Started by
26 comments, last by RoTTer 23 years, 9 months ago
Marauderz: Just look up the function VirtualQueryEx

For a good time hit Alt-F4! Go ahead try it, all the cool people are doing it.
For a good time hit Alt-F4! Go ahead try it, all the cool people are doing it.
Advertisement
I don''t know how this relates to the hooks system, but the method I use to intercept messages from a program is to use GetWindowLong and SetWindowLong to replace the windows wndproc with my own. With that I have access to every message that the program recieves. Then, I call the old wndproc of the program so that it too can process the message. I use this method mostly with winamp plugins I write, that way, My plugin can make winamp it''s bitch.

Not sure exactly how UO does it, but for winsock programming, Most programs recieve a message (Set by the program) when data has arrived. If you can figure out witch message this is you can now intercept data being sent to the app. (wParam I think) is the socket the data was recieved on, so just read it in (without removing it) and do what you please.

-Zims
Hello again!

I was working with Ziman''s idea, but I can''t change the game''s WndProc using SetWindowLong.

I created a WndProc to replace the old one, where I send a copy of every message to the old WndProc.... then I called SetWindowLong and replaced the old WndProc with the new one... I get no error messages, and everythin looks ok, but the game behaves just like I had never changed anything!

Does any of you people have any idea about what I could be doing wrong?

I''ll give a look at the other ideas (didn''t have the time yet), I just tried Ziman''s idea first because it looked simple and versatile.

It''s great to be able to count with a place like this. This place saved my butt many times. Thank yall!
Windows programming sucks! DOS rulez!
Anomymous Poster: it would be easy to cheat if the game was in dos, but since this is an online game I don''t think it would be good for it to run in dos. And making a cheating program in dos for windows programs wouldn''t work well either, unless you know how to switch to ring0 and convert the addresses.

By the way does anyone know how to do a callgate without using thunk scripts? I know its possible, but too few people use callgates with thunk scripts for there to be enough information about it. I''ve been looking for it for months.
For a good time hit Alt-F4! Go ahead try it, all the cool people are doing it.
Ack, I had the hope that I had got 2 replies full with all information I was looking for hehe

So none of you has any idea about what I may be doing wrong?

Or where can I find information about it (replacing the WndProc function of a 3rd party program with yours).

Again, thanks!

HellRaider: don''t think you''ll ever get it to work. This is straight out of MSDN
quote:
The SetWindowLong function fails if the window specified by the hWnd parameter does not belong to the same process as the calling thread.

Certain window data is cached, so changes you make using SetWindowLong will not take effect until you call the SetWindowPos function.
For a good time hit Alt-F4! Go ahead try it, all the cool people are doing it.
Hello!


I wasnt home for last 4 days or something, and I couldnt check the replies here, sorry. Now Im back, lemme read and reply all the messages. First of all : Thanks for the replies .

blue-lightning :
Ah. I was saying that cause I thought I had read that from the code (UOExtreme code), but I didnt understand it very well so I wanst 100% sure. What I understand from it is that it uses hooks to know when a packet arrived (a message seems to arrive saying a packet arrived... ?), and then dontknowhow it decrypts, reads, and closes the packet.
About the WH_KB and MOUSE hooks, uhm... Thats not exactly what I wanted my program to do (intercept keyb/mouse commands and maybe change them). Or are you telling me to play with those hooks to get used to hooks as a start?
About the code, its he source code of a program that "cheats" in Ultima Online. It reads the packets coming from the server and do whatever it needs to do to cheat. It seems it uses hook to read the packets.

Marauderz :
Ah! Thats nice! I loved when I used Game Wizard back in DOS days... hehe. And also now in Windows days that not-so-good Cheat O''Matic, but still decent. When you finish your program let us all know, Ill gladly download it (if free eheh).

Laarz :
I didnt manage to find the source there, but it seems to be somewhere around there hehe. Ill take a better look at it to see if I can find the source.

HellRaider :
Uhm, nice. We''ll be able then to easily understand the packets coming from the server using blue-lightning wsock dll as they wont come encrypted, but we still have to write the [en/de]cryption code for the final release.

Zimans :
Uhmmmm. I think thats what UOE (the program which I have the source) does (I mean, retrieve the message that sas data has arrived). About the GetWindowLong/etc you mentioned, I never tried, but as I read from a reply to your message, it seemed to work for your plugins cause it (plugin) runs in the same thread as the app (Winamp). But as Im making a 3rd party program, that shouldnt work =/. But thanks for your hint, I may need that sometime.


Thats it!
Thanks a lot you all for all the answers, and Im sorry about the long time it took me to answer all the messages. I wasnt home for some days. Ill check a bit the code now and try the hook thing .

Cya,
-RoTTer

This topic is closed to new replies.

Advertisement