Microsoft Docs

Windows Driver Model (WDM)

Portable Device Drivers

This section provides information and guidance on developing drivers for portable devices on the Windows platform. Portable devices encompass a wide range of peripherals that can be connected and disconnected from a host system, including but not limited to:

Developing drivers for these devices often involves understanding specific Windows driver models and frameworks. The primary frameworks and models relevant to portable device drivers include:

Windows Driver Frameworks (WDF)

The Windows Driver Frameworks (WDF) provide a more streamlined and object-oriented approach to driver development compared to the older Windows Driver Model (WDM). WDF offers two frameworks:

WDF is the recommended approach for most new driver development. It provides built-in handling for many common driver operations, allowing developers to focus on device-specific functionality.

Windows Driver Model (WDM)

While WDF is preferred, understanding WDM is still valuable, especially when working with legacy drivers or in specific scenarios. WDM is the foundational driver model in Windows. It uses a set of callback functions and I/O Request Packets (IRPs) to manage communication between the operating system and hardware.

Key concepts in WDM include:

For portable devices, specific WDM models might be used, such as the USB device driver model or the Mass Storage Device Class driver.

Common Device Classes and Protocols

When developing portable device drivers, you will often interact with standard device classes and protocols. Some common ones include:

Key Resources

Here are some essential resources for developing portable device drivers:

Note on UMDF 2.0 and KMDF

UMDF 2.0 is designed to be very similar to KMDF, sharing much of the same API design. This makes it easier for developers to switch between developing kernel-mode and user-mode drivers. For new development, it is generally recommended to use WDF (either KMDF or UMDF) over direct WDM programming.

Important Considerations

When developing drivers for portable devices, always consider:

  • Device Power Management: Ensure your driver correctly handles device power states to conserve energy.
  • Plug and Play: Implement proper handling for devices being connected and disconnected.
  • Security: For user-mode drivers, adhere to security best practices to protect the system.
  • Error Handling: Robust error handling is crucial for stable operation.