Sunday, November 9, 2014

Run Windows WDM Driver

The first method is to use the CreateService API.

The second method is to manually create these values in the following registry location:
  • HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\<driver name>
Registry ValueDescriptionExample
DisplayNameName of your driver for service listmy_driver
ImagePathFull NT-style path to the driver
(or just the filename if it lives in system32\drivers).
StartHow the driver can be started. For testing the recommended value is Demand (3), which indicates that the driver can only be started manually.

The other start values - Boot (0), System (1) and Auto (2) instruct Windows to load the driver at various points during the system startup.

The last value - Disabled (4) - prevents the driver from loading at all.
TypeThe type of service. Basic kernel drivers must have a value of "1" here.1

Starting a Driver

Once a driver has been registered as a system-service, it can be loaded (and unloaded) using the Service Control Manager.
  1. programmatically:
    StartService API call.
  2. command-prompt:
    net start my_driver
Unload driver
  1. programmatically:
    ControlService API call.
  2. command-prompt:
    net stop my_driver

No comments:

Post a Comment