Kernel mode to user mode communication

Hi,

I am developing a mini filter using the Microsoft IFS kit. My mini
filter communicates with a user mode service which contains certain business
logic. I have written the user mode service as a Windows NT service. The
communication is done using the standard api’s like
FltCreateCommunicationPort, FilterConnectCommunicationPort,
FilterSendMessage and FilterReplyMessage etc.

(I had initially posted the following same question on a java group but
did not get any answer). Can the user mode service be written in Java? I
mean, is it possible for the mini filter to communicate with a user mode
service written in Java? Can the Java service call the functions
FilterConnectCommunicationPort, FilterReplyMessage etc.?

Thanks in advance,

Vishal

Excuse me, but is this a question about whether java can call native
functions? If so, you are very much in the wrong newsgroup! Here’s a hint
for you however - read about JNI :slight_smile:

“Vishal Pai” wrote in message
news:xxxxx@ntfsd…
Hi,

I am developing a mini filter using the Microsoft IFS kit. My mini
filter communicates with a user mode service which contains certain business
logic. I have written the user mode service as a Windows NT service. The
communication is done using the standard api’s like
FltCreateCommunicationPort, FilterConnectCommunicationPort,
FilterSendMessage and FilterReplyMessage etc.

(I had initially posted the following same question on a java group but
did not get any answer). Can the user mode service be written in Java? I
mean, is it possible for the mini filter to communicate with a user mode
service written in Java? Can the Java service call the functions
FilterConnectCommunicationPort, FilterReplyMessage etc.?

Thanks in advance,
Vishal

No, an NT service cannot be in Java. However what you do in an NT
service is pretty much upto you, so you can start your java app if you
wish and call the whole setup a “Java service” .


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Vishal Pai
Sent: Sunday, April 02, 2006 10:29 PM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] Kernel mode to user mode communication

Hi,

I am developing a mini filter using the Microsoft IFS kit. My mini
filter communicates with a user mode service which contains certain
business logic. I have written the user mode service as a Windows NT
service. The communication is done using the standard api’s like
FltCreateCommunicationPort, FilterConnectCommunicationPort,
FilterSendMessage and FilterReplyMessage etc.

(I had initially posted the following same question on a java group
but did not get any answer). Can the user mode service be written in
Java? I mean, is it possible for the mini filter to communicate with a
user mode service written in Java? Can the Java service call the
functions FilterConnectCommunicationPort, FilterReplyMessage etc.?

Thanks in advance,

Vishal


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

You are currently subscribed to ntfsd as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Hi,

The approach I am interested is in not using JNI or any platform
dependent technology. I want my user mode to be platform independent and I
will port only the mini filter portion to other OS. (It is very simple to
communicate from the mini filter to the user mode service written in C++
using the IFS API’s. But according to my requirements the user mode service
has to be portable.).

Can I open a generic port using the mini filter (i.e. not using the
FltCreateCommunicationPort) for example, sockets? The user mode service will
just connect to this port and get data (something like sockets)? Is there
any other way to achieve this?

I was reading about the “Windows Sockets Direct Reference”. This
indicates that we can create sockets in the kernel mode. However including
the file “Ws2spi.h” gave me a lot of compilation errors like
‘CRITICAL_SECTION is undeclared identifier’ etc.

Am I missing something out here (regarding the approach and
compilation)? I am not sure if the Java code could finally read the data on
the port that is created by using this approach. I am also worried about the
synchronization issues that I will have to face if this approach is correct.

Please advice on the approach. Also, please let me know what I am
missing in compilation as well.

Thanks,

Vishal


From: Vishal Pai [mailto:xxxxx@persistent.co.in]
Sent: Monday, April 03, 2006 10:59 AM
To: ‘xxxxx@lists.osr.com’
Subject: Kernel mode to user mode communication

Hi,

I am developing a mini filter using the Microsoft IFS kit. My mini
filter communicates with a user mode service which contains certain business
logic. I have written the user mode service as a Windows NT service. The
communication is done using the standard api’s like
FltCreateCommunicationPort, FilterConnectCommunicationPort,
FilterSendMessage and FilterReplyMessage etc.

(I had initially posted the following same question on a java group but
did not get any answer). Can the user mode service be written in Java? I
mean, is it possible for the mini filter to communicate with a user mode
service written in Java? Can the Java service call the functions
FilterConnectCommunicationPort, FilterReplyMessage etc.?

Thanks in advance,

Vishal

This is a joke right? You cant do this. You cant write an Windows NT Service
without writing Native code. You cant port a Windows NT file system
minifilter to another operating system. You cant use filter manager ports
without native code. Just forget it now.

“Vishal Pai” wrote in message
news:xxxxx@ntfsd…
Hi,

The approach I am interested is in not using JNI or any platform
dependent technology. I want my user mode to be platform independent and I
will port only the mini filter portion to other OS. (It is very simple to
communicate from the mini filter to the user mode service written in C++
using the IFS API’s. But according to my requirements the user mode service
has to be portable.).

Can I open a generic port using the mini filter (i.e. not using the
FltCreateCommunicationPort) for example, sockets? The user mode service will
just connect to this port and get data (something like sockets)? Is there
any other way to achieve this?

I was reading about the “Windows Sockets Direct Reference”. This
indicates that we can create sockets in the kernel mode. However including
the file “Ws2spi.h” gave me a lot of compilation errors like
‘CRITICAL_SECTION is undeclared identifier’ etc.

Am I missing something out here (regarding the approach and
compilation)? I am not sure if the Java code could finally read the data on
the port that is created by using this approach. I am also worried about the
synchronization issues that I will have to face if this approach is correct.

Please advice on the approach. Also, please let me know what I am
missing in compilation as well.

Thanks,
Vishal

From: Vishal Pai [mailto:xxxxx@persistent.co.in]
Sent: Monday, April 03, 2006 10:59 AM
To: ‘xxxxx@lists.osr.com’
Subject: Kernel mode to user mode communication

Hi,

I am developing a mini filter using the Microsoft IFS kit. My mini
filter communicates with a user mode service which contains certain business
logic. I have written the user mode service as a Windows NT service. The
communication is done using the standard api’s like
FltCreateCommunicationPort, FilterConnectCommunicationPort,
FilterSendMessage and FilterReplyMessage etc.

(I had initially posted the following same question on a java group but
did not get any answer). Can the user mode service be written in Java? I
mean, is it possible for the mini filter to communicate with a user mode
service written in Java? Can the Java service call the functions
FilterConnectCommunicationPort, FilterReplyMessage etc.?

Thanks in advance,
Vishal

Hi,

By Java user mode service I do not mean a Windows NT service. It could
be a java application that is running continuously.

By porting the mini filter I meant that I would rewrite the kernel mode
portion for other OS. But the user mode application will remain the same.

I do not want to use filter manager ports. I want some generic mechanism
to communicate between the mini filter and the Java application.

Thanks,

Vishal


From: Vishal Pai [mailto:xxxxx@persistent.co.in]
Sent: Tuesday, April 04, 2006 9:22 PM
To: ‘xxxxx@lists.osr.com’
Subject: RE: Kernel mode to user mode communication

Hi,

The approach I am interested is in not using JNI or any platform
dependent technology. I want my user mode to be platform independent and I
will port only the mini filter portion to other OS. (It is very simple to
communicate from the mini filter to the user mode service written in C++
using the IFS API’s. But according to my requirements the user mode service
has to be portable.).

Can I open a generic port using the mini filter (i.e. not using the
FltCreateCommunicationPort) for example, sockets? The user mode service will
just connect to this port and get data (something like sockets)? Is there
any other way to achieve this?

I was reading about the “Windows Sockets Direct Reference”. This
indicates that we can create sockets in the kernel mode. However including
the file “Ws2spi.h” gave me a lot of compilation errors like
‘CRITICAL_SECTION is undeclared identifier’ etc.

Am I missing something out here (regarding the approach and
compilation)? I am not sure if the Java code could finally read the data on
the port that is created by using this approach. I am also worried about the
synchronization issues that I will have to face if this approach is correct.

Please advice on the approach. Also, please let me know what I am
missing in compilation as well.

Thanks,

Vishal


From: Vishal Pai [mailto:xxxxx@persistent.co.in]
Sent: Monday, April 03, 2006 10:59 AM
To: ‘xxxxx@lists.osr.com’
Subject: Kernel mode to user mode communication

Hi,

I am developing a mini filter using the Microsoft IFS kit. My mini
filter communicates with a user mode service which contains certain business
logic. I have written the user mode service as a Windows NT service. The
communication is done using the standard api’s like
FltCreateCommunicationPort, FilterConnectCommunicationPort,
FilterSendMessage and FilterReplyMessage etc.

(I had initially posted the following same question on a java group but
did not get any answer). Can the user mode service be written in Java? I
mean, is it possible for the mini filter to communicate with a user mode
service written in Java? Can the Java service call the functions
FilterConnectCommunicationPort, FilterReplyMessage etc.?

Thanks in advance,

Vishal

Vishal Pai wrote:

I do not want to use filter manager ports. I want some generic
mechanism to communicate between the mini filter and the Java application.

You need to write an NT Service to do the communication. If a Java
application then wants to communicate with the service that’s fine, but
that’s nothing to do with device driver development really.

Any attempt to do anything else is doomed to failure.

Tony

Well good luck. I think you will need to be ‘persistent’ in your research
but I do not think it will help you you are ‘persistent’ in posting java
questions here :slight_smile:

“Vishal Pai” wrote in message
news:xxxxx@ntfsd…
Hi,

By Java user mode service I do not mean a Windows NT service. It could
be a java application that is running continuously.

By porting the mini filter I meant that I would rewrite the kernel mode
portion for other OS. But the user mode application will remain the same.

I do not want to use filter manager ports. I want some generic mechanism
to communicate between the mini filter and the Java application.

Thanks,
Vishal

From: Vishal Pai [mailto:xxxxx@persistent.co.in]
Sent: Tuesday, April 04, 2006 9:22 PM
To: ‘xxxxx@lists.osr.com’
Subject: RE: Kernel mode to user mode communication

Hi,

The approach I am interested is in not using JNI or any platform
dependent technology. I want my user mode to be platform independent and I
will port only the mini filter portion to other OS. (It is very simple to
communicate from the mini filter to the user mode service written in C++
using the IFS API’s. But according to my requirements the user mode service
has to be portable.).

Can I open a generic port using the mini filter (i.e. not using the
FltCreateCommunicationPort) for example, sockets? The user mode service will
just connect to this port and get data (something like sockets)? Is there
any other way to achieve this?

I was reading about the “Windows Sockets Direct Reference”. This
indicates that we can create sockets in the kernel mode. However including
the file “Ws2spi.h” gave me a lot of compilation errors like
‘CRITICAL_SECTION is undeclared identifier’ etc.

Am I missing something out here (regarding the approach and
compilation)? I am not sure if the Java code could finally read the data on
the port that is created by using this approach. I am also worried about the
synchronization issues that I will have to face if this approach is correct.

Please advice on the approach. Also, please let me know what I am
missing in compilation as well.

Thanks,
Vishal

From: Vishal Pai [mailto:xxxxx@persistent.co.in]
Sent: Monday, April 03, 2006 10:59 AM
To: ‘xxxxx@lists.osr.com’
Subject: Kernel mode to user mode communication

Hi,

I am developing a mini filter using the Microsoft IFS kit. My mini
filter communicates with a user mode service which contains certain business
logic. I have written the user mode service as a Windows NT service. The
communication is done using the standard api’s like
FltCreateCommunicationPort, FilterConnectCommunicationPort,
FilterSendMessage and FilterReplyMessage etc.

(I had initially posted the following same question on a java group but
did not get any answer). Can the user mode service be written in Java? I
mean, is it possible for the mini filter to communicate with a user mode
service written in Java? Can the Java service call the functions
FilterConnectCommunicationPort, FilterReplyMessage etc.?

Thanks in advance,
Vishal

You don’t necessarily need a service to communicate with the driver, but
you do need native code. You can wrap the calls to Filter Manager in a
DLL that is called by JNI in process. If JNI is not an option, then
create a service as Tony suggested and implement a sockets protocol to
your application in that service.

While it is technically possible to create a sockets interface at the
kernel level using TDI, I can’t imagine why you’d want to do that just
for user-mode to kernel-mode communication. When it comes to drivers,
smaller and simpler is better. You are just asking for trouble.

In short, your “cross-platform” application can be in Java, but the
platform specific portion will likely contain a native user-mode portion
in addition to the kernel driver.

Peter Waldschmidt

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tony Hoyle
Sent: Tuesday, April 04, 2006 2:51 PM
To: Windows File Systems Devs Interest List
Subject: Re: [ntfsd] Kernel mode to user mode communication

Vishal Pai wrote:

I do not want to use filter manager ports. I want some generic
mechanism to communicate between the mini filter and the Java
application.

You need to write an NT Service to do the communication. If a Java
application then wants to communicate with the service that’s fine, but
that’s nothing to do with device driver development really.

Any attempt to do anything else is doomed to failure.

Tony


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

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

Thanks Peter, Tony and Lyndon. Your comments were really helpful. I had
become a bit optimistic after looking at the WspSocket api and the heading
‘Network Devices: Windows Driver Kit’ in MSDN.

I will now follow what you folks have said.

Thanks and Best Regards,

Vishal


From: Vishal Pai [mailto:xxxxx@persistent.co.in]
Sent: Tuesday, April 04, 2006 10:29 PM
To: ‘xxxxx@lists.osr.com’
Subject: RE: Kernel mode to user mode communication

Hi,

By Java user mode service I do not mean a Windows NT service. It could
be a java application that is running continuously.

By porting the mini filter I meant that I would rewrite the kernel mode
portion for other OS. But the user mode application will remain the same.

I do not want to use filter manager ports. I want some generic mechanism
to communicate between the mini filter and the Java application.

Thanks,

Vishal


From: Vishal Pai [mailto:xxxxx@persistent.co.in]
Sent: Tuesday, April 04, 2006 9:22 PM
To: ‘xxxxx@lists.osr.com’
Subject: RE: Kernel mode to user mode communication

Hi,

The approach I am interested is in not using JNI or any platform
dependent technology. I want my user mode to be platform independent and I
will port only the mini filter portion to other OS. (It is very simple to
communicate from the mini filter to the user mode service written in C++
using the IFS API’s. But according to my requirements the user mode service
has to be portable.).

Can I open a generic port using the mini filter (i.e. not using the
FltCreateCommunicationPort) for example, sockets? The user mode service will
just connect to this port and get data (something like sockets)? Is there
any other way to achieve this?

I was reading about the “Windows Sockets Direct Reference”. This
indicates that we can create sockets in the kernel mode. However including
the file “Ws2spi.h” gave me a lot of compilation errors like
‘CRITICAL_SECTION is undeclared identifier’ etc.

Am I missing something out here (regarding the approach and
compilation)? I am not sure if the Java code could finally read the data on
the port that is created by using this approach. I am also worried about the
synchronization issues that I will have to face if this approach is correct.

Please advice on the approach. Also, please let me know what I am
missing in compilation as well.

Thanks,

Vishal


From: Vishal Pai [mailto:xxxxx@persistent.co.in]
Sent: Monday, April 03, 2006 10:59 AM
To: ‘xxxxx@lists.osr.com’
Subject: Kernel mode to user mode communication

Hi,

I am developing a mini filter using the Microsoft IFS kit. My mini
filter communicates with a user mode service which contains certain business
logic. I have written the user mode service as a Windows NT service. The
communication is done using the standard api’s like
FltCreateCommunicationPort, FilterConnectCommunicationPort,
FilterSendMessage and FilterReplyMessage etc.

(I had initially posted the following same question on a java group but
did not get any answer). Can the user mode service be written in Java? I
mean, is it possible for the mini filter to communicate with a user mode
service written in Java? Can the Java service call the functions
FilterConnectCommunicationPort, FilterReplyMessage etc.?

Thanks in advance,

Vishal

Vishal

Good luck! It is not a difficult matter to write native code so you can
invoke a jvm inside a windows nt service. I think you might find however
that for systems level ‘applications’ java is not your best friend. You can
soon find you end up writing a lot of dreadful JNI glue code to allow you to
access the actual system features.

Cheers
Lyndon

“Vishal Pai” wrote in message
news:xxxxx@ntfsd…
Thanks Peter, Tony and Lyndon. Your comments were really helpful. I had
become a bit optimistic after looking at the WspSocket api and the heading
‘Network Devices: Windows Driver Kit’ in MSDN.

I will now follow what you folks have said.

Thanks and Best Regards,
Vishal

From: Vishal Pai [mailto:xxxxx@persistent.co.in]
Sent: Tuesday, April 04, 2006 10:29 PM
To: ‘xxxxx@lists.osr.com’
Subject: RE: Kernel mode to user mode communication

Hi,

By Java user mode service I do not mean a Windows NT service. It could
be a java application that is running continuously.

By porting the mini filter I meant that I would rewrite the kernel mode
portion for other OS. But the user mode application will remain the same.

I do not want to use filter manager ports. I want some generic mechanism
to communicate between the mini filter and the Java application.

Thanks,
Vishal

From: Vishal Pai [mailto:xxxxx@persistent.co.in]
Sent: Tuesday, April 04, 2006 9:22 PM
To: ‘xxxxx@lists.osr.com’
Subject: RE: Kernel mode to user mode communication

Hi,

The approach I am interested is in not using JNI or any platform
dependent technology. I want my user mode to be platform independent and I
will port only the mini filter portion to other OS. (It is very simple to
communicate from the mini filter to the user mode service written in C++
using the IFS API’s. But according to my requirements the user mode service
has to be portable.).

Can I open a generic port using the mini filter (i.e. not using the
FltCreateCommunicationPort) for example, sockets? The user mode service will
just connect to this port and get data (something like sockets)? Is there
any other way to achieve this?

I was reading about the “Windows Sockets Direct Reference”. This
indicates that we can create sockets in the kernel mode. However including
the file “Ws2spi.h” gave me a lot of compilation errors like
‘CRITICAL_SECTION is undeclared identifier’ etc.

Am I missing something out here (regarding the approach and
compilation)? I am not sure if the Java code could finally read the data on
the port that is created by using this approach. I am also worried about the
synchronization issues that I will have to face if this approach is correct.

Please advice on the approach. Also, please let me know what I am
missing in compilation as well.

Thanks,
Vishal

From: Vishal Pai [mailto:xxxxx@persistent.co.in]
Sent: Monday, April 03, 2006 10:59 AM
To: ‘xxxxx@lists.osr.com’
Subject: Kernel mode to user mode communication

Hi,

I am developing a mini filter using the Microsoft IFS kit. My mini
filter communicates with a user mode service which contains certain business
logic. I have written the user mode service as a Windows NT service. The
communication is done using the standard api’s like
FltCreateCommunicationPort, FilterConnectCommunicationPort,
FilterSendMessage and FilterReplyMessage etc.

(I had initially posted the following same question on a java group but
did not get any answer). Can the user mode service be written in Java? I
mean, is it possible for the mini filter to communicate with a user mode
service written in Java? Can the Java service call the functions
FilterConnectCommunicationPort, FilterReplyMessage etc.?

Thanks in advance,
Vishal

> did not get any answer). Can the user mode service be written in Java? I

mean, is it possible for the mini filter to communicate with a user mode
service written in Java? Can the Java service call the functions
FilterConnectCommunicationPort, FilterReplyMessage etc.?

It can, but with a major headache and a helper C/C++ DLL. I would write the
service in C/C++.

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

> dependent technology. I want my user mode to be platform independent and I

will port only the mini filter portion to other OS.

You will need an unportable Windows-only DLL file for your service anyway,
written in C++ or C and called via JNI by the portable service.

Also note that “portable” does not mean “Java”. Writing portable software in
C/C++ is also a major possibility :slight_smile: and I would prefer this to Java since Java
means VM, and I have some bit of distrust to Java VMs used in some exotic
contexts like the Windows service.

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