Sharing memory between FSD and User-mode App ( App is in C#.NET)

HI All

How can I share a data structure between a FileSystem Driver and a User mode app, but the user mode is in C#.NET (WIndows Service) .

I’ve done this for VC++ App and FSD by using DeviceIoControl. It works fine. but I wanted to convert the same into C#.NET. How can I do that??

Please advice / can somebody give a sample code?.
Thank you in advance…

Regards
K.Raju

Try Pinvoke…

Matt

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Krishnama Raju
Sent: Wednesday, July 14, 2004 7:59 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] Sharing memory between FSD and User-mode App ( App is in
C#.NET)

HI All

How can I share a data structure between a FileSystem Driver and a
User mode app, but the user mode is in C#.NET (WIndows Service) .

I’ve done this for VC++ App and FSD by using DeviceIoControl. It
works fine. but I wanted to convert the same into C#.NET. How can I do
that??

Please advice / can somebody give a sample code?.
Thank you in advance…

Regards
K.Raju


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@bitarmor.com To unsubscribe
send a blank email to xxxxx@lists.osr.com

hello Raju
You’ve done this for VC++ App and FSD by using DeviceIoControl,
can you tell me the mothed?
Whether what I said bellow is right?
first, allocate a buffer in driver (nonpaged or paged?)
and through IOCTL, user_mode app can deal with the buffer, (Buffered i/o or
Direct i/o?)

Thanks:)

“Krishnama Raju” ??? news:xxxxx@ntfsd…

HI All

How can I share a data structure between a FileSystem Driver and a User mode
app, but the user mode is in C#.NET (WIndows Service) .

I’ve done this for VC++ App and FSD by using DeviceIoControl. It works fine.
but I wanted to convert the same into C#.NET. How can I do that??

Please advice / can somebody give a sample code?.
Thank you in advance…

Regards
K.Raju

in Vc++ I’ve done something like this…

* Create a data structure use it both the ends
* from user mode send an IOCTL to share the buffer
* in FSD allocate in nonpaged pool and create an MDL
and map it and copy the address to outputbuffer
* and in usermode caste the DWORD value (outputbuffer of DeviceIOControl) to the data structure…
* there on use it as a shared buffer…

But please can somebody help me on the same to do it on C#.NET ???
Suggest me the best solution…

thanks in advance
–K.Raju

-----Original Message-----
From: Zhang Chong [mailto:xxxxx@hotmail.com]
Sent: Wednesday, July 14, 2004 7:03 PM
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] Sharing memory between FSD and User-mode App ( App
is in C#.NET)

hello Raju
You’ve done this for VC++ App and FSD by using DeviceIoControl,
can you tell me the mothed?
Whether what I said bellow is right?
first, allocate a buffer in driver (nonpaged or paged?)
and through IOCTL, user_mode app can deal with the buffer, (Buffered i/o or
Direct i/o?)

Thanks:)

“Krishnama Raju” ??? news:xxxxx@ntfsd…

HI All

How can I share a data structure between a FileSystem Driver and a User mode
app, but the user mode is in C#.NET (WIndows Service) .

I’ve done this for VC++ App and FSD by using DeviceIoControl. It works fine.
but I wanted to convert the same into C#.NET. How can I do that??

Please advice / can somebody give a sample code?.
Thank you in advance…

Regards
K.Raju


Questions? First check the IFS FAQ at https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@inquesttechnologies.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

use this link
http://www.osronline.com/article.cfm?id=94

and code associated with that article

“Zhang Chong” ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ:
news:xxxxx@ntfsd…
> hello Raju
> You’ve done this for VC++ App and FSD by using DeviceIoControl,
> can you tell me the mothed?
> Whether what I said bellow is right?
> first, allocate a buffer in driver (nonpaged or paged?)
> and through IOCTL, user_mode app can deal with the buffer, (Buffered i/o
or
> Direct i/o?)
>
> Thanks:)
>
>
>
> “Krishnama Raju” ??? news:xxxxx@ntfsd…
>
> HI All
>
> How can I share a data structure between a FileSystem Driver and a User
mode
> app, but the user mode is in C#.NET (WIndows Service) .
>
> I’ve done this for VC++ App and FSD by using DeviceIoControl. It works
fine.
> but I wanted to convert the same into C#.NET. How can I do that??
>
> Please advice / can somebody give a sample code?.
> Thank you in advance…
>
> Regards
> K.Raju
>
>
>

[my apologies if this is a re-post - I’m not having a lot of joy with
Outlook express]

I asked a CLR-type about this recently, the solution I was pointed at was
not to use PInvoke and unsafe code because of the potential cost of the
marshalling as you cross from managed to unmanaged code. Rather the
suggestion was to use C++ to look at the unmanaged [shared] memory but to
create managed objects to pass off to the upper layers (written in C#) -
that advice would work for my architecture but ymmv. I’ve not investigated
(this is at best a backgroiund project) further so I cannot point at any
strong results.

If there is anyone from the CLR listening it would be great to have some
definitive guidance on how to bring managed code closer to the FSDs. I
don’t *like* writing application code, but if I have to I’d sooner write
managed code, and coding to three different environments will be a pain.

/rod