Can anyone direct me to documentation on how to write, or whether it is
feasible to consider writing, a kernel API function that permits a kenerl
component, such as a device or filter driver, to initiate communication with
a user-space service? I have a need to develop something like the Event Log
API that is available for device drivers or the WMI interface. I know that
these actually communicate with other kernel code, but I would really like
to send information to a service, without requiring that the service issuing
an IOCTL to the driver and waiting for a response.

-ken

Re: Writing kernel API functions by Don

Don
Thu Jun 17 11:13:07 CDT 2004

Well you seem to be putting a lot of requirements on your design without
justifying them. You state you want to communicate with a service without
requiring the service to issue calls. At some point or another your service
will have to issue a call to detect or collect the information, so why is
there a requirement to not have the sevice issue calls? You are just making
things more complex.

--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply

"Ken Allen" <nospamkendrhyd@sympatico.ca> wrote in message
news:%23Ey$FPIVEHA.1152@TK2MSFTNGP09.phx.gbl...
> Can anyone direct me to documentation on how to write, or whether it is
> feasible to consider writing, a kernel API function that permits a kenerl
> component, such as a device or filter driver, to initiate communication
with
> a user-space service? I have a need to develop something like the Event
Log
> API that is available for device drivers or the WMI interface. I know that
> these actually communicate with other kernel code, but I would really like
> to send information to a service, without requiring that the service
issuing
> an IOCTL to the driver and waiting for a response.
>
> -ken
>
>



Re: Writing kernel API functions by Ken

Ken
Thu Jun 17 11:53:29 CDT 2004

Perhaps I did not make myself clear. I apologize for being vague; some NDA
and confidentiality issues, but...

I do not want the service to have to issue any IOCTL to the driver at all.
There may be several drivers that want to use this service, and I do not
want to have to inform the service of every driver that may provide
information. There must be a dynamic many-drivers-to-one-service
configuration, not a one-service-to-specific-drivers configuration.

I want the driver to be able to execute a kernel API call that will,
directly or indirectly, deliver the data to the service. The information is
similar to an Event Log or WMI API call, but rather than have the
information stored in a 'log', I would like to deliver it more directly to
the service. The interface between the API and the service would serialize
any calls so they are delivered to the service in a controlled manner.

Can a device driver open a socket connection to a local service and send
packets and receive acknowledgements?

We considered the possibility of using WMI and developing the service as a
consumer, but two issiues get in the way: being able to consume from a
dynamic list of providers; and the fact that we are not defining any of our
components as WMI devices, but would only be using the WMI facility as a
pipeline to the service.

This is a very odd situation, and the volume of information may be very
high. What I would dearly love is an interface like the Event Log kernel API
that permits the driver to send a record with a predefined number of
binary/text column values and have it stored in a SQL Server or MSDE
database directly, and that is basically what the service shall
accomplish -- if I can determine how to send ansynchronous data records from
a dynamic and variable number of kernel drivers to the same database table
(or set of tables as some packets of information may have different
'shapes').

-ken

"Don Burn" <burn@stopspam.acm.org> wrote in message
news:10d3gpg4i441317@corp.supernews.com...
> Well you seem to be putting a lot of requirements on your design without
> justifying them. You state you want to communicate with a service without
> requiring the service to issue calls. At some point or another your
service
> will have to issue a call to detect or collect the information, so why is
> there a requirement to not have the sevice issue calls? You are just
making
> things more complex.
>
> --
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> Remove StopSpam from the email to reply
>



Re: Writing kernel API functions by Pavel

Pavel
Thu Jun 17 12:01:19 CDT 2004

First of all - despite of the popular belief, a driver can easily start an user mode service.
Just add it to dependencies of your driver's service - and it will auto start with the driver.
Then it can receive WMI events sent by the driver, or consume trace provided
by the driver and so on.

"Ken Allen" <nospamkendrhyd@sympatico.ca> wrote in message news:%23Ey$FPIVEHA.1152@TK2MSFTNGP09.phx.gbl...
> Can anyone direct me to documentation on how to write, or whether it is
> feasible to consider writing, a kernel API function that permits a kenerl
> component, such as a device or filter driver, to initiate communication with
> a user-space service? I have a need to develop something like the Event Log
> API that is available for device drivers or the WMI interface. I know that
> these actually communicate with other kernel code, but I would really like
> to send information to a service, without requiring that the service issuing
> an IOCTL to the driver and waiting for a response.
>
> -ken
>
>



Re: Writing kernel API functions by Don

Don
Thu Jun 17 12:05:45 CDT 2004

Ok, this does make more sense. Basically, I would create a "service
support driver" that handled the requests, then have the service interface
to it with the common IOCTL "inverted call" model. The "service support
driver" would export its services to other drivers in any of the common
driver to driver communication models:

1. Device Interfaces - probably the best approach since it allows for
notification of the "service support driver" loading and unloading.

2. Kernel mode DLL - simplest model for a "call"

3. IOCTL pointer block - the old reliable works on every version of
Windows back to NT 3.1


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply

"Ken Allen" <nospamkendrhyd@sympatico.ca> wrote in message
news:eu%23hcuIVEHA.1888@TK2MSFTNGP11.phx.gbl...
> Perhaps I did not make myself clear. I apologize for being vague; some NDA
> and confidentiality issues, but...
>
> I do not want the service to have to issue any IOCTL to the driver at all.
> There may be several drivers that want to use this service, and I do not
> want to have to inform the service of every driver that may provide
> information. There must be a dynamic many-drivers-to-one-service
> configuration, not a one-service-to-specific-drivers configuration.
>
> I want the driver to be able to execute a kernel API call that will,
> directly or indirectly, deliver the data to the service. The information
is
> similar to an Event Log or WMI API call, but rather than have the
> information stored in a 'log', I would like to deliver it more directly to
> the service. The interface between the API and the service would serialize
> any calls so they are delivered to the service in a controlled manner.
>
> Can a device driver open a socket connection to a local service and send
> packets and receive acknowledgements?
>
> We considered the possibility of using WMI and developing the service as a
> consumer, but two issiues get in the way: being able to consume from a
> dynamic list of providers; and the fact that we are not defining any of
our
> components as WMI devices, but would only be using the WMI facility as a
> pipeline to the service.
>
> This is a very odd situation, and the volume of information may be very
> high. What I would dearly love is an interface like the Event Log kernel
API
> that permits the driver to send a record with a predefined number of
> binary/text column values and have it stored in a SQL Server or MSDE
> database directly, and that is basically what the service shall
> accomplish -- if I can determine how to send ansynchronous data records
from
> a dynamic and variable number of kernel drivers to the same database table
> (or set of tables as some packets of information may have different
> 'shapes').
>
> -ken
>
> "Don Burn" <burn@stopspam.acm.org> wrote in message
> news:10d3gpg4i441317@corp.supernews.com...
> > Well you seem to be putting a lot of requirements on your design without
> > justifying them. You state you want to communicate with a service
without
> > requiring the service to issue calls. At some point or another your
> service
> > will have to issue a call to detect or collect the information, so why
is
> > there a requirement to not have the sevice issue calls? You are just
> making
> > things more complex.
> >
> > --
> > Don Burn (MVP, Windows DDK)
> > Windows 2k/XP/2k3 Filesystem and Driver Consulting
> > Remove StopSpam from the email to reply
> >
>
>



Re: Writing kernel API functions by Ken

Ken
Thu Jun 17 13:21:27 CDT 2004

Interesting, but not quite what I was thinking. I do not need the driver to
be able to start the service, nor am I clear on how to define this
dependency to which you refer.

What I need is a facility to have a service already running (boot time
issues notwithstanding) and permit a dynamic number of drivers to send
packets of data to the service, not have the driver ask for the information
from each individual driver.

-ken

"Pavel A." <pavel_a@geeklife.com> wrote in message
news:O6CpCxIVEHA.1292@TK2MSFTNGP10.phx.gbl...
> First of all - despite of the popular belief, a driver can easily start an
user mode service.
> Just add it to dependencies of your driver's service - and it will auto
start with the driver.
> Then it can receive WMI events sent by the driver, or consume trace
provided
> by the driver and so on.
>
> "Ken Allen" <nospamkendrhyd@sympatico.ca> wrote in message
news:%23Ey$FPIVEHA.1152@TK2MSFTNGP09.phx.gbl...
> > Can anyone direct me to documentation on how to write, or whether it is
> > feasible to consider writing, a kernel API function that permits a
kenerl
> > component, such as a device or filter driver, to initiate communication
with
> > a user-space service? I have a need to develop something like the Event
Log
> > API that is available for device drivers or the WMI interface. I know
that
> > these actually communicate with other kernel code, but I would really
like
> > to send information to a service, without requiring that the service
issuing
> > an IOCTL to the driver and waiting for a response.
> >
> > -ken
> >
> >
>
>



Re: Writing kernel API functions by Ken

Ken
Thu Jun 17 14:09:48 CDT 2004

Yes, I can see some the merit in what you are proposing here, although I am
still trying to work my way through the details (I have written many device
drivers for various devices, but mostly for VMS and UNIX, and I am quite new
to the Windows device driver environment. So forgive me if I do not
understand some of your specific references.

I have embedded some comments inline below.

Thank for for this reponse and assistance.

-ken

"Don Burn" <burn@stopspam.acm.org> wrote in message
news:10d3js6icaejpdb@corp.supernews.com...
> Ok, this does make more sense. Basically, I would create a "service
> support driver" that handled the requests, then have the service interface
> to it with the common IOCTL "inverted call" model. The "service support
> driver" would export its services to other drivers in any of the common
> driver to driver communication models:
>
I am presuming that he "inverted call" model is the case where the service
issues a generic IOCTL to the driver, which does not respond until it
requires processing from the service, in which case the 'command' is sent to
the service in the reponse to the IOCTL; and the response to the 'command'
is sent to the driver using a new IOCTL. The advantage in this case is that
there would be a single "service support driver" for the service to deal
with, greatly simplifying the user-kernel interface issues.

> 1. Device Interfaces - probably the best approach since it allows
for
> notification of the "service support driver" loading and unloading.
>

I presume that this is what you meant by exporting services (features) from
the "service support driver" to the other drivers. Could you clarify, or
direct me to documentation on, "device interfaces"? I am not certain what
this means specifically, how the "service support drvier" would differ from,
say, a filter driver, how one would configure this, or what the actual
drivers would have to do to send the 'packets' to the "service support
driver". What about serialization and synchronization of concurrent packets
from several drivers?

> 2. Kernel mode DLL - simplest model for a "call"
>

I can see where this makes sense, but I am not sure how to develop one. Are
kernel DLLs shared amoung the various drivers that link to them? So the code
could be used to synchronize/serialize the requests from the various
drivers?

> 3. IOCTL pointer block - the old reliable works on every version of
> Windows back to NT 3.1
>

Yes, I can see this approach, although it is likely the least desirable.
> --
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> Remove StopSpam from the email to reply
>
> "Ken Allen" <nospamkendrhyd@sympatico.ca> wrote in message
> news:eu%23hcuIVEHA.1888@TK2MSFTNGP11.phx.gbl...
> > Perhaps I did not make myself clear. I apologize for being vague; some
NDA
> > and confidentiality issues, but...
> >
> > I do not want the service to have to issue any IOCTL to the driver at
all.
> > There may be several drivers that want to use this service, and I do not
> > want to have to inform the service of every driver that may provide
> > information. There must be a dynamic many-drivers-to-one-service
> > configuration, not a one-service-to-specific-drivers configuration.
> >
> > I want the driver to be able to execute a kernel API call that will,
> > directly or indirectly, deliver the data to the service. The information
> is
> > similar to an Event Log or WMI API call, but rather than have the
> > information stored in a 'log', I would like to deliver it more directly
to
> > the service. The interface between the API and the service would
serialize
> > any calls so they are delivered to the service in a controlled manner.
> >
> > Can a device driver open a socket connection to a local service and send
> > packets and receive acknowledgements?
> >
> > We considered the possibility of using WMI and developing the service as
a
> > consumer, but two issiues get in the way: being able to consume from a
> > dynamic list of providers; and the fact that we are not defining any of
> our
> > components as WMI devices, but would only be using the WMI facility as a
> > pipeline to the service.
> >
> > This is a very odd situation, and the volume of information may be very
> > high. What I would dearly love is an interface like the Event Log kernel
> API
> > that permits the driver to send a record with a predefined number of
> > binary/text column values and have it stored in a SQL Server or MSDE
> > database directly, and that is basically what the service shall
> > accomplish -- if I can determine how to send ansynchronous data records
> from
> > a dynamic and variable number of kernel drivers to the same database
table
> > (or set of tables as some packets of information may have different
> > 'shapes').
> >
> > -ken
> >
> > "Don Burn" <burn@stopspam.acm.org> wrote in message
> > news:10d3gpg4i441317@corp.supernews.com...
> > > Well you seem to be putting a lot of requirements on your design
without
> > > justifying them. You state you want to communicate with a service
> without
> > > requiring the service to issue calls. At some point or another your
> > service
> > > will have to issue a call to detect or collect the information, so why
> is
> > > there a requirement to not have the sevice issue calls? You are just
> > making
> > > things more complex.
> > >
> > > --
> > > Don Burn (MVP, Windows DDK)
> > > Windows 2k/XP/2k3 Filesystem and Driver Consulting
> > > Remove StopSpam from the email to reply
> > >
> >
> >
>
>



Re: Writing kernel API functions by Don

Don
Thu Jun 17 14:22:38 CDT 2004

Replies inline:

"Ken Allen" <nospamkendrhyd@sympatico.ca> wrote in message
news:%231Fan6JVEHA.1292@TK2MSFTNGP10.phx.gbl...
> Yes, I can see some the merit in what you are proposing here, although I
am
> still trying to work my way through the details (I have written many
device
> drivers for various devices, but mostly for VMS and UNIX, and I am quite
new
> to the Windows device driver environment. So forgive me if I do not
> understand some of your specific references.
>
> I have embedded some comments inline below.
>
> Thank for for this reponse and assistance.
>
> -ken
>
> "Don Burn" <burn@stopspam.acm.org> wrote in message
> news:10d3js6icaejpdb@corp.supernews.com...
> > Ok, this does make more sense. Basically, I would create a "service
> > support driver" that handled the requests, then have the service
interface
> > to it with the common IOCTL "inverted call" model. The "service support
> > driver" would export its services to other drivers in any of the common
> > driver to driver communication models:
> >
> I am presuming that he "inverted call" model is the case where the service
> issues a generic IOCTL to the driver, which does not respond until it
> requires processing from the service, in which case the 'command' is sent
to
> the service in the reponse to the IOCTL; and the response to the 'command'
> is sent to the driver using a new IOCTL. The advantage in this case is
that
> there would be a single "service support driver" for the service to deal
> with, greatly simplifying the user-kernel interface issues.

Yes the inverted call is as you suspected. The idea here would be to use a
single driver to simplify the interface.

> > 1. Device Interfaces - probably the best approach since it allows
> for
> > notification of the "service support driver" loading and unloading.
> >
>
> I presume that this is what you meant by exporting services (features)
from
> the "service support driver" to the other drivers. Could you clarify, or
> direct me to documentation on, "device interfaces"? I am not certain what
> this means specifically, how the "service support drvier" would differ
from,
> say, a filter driver, how one would configure this, or what the actual
> drivers would have to do to send the 'packets' to the "service support
> driver". What about serialization and synchronization of concurrent
packets
> from several drivers?

See IoRegisterPlugPlayNotification and IoRegisterDeviceInterface.

> > 2. Kernel mode DLL - simplest model for a "call"
> >
>
> I can see where this makes sense, but I am not sure how to develop one.
Are
> kernel DLLs shared amoung the various drivers that link to them? So the
code
> could be used to synchronize/serialize the requests from the various
> drivers?

Yes, this is a single DLL for all drivers, the basics are identical to a
driver, the
specifics are covered at http://www.osronline.com/article.cfm?id=171

> > 3. IOCTL pointer block - the old reliable works on every version
of
> > Windows back to NT 3.1
> >
>
> Yes, I can see this approach, although it is likely the least desirable.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply



Re: Writing kernel API functions by Alexander

Alexander
Thu Jun 17 17:34:23 CDT 2004

What about a named pipe opened in the service and the drivers issuing named
pipe transactions?

"Ken Allen" <nospamkendrhyd@sympatico.ca> wrote in message
news:e4vOmfJVEHA.2844@TK2MSFTNGP12.phx.gbl...
> Interesting, but not quite what I was thinking. I do not need the driver
to
> be able to start the service, nor am I clear on how to define this
> dependency to which you refer.
>
> What I need is a facility to have a service already running (boot time
> issues notwithstanding) and permit a dynamic number of drivers to send
> packets of data to the service, not have the driver ask for the
information
> from each individual driver.
>
> -ken
>
> "Pavel A." <pavel_a@geeklife.com> wrote in message
> news:O6CpCxIVEHA.1292@TK2MSFTNGP10.phx.gbl...
> > First of all - despite of the popular belief, a driver can easily start
an
> user mode service.
> > Just add it to dependencies of your driver's service - and it will auto
> start with the driver.
> > Then it can receive WMI events sent by the driver, or consume trace
> provided
> > by the driver and so on.
> >
> > "Ken Allen" <nospamkendrhyd@sympatico.ca> wrote in message
> news:%23Ey$FPIVEHA.1152@TK2MSFTNGP09.phx.gbl...
> > > Can anyone direct me to documentation on how to write, or whether it
is
> > > feasible to consider writing, a kernel API function that permits a
> kenerl
> > > component, such as a device or filter driver, to initiate
communication
> with
> > > a user-space service? I have a need to develop something like the
Event
> Log
> > > API that is available for device drivers or the WMI interface. I know
> that
> > > these actually communicate with other kernel code, but I would really
> like
> > > to send information to a service, without requiring that the service
> issuing
> > > an IOCTL to the driver and waiting for a response.
> > >
> > > -ken
> > >
> > >
> >
> >
>
>



Re: Writing kernel API functions by Mark

Mark
Thu Jun 17 18:22:09 CDT 2004

Why not just use the existing WMI facilities, as they appear to provide
exactly the sort of service you require.

--

=====================
Mark Roddy
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com
markr@hollistech.com


"Ken Allen" <nospamkendrhyd@sympatico.ca> wrote in message
news:eu%23hcuIVEHA.1888@TK2MSFTNGP11.phx.gbl...
> Perhaps I did not make myself clear. I apologize for being vague; some NDA
> and confidentiality issues, but...
>
> I do not want the service to have to issue any IOCTL to the driver at all.
> There may be several drivers that want to use this service, and I do not
> want to have to inform the service of every driver that may provide
> information. There must be a dynamic many-drivers-to-one-service
> configuration, not a one-service-to-specific-drivers configuration.
>
> I want the driver to be able to execute a kernel API call that will,
> directly or indirectly, deliver the data to the service. The information
is
> similar to an Event Log or WMI API call, but rather than have the
> information stored in a 'log', I would like to deliver it more directly to
> the service. The interface between the API and the service would serialize
> any calls so they are delivered to the service in a controlled manner.
>
> Can a device driver open a socket connection to a local service and send
> packets and receive acknowledgements?
>
> We considered the possibility of using WMI and developing the service as a
> consumer, but two issiues get in the way: being able to consume from a
> dynamic list of providers; and the fact that we are not defining any of
our
> components as WMI devices, but would only be using the WMI facility as a
> pipeline to the service.
>
> This is a very odd situation, and the volume of information may be very
> high. What I would dearly love is an interface like the Event Log kernel
API
> that permits the driver to send a record with a predefined number of
> binary/text column values and have it stored in a SQL Server or MSDE
> database directly, and that is basically what the service shall
> accomplish -- if I can determine how to send ansynchronous data records
from
> a dynamic and variable number of kernel drivers to the same database table
> (or set of tables as some packets of information may have different
> 'shapes').
>
> -ken
>
> "Don Burn" <burn@stopspam.acm.org> wrote in message
> news:10d3gpg4i441317@corp.supernews.com...
> > Well you seem to be putting a lot of requirements on your design without
> > justifying them. You state you want to communicate with a service
without
> > requiring the service to issue calls. At some point or another your
> service
> > will have to issue a call to detect or collect the information, so why
is
> > there a requirement to not have the sevice issue calls? You are just
> making
> > things more complex.
> >
> > --
> > Don Burn (MVP, Windows DDK)
> > Windows 2k/XP/2k3 Filesystem and Driver Consulting
> > Remove StopSpam from the email to reply
> >
>
>



Re: Writing kernel API functions by Ken

Ken
Fri Jun 18 05:51:29 CDT 2004

First, our drivers have no WMI presence whatsoever, and I am concerned with
how the devices would appear in any 'console' tool (like HP OpenView). I do
not understand the inner workings of WMI and how it is actually used by the
management tools to be able to determine whether there are any negative
aspects to merely using it to pass entries to a private consumer. My
understanding is that if I use WMI to simply pass packets to a private
consumer, any and every other consumer, including OpenView and other tools,
are also capable of 'seeing' those entries, and since these packets are not
intended to look like WMI information this could be confusing.

The WMI code also appears relatively complicated (registering sources and
the like), and it is not clear how efficient it is.

-ken

"Mark Roddy" <markr@hollistech.com> wrote in message
news:uvuPrHMVEHA.3336@TK2MSFTNGP11.phx.gbl...
> Why not just use the existing WMI facilities, as they appear to provide
> exactly the sort of service you require.
>
> --
>
> =====================
> Mark Roddy
> Windows 2003/XP/2000 Consulting
> Hollis Technology Solutions 603-321-1032
> www.hollistech.com
> markr@hollistech.com
>
>



Re: Writing kernel API functions by Ken

Ken
Fri Jun 18 05:54:56 CDT 2004

Hmmm. Can one open the client end of a named pipe in kernel code and send
messages? This is interesting. Of course this would mean that every driver
would have to access the same code (either common source or a kernel DLL)
that would provide the common functionality. Still, this is an interesting
thought. Any examples of how to use the named pipe from inside a kernel
component?

-ken

"Alexander Grigoriev" <alegr@earthlink.net> wrote in message
news:eDF$%23sLVEHA.3788@TK2MSFTNGP12.phx.gbl...
> What about a named pipe opened in the service and the drivers issuing
named
> pipe transactions?
>
> "Ken Allen" <nospamkendrhyd@sympatico.ca> wrote in message
> news:e4vOmfJVEHA.2844@TK2MSFTNGP12.phx.gbl...
> > Interesting, but not quite what I was thinking. I do not need the driver
> to
> > be able to start the service, nor am I clear on how to define this
> > dependency to which you refer.
> >
> > What I need is a facility to have a service already running (boot time
> > issues notwithstanding) and permit a dynamic number of drivers to send
> > packets of data to the service, not have the driver ask for the
> information
> > from each individual driver.
> >
> > -ken
> >
<snipped/>



Re: Writing kernel API functions by Doron

Doron
Fri Jun 18 09:52:05 CDT 2004

WMI can be used to pass blobs. If the tool doesn't know what the
information is (since it is ID'ed by a GUID and is typed), it should ignore
it. various MS stacks use WMI to push and pull custom data throughout the
system. Apps like OpenView have to handle that already.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Ken Allen" <nospamkendrhyd@sympatico.ca> wrote in message
news:eBMy0ISVEHA.4048@TK2MSFTNGP12.phx.gbl...
> First, our drivers have no WMI presence whatsoever, and I am concerned
with
> how the devices would appear in any 'console' tool (like HP OpenView). I
do
> not understand the inner workings of WMI and how it is actually used by
the
> management tools to be able to determine whether there are any negative
> aspects to merely using it to pass entries to a private consumer. My
> understanding is that if I use WMI to simply pass packets to a private
> consumer, any and every other consumer, including OpenView and other
tools,
> are also capable of 'seeing' those entries, and since these packets are
not
> intended to look like WMI information this could be confusing.
>
> The WMI code also appears relatively complicated (registering sources and
> the like), and it is not clear how efficient it is.
>
> -ken
>
> "Mark Roddy" <markr@hollistech.com> wrote in message
> news:uvuPrHMVEHA.3336@TK2MSFTNGP11.phx.gbl...
> > Why not just use the existing WMI facilities, as they appear to provide
> > exactly the sort of service you require.
> >
> > --
> >
> > =====================
> > Mark Roddy
> > Windows 2003/XP/2000 Consulting
> > Hollis Technology Solutions 603-321-1032
> > www.hollistech.com
> > markr@hollistech.com
> >
> >
>
>



Re: Writing kernel API functions by Peter

Peter
Fri Jun 18 12:36:13 CDT 2004

You could probably do it. You'd almost most certainly have to do the write
a passive-level and in a context in which you can block the thread. This
would probably mean spooling off your own worker thread in order to get the
data across.

it will probably also be less efficient then having your service call
ReadFile on the shared kernel compoent and returning the data yourself, both
in terms of how fast you can move data and in terms of the number of system
resources you'll need to chew up to make use of it.

-p

--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Ken Allen" <nospamkendrhyd@sympatico.ca> wrote in message
news:udYYwKSVEHA.3380@TK2MSFTNGP11.phx.gbl...
> Hmmm. Can one open the client end of a named pipe in kernel code and send
> messages? This is interesting. Of course this would mean that every driver
> would have to access the same code (either common source or a kernel DLL)
> that would provide the common functionality. Still, this is an interesting
> thought. Any examples of how to use the named pipe from inside a kernel
> component?
>
> -ken
>
> "Alexander Grigoriev" <alegr@earthlink.net> wrote in message
> news:eDF$%23sLVEHA.3788@TK2MSFTNGP12.phx.gbl...
>> What about a named pipe opened in the service and the drivers issuing
> named
>> pipe transactions?
>>
>> "Ken Allen" <nospamkendrhyd@sympatico.ca> wrote in message
>> news:e4vOmfJVEHA.2844@TK2MSFTNGP12.phx.gbl...
>> > Interesting, but not quite what I was thinking. I do not need the
>> > driver
>> to
>> > be able to start the service, nor am I clear on how to define this
>> > dependency to which you refer.
>> >
>> > What I need is a facility to have a service already running (boot time
>> > issues notwithstanding) and permit a dynamic number of drivers to send
>> > packets of data to the service, not have the driver ask for the
>> information
>> > from each individual driver.
>> >
>> > -ken
>> >
> <snipped/>
>
>



Re: Writing kernel API functions by Ken

Ken
Tue Jun 22 06:54:19 CDT 2004

Thank you for your responses.



In general, what are your feelings toward using WMI to achieve this instead
of a custom "service support" driver? I know that the latter would provide
us with more direct control and influence over the actual processing, and
permit us to control the level of 'store and forward' if the service is not
running, but the WMI interface already exists.



The largest two problems I see with WMI are the pollution of the WMI space
with messages that have nothing to do with WMI, and the non-deterministic
delivery mechanism. Our driver can be certain whether the message was
delivered to WMI, but not whether the consumer is active or whether the
consumer received the message. If the consumer terminates and is restarted,
it seems that messages that arrived in the meantime are likely to be lost.



Could you share your thoughts on this one?

-ken

"Don Burn" <burn@stopspam.acm.org> wrote in message
news:10d3rss70rq23f2@corp.supernews.com...
> Replies inline:
>
> "Ken Allen" <nospamkendrhyd@sympatico.ca> wrote in message
> news:%231Fan6JVEHA.1292@TK2MSFTNGP10.phx.gbl...
> > Yes, I can see some the merit in what you are proposing here, although I
> am
> > still trying to work my way through the details (I have written many
> device
> > drivers for various devices, but mostly for VMS and UNIX, and I am quite
> new
> > to the Windows device driver environment. So forgive me if I do not
> > understand some of your specific references.
> >
> > I have embedded some comments inline below.
> >
> > Thank for for this reponse and assistance.
> >
> > -ken
> >
> > "Don Burn" <burn@stopspam.acm.org> wrote in message
> > news:10d3js6icaejpdb@corp.supernews.com...
> > > Ok, this does make more sense. Basically, I would create a "service
> > > support driver" that handled the requests, then have the service
> interface
> > > to it with the common IOCTL "inverted call" model. The "service
support
> > > driver" would export its services to other drivers in any of the
common
> > > driver to driver communication models:
> > >
> > I am presuming that he "inverted call" model is the case where the
service
> > issues a generic IOCTL to the driver, which does not respond until it
> > requires processing from the service, in which case the 'command' is
sent
> to
> > the service in the reponse to the IOCTL; and the response to the
'command'
> > is sent to the driver using a new IOCTL. The advantage in this case is
> that
> > there would be a single "service support driver" for the service to deal
> > with, greatly simplifying the user-kernel interface issues.
>
> Yes the inverted call is as you suspected. The idea here would be to use
a
> single driver to simplify the interface.
>
> > > 1. Device Interfaces - probably the best approach since it
allows
> > for
> > > notification of the "service support driver" loading and unloading.
> > >
> >
> > I presume that this is what you meant by exporting services (features)
> from
> > the "service support driver" to the other drivers. Could you clarify, or
> > direct me to documentation on, "device interfaces"? I am not certain
what
> > this means specifically, how the "service support drvier" would differ
> from,
> > say, a filter driver, how one would configure this, or what the actual
> > drivers would have to do to send the 'packets' to the "service support
> > driver". What about serialization and synchronization of concurrent
> packets
> > from several drivers?
>
> See IoRegisterPlugPlayNotification and IoRegisterDeviceInterface.
>
> > > 2. Kernel mode DLL - simplest model for a "call"
> > >
> >
> > I can see where this makes sense, but I am not sure how to develop one.
> Are
> > kernel DLLs shared amoung the various drivers that link to them? So the
> code
> > could be used to synchronize/serialize the requests from the various
> > drivers?
>
> Yes, this is a single DLL for all drivers, the basics are identical to a
> driver, the
> specifics are covered at http://www.osronline.com/article.cfm?id=171
>
> > > 3. IOCTL pointer block - the old reliable works on every
version
> of
> > > Windows back to NT 3.1
> > >
> >
> > Yes, I can see this approach, although it is likely the least desirable.
>
>
> --
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> Remove StopSpam from the email to reply
>
>



Re: Writing kernel API functions by Peter

Peter
Tue Jun 22 11:17:37 CDT 2004

how is the "non-determinism" problem you point out with WMI addressed in
your home-built solution? Are you considering a two-phase commit between
the driver and the service where the service asks for the outstanding events
and then tells you you can clear them once it's written them out somewhere?
How are you planning to do flow-control on events when your service gets
delayed for some reason and can't find processor time or memory to get the
requests out of the driver queue fast enough?

i'm not trying to criticize your plan, i'm just pointing out that i don't
think the non-determinisim is only an aspect of WMI.

-p

--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Ken Allen" <nospamkendrhyd@sympatico.ca> wrote in message
news:exRPn%23EWEHA.1356@TK2MSFTNGP09.phx.gbl...
> Thank you for your responses.
>
>
>
> In general, what are your feelings toward using WMI to achieve this
> instead
> of a custom "service support" driver? I know that the latter would provide
> us with more direct control and influence over the actual processing, and
> permit us to control the level of 'store and forward' if the service is
> not
> running, but the WMI interface already exists.
>
>
>
> The largest two problems I see with WMI are the pollution of the WMI space
> with messages that have nothing to do with WMI, and the non-deterministic
> delivery mechanism. Our driver can be certain whether the message was
> delivered to WMI, but not whether the consumer is active or whether the
> consumer received the message. If the consumer terminates and is
> restarted,
> it seems that messages that arrived in the meantime are likely to be lost.
>
>
>
> Could you share your thoughts on this one?
>
> -ken
>
> "Don Burn" <burn@stopspam.acm.org> wrote in message
> news:10d3rss70rq23f2@corp.supernews.com...
>> Replies inline:
>>
>> "Ken Allen" <nospamkendrhyd@sympatico.ca> wrote in message
>> news:%231Fan6JVEHA.1292@TK2MSFTNGP10.phx.gbl...
>> > Yes, I can see some the merit in what you are proposing here, although
>> > I
>> am
>> > still trying to work my way through the details (I have written many
>> device
>> > drivers for various devices, but mostly for VMS and UNIX, and I am
>> > quite
>> new
>> > to the Windows device driver environment. So forgive me if I do not
>> > understand some of your specific references.
>> >
>> > I have embedded some comments inline below.
>> >
>> > Thank for for this reponse and assistance.
>> >
>> > -ken
>> >
>> > "Don Burn" <burn@stopspam.acm.org> wrote in message
>> > news:10d3js6icaejpdb@corp.supernews.com...
>> > > Ok, this does make more sense. Basically, I would create a "service
>> > > support driver" that handled the requests, then have the service
>> interface
>> > > to it with the common IOCTL "inverted call" model. The "service
> support
>> > > driver" would export its services to other drivers in any of the
> common
>> > > driver to driver communication models:
>> > >
>> > I am presuming that he "inverted call" model is the case where the
> service
>> > issues a generic IOCTL to the driver, which does not respond until it
>> > requires processing from the service, in which case the 'command' is
> sent
>> to
>> > the service in the reponse to the IOCTL; and the response to the
> 'command'
>> > is sent to the driver using a new IOCTL. The advantage in this case is
>> that
>> > there would be a single "service support driver" for the service to
>> > deal
>> > with, greatly simplifying the user-kernel interface issues.
>>
>> Yes the inverted call is as you suspected. The idea here would be to use
> a
>> single driver to simplify the interface.
>>
>> > > 1. Device Interfaces - probably the best approach since it
> allows
>> > for
>> > > notification of the "service support driver" loading and unloading.
>> > >
>> >
>> > I presume that this is what you meant by exporting services (features)
>> from
>> > the "service support driver" to the other drivers. Could you clarify,
>> > or
>> > direct me to documentation on, "device interfaces"? I am not certain
> what
>> > this means specifically, how the "service support drvier" would differ
>> from,
>> > say, a filter driver, how one would configure this, or what the actual
>> > drivers would have to do to send the 'packets' to the "service support
>> > driver". What about serialization and synchronization of concurrent
>> packets
>> > from several drivers?
>>
>> See IoRegisterPlugPlayNotification and IoRegisterDeviceInterface.
>>
>> > > 2. Kernel mode DLL - simplest model for a "call"
>> > >
>> >
>> > I can see where this makes sense, but I am not sure how to develop one.
>> Are
>> > kernel DLLs shared amoung the various drivers that link to them? So the
>> code
>> > could be used to synchronize/serialize the requests from the various
>> > drivers?
>>
>> Yes, this is a single DLL for all drivers, the basics are identical to a
>> driver, the
>> specifics are covered at http://www.osronline.com/article.cfm?id=171
>>
>> > > 3. IOCTL pointer block - the old reliable works on every
> version
>> of
>> > > Windows back to NT 3.1
>> > >
>> >
>> > Yes, I can see this approach, although it is likely the least
>> > desirable.
>>
>>
>> --
>> Don Burn (MVP, Windows DDK)
>> Windows 2k/XP/2k3 Filesystem and Driver Consulting
>> Remove StopSpam from the email to reply
>>
>>
>
>



Re: Writing kernel API functions by Ken

Ken
Tue Jun 22 13:51:16 CDT 2004

The thought at this time is to permit the "service support" driver act as a
store-and-forward with a reasonably large amount of space for holding
pending messages. If this pending space becomes full, then we would have a
problem, but by making this large enough and taking steps to ensure the
service is running properly we hope to minimize the impact.

When the service asks for information from the driver, we expect to pass
back all of the currently pending messages (if there are none, then the
request will stall until there is one), rather than always passing one
message at a time. The service will then process these messages as quickly
as possible and then ask for more. As each block of messages is processed by
the service, it would inform the "service support" driver, who would then
remove them from the buffer to make space for more. We are looing into
several methods to achieve this.

If the service were too slow in its processing, then this would create a
severe problem, you are correct, and this would be common to all approaches.
So we must be careful to ensure that the code is efficient and fast enough !
;-)

With the WMI approach, however, we have no mechanism to know when the
consumer has, or even if a consumer ever did, retrieve the message from the
WMI repository. The documentation is a bit scanty, but we came across
several references that have lead us to believe that messages sent to WMI
that are not collected by a consumer within a reasonable amount of time are
simply discarded. The wording in some places was vague, so we are left not
knowing whether the messages are discarded if there is no consumer waiting
for them, or if simply based on time. There is a reference that indicated
that a newly launched consumer might only collect messages from that point
forward, which implied that the messages do not remain in the repository for
very long and that there is no facility for querying historical information.

The specific messages we need to deal with are rather critical, being more
of an audit trail of specific activities, and it is not permitted that some
messages be dropped. If the "service support" driver detects that the pengin
message area is becoming full, then we may be able to put our other drivers
in a read-only state, thus preventing the creation of new messages for a
period of time, but that means the "support driver" must be able to detect
this condition and report it to the initiating drivers. Unfortunately the
size of the messages involved prevents us from using the Event Log kernel
API calls, as these limit us to creating Event Log Entries of no more than
about 150 bytes of data, and some of the messages we need to record are
significantly large than this -- and the Event Log Entries do not provide
the required number of unique 'columns' by which to identify and search the
data. Hence we are considering a service that records into an MSDE or SQL
Server database and a single "service support" driver that collects the
messages from the dynamic number of initiating drivers.

I hope this clarifies things.

-ken

"Peter Wieland [MSFT]" <peterwie@online.microsoft.com> wrote in message
news:OQWTwRHWEHA.2340@TK2MSFTNGP09.phx.gbl...
> how is the "non-determinism" problem you point out with WMI addressed in
> your home-built solution? Are you considering a two-phase commit between
> the driver and the service where the service asks for the outstanding
events
> and then tells you you can clear them once it's written them out
somewhere?
> How are you planning to do flow-control on events when your service gets
> delayed for some reason and can't find processor time or memory to get the
> requests out of the driver queue fast enough?
>
> i'm not trying to criticize your plan, i'm just pointing out that i don't
> think the non-determinisim is only an aspect of WMI.
>
> -p
>
> --
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> "Ken Allen" <nospamkendrhyd@sympatico.ca> wrote in message
> news:exRPn%23EWEHA.1356@TK2MSFTNGP09.phx.gbl...
> > Thank you for your responses.
> >
> >
> >
> > In general, what are your feelings toward using WMI to achieve this
> > instead
> > of a custom "service support" driver? I know that the latter would
provide
> > us with more direct control and influence over the actual processing,
and
> > permit us to control the level of 'store and forward' if the service is
> > not
> > running, but the WMI interface already exists.
> >
> >
> >
> > The largest two problems I see with WMI are the pollution of the WMI
space
> > with messages that have nothing to do with WMI, and the
non-deterministic
> > delivery mechanism. Our driver can be certain whether the message was
> > delivered to WMI, but not whether the consumer is active or whether the
> > consumer received the message. If the consumer terminates and is
> > restarted,
> > it seems that messages that arrived in the meantime are likely to be
lost.
> >
> >
> >
> > Could you share your thoughts on this one?
> >
> > -ken
> >
> > "Don Burn" <burn@stopspam.acm.org> wrote in message
> > news:10d3rss70rq23f2@corp.supernews.com...
> >> Replies inline:
> >>
> >> "Ken Allen" <nospamkendrhyd@sympatico.ca> wrote in message
> >> news:%231Fan6JVEHA.1292@TK2MSFTNGP10.phx.gbl...
> >> > Yes, I can see some the merit in what you are proposing here,
although
> >> > I
> >> am
> >> > still trying to work my way through the details (I have written many
> >> device
> >> > drivers for various devices, but mostly for VMS and UNIX, and I am
> >> > quite
> >> new
> >> > to the Windows device driver environment. So forgive me if I do not
> >> > understand some of your specific references.
> >> >
> >> > I have embedded some comments inline below.
> >> >
> >> > Thank for for this reponse and assistance.
> >> >
> >> > -ken
> >> >
> >> > "Don Burn" <burn@stopspam.acm.org> wrote in message
> >> > news:10d3js6icaejpdb@corp.supernews.com...
> >> > > Ok, this does make more sense. Basically, I would create a
"service
> >> > > support driver" that handled the requests, then have the service
> >> interface
> >> > > to it with the common IOCTL "inverted call" model. The "service
> > support
> >> > > driver" would export its services to other drivers in any of the
> > common
> >> > > driver to driver communication models:
> >> > >
> >> > I am presuming that he "inverted call" model is the case where the
> > service
> >> > issues a generic IOCTL to the driver, which does not respond until it
> >> > requires processing from the service, in which case the 'command' is
> > sent
> >> to
> >> > the service in the reponse to the IOCTL; and the response to the
> > 'command'
> >> > is sent to the driver using a new IOCTL. The advantage in this case
is
> >> that
> >> > there would be a single "service support driver" for the service to
> >> > deal
> >> > with, greatly simplifying the user-kernel interface issues.
> >>
> >> Yes the inverted call is as you suspected. The idea here would be to
use
> > a
> >> single driver to simplify the interface.
> >>
> >> > > 1. Device Interfaces - probably the best approach since it
> > allows
> >> > for
> >> > > notification of the "service support driver" loading and unloading.
> >> > >
> >> >
> >> > I presume that this is what you meant by exporting services
(features)
> >> from
> >> > the "service support driver" to the other drivers. Could you clarify,
> >> > or
> >> > direct me to documentation on, "device interfaces"? I am not certain
> > what
> >> > this means specifically, how the "service support drvier" would
differ
> >> from,
> >> > say, a filter driver, how one would configure this, or what the
actual
> >> > drivers would have to do to send the 'packets' to the "service
support
> >> > driver". What about serialization and synchronization of concurrent
> >> packets
> >> > from several drivers?
> >>
> >> See IoRegisterPlugPlayNotification and IoRegisterDeviceInterface.
> >>
> >> > > 2. Kernel mode DLL - simplest model for a "call"
> >> > >
> >> >
> >> > I can see where this makes sense, but I am not sure how to develop
one.
> >> Are
> >> > kernel DLLs shared amoung the various drivers that link to them? So
the
> >> code
> >> > could be used to synchronize/serialize the requests from the various
> >> > drivers?
> >>
> >> Yes, this is a single DLL for all drivers, the basics are identical to
a
> >> driver, the
> >> specifics are covered at http://www.osronline.com/article.cfm?id=171
> >>
> >> > > 3. IOCTL pointer block - the old reliable works on every
> > version
> >> of
> >> > > Windows back to NT 3.1
> >> > >
> >> >
> >> > Yes, I can see this approach, although it is likely the least
> >> > desirable.
> >>
> >>
> >> --
> >> Don Burn (MVP, Windows DDK)
> >> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> >> Remove StopSpam from the email to reply
> >>
> >>
> >
> >
>
>