Hi,

I am trying to create a file system driver with support for live
notifications.

That is, when ever an application changes any portion of the data in an open
file, all other processes that has opened the same file should get notified
about the changes. (Similar to directory change notifications, but at a more
granular level of files.)

It seems all that i need to do is raise a notification in the IOWrite event
of my driver.

But I could not get how the kernel driver can inform the user mode
applications about the changes.
Should I have a user mode function that regularily polls the kernel
driver for the changes?
Or is there any way the user mode applications can "register" for some
callback and the kernel driver can invoke the callbacks right from the
IOWrite call ?

Which way is good/easy to implement?

Any guidance is greatly appreciated.

Yours,
P.Gopalakrishna.

Re: How to notify user mode applications from kernel mode drivers by euacela

euacela
Wed Nov 15 06:56:52 CST 2006

it can be done with events.
just make an event in the driverentry routine, with
iocreatenotificationevent and then open it in user mode and use
waitforsingle object, or you could just make an event in user mode and
send it in kernel mode via DeviceIoControl, reference it by handle and
then both user mode and kernel mode can change it;s state.
this is the best u can get in sycronization ;)
good luck
P.GopalaKrishna wrote:
> Hi,
>
> I am trying to create a file system driver with support for live
> notifications.
>
> That is, when ever an application changes any portion of the data in an open
> file, all other processes that has opened the same file should get notified
> about the changes. (Similar to directory change notifications, but at a more
> granular level of files.)
>
> It seems all that i need to do is raise a notification in the IOWrite event
> of my driver.
>
> But I could not get how the kernel driver can inform the user mode
> applications about the changes.
> Should I have a user mode function that regularily polls the kernel
> driver for the changes?
> Or is there any way the user mode applications can "register" for some
> callback and the kernel driver can invoke the callbacks right from the
> IOWrite call ?
>
> Which way is good/easy to implement?
>
> Any guidance is greatly appreciated.
>
> Yours,
> P.Gopalakrishna.


RE: How to notify user mode applications from kernel mode drivers by pavel_a

pavel_a
Wed Nov 15 11:53:01 CST 2006

Use NTFS change journal?

"P.GopalaKrishna" wrote:
> Hi,
>
> I am trying to create a file system driver with support for live
> notifications.
>
> That is, when ever an application changes any portion of the data in an open
> file, all other processes that has opened the same file should get notified
> about the changes. (Similar to directory change notifications, but at a more
> granular level of files.)
>
> It seems all that i need to do is raise a notification in the IOWrite event
> of my driver.
>
> But I could not get how the kernel driver can inform the user mode
> applications about the changes.
> Should I have a user mode function that regularily polls the kernel
> driver for the changes?
> Or is there any way the user mode applications can "register" for some
> callback and the kernel driver can invoke the callbacks right from the
> IOWrite call ?
>
> Which way is good/easy to implement?
>
> Any guidance is greatly appreciated.
>
> Yours,
> P.Gopalakrishna.

Re: How to notify user mode applications from kernel mode drivers by PGopalaKrishna

PGopalaKrishna
Wed Nov 15 23:22:02 CST 2006



"euacela@gmail.com" wrote:

> it can be done with events.
> just make an event in the driverentry routine, with
> iocreatenotificationevent and then open it in user mode and use
> waitforsingle object, or you could just make an event in user mode and
> send it in kernel mode via DeviceIoControl, reference it by handle and
> then both user mode and kernel mode can change it;s state.
> this is the best u can get in sycronization ;)
> good luck


Thank you very much for the suggestions. I would try to use it.

By the way, any idea how DirectoryChangeNotifications is implemented in
Win32? Does it use similar technique of events or any other?


Yours,
P.Gopalakrishna.

RE: How to notify user mode applications from kernel mode drivers by PGopalaKrishna

PGopalaKrishna
Wed Nov 15 23:23:01 CST 2006



"Pavel A." wrote:

> Use NTFS change journal?
>


Dear,

I would like to use that. But I am planning my driver to be compatible with
other file systems too (such as Fat, Ext2 etc..) - and I am not sure if all
of them provide journaling.

Yours,
P.Gopalakrishna.