Managed and un-managed code integration.

My managed code resides in the LocalSystem and is a service. The
un-managed code is an MFC application that needs to pass data back and
forth to the service. Will an IpcChannel defined in the service permit
this and how then does the application connect and transfer data? Does the
app open a pipe?
Named or unnamed? Is there an IPC mechanism in MFC, or is that really a
pipe?

Maybe I am just dense or went through the docs to quickly but I find lots
about sockets, pipes, and IPCs, but nothing that says that a pipe is an
IPC or can talk with an IPC channel.


Confused in Minnesota
Gary G. Little

IpcChannel is an implementation of a .Net Remoting channel, and as such,
can (normally) only be used to communicate between two .Net applications
using Remoting. The implementation apparently uses named pipes.

.Net remoting divides the equivalent of RPC/DCOM into several different
layers. There’s the layer that handles intercepting requests to create
objects (Activator) and invoke methods on them – that’s provided by the
runtime, and you have some control over how it works. Then there’s the
“formatting” layer, which handles marshaling and unmarshaling method
calls and their arguments / results. This layer is pluggable, and the
CLR provides several (BinaryFormatter, SoapFormatter, etc.). The next
layer down is the transport (“channels”), and this is also pluggable.

So, if you really wanted to, you could implement the other side of the
named pipe interface, and then deal with formatting / parsing the
messages so that you can interoperate with whichever Remoting formatter
you’re using. But that seems rather complex.

MFC doesn’t provide any IPC mechanisms – it’s mostly but not entirely a
GUI framework. You’ll have to talk directly to Win32 to build whatever
communication channel you want. There are a *lot* of options, of
course, and that’s pretty far outside the scope of NTDEV. But the short
story is that MFC doesn’t provide anything special. And second, make
sure .Net Remoting is really what you want to do here. You may be
better off using some other communications channel between your managed
and unmanaged components.

– arlie

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@seagate.com
Sent: Thursday, May 11, 2006 4:23 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Managed and un-managed code integration.

My managed code resides in the LocalSystem and is a service. The
un-managed code is an MFC application that needs to pass data back and
forth to the service. Will an IpcChannel defined in the service permit
this and how then does the application connect and transfer data? Does
the app open a pipe?
Named or unnamed? Is there an IPC mechanism in MFC, or is that really a
pipe?

Maybe I am just dense or went through the docs to quickly but I find
lots about sockets, pipes, and IPCs, but nothing that says that a pipe
is an IPC or can talk with an IPC channel.


Confused in Minnesota
Gary G. Little


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

> Named or unnamed? Is there an IPC mechanism in MFC, or is that really a

pipe?

There are named pipes in Win32.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com