| View previous topic :: View next topic |
| Author |
Message |
Odecey Master Cheater
Reputation: 1
Joined: 19 Apr 2007 Posts: 259 Location: Scandinavia
|
Posted: Thu Nov 13, 2008 2:46 pm Post subject: Applications communicating? |
|
|
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 |
|
 |
Innovation Grandmaster Cheater
Reputation: 12
Joined: 14 Aug 2008 Posts: 617
|
Posted: Thu Nov 13, 2008 2:56 pm Post subject: |
|
|
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 |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Thu Nov 13, 2008 4:06 pm Post subject: |
|
|
Piping.
Even though C# has a managed version of Piping, I'd suggest you import the native APIs for piping, to stay consistent.
_________________
|
|
| Back to top |
|
 |
sloppy Expert Cheater
Reputation: 0
Joined: 17 Aug 2008 Posts: 123
|
Posted: Thu Nov 13, 2008 5:20 pm Post subject: |
|
|
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 |
|
 |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
|
| Back to top |
|
 |
BanMe Master Cheater
Reputation: 0
Joined: 29 Nov 2005 Posts: 375 Location: Farmington NH, USA
|
Posted: Fri Nov 14, 2008 11:05 am Post subject: |
|
|
| 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 |
|
 |
Odecey Master Cheater
Reputation: 1
Joined: 19 Apr 2007 Posts: 259 Location: Scandinavia
|
Posted: Sat Nov 15, 2008 6:54 pm Post subject: |
|
|
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 |
|
 |
Overload Master Cheater
Reputation: 0
Joined: 08 Feb 2008 Posts: 293
|
Posted: Sat Nov 15, 2008 7:56 pm Post subject: |
|
|
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 |
|
 |
kitterz Grandmaster Cheater Supreme
Reputation: 0
Joined: 24 Dec 2007 Posts: 1268
|
Posted: Sat Nov 15, 2008 8:27 pm Post subject: |
|
|
Make a custom windows message and PostMessage it over?
_________________
|
|
| Back to top |
|
 |
Odecey Master Cheater
Reputation: 1
Joined: 19 Apr 2007 Posts: 259 Location: Scandinavia
|
Posted: Sun Dec 14, 2008 1:03 pm Post subject: |
|
|
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 |
|
 |
dnsi0 I post too much
Reputation: 0
Joined: 04 Jan 2007 Posts: 2674
|
Posted: Sun Dec 14, 2008 1:09 pm Post subject: |
|
|
I have an easier way..
CreateFileMapping/ViewMapOfFile.
I use this for everything that has to do with reading maple's memory.
|
|
| Back to top |
|
 |
AlbanainRetard Master Cheater
Reputation: 0
Joined: 02 Nov 2008 Posts: 494 Location: Canada eh?
|
Posted: Sun Dec 14, 2008 1:42 pm Post subject: |
|
|
Using PostMessage to a window, and on the other side, just check it on WM switch.
But piping is the best.
_________________
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Sun Dec 14, 2008 4:22 pm Post subject: |
|
|
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 |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Sun Dec 14, 2008 5:42 pm Post subject: |
|
|
| Or sockets.
|
|
| Back to top |
|
 |
Odecey Master Cheater
Reputation: 1
Joined: 19 Apr 2007 Posts: 259 Location: Scandinavia
|
Posted: Mon Dec 15, 2008 1:10 pm Post subject: |
|
|
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 |
|
 |
|