Discussion:
Problem using ChangeServiceConfig to set a driver to Boot start
(too old to reply)
Bob K
2005-01-02 21:38:02 UTC
Permalink
In using ChangeServiceConfig to change only the start type to
SERVICE_BOOT_START, I get the error:

ERROR_INVALID_PARAMETER (87) - The parameter is incorrect

If I use this exact same call to set the start type to any of the other
valid values, it works fine.
The doc for ChangeServiceConfig does specify that SERVICE_BOOT_START is an
acceptable parameter.
I have tried changing the permissions of OpenSCManager and OpenService to
"all access" but it didn't help.

Any ideas??

I am just about ready to just poke the registry directly ("Start" value),
but I'm sure purists will object.

Thanks,
Bob
Bob K
2005-01-02 22:01:40 UTC
Permalink
A little more information:

The "service" is really a filter driver. The "type" parameter for the
service is - 2 (SERVICE_FILE_SYSTEM_DRIVER). I've tried setting it
temporarily to 1 (SERVICE_KERNEL_DRIVER) but that didn't make any
difference.
Post by Bob K
In using ChangeServiceConfig to change only the start type to
ERROR_INVALID_PARAMETER (87) - The parameter is incorrect
If I use this exact same call to set the start type to any of the other
valid values, it works fine.
The doc for ChangeServiceConfig does specify that SERVICE_BOOT_START is an
acceptable parameter.
I have tried changing the permissions of OpenSCManager and OpenService to
"all access" but it didn't help.
Any ideas??
I am just about ready to just poke the registry directly ("Start" value),
but I'm sure purists will object.
Thanks,
Bob
Rhett Gong [MSFT]
2005-01-04 06:08:18 UTC
Permalink
Hello Bob,
For a fashioned driver, we can set SERVICE_BOOT_START or
SERVICE_DEMAND_START. Since SERVICE_DEMAND_START works fine and it is a
filter driver. so could you details what your service really is and what
you are doing in your filter driever please? Is it a FS filter driver or a
filter driver for PnP device?

Thanks,
Rhett Gong [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
Bob K
2005-01-06 02:53:23 UTC
Permalink
We have a filter driver that has been working great as AUTO or DEMAND start
for a while. In the latest version, we've made some major modifications to
it so that it will work as a BOOT start driver. Our app is a file
replication app and being a BOOT start driver allows us to replicate files
that the OS has open from startup.

Our driver is working fine. I thought the EASIEST part of this would be to
allow the user to set it as a AUTO/DEMAND start or a BOOT start.

Setting the driver to AUTO or DEMAND works fine using the
ChangeServiceConfig API. Using the same API to set it to BOOT start returns
the "incorrect parameter" error.

The doc says that BOOT start is a valid parameter as long as the service is
really a kernel driver. It IS but I still get the incorrect parameter error.

Bob
Post by Rhett Gong [MSFT]
Hello Bob,
For a fashioned driver, we can set SERVICE_BOOT_START or
SERVICE_DEMAND_START. Since SERVICE_DEMAND_START works fine and it is a
filter driver. so could you details what your service really is and what
you are doing in your filter driever please? Is it a FS filter driver or a
filter driver for PnP device?
Thanks,
Rhett Gong [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties and confers no rights.
Rhett Gong [MSFT]
2005-01-06 06:55:36 UTC
Permalink
Now, you mean your driver is a File System Filter driver, please try
following command to see if you can add your driver as boot startup with
our support tool ---- sc.exe

assume your fs filter driver is myfsfd.
sc.exe delete myfsfd
then you may need to reboot if your driver service can't be stopped/del'ed
sc.exe create myfsfd binPath= "your driver path" type= filesys start= boot
group= "FSFilter group"

if all commands above can be executed without any error, then your driver
is setted as boot start, there must be some error in your config code. If
the second command failed, maybe your driver can meet the requirement as
boot start driver service. I suggest you consult device.drivers group for
appropriate help.


Thanks,
Rhett Gong [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
Bob K
2005-01-07 15:51:00 UTC
Permalink
I tried something simpler. I just used the "sc" command to change my driver
to boot start.

It worked. It didn't display any error and the registry entry was modified.
I noticed that in addition to the "Start" value changing to 0 (boot), the
ImagePath may have changed. Actually, I'm a little confused. I noticed that
when I use "sc" to switch between demand and boot, the ImagePath changes
also:

Demand:
\SystemRoot\System32\drivers\driver.sys

Boot:
System32\drivers\driver.sys

Now, during install, the imagepath specified is
"System32\drivers\driver.sys"

So, apparently, there is more to setting a process to boot than just using
ChangeServiceConfig. Unfortunately, I can't find any documentation that
describes all of the caveats. Is there any way to find out exactly what "sc"
is doing?

Thanks,
Bob
Post by Rhett Gong [MSFT]
Now, you mean your driver is a File System Filter driver, please try
following command to see if you can add your driver as boot startup with
our support tool ---- sc.exe
assume your fs filter driver is myfsfd.
sc.exe delete myfsfd
then you may need to reboot if your driver service can't be stopped/del'ed
sc.exe create myfsfd binPath= "your driver path" type= filesys start= boot
group= "FSFilter group"
if all commands above can be executed without any error, then your driver
is setted as boot start, there must be some error in your config code. If
the second command failed, maybe your driver can meet the requirement as
boot start driver service. I suggest you consult device.drivers group for
appropriate help.
Thanks,
Rhett Gong [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties and confers no rights.
Rhett Gong [MSFT]
2005-01-10 06:18:59 UTC
Permalink
Hello Bob,
Yes, I then queried our bug db and found a bug -- SCM returns error 87
trying to change service start type to boot if binpath is not prefixed with
\SystemRoot\.
Since a boot drvier's binpath does not contain this prefix, we have to add
"\SystemRoot\" by hand to make it work.

Thanks,
Rhett Gong [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
Bob K
2005-01-10 18:37:24 UTC
Permalink
That did it!!

Thanks!

Bob
Post by Rhett Gong [MSFT]
Hello Bob,
Yes, I then queried our bug db and found a bug -- SCM returns error 87
trying to change service start type to boot if binpath is not prefixed with
\SystemRoot\.
Since a boot drvier's binpath does not contain this prefix, we have to
add
"\SystemRoot\" by hand to make it work.
Thanks,
Rhett Gong [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties and confers no rights.
Rhett Gong [MSFT]
2005-01-11 07:14:50 UTC
Permalink
You are welcome.

Thanks,
Rhett Gong [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
Loading...