Convert Figma logo to code with AI

microsoft logoWindows-Driver-Frameworks

WDF makes it easy to write high-quality Windows drivers

1,261
366
1,261
4

Top Related Projects

This repo contains driver samples prepared for use with Microsoft Visual Studio and the Windows Driver Kit (WDK). It contains both Universal Windows Driver and desktop-only driver samples.

This repo contains samples that demonstrate the API used in Windows classic desktop applications.

API samples for the Universal Windows Platform.

14,402

A free Windows-compatible Operating System

Quick Overview

The Microsoft Windows Driver Frameworks (WDF) is a set of libraries and tools that simplify the development of Windows device drivers. It provides a consistent and modern programming model for creating both kernel-mode (KMDF) and user-mode (UMDF) drivers, making it easier to develop, debug, and deploy device drivers for Windows-based systems.

Pros

  • Simplified Driver Development: WDF abstracts away many low-level details of the Windows Driver Model (WDM), allowing developers to focus on the core functionality of their device drivers.
  • Improved Reliability: WDF includes built-in support for common driver tasks, such as power management and I/O processing, reducing the likelihood of common driver bugs.
  • Consistent Programming Model: KMDF and UMDF provide a unified programming model for kernel-mode and user-mode drivers, making it easier to develop and maintain drivers that work across different Windows versions.
  • Extensive Documentation and Community: Microsoft provides comprehensive documentation and resources for WDF, and there is a large community of developers working with the framework.

Cons

  • Limited to Windows: WDF is specific to the Windows operating system and cannot be used for developing drivers for other platforms.
  • Steep Learning Curve: While WDF simplifies many aspects of driver development, it still requires a significant amount of knowledge about the Windows Driver Model and low-level system internals.
  • Potential Performance Overhead: The abstraction and additional functionality provided by WDF may introduce some performance overhead compared to directly using the Windows Driver Model.
  • Vendor-specific: As a Microsoft-developed framework, WDF may not be as widely adopted or supported by third-party hardware vendors as other driver development frameworks.

Code Examples

N/A (This is not a code library)

Getting Started

N/A (This is not a code library)

Competitor Comparisons

This repo contains driver samples prepared for use with Microsoft Visual Studio and the Windows Driver Kit (WDK). It contains both Universal Windows Driver and desktop-only driver samples.

Pros of Windows-driver-samples

  • Provides a wide range of practical examples for various driver types
  • Includes complete, functional driver code that can be used as a starting point
  • Offers samples for both Windows Desktop and Windows 10 Mobile/IoT Core

Cons of Windows-driver-samples

  • May require more effort to understand and implement specific driver functionality
  • Samples might not cover all possible scenarios or edge cases
  • Could be overwhelming for beginners due to the large number of samples

Code Comparison

Windows-driver-samples:

NTSTATUS
DriverEntry(
    _In_ PDRIVER_OBJECT  DriverObject,
    _In_ PUNICODE_STRING RegistryPath
)
{
    // Driver initialization code
}

Windows-Driver-Frameworks:

NTSTATUS
DriverEntry(
    _In_ PDRIVER_OBJECT     DriverObject,
    _In_ PUNICODE_STRING    RegistryPath
)
{
    WDF_DRIVER_CONFIG config;
    // WDF initialization code
}

The main difference is that Windows-Driver-Frameworks uses WDF-specific structures and functions, while Windows-driver-samples may use more traditional WDM approaches in some cases.

This repo contains samples that demonstrate the API used in Windows classic desktop applications.

Pros of Windows-classic-samples

  • Broader scope, covering various Windows programming concepts and APIs
  • More diverse set of examples, suitable for general Windows development
  • Includes samples for desktop applications, system services, and more

Cons of Windows-classic-samples

  • Less focused on driver development specifically
  • May not provide as in-depth coverage of driver-related topics
  • Potentially overwhelming for developers solely interested in driver frameworks

Code Comparison

Windows-classic-samples:

// Sample Win32 application code
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
    // Window creation and message loop
}

Windows-Driver-Frameworks:

// Sample driver code
NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
{
    // Driver initialization
}

The code snippets illustrate the different focus areas of the two repositories. Windows-classic-samples provides examples for general Windows programming, while Windows-Driver-Frameworks concentrates on driver development.

API samples for the Universal Windows Platform.

Pros of Windows-universal-samples

  • Provides a wide range of sample code for Universal Windows Platform (UWP) development
  • Regularly updated with new samples and features for the latest Windows SDK versions
  • Includes comprehensive documentation and explanations for each sample

Cons of Windows-universal-samples

  • Focused solely on UWP development, limiting its usefulness for other Windows programming scenarios
  • May not cover advanced or specialized driver development topics

Code Comparison

Windows-universal-samples:

StorageFile file = await StorageFile.GetFileFromPathAsync(filename);
var stream = await file.OpenAsync(FileAccessMode.Read);
BitmapDecoder decoder = await BitmapDecoder.CreateAsync(stream);

Windows-Driver-Frameworks:

NTSTATUS status;
WDF_OBJECT_ATTRIBUTES attributes;
WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
status = WdfDeviceCreate(&DeviceInit, &attributes, &device);

Summary

Windows-universal-samples is ideal for developers working on UWP applications, offering a broad range of examples and up-to-date content. However, it may not be suitable for those focusing on driver development or other Windows programming areas. Windows-Driver-Frameworks, on the other hand, is specifically tailored for driver development, providing the necessary tools and frameworks for that purpose.

14,402

A free Windows-compatible Operating System

Pros of ReactOS

  • Open-source and community-driven, allowing for greater transparency and contributions
  • Aims to be a complete operating system, not just a driver framework
  • Potentially more flexible and customizable for specific use cases

Cons of ReactOS

  • Less mature and stable compared to Windows Driver Frameworks
  • Smaller developer community and ecosystem
  • May lack support for some advanced or proprietary hardware features

Code Comparison

ReactOS (device driver example):

NTSTATUS
NTAPI
DriverEntry(
    IN PDRIVER_OBJECT DriverObject,
    IN PUNICODE_STRING RegistryPath)
{
    // Driver initialization code
}

Windows Driver Frameworks (KMDF driver example):

NTSTATUS
DriverEntry(
    _In_ PDRIVER_OBJECT  DriverObject,
    _In_ PUNICODE_STRING RegistryPath
)
{
    WDF_DRIVER_CONFIG config;
    // Driver initialization code
}

Both examples show the entry point for a kernel-mode driver, but the Windows Driver Frameworks version includes additional WDF-specific structures and initialization.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Windows Driver Frameworks

The Windows Driver Frameworks (WDF) are a set of libraries that make it simple to write high-quality device drivers.

Goals for this project

Developers can use the MSDN reference documentation to learn about the core concepts of WDF and the APIs available for use. Still, there's no substitute for actual source code. That's why we've published the source behind KMDF and UMDF v2 for anyone to dig through and debug drivers with.

Learning from the source

Unsure about what a particular WDF method is doing? Take a look at the source. Our aim is to make the inner workings of WDF as transparent for developers as possible.

Note: As you experiment with WDF, you may come across undocumented behavior or APIS. We strongly advise against taking dependencies on that behavior as it's subject to change in future releases.

Debugging with the framework

Using the source in this repo, developers can perform step-through debugging into the WDF source. This makes it much easier to follow driver activity, understand interactions with the framework, and diagnose issues. Debugging can be done live by hooking onto a running driver or after a crash by analyzing the dump file. See the debugging page in the wiki for instructions.

Scope

With this initial release, we've published the source behind KMDF and UMDF v2. You'll find that a great deal of the source is shared between the two. Driving the frameworks forward with a unified model is a key priority for the WDF team.

Contributing to WDF

See CONTRIBUTING.md for policies on pull requests to this repo.

FAQ about this repo

See the FAQ page in the Wiki.

Licensing

WDF is licensed under the MIT License.

Related Repos

Driver samples for Windows 10 now also live on GitHub.