Share data between C# and Delphi with madshi IPC
Share data between C# and Delphi with madshi IPC
Hi All,
Is it possible to use madshi IPC to share data between C# and Delphi.
Is it possible to use madshi IPC to share data between C# and Delphi.
Re: Share data between C# and Delphi with madshi IPC
Can you be a bit more specific? Are we talking about 2 different processes? Or about different DLLs within the same process?
Generally, the IPC should work fine, regardless of which language you use it in. However, madCodeHook does not come with C# headers. I've zero knowledge about C#, so I'm not sure if you can use madCodeHook with C#.
Generally, the IPC should work fine, regardless of which language you use it in. However, madCodeHook does not come with C# headers. I've zero knowledge about C#, so I'm not sure if you can use madCodeHook with C#.
Re: Share data between C# and Delphi with madshi IPC
Between 2 different processes. One is Delphi and other c# app. Sometimes I need to use mini C# apps to use specific .net apis.
Re: Share data between C# and Delphi with madshi IPC
The key problem will be how to make madCodeHook accessible from within your C# app. I suppose you could create a little win32 helper DLL with C++, which your C# app might then be able to use to do IPC communication? Please be careful, though, that you don't export madCodeHook APIs directly in the DLL, otherwise other developers (e.g. malware devs) could simply copy your DLL and use it for their own purposes.
Re: Share data between C# and Delphi with madshi IPC
Thanks for reply.
I have another question.
I have made a sample app with Delphi XE2. It creates IPC queue and receives ipc messages from hooked Chrome(64bit). 64bit build seems working but 32bit build crashes after 4-5 message. Do you anything to recommend me to check ? My IPC callback :
I have another question.
I have made a sample app with Delphi XE2. It creates IPC queue and receives ipc messages from hooked Chrome(64bit). 64bit build seems working but 32bit build crashes after 4-5 message. Do you anything to recommend me to check ? My IPC callback :
Code: Select all
procedure IPC_Callback(lpName: PChar;
lpMessageBuf: PWChar;
dwMessageLen: DWORD;
lpAnswerBuf: Pointer;
dwAnswerLen: DWORD;
lpContext: Pointer); stdcall;
begin
try
PINT(lpAnswerBuf)^ := SendMessage(HostApplicationMain.Handle, WM_USER + 777, NativeInt(lpMessageBuf), $777);
finally
end;
end;
procedure THostApplicationMain.HandleIPC(var Message: TMessage);
Var
ParamList : TstringList;
begin
ParamList := TstringList.Create;
ParamList.Text := PWChar(pointer(Message.wParam));
//do something
ParamList.Free;
Message.Result := 1;
end;
Re: Share data between C# and Delphi with madshi IPC
Which part crashes? The hook dll calling SendIpcMessage? Or your application receiving it?
Re: Share data between C# and Delphi with madshi IPC
Receiver part crashes.
Re: Share data between C# and Delphi with madshi IPC
Do you have madExcept installed? If so, do you get a madExcept crash report from the receiver?
Re: Share data between C# and Delphi with madshi IPC
I attached it.
- Attachments
-
- bugreport.zip
- Bug report
- (6.98 KiB) Downloaded 404 times
Re: Share data between C# and Delphi with madshi IPC
That looks weird. Maybe some buffer overrun somewhere, or something like that? What happens if you empty the IPC callback function? Does the problem go away then?
Re: Share data between C# and Delphi with madshi IPC
Crash continues with empty callback
Re: Share data between C# and Delphi with madshi IPC
How does your InjectLibrary() call look like?
Re: Share data between C# and Delphi with madshi IPC
Let me create app for reproduce.
Re: Share data between C# and Delphi with madshi IPC
sample project link
http://zipansion.com/45Q4C
Steps
1. Run Chrome.
2. Run 64 bit test app. This will inject 64bit dll to chrome processes.
3. Run 32 bit test app. This will create IPC channel.
4. Browse randomly on Chrome.
Test environment
OS : Windows 10 x64
madCodeHook : 3.1.18
Delphi : XE2
http://zipansion.com/45Q4C
Steps
1. Run Chrome.
2. Run 64 bit test app. This will inject 64bit dll to chrome processes.
3. Run 32 bit test app. This will create IPC channel.
4. Browse randomly on Chrome.
Test environment
OS : Windows 10 x64
madCodeHook : 3.1.18
Delphi : XE2
Re: Share data between C# and Delphi with madshi IPC
Hi madshi,
Any progress for this issue ?
Any progress for this issue ?