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:
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).
To add a device driver to your InstallMate project, act as follows.
- Go to the Components project page.
- 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.
- 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.
- 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.
- Go to the Files and folders project page.
- 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.
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
- Repeat steps 6-7 as required for other device drivers.
- On the InstallMate - Installer options project page, make sure that the Installation level option is set to Administrator.
To register a device driver with Windows, you must add certain keys and values to the registry. There are two ways to do so:
- Add them on the Registry project page; or
- Create them on the Services project page (only for Windows NT, 2000, XP, and later).
Registry project page
This method works for both Windows 9x (VXD, WDM) and Windows NT-based (SYS) device drivers.
- Start the Registry Editor (RegEdit.exe) on a system that has the desired device driver already installed.
- Navigate to the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services registry key.
- Find and select the registry subkey that corresponds to your device driver.
- 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.
- In your InstallMate project, go to the Registry project page.
- Choose File > Import > Registry File... from the main menu and open the file that you saved in step 4.
- 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.
- 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.
- Go to the Services project page.
- Create a new Service item.
- In the Service attributes pane, set Service name to the internal name of your device driver and Type to Kernel Driver.
- 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.
- 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.
- Right-click on the Service object, then choose Assign to Component from the context menu and select the DevNT component.
- 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)
- Right-click on the Service Action object, then choose Assign to Component from the context menu and select the DevNT component.