driver-win.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sat, 24 Jul 2010 18:53:07 +0300
changeset 458 b4a231e0296a
parent 450 4718697074d9
child 459 13abfab8b41b
permissions -rw-r--r--
How debug Windows drivers.

-*- outline -*-

* Which version exist?

 - VxD
                Windows 3.x and Windows 9x
 - Windows Driver Model (WDM)
                Windows 98, Windows 98 Second Edition, Windows Me, Windows
                2000, Windows XP, Windows Server 2003 and Windows Vista (for
                backwards compatibility)
 - Windows Driver Foundation (WDF)
                Windows 2000 and later

* VxD.

See

  http://en.wikipedia.org/wiki/VxD

* WDM.

See

  http://en.wikipedia.org/wiki/Windows_Driver_Model

* WDF.

See

  http://en.wikipedia.org/wiki/Windows_Driver_Foundation

* Tools.

** Msinfo32.exe

Windows XP/2003 System Information Tool.

See

  http://support.microsoft.com/kb/308549

** Sysinternals.

*** WinObj.

Winobj is a program that lets you browse the Windows NT Object Manager
namespace.

** devtree.

The DeviceTree V2.12 utility is a Windows XP/Server 2003 utility written by
OSR, that allows the user the ability to display the drivers and devices
loaded in 2 different views. The first view Driver View the user sees a list
of all the drivers loaded in kernel mode and all the devices that those
drivers have created. In the second view PnP View the user sees a list of all
the devices in the system from that of Plug and Play Manager (PnP).

** Microsoft DDK.

*** DevCon.

Supported device classes:

  cmd> devcon.exe classes

Which files used by specific driver (with "*" prints list of files for all drivers):

  cmd> devcon.exe driverfiles *

Device ID (names included):

  cmd> devcon.exe hwids *

Device status (running/stoped):

  cmd> devcon.exe status *

** USB Command Verifier.

All USB peripherals are required to pass the Device Framework tests in order
to gain certification.

  http://www.usb.org/developers/tools/

* Files.

** Windows 98 SE/ME.

 * .386
   VxD driver under Windows 3.x
 * .vxd
   VxD driver under Windows 95

** Windows NT (2000/XP/2003).

 * .inf
   Stored in %Windir%\Inf.
 * .pnf
   Precompiled INF File. Stored in %Windir%\Inf.

* Driver type.

** CDC.

  http://support.microsoft.com/kb/837637
                How to use or to reference the Usbser.sys driver from
                universal serial bus (USB) modem .inf files.

* Driver class.

See

  http://msdn.microsoft.com/en-us/library/ms791134.aspx
                System-Supplied Device Setup Classes
  http://msdn.microsoft.com/en-us/library/ff538820.aspx
                Drivers for the Supported USB Device Classes

* How list drivers?

Set environment devmgr_show_nonpresent_devices to 1 and run Device Manager,
select "View" --> "Show hidden devices".

* How install drivers?

Driver Install Frameworks (DIFx) tools allow installing driver under following
OSes:

  Windows Server 2008 R2
  Windows 7
  Windows Server 2008
  Windows Vista
  Windows Server 2003
  Windows XP
  Windows 2000

It consist from API (from library, DIFxAPI, DIFxApp) and command line tool
(DPInst) which can be found in WDK and their licence allow redistribution.

  http://www.microsoft.com/whdc/driver/install/DIFxFAQ.mspx
                Information about Driver Install Frameworks Tools
  http://msdn.microsoft.com/ru-ru/magazine/cc302206%28en-us%29.aspx
                If you update any drivers in Device Manager
                %windir%\system32\ReinstallBackups folder is created with
                backups of the old drivers.

* How debug Windows drivers.

  http://www.microsoft.com/whdc/devtools/debugging/debugtips.mspx
                Improve Driver Debuggability
  http://msdn.microsoft.com/en-us/library/ff551063.aspx
                Debugging Tools for Windows