Saturday, February 5, 2011

How to make program to get device drivers - Part 2

In order to get device drivers which installed on your computer we will write method its name (GetDriversList), this method is it most important part of our program which it consists of sub-method its name (GetDriver), which get and store driver informaion.
So the first stage is to bring a list containing the device drivers installed on your computer, which, as we mentioned previously that it found in the Registry Editor, and then brought the information contained in the key of each driver.
 
To store information about each driver, you declare the structure (DriverInfo) containing 6 fields to store the name, version, date, manufacture ....... of each driver.
 
The method that bring in device drivers (GetDriversList), supplied with a parameter determines if we want to get all the drivers, including drivers that are installed with the system or only drivers that you installed after you install the system. In order to get that we test the value of the manufacturer (drvManufacture) If it is equal to (Microsoft), this means that the driver was already installed with the system and we do not need to do a backup copy of it.

struct DriverInfo  //structure for storing driver informations
{
    public string drvName;
    public string drvVersion;
    public string drvManufacture;
    public string drvDate;
    public string drvInfPath;
    public string drvInfSection;
}

Thursday, February 3, 2011

How to make program to get device drivers

Where do we find device drivers??
We can we find device drivers in the registry editor and in the following key:
HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Class



Where this key (Class) contains many of the subkeys that represent device drivers, as we see in the picture that the names of these keys is a (GUID)
Under these subkeys we find other sub-keys have their names, like this: 0000-0001-0002 - etc.

In these keys we find the required information, as we see there are values in these keys contain information on device drivers, most important of these values are:

  1. DriverDesc: which represents the name of the driver
  2. DriverVersion: which is the version of the driver
  3. DriverDate: which is the date the driver
  4. InfPath: which represents the name of the Inf file for this this driver, which is located in the folder: C: \ Windows \ Inf
  5. ProviderName: which represents the name of the manufacturer of this driver, this is very important since by this value we can identify the drives that install automatically with the system and its value is 'Microsoft', either to have installed by the user will be value certainly not a 'Microsoft', but 'Intel' Or 'Relatek' for example

The program interface:
The program interface consists of ListView to display the drives and their information, as well as some buttons such as: Get Drivers List and Backup Drivers.


How we will make a backup??
We can do it by the Inf file for each driver (*. Inf)Where contains inside a section containing the names of the files that make up the driver.
Our task is to extract the names of the files from the Inf file and then copy it to the location specified by the user.
Conclusion:
This lesson was just a paving and a brief explanation for the work through the program in general .. It sounds easy for a moment, but its implementation will be a little harder, for reasons I will mention in other parts of this lesson, but surely there is nothing difficult or impossible in the world of programming.
Author: Abdullah Alezzo