Categories
How-to

How to get an Inventory of all the Installed Device Drivers in a Machine?

Consider a scenario, where you need to take an inventory of all the Device drivers installed on your machine. This information will be very essential to identify the vendor details, Driver files and other important stats. Driverquery command will exactly help us in this purpose.

Running the Driverquery command in the Command Prompt will list out all the drivers installed on the machine. (Run the Command Prompt in Administrator Context)

Driverquery Command - Listing all the Drivers in a machine

If you want a compact record of installed drivers in a reporting format, use this command with appropriate switches. As we saw above, DriverQuery command gives all the information; You can modify the output of the command with a variety of switches, and you can redirect the output of the command to a file so that you can load it in another program.

You can use the /v switch to produce a detailed verbose information, and add the /Fo switch with the CSV parameter to generate the output in the csv (Comma Seperated Value) format. – driverquery /v /fo csv > drvlist.csv

Inventory of Installed Drivers in a Machine

Further, Opening this file Driverlist.csv in Excel will give you a highly detailed list of all your hardware. (as shown below – Click the image for ful size)

List of Installed Drivers in CSV Format - Driverquery

Similarly, using the /SI switch to get all the information on the signed drivers installed on the machine.

Inventory of Installed Signed Drivers - DriverQuery

Signed Device Drivers Information

DriverStore is a new and a central location in Windows Vista and Windows 7 where all the driver files will be stored., before they are copied to their final destination during the device driver installation. – Read more to Understand better

For a full list of the switches available for the Driverquery command., run the driverquery with a /? switch.

Driverquery with Help Syntax

You would also be interested in reading –

Categories
Best Practices Microsoft Windows Installer, Application Compatibility and Deployments

Importance of a RunOnce Key in Device Driver Installation

Well, The Run and RunOnce registry entries help programs to be run automatically. In device driver installations,  A RunOnce entry is executed immediately after the driver is installed; These entries are not executed until the user logs on.

For a Client-side installation, all RunOnce entries are executed. No Run, RunEx, or RunOnceEx entries are executed.
For a Server-side installation, Setup looks for RunOnce entries in the INF in the format described on the DDK. The DLLs specified are run in the system context with no UI. Any RunOnce entries that do not follow this format are deferred to a client-side installation and are run in administrator context with UI.

This is the primary reason for special requirements on RunOnce entries.

Addition Information: Run, RunEx, or RunOnceEx entries are executed only in the context of a logged-on user, and are not executed immediately after device is installed. A Service entry can immediately provide functionality for multiple logged-on users, whereas Run entries provide service to them only when the user next logs on, and also run one instance for each user.

For more information on RunOnce and Run Keys, Check these links –
http://www.dewassoc.com/support/useful/registry/reg_run_keys.htm
http://support.microsoft.com/kb/179365

Categories
Best Practices Microsoft

Where are Device Drivers stored in Windows 7? – DriverStore

DriverStore is a new and a central location in Windows where all the driver files will be stored., before they are copied to their final destination during the device driver installation. The location of the driver store is – C:\Windows\System32\DriverStore

Driver files are stored in folders, which are located inside the FileRepository folder as shown in the image below.

Driver Store

Here is a screenshot from the latest version of Windows 10.

Driverstore-windows

For eg: the driver package developed by Microsoft that contains the core mouse support files is present in the following folder.

C:\Windows\System32\DriverStore\FileRepository\msmouse.inf_amd64_neutral_6f653f6716c1448c

Within this folder are the driver files (.sys), driver setup files (.inf), pre-compiled INF files(.pnf), and an XML manifest file that contains the manifest of all the files within the driver package. Together, all of these different files add up to the driver package, which contains all the files needed to install the device. To protect these files, the NTFS permissions on the driver store and its sub-folders and files is full control for the local system account and Read& Execute for the Everyone built in identity.

Earlier in Windows XP and 2000, the driver source files neeeded for installing the devices were typically found in several locations.

  • %SystemRoot%\Driver Cache\i386\drivers.cab
  • %SystemRoot%\Driver Cache\i386\service_pack.cab
  • .inf files under %windir%inf
  • .sys files under %SystemRoot%\System32\Drivers
  • Support DLLs under %SystemRoot%\System32
  • Third Party co-installers in various locations.

Advantages of maintaining a central store:

  1. Allows for potentially faster device installation and more realiable driver rollback and is a single standard for un-installing drivers.
  2. Allows you to protect drivers by using the Windows Resource Protection(WRP).
  3. Uses index files to minimize the performance impact on installing devices when the driver store grows in size as a result of new package additions.

To learn, How to get an Inventory of all the Installed Device Drivers in a Machine – Read this article

References: Vista Resource kit and Technet

Categories
Microsoft Windows Installer, Application Compatibility and Deployments

Package Device Driver Applications using DPInst.exe

When a Driver application gets installed on to a machine, it installs driver information like PNF, INF, CAT files in the location “C:\Windows\inf”. By default, these files will be named as oemXX.pnf or oemXX.inf where XX stands for the number. Ex: oem1.INF, oem1.PNF and so on. So when we do a capture of such applications, these XX values will be hard coded which does affect many other device driver applications which are pre-existent in the machine. Hence, in this case we used to customize the package by writing few Custom actions using “setupapi.dll” in such a way that it checks for the max XX value which is present in the machine and install the PNF or INF file of the package.

This approach takes a lot time in creating multiple custom actions for copying oem/pnf files. In this article, we discuss on a executable “DPInst.exe” which makes our life easy in dealing with driver based packages.

Introduction to DPInst

DPInst is a component of the Microsoft Windows Driver Install Frameworks (DIFx) that simplifies and customizes the installation of driver packages for devices that are not yet installed on a computer (commonly known as a software-first installation). DPInst also automatically updates the drivers for any installed devices that are supported by the newly installed driver packages.

How Packages Install using DPInst:

By default, when the Microsoft® Windows® Driver Package Installer (DPInst) runs, it runs in a wizard-install mode that displays a sequence of wizard pages. In wizard-install mode, DPInst first displays a welcome page, and then displays an end-user license agreement (EULA) page. After the user accepts the licensing agreement on the EULA page, DPInst displays an installation page, and then performs the following steps to install Plug and Play (PnP) function drivers:

1. Locates the INF files. DPInst searches the directory where the DPInst executable (DPInst.exe) is located. DPInst also searches vendor-specified subdirectories under the directory where DPInst.exe is located. A vendor specifies the subdirectories by using the search and subDirectory XML elements in an optional DPInst descriptor file (DPInst.xml)
2. Authenticates the driver packages.
3. Preinstalls driver packages in the driver store.
4. Adds an Add or Remove Program entry in Control Panel that represents a driver package. (DPInst does not support this feature on Windows Longhorn.)
5. Installs the driver packages on matching devices that are connected to a computer.

After DPInst completes the installation of a driver package, DPInst displays a finish page that informs the user of the status of the installation. DPInst supports a suppress-wizard mode that suppresses the display of wizard pages and other user messages that DPInst generates. It also supports command-line options that control the display of its wizard pages and other DPInst operations. For general information about INF files and driver packages, see “Providing a Driver Package” in the Microsoft Windows Driver Development Kit (WDK).

Steps to Follow in MSI package:

We need to follow these below steps to achieve efficient driver installation.

Step 1: Search for “*.inf” files in the captured folder.
Step 2: Cross check the contents of this file (step 1) with the contents of “*.inf” files under “[WindowsFolder]INF” folder.
Step 3: Delete the file “oemXX.inf” from “[WindowsFolder]INF” folder from your package.
Step 4: Copy DPInst.exe under the location where you get the “.inf” file
Step 5: Write a custom action as shown below.

Repeat the above steps from 1 to 5 for each oemXX.inf files. By following this, the MSI package created will be able to install the driver files without affecting the pre-existant application’s functionality as well as the operating system.

Features of DPInst :

• Localization. There are two versions of DPInst: an English-only version and a multi-language version that supports many of the commonly used languages that Windows supports.

• Driver installation customization. You can localize and customize the text, icon, and bitmaps that are displayed on wizard pages. You can include branding, an optional EULA, and control whether wizard pages are displayed.

• Automatic driver package removal. For each driver package that is installed by DPInst, DPInst adds an entry to Add or Remove Programs (in Control Panel) where a user can remove the driver package from their computer. If the user removes a driver package, the package is removed from the driver store, the corresponding INF file is removed from the system INF file directory, and all devices that were previously supported by the package are updated with the next best available driver.

• Installation error logs. DPInst logs high-level messages in the DPInst log file (%windir%\DPINST.LOG). The log file is a plain-text file that contains information and error messages and identifies the driver package that was being installed when an error occurred.


References:

Driver Package Installer (DPInst)

http://msdn.microsoft.com/en-us/library/ms790308.aspx

DPInst Command-Line Switches

http://msdn.microsoft.com/en-us/library/ms790806.aspx http://www.microsoft.com/whdc/driver/install/DIFxFAQ.mspx