Discussion:
Automatic loading of WDF driver
(too old to reply)
ramjohnny
2006-08-14 20:27:01 UTC
Permalink
Hi folks,

I am trying to install a WDF driver (software only driver) from within an
application program.

The challenge is that my driver is a software only driver (no hardware
device associated with it). Does any one know any setting while calling
CreateService or the StartService routine in order to tell the manager that
this particular driver is software only. Currently after successful calls to
"WdfPreDeviceInstall", createService and "WdfPostDeviceInstall", when
'StartService' is called an error with system error code '1058' is returned.
This error corresponds to "The service cannot be started, either because it
is disabled or because it has no enabled devices associated with it". Because
this is a software only driver, I do not expect there to be any enabled
devices associated to it. In the 'inf' equivalent of installing driver we
would instruct the inf to install the device at the 'root' and hence not have
this particular issue of identifying an associated enabled device.

Thanks!
--
Ram
Driver Developer
Don Burn
2006-08-14 20:39:44 UTC
Permalink
Is the driver truly a PnP driver or a legacy driver? StartService is only
for legacy drivers, and I would expect a KMDF driver to be PnP. You need to
look at the DevCon sample.
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
http://www.windrvr.com
Remove StopSpam from the email to reply
Post by ramjohnny
Hi folks,
I am trying to install a WDF driver (software only driver) from within an
application program.
The challenge is that my driver is a software only driver (no hardware
device associated with it). Does any one know any setting while calling
CreateService or the StartService routine in order to tell the manager that
this particular driver is software only. Currently after successful calls to
"WdfPreDeviceInstall", createService and "WdfPostDeviceInstall", when
'StartService' is called an error with system error code '1058' is returned.
This error corresponds to "The service cannot be started, either because it
is disabled or because it has no enabled devices associated with it". Because
this is a software only driver, I do not expect there to be any enabled
devices associated to it. In the 'inf' equivalent of installing driver we
would instruct the inf to install the device at the 'root' and hence not have
this particular issue of identifying an associated enabled device.
Thanks!
--
Ram
Driver Developer
ramjohnny
2006-08-14 22:01:02 UTC
Permalink
Don,

Thanks for the quick reply. Yes, my driver is a PnP driver and not a legacy
one. I was trying to model the driver loading after the 'nonpnp' example in
the wdf/kmdf/src directory of the DDK.

If I do not call the StartService, a subsequent call to get a handle to the
driver via CreateFile returns a file not found.

Installing the driver using an inf and devcon physically puts up a node in
the DeviceManager (so that we know that the driver did install). Shouldn't a
programmatic installation of the driver also do the same thing? (make some
visible changes so that we know that the driver was installed).

Thanks!
--
Ram
Driver Developer
Post by Don Burn
Is the driver truly a PnP driver or a legacy driver? StartService is only
for legacy drivers, and I would expect a KMDF driver to be PnP. You need to
look at the DevCon sample.
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
http://www.windrvr.com
Remove StopSpam from the email to reply
Post by ramjohnny
Hi folks,
I am trying to install a WDF driver (software only driver) from within an
application program.
The challenge is that my driver is a software only driver (no hardware
device associated with it). Does any one know any setting while calling
CreateService or the StartService routine in order to tell the manager that
this particular driver is software only. Currently after successful calls to
"WdfPreDeviceInstall", createService and "WdfPostDeviceInstall", when
'StartService' is called an error with system error code '1058' is returned.
This error corresponds to "The service cannot be started, either because it
is disabled or because it has no enabled devices associated with it". Because
this is a software only driver, I do not expect there to be any enabled
devices associated to it. In the 'inf' equivalent of installing driver we
would instruct the inf to install the device at the 'root' and hence not have
this particular issue of identifying an associated enabled device.
Thanks!
--
Ram
Driver Developer
Don Burn
2006-08-14 22:24:04 UTC
Permalink
You are going to have to leverage the source code of DevCon to do this, as I
said StartService before does not do enough, that is legacy )non-PnP) only.
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
http://www.windrvr.com
Remove StopSpam from the email to reply
Post by ramjohnny
Don,
Thanks for the quick reply. Yes, my driver is a PnP driver and not a legacy
one. I was trying to model the driver loading after the 'nonpnp' example in
the wdf/kmdf/src directory of the DDK.
If I do not call the StartService, a subsequent call to get a handle to the
driver via CreateFile returns a file not found.
Installing the driver using an inf and devcon physically puts up a node in
the DeviceManager (so that we know that the driver did install). Shouldn't a
programmatic installation of the driver also do the same thing? (make some
visible changes so that we know that the driver was installed).
Thanks!
--
Ram
Driver Developer
Post by Don Burn
Is the driver truly a PnP driver or a legacy driver? StartService is only
for legacy drivers, and I would expect a KMDF driver to be PnP. You need to
look at the DevCon sample.
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
http://www.windrvr.com
Remove StopSpam from the email to reply
Post by ramjohnny
Hi folks,
I am trying to install a WDF driver (software only driver) from within an
application program.
The challenge is that my driver is a software only driver (no hardware
device associated with it). Does any one know any setting while calling
CreateService or the StartService routine in order to tell the manager that
this particular driver is software only. Currently after successful
calls
to
"WdfPreDeviceInstall", createService and "WdfPostDeviceInstall", when
'StartService' is called an error with system error code '1058' is returned.
This error corresponds to "The service cannot be started, either
because
it
is disabled or because it has no enabled devices associated with it". Because
this is a software only driver, I do not expect there to be any enabled
devices associated to it. In the 'inf' equivalent of installing driver we
would instruct the inf to install the device at the 'root' and hence
not
have
this particular issue of identifying an associated enabled device.
Thanks!
--
Ram
Driver Developer
ramjohnny
2006-08-15 19:19:01 UTC
Permalink
Don,

I looked into the source of devCon and found the cmdInstall function that
sets up a node in the device tree. This doesn't seem to fit the paradigm I am
looking for. There are no references to 'CreateService'.

I just want to make clear, what works and what doesn't for a WDF PnP driver
installation. From other articles on the WEB I realize that the coinstaller
has to be involved and specific functions from the coinstaller have to be
called. I still don't understand why after the function calls to the
coinstaller successfully completed the driver is still not loaded. Is there
an example of automatic loading of wdf pnp driver in the ddk?

Thanks!
--
Ram
Driver Developer
Post by Don Burn
You are going to have to leverage the source code of DevCon to do this, as I
said StartService before does not do enough, that is legacy )non-PnP) only.
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
http://www.windrvr.com
Remove StopSpam from the email to reply
Post by ramjohnny
Don,
Thanks for the quick reply. Yes, my driver is a PnP driver and not a legacy
one. I was trying to model the driver loading after the 'nonpnp' example in
the wdf/kmdf/src directory of the DDK.
If I do not call the StartService, a subsequent call to get a handle to the
driver via CreateFile returns a file not found.
Installing the driver using an inf and devcon physically puts up a node in
the DeviceManager (so that we know that the driver did install). Shouldn't a
programmatic installation of the driver also do the same thing? (make some
visible changes so that we know that the driver was installed).
Thanks!
--
Ram
Driver Developer
Post by Don Burn
Is the driver truly a PnP driver or a legacy driver? StartService is only
for legacy drivers, and I would expect a KMDF driver to be PnP. You need to
look at the DevCon sample.
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
http://www.windrvr.com
Remove StopSpam from the email to reply
Post by ramjohnny
Hi folks,
I am trying to install a WDF driver (software only driver) from within an
application program.
The challenge is that my driver is a software only driver (no hardware
device associated with it). Does any one know any setting while calling
CreateService or the StartService routine in order to tell the manager that
this particular driver is software only. Currently after successful
calls
to
"WdfPreDeviceInstall", createService and "WdfPostDeviceInstall", when
'StartService' is called an error with system error code '1058' is returned.
This error corresponds to "The service cannot be started, either
because
it
is disabled or because it has no enabled devices associated with it". Because
this is a software only driver, I do not expect there to be any enabled
devices associated to it. In the 'inf' equivalent of installing driver we
would instruct the inf to install the device at the 'root' and hence
not
have
this particular issue of identifying an associated enabled device.
Thanks!
--
Ram
Driver Developer
Don Burn
2006-08-15 19:25:29 UTC
Permalink
The only sample for loading any PnP driver is DevCon. You cannot use
CreateService with PnP since it does not communicate with the PnP manager
and is only for non-PnP Services and drivers!
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
http://www.windrvr.com
Remove StopSpam from the email to reply
Post by ramjohnny
Don,
I looked into the source of devCon and found the cmdInstall function that
sets up a node in the device tree. This doesn't seem to fit the paradigm I am
looking for. There are no references to 'CreateService'.
I just want to make clear, what works and what doesn't for a WDF PnP driver
installation. From other articles on the WEB I realize that the coinstaller
has to be involved and specific functions from the coinstaller have to be
called. I still don't understand why after the function calls to the
coinstaller successfully completed the driver is still not loaded. Is there
an example of automatic loading of wdf pnp driver in the ddk?
Thanks!
--
Ram
Driver Developer
Post by Don Burn
You are going to have to leverage the source code of DevCon to do this, as I
said StartService before does not do enough, that is legacy )non-PnP) only.
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
http://www.windrvr.com
Remove StopSpam from the email to reply
Post by ramjohnny
Don,
Thanks for the quick reply. Yes, my driver is a PnP driver and not a legacy
one. I was trying to model the driver loading after the 'nonpnp'
example
in
the wdf/kmdf/src directory of the DDK.
If I do not call the StartService, a subsequent call to get a handle to the
driver via CreateFile returns a file not found.
Installing the driver using an inf and devcon physically puts up a node in
the DeviceManager (so that we know that the driver did install).
Shouldn't
a
programmatic installation of the driver also do the same thing? (make some
visible changes so that we know that the driver was installed).
Thanks!
--
Ram
Driver Developer
Post by Don Burn
Is the driver truly a PnP driver or a legacy driver? StartService is only
for legacy drivers, and I would expect a KMDF driver to be PnP. You
need
to
look at the DevCon sample.
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
http://www.windrvr.com
Remove StopSpam from the email to reply
Post by ramjohnny
Hi folks,
I am trying to install a WDF driver (software only driver) from
within
an
application program.
The challenge is that my driver is a software only driver (no hardware
device associated with it). Does any one know any setting while calling
CreateService or the StartService routine in order to tell the
manager
that
this particular driver is software only. Currently after successful
calls
to
"WdfPreDeviceInstall", createService and "WdfPostDeviceInstall", when
'StartService' is called an error with system error code '1058' is returned.
This error corresponds to "The service cannot be started, either
because
it
is disabled or because it has no enabled devices associated with
it".
Because
this is a software only driver, I do not expect there to be any enabled
devices associated to it. In the 'inf' equivalent of installing
driver
we
would instruct the inf to install the device at the 'root' and hence
not
have
this particular issue of identifying an associated enabled device.
Thanks!
--
Ram
Driver Developer
Doron Holan [MS]
2006-08-16 03:32:32 UTC
Permalink
think of this way. the INF is a script that setup uses to install the pnp
device. one of those steps that setup does for you is create and start the
service which is why you don't see an explicit CreateService()
call

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.
Post by ramjohnny
Don,
I looked into the source of devCon and found the cmdInstall function that
sets up a node in the device tree. This doesn't seem to fit the paradigm I am
looking for. There are no references to 'CreateService'.
I just want to make clear, what works and what doesn't for a WDF PnP driver
installation. From other articles on the WEB I realize that the coinstaller
has to be involved and specific functions from the coinstaller have to be
called. I still don't understand why after the function calls to the
coinstaller successfully completed the driver is still not loaded. Is there
an example of automatic loading of wdf pnp driver in the ddk?
Thanks!
--
Ram
Driver Developer
Post by Don Burn
You are going to have to leverage the source code of DevCon to do this, as I
said StartService before does not do enough, that is legacy )non-PnP) only.
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
http://www.windrvr.com
Remove StopSpam from the email to reply
Post by ramjohnny
Don,
Thanks for the quick reply. Yes, my driver is a PnP driver and not a legacy
one. I was trying to model the driver loading after the 'nonpnp'
example
in
the wdf/kmdf/src directory of the DDK.
If I do not call the StartService, a subsequent call to get a handle to the
driver via CreateFile returns a file not found.
Installing the driver using an inf and devcon physically puts up a node in
the DeviceManager (so that we know that the driver did install).
Shouldn't
a
programmatic installation of the driver also do the same thing? (make some
visible changes so that we know that the driver was installed).
Thanks!
--
Ram
Driver Developer
Post by Don Burn
Is the driver truly a PnP driver or a legacy driver? StartService is only
for legacy drivers, and I would expect a KMDF driver to be PnP. You
need
to
look at the DevCon sample.
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
http://www.windrvr.com
Remove StopSpam from the email to reply
Post by ramjohnny
Hi folks,
I am trying to install a WDF driver (software only driver) from
within
an
application program.
The challenge is that my driver is a software only driver (no hardware
device associated with it). Does any one know any setting while calling
CreateService or the StartService routine in order to tell the
manager
that
this particular driver is software only. Currently after successful
calls
to
"WdfPreDeviceInstall", createService and "WdfPostDeviceInstall", when
'StartService' is called an error with system error code '1058' is returned.
This error corresponds to "The service cannot be started, either
because
it
is disabled or because it has no enabled devices associated with
it".
Because
this is a software only driver, I do not expect there to be any enabled
devices associated to it. In the 'inf' equivalent of installing
driver
we
would instruct the inf to install the device at the 'root' and hence
not
have
this particular issue of identifying an associated enabled device.
Thanks!
--
Ram
Driver Developer
Loading...