The Windows Driver Kit (WDK) 9

 

 

 

Installing/Registering a Driver

 

There are two ways to register a driver as a system service. The first (and easiest) is to use the CreateService() API which is documented in MSDN. But basically all this does is create a few values in the Registry on your behalf. The second method is to manually create these values however this step is not recommended. In this tutorial we are using a tool that makes our tasks automated. Note that a driver only needs to be registered once (it can only be registered once) - and can be started and stopped as many times as you like after this. Click the Register Service button to register/install the driver.

 

 

 

WDK registering and installing Windows device driver, osrloader: registering the Windows driver

 

Starting a Driver

 

Once a driver has been registered as a system-service, it can be loaded (and unloaded) using the Service Control Manager (SCM). In this tutorial we will use osrloader by clicking the Start Service button.

 

WDK registering and installing Windows device driver, osrloader: starting the Windows device driver service

 

You can start a driver programmatically using the StartService() API call, but it is far easier to goto the command-prompt and type:

 

net start hello

 

The following output will then be displayed:

 

The hello service was started successfully.

 

Nothing else will appear to happen though because drivers don't (and can't) output any data to the console. Note that at this point the driver has been loaded into kernel-space and your DriverEntr() function has been executed.

There are several types of the service start as shown below.

 

WDK registering and installing Windows device driver, osrloader: device driver service startup type

 

Click the Active Services button to verify that our driver has been loaded and running.

 

WDK registering and installing Windows device driver, osrloader: viewing all the Windows services/drivers

 

Open registry editor (regedt32) and search the hello word.

 

WDK registering and installing Windows device driver, osrloader: verifying the Windows device driver service registeration through Windows registry

 

Next, click Start > all Programs > Accessories > System Tools > System Information

 

 

WDK registering and installing Windows device driver, osrloader: verifying the Windows device driver service registeration through Windows System Information

 

 

 

< Windows Driver Kit (WDK) 8 | Windows Driver Kit (WDK) Programming | Win32 Programming | Windows Driver Kit (WDK) 10 >