Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Applications communicating?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Odecey
Master Cheater
Reputation: 1

Joined: 19 Apr 2007
Posts: 259
Location: Scandinavia

PostPosted: Thu Nov 13, 2008 2:46 pm    Post subject: Applications communicating? Reply with quote

I'm wondering how I best can send a value directly from one process to another.One is in C++, the other is in C# if that matters. Thanks in advance.
_________________
Never confuse activity with productivity. You can be busy without a purpose, but what's the point?- Rick Warren
Back to top
View user's profile Send private message MSN Messenger
Innovation
Grandmaster Cheater
Reputation: 12

Joined: 14 Aug 2008
Posts: 617

PostPosted: Thu Nov 13, 2008 2:56 pm    Post subject: Reply with quote

You could make an entry in the registry.
I know this would not be the best way but it is a way.
Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Thu Nov 13, 2008 4:06 pm    Post subject: Reply with quote

Piping.

Even though C# has a managed version of Piping, I'd suggest you import the native APIs for piping, to stay consistent.

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
sloppy
Expert Cheater
Reputation: 0

Joined: 17 Aug 2008
Posts: 123

PostPosted: Thu Nov 13, 2008 5:20 pm    Post subject: Reply with quote

I'd go with sending windows messages between them, but there is plenty of other choices.. MSDN has a good article on inter-process communications and provides some examples of each method in c/c++. Google for the c# implementations.

Although, some of this may be overkill depending on what you wish to accomplish.. ?
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Fri Nov 14, 2008 6:24 am    Post subject: Reply with quote

IPC is the keyword for Google :) Eg. http://en.wikipedia.org/wiki/Interprocess_communication
Back to top
View user's profile Send private message
BanMe
Master Cheater
Reputation: 0

Joined: 29 Nov 2005
Posts: 375
Location: Farmington NH, USA

PostPosted: Fri Nov 14, 2008 11:05 am    Post subject: Reply with quote

IPC is basiclly Creation of a Share Object that can be accessible not only to the parent process but to other process that request a handle to it.. the key is managing access.. now this can be done with pipes / Share Named Memory / MailSlots / WriteProcessMemory though probably the best one is described in WLSI paper.. which uses shared section object create by the "server" which can also be written to by the server in which the client request a handle to the object and upon success gets mapped into the clients address space(all managed by the system)... ive been working on a refined method of this sort for some time, using a shared section as a storage for a CONTEXT structure in order to restore it after a call to RtlRemoteCall ... as alex ionescu's code for RtlRemoteCall was never released as i had hoped in a reasonable amount of time.. i plan to release mine soon after i get all the bugs out and work on a effecient shared calling mechanism..
Back to top
View user's profile Send private message MSN Messenger
Odecey
Master Cheater
Reputation: 1

Joined: 19 Apr 2007
Posts: 259
Location: Scandinavia

PostPosted: Sat Nov 15, 2008 6:54 pm    Post subject: Reply with quote

Thanks for the replies. I've skimmed through some code snippets for most of them, and they all seem very complicated for something I had thought would be so simple, so I tried to simply use PostThreadMessage and GetMessage:
First,the dll is injected into MapleStory, and immediately after I call :
Code:

PostThreadMessage(ThreadHandle.ToInt32(),(uint)1,0,0);

When the dll is loaded this code is executed:
Code:

LPMSG msg = (LPMSG) "";
BOOL rec ) GetMessage(msg,FindWindow("MapleStoryClass",NULL),0,0);
 if((int)msg==1)
       Beep(500,500);
However, I never hear a Beep. What is it I'm doing wrong?
_________________
Never confuse activity with productivity. You can be busy without a purpose, but what's the point?- Rick Warren
Back to top
View user's profile Send private message MSN Messenger
Overload
Master Cheater
Reputation: 0

Joined: 08 Feb 2008
Posts: 293

PostPosted: Sat Nov 15, 2008 7:56 pm    Post subject: Reply with quote

Just use Named Pipes. As samuri said.
_________________
Blog

Quote:
Rhys says:
you can be my maid
Rhys says:
ill buy you a french maid outfit
Tyler says:
Sounds good
Rhys says:
ill hold you to that
Back to top
View user's profile Send private message MSN Messenger
kitterz
Grandmaster Cheater Supreme
Reputation: 0

Joined: 24 Dec 2007
Posts: 1268

PostPosted: Sat Nov 15, 2008 8:27 pm    Post subject: Reply with quote

Make a custom windows message and PostMessage it over?
_________________
Back to top
View user's profile Send private message Send e-mail
Odecey
Master Cheater
Reputation: 1

Joined: 19 Apr 2007
Posts: 259
Location: Scandinavia

PostPosted: Sun Dec 14, 2008 1:03 pm    Post subject: Reply with quote

OK,after giving up on this for a while, I've decided to give it another go.
I have come as far as successfully connecting the two programs, but when i send a message it doesn't get detected by the other program.

What i do:
In the C# program I first call CreateNamedPipe, followed by continually calling ConnectNamedPipe. At this point i inject the .dll into the target process which calls CreateFile upon injection. When this happens the connection is successfully made (or so I assume, connectNamedPipe returns 1 and createfile returns something other than INVALID_HANDLE_VALUE), and i stop calling ConnectNamedPipe.In the dll i start an infinate loop which continually calls ReadFile, and if the buffer length is bigger than zero, shows a messagebox indicating that it successfully received the message.However, the messagebox never shows. Any idea what might cause things to go wrong at this stage? Does it matter that lpOverlapped parameter in CreateFile isn't initialized before I call the function? Any help on this is appreciated =).
Edit: I would post the code, but I'm on another PC right now.

_________________
Never confuse activity with productivity. You can be busy without a purpose, but what's the point?- Rick Warren
Back to top
View user's profile Send private message MSN Messenger
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Sun Dec 14, 2008 1:09 pm    Post subject: Reply with quote

I have an easier way..
CreateFileMapping/ViewMapOfFile.

I use this for everything that has to do with reading maple's memory.
Back to top
View user's profile Send private message
AlbanainRetard
Master Cheater
Reputation: 0

Joined: 02 Nov 2008
Posts: 494
Location: Canada eh?

PostPosted: Sun Dec 14, 2008 1:42 pm    Post subject: Reply with quote

Using PostMessage to a window, and on the other side, just check it on WM switch.

But piping is the best.

_________________
Back to top
View user's profile Send private message Send e-mail
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Sun Dec 14, 2008 4:22 pm    Post subject: Reply with quote

Create a Driver that just loads and has a custom ReadControl. When ReadFile is called on the drivers handle, have the info loaded into the kernels memory. Then make a custom WriteControl and when WriteFile is called on the kernel, have that info sent from the kernel to your C# usermode app.

Actually it would make more sense to swap ReadFile and Writefile wouldn't it? I'm too lazy to change it. lol

_________________
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Sun Dec 14, 2008 5:42 pm    Post subject: Reply with quote

Or sockets.
Back to top
View user's profile Send private message MSN Messenger
Odecey
Master Cheater
Reputation: 1

Joined: 19 Apr 2007
Posts: 259
Location: Scandinavia

PostPosted: Mon Dec 15, 2008 1:10 pm    Post subject: Reply with quote

Got it working using named pipes now ^_^(one way anyway >.> Working on the other now). Thanks for all the replies.
_________________
Never confuse activity with productivity. You can be busy without a purpose, but what's the point?- Rick Warren
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites