How to build a hybrid service/driver?

Is it possible, since the distinction between a driver and a service is
somewhat blurred, to combine the capabilities of the two in the same
module? I am interested in performing driver-type activities (such as
direct hardware access) from a service module that can interact with
users and other modules. I have been experimenting with the flags
available for the ‘dwServiceType’ parameter of the ‘CreateService’ API
with interesting (albeit fruitless) results.

I can already accomplish what I need to do with a
driver/service/application (3 module) suite, but am interested in
minimizing the number of components that need to be developed/maintained.

You may find the lines are less “blurred” than you think :wink:

The hardware access is only possible from a driver so you will need to
retain that.

Whether you really need your service or not is the real question.

BR,

Rob Linegar
Software Engineer
Data Encryption Systems Limited
www.des.co.uk | www.deslock.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Dan Randall
Sent: 08 November 2004 16:04
To: Windows System Software Devs Interest List
Subject: [ntdev] How to build a hybrid service/driver?

Is it possible, since the distinction between a driver and a service is
somewhat blurred, to combine the capabilities of the two in the same
module? I am interested in performing driver-type activities (such as
direct hardware access) from a service module that can interact with
users and other modules. I have been experimenting with the flags
available for the ‘dwServiceType’ parameter of the ‘CreateService’ API
with interesting (albeit fruitless) results.

I can already accomplish what I need to do with a
driver/service/application (3 module) suite, but am interested in
minimizing the number of components that need to be
developed/maintained.


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

You are currently subscribed to ntdev as: xxxxx@des.co.uk
To unsubscribe send a blank email to xxxxx@lists.osr.com

> Is it possible, since the distinction between a driver and a service is

somewhat blurred

It is by no means blurred. Drivers are kernel modules which run in kernel mode.
Services are user-mode processes.

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

The distinction between a service and a driver is blurred only by the
service control API, which in turn is really only relevant to legacy NT4
style drivers. That API is simply a common vehicle for starting/stopping and
configuring services and NT4-style drivers.

Drivers are kernel mode modules with the resultant capability for servicing
interrupts, directly accessing hardware etc. Services are user mode
applications, with all of the usual restrictions on user mode applications
forbidding these same activities.

The driver/service/app trinity is the correct model. That said, there are of
course commercial products out there that will essentially export something
that resembles a driver interface to user mode (Jungo WinDriver for
example,) but these are all HACKS and the wrong way to go in the current NT
OS architecture.

=====================
Mark Roddy

-----Original Message-----
From: Dan Randall [mailto:xxxxx@interposellc.com]
Sent: Monday, November 08, 2004 11:04 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to build a hybrid service/driver?

Is it possible, since the distinction between a driver and a service is
somewhat blurred, to combine the capabilities of the two in the same module?
I am interested in performing driver-type activities (such as direct
hardware access) from a service module that can interact with users and
other modules. I have been experimenting with the flags available for the
‘dwServiceType’ parameter of the ‘CreateService’ API with interesting
(albeit fruitless) results.

I can already accomplish what I need to do with a driver/service/application
(3 module) suite, but am interested in minimizing the number of components
that need to be developed/maintained.


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

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

A service is a user-mode application, so it can’t access hardware directly
without a driver of some sort.

The difference between a service and a user app, is that the service is
controlled by the service manager, whilst the user app is controlled by the
user. So for instance, a service can be started before any user has logged
in, and it can run as “Administrator” on a system, and as such have access
to information and system functions that aren’t availble to “mortal users”.

However, to directly operate on hardware, you still need to have some sort
of driver, because it’s necessary to run “inside the kernel” to be able to
touch the hardware.

Of course, in theory, you could have a really simple driver that just maps
the hardware for the service, and then let the user-app talk to the service
that does all the work.


Mats

xxxxx@lists.osr.com wrote on 11/08/2004 04:03:57 PM:

Is it possible, since the distinction between a driver and a service is
somewhat blurred, to combine the capabilities of the two in the same
module? I am interested in performing driver-type activities (such as
direct hardware access) from a service module that can interact with
users and other modules. I have been experimenting with the flags
available for the ‘dwServiceType’ parameter of the ‘CreateService’ API
with interesting (albeit fruitless) results.

I can already accomplish what I need to do with a
driver/service/application (3 module) suite, but am interested in
minimizing the number of components that need to be developed/maintained.


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

You are currently subscribed to ntdev as: xxxxx@3dlabs.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

ForwardSourceID:NT00006EE6

The service’s role in the trinity is to provide privileged access to the
driver. Apps talk service, and can be ‘normal’ users.

=====================
Mark Roddy

-----Original Message-----
From: Rob Linegar [mailto:xxxxx@des.co.uk]
Sent: Monday, November 08, 2004 11:10 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to build a hybrid service/driver?

You may find the lines are less “blurred” than you think :wink:

The hardware access is only possible from a driver so you will need to
retain that.

Whether you really need your service or not is the real question.

BR,

Rob Linegar
Software Engineer
Data Encryption Systems Limited
www.des.co.uk | www.deslock.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Dan Randall
Sent: 08 November 2004 16:04
To: Windows System Software Devs Interest List
Subject: [ntdev] How to build a hybrid service/driver?

Is it possible, since the distinction between a driver and a service is
somewhat blurred, to combine the capabilities of the two in the same module?
I am interested in performing driver-type activities (such as direct
hardware access) from a service module that can interact with users and
other modules. I have been experimenting with the flags available for the
‘dwServiceType’ parameter of the ‘CreateService’ API with interesting
(albeit fruitless) results.

I can already accomplish what I need to do with a driver/service/application
(3 module) suite, but am interested in minimizing the number of components
that need to be developed/maintained.


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

You are currently subscribed to ntdev as: xxxxx@des.co.uk To unsubscribe send
a blank email to xxxxx@lists.osr.com


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

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