Installing and Registering Device Drivers

Device drivers are executable files (SYS for Windows NT-based platforms and VXD or WDM for Windows 9x) that interface between a hardware device and the operating system. Installing a device driver requires two steps:

  1. Installation of the device driver executable file;
  2. Registration of the device driver with Windows.

The appropriate installation folder for device drivers is platform dependent. However, if you place them in the Windows\System (32-bit)\Drivers folder, then InstallMate will automatically select the correct folder for you. On Windows 9x, this folder resolves to the Windows System folder; on Windows NT, it is the Drivers subfolder.

Be aware of the fact that most, if not all, device drivers themselves are platform dependent in the same manner. To avoid installation or registration problems, you should therefore mark each executable file for installation only on the relevant platforms through the Platforms... setting of the file's component.

The net result is that the device driver or service will be installed and registered when your application is installed, and unregistered and removed when your application is uninstalled. All this is subject to the usual rules for file installation; in particular, InstallMate will correctly handle updates of existing copies of the file (based on a version check, if available) and will only remove the device driver or service if no other applications use it. This remains true even if the SharedDlls reference count of the file is unreliable (as is often the case).

1. Installation of the device driver executable file

To add a device driver to your InstallMate project, act as follows.

  1. Go to the Components project page.
  2. If you are installing one or more device drivers for Windows 95, 98, or Me (VXD or WDM executables), then create a new component and call it Dev9x. In the component's Component attributes pane, click on Platforms... and clear all check boxes except Windows 95, Windows 98, and Windows Me.
  3. If you are installing one or more device drivers for Windows NT, 2000, XP, or later (SYS executables), then create a new component and call it DevNT. In the component's Component attributes pane, click on Platforms... and check all boxes except Windows 95, Windows 98 , and Windows Me.
  4. Add the newly created components to at least one feature in the Components tree. You can simply drag & drop each component to the desired feature.
  5. Go to the Files and folders project page.
  6. Add the device driver executable file as an installation file to the Windows\System (32-bit)\Drivers folder. If necessary, refer to Installing Files for information about adding installation files to folders. When asked in the Bulk Import dialog box, select Assign to existing component and choose Dev95 (for VXD and WDM files) or DevNT (for SYS files) from the drop-down list.
    Note: You can also change the file's component afterwards by right-clicking on the file and choosing Assign to component.
  7. Select the newly added file in the files list to display its settings in the File attributes pane, then check that the following options are set:

    • Install action - Install if newer
    • Remove action - Remove if installed
    • Registration - Set to No self-registration.
    • Shared file - checked
  8. Repeat steps 6-7 as required for other device drivers.
  9. On the InstallMate - Installer options project page, make sure that the Installation level option is set to Administrator.

2. Registration of the device driver with Windows

To register a device driver with Windows, you must add certain keys and values to the registry. There are two ways to do so:

Registry project page

This method works for both Windows 9x (VXD, WDM) and Windows NT-based (SYS) device drivers.

  1. Start the Registry Editor (RegEdit.exe) on a system that has the desired device driver already installed.
  2. Navigate to the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services registry key.
  3. Find and select the registry subkey that corresponds to your device driver.
  4. Choose File > Export... from the Registry Editor's main menu, select Selected branch, and save the .reg file. You can use either the Registration Files (*.reg) or the Win9x/NT4 Registration Files (*.reg) format. We recommend using the former one.
  5. In your InstallMate project, go to the Registry project page.
  6. Choose File > Import > Registry File... from the main menu and open the file that you saved in step 4.
  7. When the the Bulk Import dialog box, select Assign to existing component and choose Dev95 (for VXD and WDM device drivers) or DevNT (for SYS device drivers) from the drop-down list.
  8. The registry keys and values are now added to the Registry tree on the Registry project page, under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\...name.... You may want to clean up the keys and values somewhat; in particular, you should delete the Enum subkey that may appear under the device driver's registry key.

Services project page

This method only works for device drivers on Windows NT, 2000, XP and later. Furthermore, if your device driver requires non-standard startup attributes, you might have to use the previous method after all.

  1. Go to the Services project page.
  2. Create a new Service item.
  3. In the Service attributes pane, set Service name to the internal name of your device driver and Type to Kernel Driver.
  4. Set the Executable file attribute to the name of the SYS file that you added to the project earlier. You can click the ... (browse) button to open the Select Installation File or Folder dialog box that allows you to browse for the file.
  5. Set the other attributes as required by your device driver. You may have to run RegEdit.exe on your development system to see how the device driver is registered.
  6. Right-click on the Service object, then choose Assign to Component from the context menu and select the DevNT component.
  7. If desired, add a new ServiceControl item and set its attributes as follows:
    • Service name - the internal name of your device driver
    • Install action - Start Service
    • Remove action - Delete Service (this will also stop the device driver)
  8. Right-click on the Service Action object, then choose Assign to Component from the context menu and select the DevNT component.