Installation, configuration and Windows recovery 7 100% Vatamanyuk Alexander Ivanovich

Installing a driver from an INF file

Let's consider a situation where a set of INF files is used to install equipment.

Open Control Panel and start the mechanism device Manager. As a result, a window will open in which you can see a list of all devices detected by the operating system on the computer (Fig. 16.1).

Most of it consists of devices located on motherboard, and only a few entries indicate devices that are installed as an expansion card or connected using external ports.

Our task is to install a driver for a device that is not detected by the operating system. If your device is not yet connected to your computer, now is the time to do so.

If the device is already connected to the computer, then right-click on the computer name at the very top of the list and in the menu that appears, select Install old device (Fig. 16.2). This will launch the Hardware Installation Wizard, which will help you and guide your actions when installing equipment (Fig. 16.3).

Rice. 16.1. Launch the Device Manager mechanism

Rice. 16.2. Select Install old device

After reading the introductory speech and preparing the driver disk, if needed, click the button Further, to begin the device installation process.

Rice. 16.3. Hardware Installation Wizard

The installation wizard offers two options for further actions: automatic and manual installation equipment (Fig. 16.4). Automatic installation will not do anything, since the operating system has already tried to do this during the installation process. For this reason, it is necessary to immediately move on to the second option. Set the switch to position Installing equipment manually selected from the list and press the button Further.

Rice. 16.4. Selecting an action option

In the next window you will see a list of devices different types, drivers for which are available in the operating system (Fig. 16.5).

Rice. 16.5. Specify the type of device that needs to be installed

Let's first consider the option when you find the driver you need in the list of manufacturers and drivers. Having marked it, press the button Further, to proceed to install it.

In the next window, the Hardware Installation Wizard will show a list of all drivers available in the system for the selected device type, sorted by hardware manufacturer. If you are sure that one of the proposed drivers is suitable for your equipment, then select the desired manufacturer on the left side of the window, and the required driver on the right. After that, you can try to install it by clicking the button Further(Fig. 16.6). This will bring up a confirmation window in which you need to click the button again Further(Fig. 16.7).

After driver installation is confirmed, the Add Hardware Wizard copies the necessary drivers to the system and attempts to initialize the device. If the device initialization was successful, you will see a message window indicating that the driver for the device was installed correctly and the device is ready to use. Otherwise, the wizard will report that the installation failed and the device cannot be started, or that there are some difficulties (Fig. 16.8).

Rice. 16.6. Specify the driver for the device

Rice. 16.7. Confirm driver installation

In this situation, the only way out is to try installing another driver, for example, one that came with the device or one downloaded from the manufacturer’s website on the Internet.

Rice. 16.8. Driver installation failed

To install a different driver, click the button Install from disk(see Fig. 16.6). As a result, a window will appear in which you need to click the button Review(Fig. 16.9) and in the file selection window that opens, specify the location of the file with the driver.

Rice. 16.9. Installing a driver from another source

After pressing the button OK the wizard will try to install the driver. If this driver can work in Windows 7, it will be installed and the device will be able to function.

This text is an introductory fragment. From the book Fedora 8 User Guide author Kolisnichenko Denis Nikolaevich

5.5.2.4. Checking the driver After downloading, make sure the driver is installed and in use. Press ‹Alt+F2›, enter system-config-display, go to the Hardware tab in the window that opens and click on the Configure button next to the line identifying the video card. IN

From the book How to Write Drivers author

How to write drivers (part 1) Preface. Drivers for Windows are, for most programmers, a “closed secret”. And not at all because it is something extremely complex, but because of the absolute lack of documentation of the ideology. Having started to study this topic, I

From the book Writing a Windows Driver in Assembly Language author Computers Author unknown -

How to write drivers (part 2) Before getting into the description of the driver itself, let's define the types of existing drivers. According to the division existing in the DDK, Microsoft itself divides drivers into the following types: – Kernel-Mode Drivers; – Kernel Streaming Drivers; – Graphics Drivers ;– Network

From the book PC Failures and Errors. We treat the computer ourselves author Dontsov Dmitry

From the book System Programming in Windows environment by Hart Johnson M

From the book MySQL: A Professional's Guide author Pautov Alexey V

Part 2. API for WDM driver. Most of the driver API functions that we are interested in are provided by the ntoskrnl.exe module. To use them, you need to do the following: 1) Declare data types and define constants. Most definitions for C are in the files ntdef.h and wdm.h. 2)

From book Windows setup 7 with your own hands. How to make work easy and convenient author Gladky Alexey Anatolievich

Driver rollback Sometimes it happens that during installation new version device drivers, such as a video card, the system becomes unstable. Naturally, this is unacceptable, since it creates a lot of inconvenience. Everything is made worse by the fact that, as a rule, distributions

From the book Linux Programming with Examples author Robbins Arnold

Setting File Size, File Initialization, and Sparse Files The SetEndOfFile function allows you to reset the file size by using the current file pointer value to determine its size. Both extension and truncation of the file are possible. In case of file extension

From the book InterBase World. Architecture, administration and development of database applications in InterBase/FireBird/Yaffil author Kovyazin Alexey Nikolaevich

Example: Setting File Timestamps Program 3.3 implements the UNIX touch command to change file security code and update timestamps to the current system time. Exercise 3.11 requires you to extend the touch function to

From the book Installing, configuring and restoring Windows 7 100% author Vatamanyuk Alexander Ivanovich

From the book Using NuMega DriverStudio to Write WDM Drivers author Tarvo Alexander

Drivers and their purpose In order to connect equipment to a computer, it is not enough to simply physically connect it to system unit. For the operating system to recognize this hardware, you must have special program– driver. Only after

From the author's book

From the author's book

Installing the driver and configuring data sources The driver distribution consists of one executable file named ibgem_21_desk.exe (for the desktop edition of the driver version 2.1). To install the driver, you need to run this file. There are two ways to create

From the author's book

Installing a driver using a setup program Often, you use a setup program to install older hardware, and the standard driver installation approach described above is not suitable for this. However, when I run the installer it refuses

From the author's book

16.3. Driver rollback Sometimes you have to not only install drivers from scratch, but also update old drivers. The need to install a new driver is explained quite simply: new driver is almost always a patched version of the old driver

From the author's book

2.2 Compiling and installing the driver. The project generated by DriverWizard is located in the XDSP directory. This directory contains the VC++ Workspace files: XDSP.dsw, XDSP.ncd and XDSP.opt and two directories - sys and exe. The XDSPioctl.h file is also located here. It describes the control codes

Not such a common situation, but when servicing a large fleet user computers Sometimes it happens that for some device the manufacturer has not released drivers for the required OS version. It could be old version OS, or old device. All in all. Sometimes you need to install drivers manually. They are usually supplied in the form of several files. Most often they have the extension inf or sys, but they can also be different.

The procedure for installing a driver in Windows 10 depends on how you install it. Each method has its pros and cons. The most important advantage is that any user, from a beginner to a master, can choose the most convenient one for himself, avoiding system errors and the departure of programs in the future. We will look at each method in detail separately. Remember that the most important thing is to use drivers from reliable sources so as not to damage the operating system or accidentally launch a virus, the elimination of which will take much more time and effort than installing any driver.

What you need to install the driver

In order to install the driver manually, you need an installation disk or special software that will help you step by step through the entire installation procedure. Below we will look at one of these programs - Driver Easy. There are situations when, due to incompatibility of the driver with installation disk gives an error message. It is in such cases that we need programs that will help us find and update the driver. In addition, this option will be more acceptable for owners of netbooks, which often do not have a disk drive. For such cases there is an installation option required driver from a USB drive, we will also analyze it today, since this method has its own characteristics.

Manual installation - instructions

Installing the driver manually using Device Manager

1. Open the panel Windows management 10 by simultaneously pressing the Win + X key ( Windows key and the X key) and left-click on the “Control Panel” item

2. For convenience, it is advisable to set up small icons.

3. Click on “Device Manager”.

In the Device Manager window, expand the categories and find the device you need. Then right-click on the device name and select Update Driver Software. The photo shows an example of driver installation network adapter Realtek PCIe GBE Family Controller.

Installing the driver manually using Driver Easy

1. In the main window of the Driver Easy program, click on the driver of the device that needs to be updated. After this, you will see the standard task manager window, which was described above. Select the device to update.

2. You will see two options in the pop-up window. Click "Browse My Computer" to install software drivers.

3. Click Browse to locate the downloaded driver file.

Click the Down Triangle button in Driver Easy, then select Open File Location to open the driver folder.

For convenience, you can copy and paste the location of the downloaded files into the field.

The path to the file:

As you already understood, the update takes a lot of time and requires basic knowledge of working with a personal computer. In addition to updating manually, Driver program Easy is capable of performing automatic search, downloading and installing all drivers that need updating. But, as we already said, this is not safe, since this function works in automatic mode, and in this case it is impossible to do backup copy in case of a serious failure.

Installing the driver from a CD or DVD

Almost all computer and hardware manufacturers provide a set of drivers for various hardware devices. For example, the driver CD that comes with your printer contains drivers for many different printers, not just the one you purchased. When installing drivers, make sure that you are installing drivers for your printer model and not for another one. Also, make sure that you are installing it for the version of Windows that is installed on your computer. The process of installing a driver from a CD is no different from the standard installation process of any other program. Be sure to follow all instructions in the installer the first time you run it. In some cases, you need to remove the old driver before installing the new one.

If you have a driver CD but your computer doesn't have a drive or it doesn't work, you can also load the drivers from a USB drive.

Installing drivers from a USB drive

After copying the drivers to a USB drive, you can install the necessary software on your computer. Make sure the drive is connected to your computer, open Windows Explorer and find the name of your device in it. For example, if you have a USB drive that is assigned to the E: drive when connected, then you need to click on the icon named E: in order for the contents to open.

Once the drivers are found on the disk, you must determine exactly how they will be installed on your computer. If the directory contains executable files or an installation file (extension *.exe), then you can install the driver using this file. If the drivers are compressed into a ZIP file, you will need to extract the file using archivers such as 7-Zip and WinZip.

Installing inf file

If the above recommendations did not help you, then all instructions for installing drivers and hardware devices are always contained in a file with the .inf extension, which is located in the C: Windowsinf folder. The folder containing the information files is protected and hidden. To make it appear, in the folder view settings, check the “Hidden items” checkbox. To find the information file for the device you need, follow these instructions:

  • open device manager;
  • right-click on the selected device and select “Properties” from the menu
  • After that, go to the “Details” tab. Expand the list and select “INF Name”. The file name will be displayed in the "Value" field.
  • Once you know the file name, return to the Task Manager, select the device, click "Update Driver" and specify the path to the *.inf file (in in this example it will be C:Windowsinfoem3.inf).

    How to force install drivers on Windows 7.

    This type of driver installation almost always helps when the driver for the device is not installed by simply running installation file setup, with extensions *.exe or *.msi.

    But the main condition for successful driver installation in this case is that the driver must be completely unpacked and the file with the extension *.inf must be available. Often, hardware manufacturers package their drivers not only with standard ZIP archivers, but also using intricate programs of their own making. Here a program can be very useful for unpacking Universal Extractor, which can be used to unpack almost any driver installer.

    Let's consider how to force install a driver in Windows 7 using a webcam as an example Defender AV-W2035. There is a driver downloaded from the Internet AV-W2035_VISTA.zip, which we successfully unpacked into a folder C:/AW-0350-MIC-VISTA. First, we need to look at where our file with the extension is located *.inf. To do this in properties Windows folders You need to enable the display of file extensions so that file names are written with their extensions. Or use very useful program Total Commander or similar file manager. After looking through the folders (you can use the file search), we found the file snpstd2.inf

    You should remember the entire path to this file so that later it will be easier to find it in Conductor. We connect the camera to the computer and wait for Windows to complete all its operations to detect new hardware.

    Opening device Manager (Start –> Control Panel –> Device Manager)

    The device is immediately visible USB camera without installed drivers. Right click mouse click on the camera and context menu select an item Update drivers...

    in the window that opens, click

    and then select the button Further

    A window will open with a list of equipment categories.
    In order not to waste time or rack your brains, we simply point to the first line Show all devices and press the button Further

    In the next window we will see a list of available drivers in the system (if any). But since we know that we have a folder with the driver, without selecting anything from the list, we click on the button

    Press the button Review…

    and using Explorer we look for our file with the extension *.inf, select it with the mouse and follow the button Open

    and, of course, a button OK

    Now our driver will appear in the window with a list of available drivers (if the driver is not suitable for the equipment, the system will generate an error).

    Here you should pay attention to the checkbox Compatible devices only. The fact is that if the connected equipment has not been tested for compatibility with installed version Windows, then there is no driver for it, despite the fact that it may be quite working. Therefore, in some cases, this checkbox should be unchecked and the driver search repeated again.

    So, after the file with the driver is found, select our driver in the list with the mouse and press the button Further

    The driver installation will begin.

    A Windows warning may appear indicating that the driver you are installing is not digitally signed or has not been tested for compatibility. If you are sure that the driver was taken from a reliable source and is exactly intended for the installed equipment, then you should absolutely not be afraid of such a warning, but should agree to further installation drivers. When the installation is complete, the system will display a completion window.

    You can verify successful driver installation by checking Device Manager, where the connected device will no longer have a question mark, and its name will change to the correct one created by the manufacturer. In our case with the camera, this will be the device that appears with the name USB PC Camera (SN9C103)

    The installation is complete, you can safely start using your new equipment!

    Obviously, each user personal computer, from time to time there is a need to connect a device to your station. The reason why this happens is not of much interest to us now, it could be an upgrade that is well known to many (in order to increase the performance of individual nodes, and as a consequence of the overall performance of the system), it could also be simply the addition of new equipment to expand functionality existing configuration, as, for example, in the case of connecting a new game controller, this may also be the need to use data from a flash drive. Regardless of exactly how we connect a new device, the Windows operating system is forced to respond to the appearance of new hardware by performing certain manipulations to ensure support for the new hardware on program level. Many operating systems use an interface between the hardware and a software layer called a driver to provide software interaction with devices.

    Driver is software with which the operating system and software modules running within it gain access to hardware or logical devices.

    That is why the operating system is trying by all means available to it to ensure the functioning of the device in its environment; for this, an attempt is made to install the appropriate driver for the newly connected device, in order to thereby provide the functions of the new device for access to programs user mode and kernel mode code, because without this very notorious driver, the equipment in the system simply cannot work.
    It is no coincidence that I mentioned logical devices in the definition, since there is a separate category of drivers that do not perform maintenance hardware, but are integrated to expand the implementation (expansion, addition) of the functional features of various system modules. But who can be surprised by installing drivers now? This process is already so familiar to all PC users from many years of practice that some, I am sure, can do this with eyes closed:) But have we ever thought about the details of this process, have we ever thought about driver installation algorithm? Have you ever wondered what actions the operating system performs when connecting a new device and installing drivers?

    Agree that from the user's point of view, the process of installing a driver in Windows, in most cases, looks quite prosaic. The usual animated installation wizard icon appears in the system tray, and after a while the system may issue a report on the successful or unsuccessful completion of the installation procedure for a new device driver in the system. Moreover, often the installation wizard, apart from this very icon in the tray, does not provide any visual confirmation of attempts to install a new device, while “quietly” adding new equipment to the list of devices and (if unsuccessful) marking it with a special icon in the device manager, suggesting the user can continue configuring the equipment manually. All these external processes, already well known to both you and me, have been present in one form or another in all versions of Windows operating systems almost since the appearance of this operating system, differing slightly from each other only in details. They became so familiar and habitual that I never even thought about what was happening “on the other side of the screen,” in the depths of the operating system, what was hidden under this imaginary simplicity? As you will see below, installation Windows drivers for a physical or logical device hides quite complex and extremely interesting processes. Driver installation algorithm in Windows can be broken down into the following key global tasks:

    • Copying the driver binary file to the appropriate directory on the system;
    • Driver registration in Windows system indicating the loading method;
    • Addition necessary information to the system registry;
    • Copy/install related supporting components from the driver package;

    In addition to the main tasks performed as part of the driver installation algorithm in Windows, it would be nice to classify the conditions under which the Windows driver installation process starts:

    • The user installs a new device into a switched off computer. In this case, the process of detecting a new device and installing the driver begins already at the stage of loading the operating system.
    • User with rights local administrator, using the "Device Manager" snap-in, initiates the installation or update of a driver for any already installed device.
    • The user “on the go” connects a new device to a running computer. In this case, we are talking about a certain category of devices that can connect on the fly, such as devices with external interface eSata, USB, etc. After all, you won’t install an internal video card when power is supplied to the PCIe slots? I personally haven't done this yet :)
    • The user independently launches the driver package installation program from under account with local administrator rights. This method can be used both to install drivers for physical devices that support the Plug and Play standard, and to install non-PnP (legacy) drivers, logical device drivers that cannot be automatically detected by the system and which cannot be installed otherwise in manual mode. A typical example would be antiviruses or virtual machines that install their drivers (logical devices) into the system.
    • The user right-clicks the .inf file in the driver directory and selects Install from an account with local administrator rights.

    But what is the driver package itself? After all, as we have seen more than once, this is a whole set of files with completely different, at first glance, purposes. Without a more in-depth review of the structure of the driver installation package, it will be difficult for us to understand the driver installation algorithm itself, so we will present the general components:

    • .inf file(s). The key component of the driver installation package is a file that describes the driver installation process. inf file is divided into sections and consists of instructions that indicate to the system exactly how the driver is installed: they describe the device being installed, the source and destination locations of all driver components, various changes that need to be made to the registry when installing the Windows driver, dependency information drivers and so on. .inf files associate a physical device with a driver that controls this device.
    • Driver binary file(s). The package, at a minimum, must contain a .sys or .dll file for the driver core. In fact, a single .sys file (as a last resort) can be installed (with reservations) manually by editing the registry.
    • Installation executables. Usually these are already well-known installation utilities, which have the names setup.exe, install.exe and some others.
    • Removal executables. These are usually uninstallation utilities that are named uninstall.exe.
    • File(s) of additional procedures and libraries. Usually these are auxiliary libraries in .dll format, co-installers.
    • .cat file(s). Digitally signed catalog file. These files contain digital directory signatures and act as a signature for package files, with which the user can determine the origin of the package and verify the integrity of the driver package files. Required on 64-bit versions of Windows starting with Vista and later and recommended for all others.
    • User mode control modules. Typically these are various command applets that work in user mode, such as ATI Catalist Control Center, VIA HD Audio Desk, Realtek HD Audio Control Panel and the like.
    • Help files. Where would we be without them?

    Terms and Definitions

    In this article I will describe only one installation method, which, in any case, describes almost all stages of the driver installation algorithm in Windows, which are also applicable to other methods. And now we will talk about the situation when the user inserts new equipment, for example a video card, into the internal connector of a switched off computer. But first, let’s introduce some definitions that we need in the process of studying the driver installation algorithm.
    Manager (dispatcher) Plug and Play (PnP Manager, PnP Manager)- a cloud of kernel mode and user mode code, responsible for adding, recognizing, removing devices in the system. The kernel mode block interacts with the rest of the system components during the download/installation of software necessary to service the devices present in the system. User mode block ( %Windir%\System32\umpnpmgr.dll, runs in the main context system process svchost.exe) is responsible for user interaction in situations that require installing new drivers or adjusting operating parameters in already installed ones. Responsible for the assignment and subsequent allocation of hardware resources such as interrupts (IRQs), I/O ports, direct memory access (DMA) channels, and memory addresses. It has the functionality of determining the driver required to support a specific device and the functionality of downloading/installing this driver. Able to recognize new devices, respond to their connection and disconnection. It is part of the Windows executive subsystem code.

    Enumeration of devices

    There is no point in describing the entire loading stage from the very beginning, and we will start with only the stage of interest to us, at which the Winload(.efi) module loads the kernel of the Windows 7 operating system from the file ntoskrnl.exe. The kernel is launched by the PnP manager, which is part of the executive subsystem. The PnP manager starts the process of enumerating devices from the root device, a virtual bus driver called ROOT, which represents the entire system and is a bus driver for all PnP and non-PnP devices, as well as the HAL (hardware level abstractions). The HAL at this stage functions as a bus driver that enumerates the devices directly connected to the motherboard. However, the HAL, instead of actually listing it, relies on the hardware description already present in the registry. HAL's goal is at this stage- detect primary buses such as PCI. Driver primary PCI buses, in turn, lists the devices connected to this bus, finds other buses for which the PnP manager immediately loads drivers. These bus drivers, in turn, detect devices on their buses. This recursive process of enumeration, loading drivers, and then enumerating continues until all devices on the system have been discovered and configured. During the enumeration process, the PnP manager builds a device tree that uniquely describes the relationships between all devices in the system. The nodes in this tree, called devnodes (short for device nodes), contain information about a device object, which in turn describes the device in detail.
    Records of all devices that have been detected since the installation of the system are stored in the registry hive HKLM\SYSTEM\CurrentControlSet\Enum. The subkeys of this hive describe devices in the following format:

    HKLM\SYSTEM\CurrentControlSet\Enum\Enumerator\DeviceID\InstanceID

    HKLM\SYSTEM\CurrentControlSet\Enum\

    • Enumerator - name of the bus driver. Can take values: ACPI, DISPLAY, HDAUDIO, HID, HDTREE, IDE, PCI, PCIIDE, Root, STORAGE, SW, UMB, USB, USBSTOR and others;
    • DeviceID - unique identifier for of this type devices;
    • InstanceID - a unique identifier for different instances of the same device.

    The fact is that the driver of the bus to which the device is connected requests various parameters from the device (manufacturer, device, revision, etc. identifier) ​​and generates a so-called hardware identifier (HardwareID), which uniquely describes the device and is a string of parameters separated by signs & and consisting of the following parts:

    • A prefix describing the bus to which the device is connected.
    • Device ID. Consists of several parts, such as manufacturer identifier, product (model) identifier, device revision.

    HardwareID is an identification string that depends on the device parameters (manufacturer, model, revision, version, etc.) that Windows uses to match the device with the driver .inf file.

    Typical HardwareID structure:

    PCI\VEN_10DE&DEV_1341&SUBSYS_2281103C&REV_A2

    In addition to the HardwareID , the device is assigned the CompatibleID parameter(s), which have a similar format, but contain only more general values ​​that do not contain device-specific parameters (some device identifiers) and are necessary to initialize a wider range of compatible devices.

    The HardwareID and CompatibleID are used by Windows executive code to find a device driver.

    Driver detection

    If at the stage of enumerating devices and loading drivers, the functional driver of the bus on which the new device is connected informs the PnP manager about changes in the connected child devices. The kernel mode PnP manager checks whether a driver is associated with the device by querying the driver of the bus on which the new device is connected and obtaining the HardwareID and, optionally, the CompatibleID of the device. The kernel mode PnP manager informs the user mode PnP manager with a special event that this device requires installation, passing it the received identifiers. The user mode PnP manager first tries to install the device automatically without user intervention. To do this, the user-mode PnP manager runs the rundll32.exe utility to launch the Device Driver Installation Wizard (%Windir%\System32\Newdev.dll).

    The Device Driver Installation Wizard initiates a search for a suitable driver for the device using information from all system inf files located in the following trusted system locations:

    • Driver repository;
    • Windows Update;
    • System directory of INF files;

    For the above purposes of searching and installing the driver, the functions of the setupapi.dll (installation support functions) and cfgmgr32.dll (configuration manager) libraries are used. During the search process, those already obtained are used. this moment HardwareID and (optional) CompatibleID identifiers, the values ​​of which describe everything possible options hardware identification in the driver installation file, that is, the inf file. The identifier values ​​of the installed device are compared with those described in the Models sections of the inf files registered in the system. The lists of identifiers are ordered so that more specific hardware descriptors are presented first in the lists. If ID matches were found in multiple inf files, the more exact match is considered to be preferred over the less exact match, signed inf files are preferred over unsigned inf files, and later signed inf files are preferred over previously signed inf files. If a match based on HardwareID is not found, then CompatibleID is used, if available, of course. If a match is not found based on CompatibleID, the Add Hardware Wizard may prompt you to specify a location fresh driver equipment. Let's take a closer look at all of these sources of information about drivers.

    Driver repository

    The Driver Installation Wizard tries to locate a suitable inf file in the system driver store, located in the %Windir%\System32\DriverStore directory, which contains all, without exception, system drivers included in the Windows distribution, obtained through the "service" Windows Update", or installed into the system by the user.

    Driver repository is a secure system location, a directory designed to store all driver packages that have ever been installed on the system.

    Driver repository was first introduced in Windows Vista. Before installing any driver on the system, first specialized code checks the digital signature of the driver, then the syntax of the driver inf files, then the privileges current user, only then puts all driver components into the system driver store. But then the driver located in the driver repository can be used to install devices on the system. Since the procedure for placing a driver in the repository is quite sophisticated, the driver repository is the most trusted source of information about drivers.

    System directory of INF files

    In parallel, the system searches for the driver in the system location described by the value of the DevicePath parameter located in the registry branch HKLM\Software\Microsoft\Windows\CurrentVersion. Typically the value is %SystemRoot%\inf , which on most systems is equivalent to the location C:\Windows\inf .

    INF file

    I would like to make a small digression and talk separately about the information files of the driver package. inf file is one of the key components of the driver kit. It stores the sequence of operations for installing and uninstalling the driver, described by special directives indicating the location of the functional driver files. The file contains commands that add information to the registry responsible for listing (Enum) the driver and its class (Class), and may contain instructions for the Hardware Installation Wizard to launch the so-called main installers (Class Installer) and additional installers (CoInstaller , Co-installer) for the device class and the device itself. Additionally, the inf file determines the type, manufacturer, model of the device, driver class, necessary files and resources.

    Co-installer (a regular DLL in structure) is an additional installer called at the installation stage, which performs installation steps specific to the subclass or device, such as preparing the infrastructure for the driver to work in the system (for example, installing the NET.Framework package), outputting configuration dialog boxes, which allow the user to specify settings for a specific device.

    An important feature of co-installers is that, if necessary, they bind instances of a new device to the protocols required for operation. This, for example, may apply to various types of communication devices that require different protocols and transports to operate, such as ndis, pppoe, tcpip, tcpip6, smb, netbt.
    The .inf file additionally describes the operations of unpacking, copying, running, renaming files, adding and deleting keys in the registry, and much more.
    However, let's return to the main algorithm for installing a driver in Windows. If the device driver installer does not find suitable drivers in the locations listed above, the system marks the device as unidentified.

    In this case, the user is asked to continue installing the device through the applet. device Manager. After the user independently selects the device and indicates the location of the driver files, the driver installation algorithm continues its work and the next step is checking the driver’s digital signature.

    Verifying driver digital signature

    The fact is that the driver, as part of the kernel mode code, is a fairly critical component of the operating system, and any errors made by the developer in the driver code can easily lead to serious failures (BSOD) in the system. For some time now, Microsoft has been quite sensitive to the quality of driver code, and in connection with this, mechanisms such as driver digital signature and system driver signature policy have been introduced into Windows operating systems.

    A driver's digital signature is a variable-length string of data that provides some assurance that the driver code was created by a trusted source and has not been subject to unauthorized modifications.

    The next step is the user-mode portion of the PnP manager code, which checks the system driver signing policy. If system policy instructs the kernel code to block or warn about the installation of unsigned drivers, then the PnP manager parses the driver inf file for the presence of a CatalogFile directive pointing to a catalog file (a file with a .cat extension) containing the digital signature of the driver package.

    Catalog file (.cat) - special file, which plays the role of a digital signature for the entire driver package, because each file included in the driver package is not signed separately. The only exception is the boot phase kernel driver binaries, but these are checked by separate kernel code.

    A laboratory was formed to test drivers and sign them Microsoft Windows Hardware Quality Lab (WHQL), which thoroughly tests drivers supplied with Windows distributions, as well as drivers from major hardware suppliers. For all other driver developers, procedures are provided for obtaining the opportunity to independently sign drivers on a paid basis. When a driver passes all WHQL tests, it becomes "signed". This means that WHQL generates a hash, or unique signature, for the driver that uniquely identifies the driver files, and then signs it using cryptographic algorithms using a special Microsoft private key used for signing drivers. The signed hash is placed in a directory file (.cat file) that is placed directly in the driver package directory.
    During the driver installation process, the user-mode PnP manager extracts the driver signature from the .cat file, decrypts the signature using the Microsoft public key, and compares the resulting hash with the hash of the installed driver file. If the hashes match, the driver is marked as having passed WHQL testing. If the signature cannot be verified, the PnP manager acts in accordance with the settings of the system driver signing policy, either prohibiting the installation of the driver, or still allowing the installation of the driver.

    Creating a Backup

    It's a pretty good Windows strategy to create a restore point before adding new device drivers to the system. This is due, first of all, to the fact that a kernel mode driver containing an error can cause the system to become completely inoperable, and then what should we do with this system? Even despite all the signatures and checks, the user should be able to roll back the configuration if, for example, he didn’t like something after installation.

    Driver installation

    At this point, the third-party driver package is deployed to the system driver store. Then, the system performs the actual installation of the driver from the driver store, which is done using the %Windir%\System32\drvinst.exe utility. At this stage the following events occur:

    • inf file of the driver is copied to the specialized folder %Windir%/inf. For third-party drivers, it is common to rename the file to OEMx.inf, where x is the serial number of the inf file in the directory.
    • The operating system code records the fact of installation of the inf file in the registry.
    • A device node (devnode) is created in the registry along the path HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ \\ , which contains detailed information about the device.
    • The driver binaries are copied to the target folder %Windir%\System32\DRIVERS and possibly other target folders. Registry keys are updated.
    • A registry key corresponding to the driver is generated: HKLM\SYSTEM\CurrentControlSet\Services\driver_name. The key parameters are generated.
    • A registry key responsible for logging driver events is generated, located in the branch HKLM\SYSTEM\CurrentControlSet\Services\EventLog\System\driver_name.
    • The PnP manager calls the DriverEntry procedure for each newly installed driver. The kernel mode PnP manager then attempts to "start" the driver by loading it into memory and calling the driver's AddDevice routine to inform the driver itself of the presence of the device for which it was loaded.

    Driver Information Location

    In addition to describing the driver installation algorithm itself in Windows, I would like to highlight a separate section and devote it to a description of possible locations for placing information about drivers in file system and registry. From a practical point of view, this information is intended to simplify manual editing in the event of any fatal failures. The following are locations where you may notice traces of driver information.

    General Driver Logs

    There are a number of logs on the system that can help with various driver issues.

    • %Windir%\setupact.log -- contains debug messages from the kernel mode driver installer, which is a Win32 DLL that accompanies the device installation process;
    • %Windir%\inf\setupapi.app.log -- contains messages from the application installation process;
    • %Windir%\inf\setupapi.dev.log -- contains messages from the device installation process;

    Driver log

    If you use the Package Manager (pkgmgr) to install/uninstall a package, which (in turn) installs, updates, or uninstalls a driver, then you have the opportunity to enable (for debugging purposes) the creation of a special log file drivers.log , which will only contain driver-specific errors. To create this log, create/set the following registry key, and then run pkgmgr again. After this, a drivers.log file will be created in the directory from which pkgmgr was launched.
    Branch: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Device Installer
    Key: DebugPkgMgr
    Type: DWord
    Value: 1

    %Windir%\inf

    All inf files are stored in this directory. As mentioned above, after installing a third-party driver on the system, its inf file is renamed OEMx.inf, so you can see a whole series of similar files in the directory. The operating system code remembers the fact that the inf file was installed in the registry.

    %Windir%\System32\DRIVERS

    This is the directory in the Windows file system where the driver files are located. In modern operating systems, and I’m talking now about Windows Vista and later, the overwhelming majority of drivers in this directory have .sys extensions, dll files are less common, but this does not change the general meaning, since, regardless of the extension, all they are identical in structure to .dll files. In earlier operating systems, formats such as .drv and .vxd were encountered.

    %Windir%\System32\DriverStore

    A system collection of drivers, which is intended to contain each and every driver that passed through your system. Used since Windows Vista. Before installing any driver into the operating system, first specialized code checks the driver signature, then the syntax of the driver inf files, then the privileges of the current user, and only then adds all driver components to the system collection. And only after this the driver can be used in the system to install devices without any user intervention.

    HKLM\SYSTEM\CurrentControlSet\Enum

    A registry hive containing information about the devices present in the system. The PnP manager creates a key here for each device in the format HKLM\SYSTEM\CurrentControlSet\Enum\Enumerator\deviceID. where Enumerator is the bus identifier described above in the article, obtained at the device enumeration stage, deviceid is the device type identifier. The key contains the following information: device description, hardware identifiers (Hardware ID), compatible device identifiers (Compatible ID) and resource requirements. The hive is reserved for use exclusively by operating system code, so user applications and drivers are not recommended to interact with it directly, but are encouraged to use documented system functions.

    HKLM\SYSTEM\CurrentControlSet\Control

    A registry hive containing information about various driver configuration parameters during operating system startup. Contains such important keys as:

    • Class contains information about device installation classes, which are used to group devices that are configured and installed in a similar way. For each installation class, this key contains a key whose name matches the GUID name of the corresponding installation class.
    • CoDeviceInstallers contains information about class co-installers
    • DeviceClasses contains information about device interfaces registered in the system. any driver that wants to interact with user-mode programs on the system must provide an interface. The device interface class provides functionality device and its drivers to other system components and user mode applications.

    HKLM\SYSTEM\CurrentControlSet\Services

    A registry hive that is used to place information about all services (drivers) in the system. Each system driver places quite important global information about itself in connections of the form HKLM\SYSTEM\CurrentControlSet\Services\<Имя_драйвера> , which is used by the driver during the initialization process at the system boot stage. The hive is actively used by the PnP manager to pass parameters when calling the driver initialization procedure.
    This bush contains the following elements:

    • ImagePath - contains the full path to the driver binary file (image). the installation program fills this value based on data from the inf file of the driver package;
    • Parameters - stores individual driver information, filled in based on the data placed in the inf file of the driver package;
    • Performance - information for monitoring the performance of the device controlled by the driver. Specifies the name of the performance monitoring DLL and the names of the functions exported by this DLL. Filled in based on data obtained from the inf file;

    HKLM\SYSTEM\CurrentControlSet\HardwareProfiles

    A registry hive that contains information about system hardware profiles and is designed to support this technology. A hardware profile is just a set of changes to the standard hardware configuration and service configuration (original configuration), loaded at system startup. Contains specific changes to the original, main hardware profile configured in two registry keys: HKLM\SOFTWARE and HKLM\SYSTEM. Not used in Windows 7, although registry keys remain, probably for compatibility reasons.

    How to force install drivers on Windows 7.

    This type of driver installation almost always helps when the driver for the device is not installed by simply running the installation file setup, with extensions *.exe or *.msi.

    But the main condition for successful driver installation in this case is that the driver must be completely unpacked and the file with the extension *.inf must be available. Often, hardware manufacturers package their drivers not only with standard ZIP archivers, but also using intricate programs of their own making. Here a program can be very useful for unpacking Universal Extractor, which can be used to unpack almost any driver installer.

    Let's consider how to force install a driver in Windows 7 using a webcam as an example Defender AV-W2035. There is a driver downloaded from the Internet AV-W2035_VISTA.zip, which we successfully unpacked into a folder C:/AW-0350-MIC-VISTA. First, we need to look at where our file with the extension is located *.inf. To do this, you need to enable the display of file extensions in Windows folder properties so that file names are written with their extensions. Or use a very useful program Total Commander or similar file manager. After looking through the folders (you can use the file search), we found the file snpstd2.inf

    You should remember the entire path to this file so that later it will be easier to find it in Conductor. We connect the camera to the computer and wait for Windows to complete all its operations to detect new hardware.

    Opening device Manager (Start –> Control Panel –> Device Manager)

    The device is immediately visible USB camera without installed drivers. Right-click on the camera and select the item in the context menu Update drivers...

    in the window that opens, click

    and then select the button Further

    A window will open with a list of equipment categories.
    In order not to waste time or rack your brains, we simply point to the first line Show all devices and press the button Further

    In the next window we will see a list of available drivers in the system (if any). But since we know that we have a folder with the driver, without selecting anything from the list, we click on the button

    Press the button Review…

    and using Explorer we look for our file with the extension *.inf, select it with the mouse and follow the button Open

    and, of course, a button OK

    Now our driver will appear in the window with a list of available drivers (if the driver is not suitable for the equipment, the system will generate an error).

    Here you should pay attention to the checkbox Compatible devices only. The fact is that if the connected equipment has not been tested for compatibility with the installed Windows version, then there is no driver for it, despite the fact that it may be quite working. Therefore, in some cases, this checkbox should be unchecked and the driver search repeated again.

    So, after the file with the driver is found, select our driver in the list with the mouse and press the button Further

    The driver installation will begin.

    A Windows warning may appear indicating that the driver you are installing is not digitally signed or has not been tested for compatibility. If you are sure that the driver was taken from a reliable source and is exactly intended for the equipment being installed, then you should absolutely not be afraid of such a warning, but should agree to further install the driver. When the installation is complete, the system will display a completion window.

    You can verify successful driver installation by checking Device Manager, where the connected device will no longer have a question mark, and its name will change to the correct one created by the manufacturer. In our case with the camera, this will be the device that appears with the name USB PC Camera (SN9C103)

    The installation is complete, you can safely start using your new equipment!