Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

wdf-umdf

/wdf-umdf

Prowadzi pisanie sterowników w trybie użytkownika UMDF v2 uruchamianych w procesie WUDFHost.exe, wymaganych m.in. dla Indirect Display Drivers oraz wielu sterowników czujników i kamer.

Licencja
MIT
Ostatnia zmiana repozytorium
21.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 21.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Prowadzi pisanie sterowników w trybie użytkownika UMDF v2 uruchamianych w procesie WUDFHost.exe, wymaganych m.in. dla Indirect Display Drivers oraz wielu sterowników czujników i kamer.

Wyzwalacze z opisu

t strictly need kernel mode. USE WHEN: user mentionsWUDFHostuser-mode driverreflectorIDDISensorWDFHOSTUMDF v2
Oryginalny opis (EN)

User-Mode Driver Framework v2 (UMDF). User-mode driver model that uses the same WDF object model as KMDF but runs in a host process (WUDFHost.exe) protected by the reflector. Required for some categories (Indirect Display Drivers, many sensor and camera drivers) and recommended for any driver that doesn't strictly need kernel mode. USE WHEN: user mentions "UMDF", "WUDFHost", "user-mode driver", "reflector", "IDD", "ISensor", "WDFHOST", "UMDF v2", "FX2" DO NOT USE FOR: KMDF (use `wdf-kmdf`), classic UMDF v1 (deprecated, COM-based)

Jak działa

  1. When UMDF is the right answer
  2. DriverEntry equivalent
  3. What's different from KMDF
  4. INF entries (UMDF v2)
  5. Reflector — what it actually does
  6. Companion kernel driver (when UMDF can't reach what you need)
  7. Project structure (UMDF DLL + INF + driver package)
  8. Debugging UMDF
  9. Anti-Patterns
Sekcje z nagłówków SKILL.md, w oryginale · 122 linii, 751 słów
Podgląd SKILL.md
---
name: wdf-umdf
description: |
  User-Mode Driver Framework v2 (UMDF). User-mode driver model that uses the same WDF
  object model as KMDF but runs in a host process (WUDFHost.exe) protected by the
  reflector. Required for some categories (Indirect Display Drivers, many sensor and
  camera drivers) and recommended for any driver that doesn't strictly need kernel mode.

  USE WHEN: user mentions "UMDF", "WUDFHost", "user-mode driver", "reflector",
  "IDD", "ISensor", "WDFHOST", "UMDF v2", "FX2"

  DO NOT USE FOR: KMDF (use `wdf-kmdf`), classic UMDF v1 (deprecated, COM-based)
allowed-tools: Read, Grep, Glob, Write, Edit
---
# UMDF v2 - Quick Reference

> **Deep Knowledge**: Use `mcp__documentation__fetch_docs` with technology: `wdf-umdf`. Authoritative source: `learn.microsoft.com/en-us/windows-hardware/drivers/wdf/getting-started-with-umdf-version-2`.

## When UMDF is the right answer

- **Driver runs in `WUDFHost.exe`**, a user-mode service host. No bugchecks if it crashes — reflector restarts it.
- **Same WDF object model and APIs as KMDF** (`WdfDriverCreate`, `WdfDeviceCreate`, `WdfRequest*`). Differences are mostly which APIs are available, not how to call them.
- Required model for: **Indirect Display Drivers (IDD)**, many HID over Bluetooth scenarios, sensor drivers, camera drivers (MFT/AVStream is a separate path).
- Recommended for: anything where the device protocol is reachable from user mode (USB, Bluetooth, network, mostly-software devices) and you don't need to be in the IRP path of a kernel-only stack.

## DriverEntry equivalent

UMDF drivers expose the same `DriverEntry` symbol; the host loads the DLL and calls it:

```c
NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) {
    WDF_DRIVER_CONFIG config;
    WDF_DRIVER_CONFIG_INIT(&config, MyEvtDeviceAdd);
    return WdfDriverCreate(DriverObject, RegistryPath,
                           WDF_NO_OBJECT_ATTRIBUTES, &config, WDF_NO_HANDLE);
}
```

## What's different from KMDF

| Concern | KMDF | UMDF |
|---------|------|------|
| Process | `System` (`ntoskrnl.exe`) | `WUDFHost.exe` (user mode) |
| Crash impact | Bugcheck | Host restart, device disappears briefly |
| C++ usage | Discouraged (no exceptions/RTTI) | **Full C++ allowed** (use the `cpp` skill freely) |
| Direct hardware access | MMIO, port I/O, DMA | Through reflector / a kernel companion driver if needed |
| Synchronous kernel APIs | Available | Not available — use Win32 / WDF user-mode equivalents |
| IRQL | Real IRQL discipline | Always at PASSIVE-equivalent (no DISPATCH worries) |
| Pool | `ExAllocatePool2` | `new` / `malloc` / `HeapAlloc` |
| Tracing | WPP | WPP **or** standard ETW providers |

> **Practical consequence**: UMDF is almost C++17/20 application code with WDF idioms wrapped around it. Memory bugs are caught by ASan-style tooling at user-mode dev time; kernel pitfalls disappear.

## INF entries (UMDF v2)

```inf
[Manufacturer]
%MfgName% = Standard,NT$ARCH$.10.0...19041

[Standard.NT$ARCH$.10.0...19041]
%Device.DeviceDesc% = MyDevice_Install, ROOT\MyDevice

[MyDevice_Install.NT]
CopyFiles = MyDevice.CopyFiles
AddReg    = MyDevice.AddReg

[MyDevice_Install.NT.Services]
AddService = WUDFRd, 0x000001fa, WUDFRD_ServiceInstall

[WUDFRD_ServiceInstall]
DisplayName  = "WUDF Reflector"
ServiceType  = 1
StartType    = 3
ErrorControl = 1
ServiceBinary= %12%\WUDFRd.sys
LoadOrderGroup = Base

[MyDevice_Install.NT.Wdf]
UmdfDispatcher       = NativeUSB        ; or NativeIDD, NativeHID, etc.
UmdfServiceOrder     = MyUmdfDriver
UmdfKernelModeClientPolicy = AllowKernelModeClients

[MyUmdfDriver]
UmdfLibraryVersion = $UMDFVERSION$
DriverCLSID        = {01234567-89AB-CDEF-0123-456789ABCDEF}
ServiceBinary      = %13%\MyDevice.dll
```

## Reflector — what it actually does

`WUDFRd.sys` (the Reflector) sits in the kernel as the proxy for the user-mode driver. It:
- Receives the kernel IRPs
- Marshals them across the user/kernel boundary into WDF requests delivered to your DLL
- Marshals your completions back into IRPs
- Restarts the host if your DLL crashes

You don't write reflector code; you write DLL code and the framework + reflector deliver requests to it.

## Companion kernel driver (when UMDF can't reach what you need)

UMDF cannot call arbitrary kernel APIs. Patterns:
1. **Inbox kernel client** (e.g. WinUSB, HIDClass, WUDFRd) handles the kernel side
2. **Custom companion KMDF driver** + a private inverted-call IOCTL channel — your UMDF driver opens it and sends commands

## Project structure (UMDF DLL + INF + driver package)

```
DriverSolution/
├── MyUmdfDriver/                     (.vcxproj — UMDF v2)
│   ├── Driver.cpp                    DriverEntry, EvtDeviceAdd
│   ├── Device.cpp                    Device-level WDF callbacks
│   ├── Queue.cpp                     IOCTL / Read / Write handlers
│   ├── MyUmdfDriver.def              Exports
│   └── MyUmdfDriver.inf
├── MyUmdfDriverPackage/              Driver package (.cab + signing)
└── MyUmdfDriverTests/                User-mode test app (Win32 console / GTest)
```

## Debugging UMDF

- Attach a normal **user-mode debugger (WinDbg / Visual Studio)** to `WUDFHost.exe` — much friendlier than KMDF
- Set `HKLM\System\CurrentControlSet\Services\WUDFHost\Parameters\HostProcessDbgBreakOnStart=1` to break before driver load
- Use `Application Verifier` for memory/handle bugs (much like Driver Verifier for KMDF)
- ETW + WPP traces work the same as KMDF

## Anti-Patterns

| Anti-Pattern | Why It's Bad | Correct Approach |
|--------------|--------------|------------------|
| Treating UMDF callbacks as background work | They serialize requests | Hand off long work to a separate worker thread; complete the request when done |
| Calling kernel-only APIs | Won't link | Use Win32 / WDF user-mode equivalents |
| Holding a request indefinitely with no cancel handler | App hangs | Mark cancelable, handle `EvtRequestCancel` |
| Using process global state | Multiple device instances share the host | Per-device context via WDF_OBJECT_ATTRIBUTES |
| Logging via `OutputDebugString` only | Lost in production | WPP/ETW with a published GUID |
| Assuming the host stays up | Reflector can recycle it | Persist nothing in process memory; reload from registry/file on `EvtDevicePrepareHardware` |

Wersje

W bazie nie ma innych skilli o nazwie wdf-umdf.

Migawka bazy z 13.11.2026 · wersja paczki f6d5292643fc (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 1 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100wdf-kmdf
    Prowadzi pisanie sterowników trybu jądra Windows w KMDF: DriverEntry, EvtDeviceAdd, IRP i IOCTL, kolejki I/O, maszyny stanów PnP i zasilania, dyscyplina IRQL, pule pamięci, WPP i Driver Verifier.
  • 100indirect-display
    Opisuje sterownik Windows Indirect Display Driver (UMDF v2), który dodaje wirtualne monitory, przechwytuje ich klatki i kieruje je do sieci, pliku lub enkodera.
  • 100windbg-user-exception-triage
    Analizuje awarie natywnych aplikacji C/C++, usług i hostów sterowników trybu użytkownika ze strukturalnym wyjątkiem w zrzucie lub sesji WinDbg.
  • 100wk-windows-kernel-programming
    Planuje zadanie sterownika trybu jądra Windows: wybór WDM, KMDF lub minifiltra, środowisko testowe i procedury obsługi.
  • 100embedded-driver-design
    Wymusza warstwową architekturę sterowników peryferiów firmware'u wbudowanego: abstrakcję magistrali, obiekty kontekstu urządzenia i separację sterowników od BSP.
  • 100device-driver-development
    Wspiera tworzenie, przegląd, debugowanie i portowanie sterowników urządzeń jądra Linux, modułów, device tree, DMA, IRQ i bring-up sprzętu.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.