Share data between C# and Delphi with madshi IPC
Re: Share data between C# and Delphi with madshi IPC
Sorry for the late reply. I've tried to download your sample now, but I failed. I'm getting redirected through multiple sites, asked to turn off my ad blocker, asked to allow notification, and still no download link. Could you please use a proper file host? E.g. try mediafire.
Re: Share data between C# and Delphi with madshi IPC
Not sure why, but it seems to work fine here without crashes. Can you double check? Here's my build, compiled with XE8 using madCodeHook v4:
http://madshi.net/IPCCrashTest.rar
http://madshi.net/IPCCrashTest.rar
Re: Share data between C# and Delphi with madshi IPC
I tested and it seems working very well. I mixed yours and my examples. Your 32bit receiver part works good.
Re: Share data between C# and Delphi with madshi IPC
I'm not sure if it's the difference between v3 and v4, or maybe XE2 vs XE8? I think it's more likely v3 vs v4.
Re: Share data between C# and Delphi with madshi IPC
Company firewall doesnt allow download (virus alert). I will try at home.
Re: Share data between C# and Delphi with madshi IPC
I tried both mine and your demos at home. IPCCrashTestApp XE2 v4 working well. IPCCrashTestApp XE8 v3 crashes like mine.
Re: Share data between C# and Delphi with madshi IPC
Oh well, looks like a bug in v3 then, probably...
Re: Share data between C# and Delphi with madshi IPC
I upgraded to v4 and problem solved.
One more question. How can I use AddAccessForEveryone. Can you provide sample ? I am planning to run this code in delphi service AfterInstall event.
One more question. How can I use AddAccessForEveryone. Can you provide sample ? I am planning to run this code in delphi service AfterInstall event.
-
- Posts: 109
- Joined: Thu Dec 30, 2004 9:59 pm
- Location: UK
Re: Share data between C# and Delphi with madshi IPC
Just to let you know that it is completely possible to use the IPC between (any language) c++ DLL and c# application as i use it already. Its not easy to push callbacks of this nature into c#, you need to be 3l1t3ExPx wrote:Hi madshi,
Any progress for this issue ?
There is no bug with the MCH/SendIPC system...
Re: Share data between C# and Delphi with madshi IPC
Hmmm after taking a look at the posted code from ExPx for the IPC callback it's using the updated prototype which includes the extra Context pointer parameter. Well, if a user was using MCH v3.x (which he was) with the updated IPC callback prototype from MCH v4.x, this could cause issues. Case example below:
That's assuming lpContext param addition was specifically introduced in v4 and wasn't used in v3. I'm a 4.x user so I'd have to check the older prototype. The help docs only show the newest/latest (v4.x) ...
--Iconic
Code: Select all
MCHv3.CreateIpcQueue(IPC_NAME, @Callback);
Code: Select all
MCHv4.Callback(lpName: PChar;
lpMessageBuf: PWChar;
dwMessageLen: DWORD;
lpAnswerBuf: Pointer;
dwAnswerLen: DWORD;
lpContext: Pointer <--- unexpected);
--Iconic
Re: Share data between C# and Delphi with madshi IPC
Good catch, iconic! That might explain the problem nicely.
@ExPx, you should not have to call AddAccessForEveryone yourself, CreateIpcQueue already does that for you internally. But anyway, if you want to know how to call it, you can check "InjectService.cpp" in this demo:
http://madshi.net/HookProcessTermination.zip
@ExPx, you should not have to call AddAccessForEveryone yourself, CreateIpcQueue already does that for you internally. But anyway, if you want to know how to call it, you can check "InjectService.cpp" in this demo:
http://madshi.net/HookProcessTermination.zip
Re: Share data between C# and Delphi with madshi IPC
Thanks Madshi It worked. I had to change service installation procedure in SvcMgr pas becuse AfterInstall event doesn't expose SC_HANDLE result of CreateService.