How do I start a kernel-mode driver at boot time? - ANSWERED.

Thank you, Mohammad, for your kind answer. It didn’t really
helped much but I eventually solved up the problem: I simply
used SERVICE_AUTO_START on CreateService().

Once I install and start the driver, it will keep running even on
reboots. I may stop and remove it also, so I guess it works
fine now… :wink:

Miguel Monteiro
xxxxx@criticalsoftware.com
www.criticalsoftware.com

«Humour and love are God’s answers
to Human weaknesses»

----- Original Message -----
From: “MOHAMMAD IQBAL”
To: “Miguel Monteiro”
Sent: Monday, April 09, 2001 12:28 PM
Subject: RE: [ntdev] How do I start a kernel-mode driver at boot time?
(II)

The registry entry key “Start” only determines the start order of your
driver. the driver code has no role in that.
There is no need to put a test folder for your driver. the system32
folder
is enough. If you are putting the driver in system32 folder and the
driver
file name is same as that of registry key entry, then no need of file
path
to be specified. Just remove that and try to reboot. We had encountered
the
same pblm because during the boot time, C: etc won’t be alive. So, path
will
be unable to be resolved. SO, a driver in system32 and with the same
file
name as registry entry name has no need to specify the path.

Hope this helps
Iqbal

-----Original Message-----
From: Miguel Monteiro [mailto:xxxxx@criticalsoftware.com]
Sent: Monday, April 09, 2001 4:46 PM
To: NT Developers Interest List
Subject: [ntdev] How do I start a kernel-mode driver at boot time? (II)

I know I may use regedit and on the

\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\myDriver

key simply modify the ‘Start’ entry to 0 (SERVICE_BOOT_START). This
will work, but I want to know how to do it programmatically. Also, when
I
use this approach I see that the System Information tool displays:

File: \systemroot\??\c:\test\mydriver.sys

instead of

File: ??\c:\test\mydriver.sys

Does this mean that:

a) To enable my driver at boot time, is enough to copy it to the
%WINDIR%\system32 directory (instead of using a test directory like I’ve
been doing)?

b) There’s a way (what?) to enable the driver at boot-time, by adding
changes
to the driver source code? (I usually apply the \Device\myDriver and
\DosDevices\myDriver unicode strings; however, I’ve also seen
\??\myDriver
on some driver’s source code… what’s the difference, btw, between the
\DosDevices\ and \??\ strings?)

Miguel Monteiro
xxxxx@criticalsoftware.com
www.criticalsoftware.com
------------------------------------------------------------
«Humour and love are God’s answers
to Human weaknesses»
------------------------------------------------------------

— Original Message —

Hi,
Until now I’ve been installing/starting kernel-mode driver experiments
using local Service Control Manager (SCM) services; these allow me
to install the driver on-demand basis:

hService = CreateService (hSCM, szDriver, szDriver,
SERVICE_ALL_ACCESS,
SERVICE_KERNEL_DRIVER,
SERVICE_DEMAND_START, // On-demand
start
SERVICE_ERROR_NORMAL,
szPath,
NULL, NULL, NULL, NULL, NULL);

Now I need to install my driver at boot time. However, using
SERVICE_BOOT_START returns the “invalid parameter” error.

I’m not sure, but on NT 4 I think it was simple to change this. But on
Win2K SP1 (my driver-development environment) the
Settings>Control Panel>Administrative Tools>Services doesn’t help
much. I can see my driver at the Software Environment>Drivers on
the System Information tool, but it doesn’t help much either, as I
don’t know how to change the Start Mode field:

Name/Description: myDriver
File: ??\c:\test\mydriver.sys
Type: Kernel Driver
Started: True
Start Mode: Manual <— (I need to change this to “Boot”)
State: Running
Status: OK
Error Control: Normal
Accept Pause: False
Accept Stop: True

The idea is simply to install the driver in such a way it remains active
(being re-enabled at boot time - and though surviving reboots) until
explicitly stopped/removed (which is also convenient, of course).

Help would be appreciated.
Thanks in advance,

Miguel Monteiro
xxxxx@criticalsoftware.com
www.criticalsoftware.com
------------------------------------------------------------
«Humour and love are God’s answers
to Human weaknesses»
------------------------------------------------------------


You are currently subscribed to ntdev as: xxxxx@nestec.net
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com