Upload
clara-rice
View
218
Download
0
Tags:
Embed Size (px)
Citation preview
Introduction to User-Mode Driver Framework
OutlineOutline
What is UMDF?
When should I use UMDF?
When shouldn’t I use UMDF?
What does UMDF give me?What kind of drivers can I write?
What can my drivers do?
What next?
GoalsGoals
How UMDF fits into WDF
Understand UMDF’s capabilities
Current Driver ModelsCurrent Driver Models
Windows has several different driver modelsWindows Driver Model (WDM) is the generic model
Specific driver models for popular devices classesStorage, Networking, Printing, Imaging, etc...
Some built on top of WDM. Others run as user-mode services.
WDM FeaturesAsynchronous, packet-based I/O
I/O Cancellation
Layering of drivers
Dynamic loading and unloading of drivers
Plug and Play & Power management
Low-level high-performance interfaces
WDM AdvantagesLarge device coverage
Flexible
Limitations with Current ModelsLimitations with Current Models
Generic driver model (WDM) is too complexFocuses on very advanced drivers which punishes simple ones
Poor DDI design
Device specific models have complexity of their ownOften this bubbles through from WDM
Developer trapped in device-specific model
Poor knowledge transfer from one to the next
Many drivers must be written in kernel mode Even though much functionality could be user mode
Developers spend too much time driving our softwareCannot concentrate on driving their hardware
Driver quality suffers as a result
Do not allow extension and future growth
Overview of Current Driver ModelsOverview of Current Driver Models
Device/Driver Classes Current ModelDisplay Adapters Video port
Storage Adapters (SCSI & ATA) SCSIport, Storport, ATAport,
Network Adapters NDIS
Video Capture AvStream
Audio Adapters AVStream, PortCls
File System filters FS Mini filter
Printers UniDrv
Scanners,Cameras WIA
PCI, PC Card, generic filter drivers WDM
Modems, Cable Modem WDM & NDIS WDM
Biometric Devices WDM
Smart Card Devices WDM
Keyboard/Mouse Filters WDM
Legacy Devices (Serial, Parallel) WDM
Portable Media Players WMDM
UPnP & Network Connected Devices, Cell Phones No support
USB, 1394, Bluetooth, SD devices WDM (kernel), no support (user)
Others WDM
Windows Driver FoundationWindows Driver Foundation
We need a new generic driver model that ...Scales conceptually from simple to extremely complex drivers
Can be extended to domain specific models
Can be validated at compile-time as well as run-time
Windows Driver Foundation (WDF) consists ofA generic driver model
Implementations of that modelKernel Mode Driver Framework (KMDF)
User Mode Driver Framework (UMDF)
Driver Verification ToolsStatic Driver Verifier
PREfast for Drivers
Windows Driver Foundation GoalsWindows Driver Foundation Goals
SimplicityNo harder than it needs to be to accomplish a task
Fast time to market for driversLet driver developers focus on their domain, not ours
Reduce crashes and blue screens due to driversBetter customer experience helps everyone
Provide complete driver development experienceDevelop and test
Built-in diagnosability, tracing, verification tools
Deployment and InstallSupport versioning
Windows Driver Foundation- ExperienceWindows Driver Foundation- Experience
Overview of Current (User) Driver ModelsOverview of Current (User) Driver Models
Device/Driver Classes Current ModelDisplay Adapters Video port
Storage Adapters (SCSI & ATA) SCSIport, Storport, ATAport,
Network Adapters NDIS
Video Capture AvStream
Audio Adapters AVStream, PortCls
File System filters FS Mini filter
Printers UniDrv
Scanners,Cameras WIA
PCI, PC Card, generic filter drivers WDM
Modems, Cable Modem WDM & NDIS WDM
Biometric Devices WDM
Smart Card Devices WDM
Keyboard/Mouse Filters WDM
Legacy Devices (Serial, Parallel) WDM
Portable Media Players WMDM
UPnP & Network Connected Devices, Cell Phones No support
USB, 1394, Bluetooth, SD devices WDM (kernel), no support (user)
Others WDM
Why Build a User-Mode Framework?Why Build a User-Mode Framework?
Difficult to provide high-quality driversCrash statistics prove this
WDF Framework makes drivers easier to write
Lots of driver models already live in user spacePrinters, Audio, Imaging
Divergent driver models has become a problem
UMDF brings general-purpose model into user-mode
General UMDF provides:Unified facilities
Support for WDF model
What is UMDF?What is UMDF?
Implementation of the WDF Driver Model
Provides ...The infrastructure to run a device driver in user-mode
The WDF I/O Pipeline and PnP/PM State Machine
The core WDF objectsDevices, Files, Queues, Requests, I/O Targets, etc...
UMDF and KMDF both share the WDF ModelSo learning how to use one will apply to the other
But they are not source or binary compatibleHave similar but not identical DDIs
Each has additional functionality applicable to its domain
Device Stack
Overview of the ArchitectureOverview of the Architecture
Provided by:
Microsoft
ISV
IHV
Driver Manager
Host ProcessUser
Kernel
Framework
UM driverFramework
UM driver
Reflector
...
CoInstaller
Kernel Driver
Kernel Driver
Who Should Use UMDF?Who Should Use UMDF?
Existing driver developers…Who want to move drivers to user space
Who already have the “driver mindset”
New driver developers…Coming from application development
Who need to provide device support
Who are learning new skills
Anyone who wants to...Build a driver without a lot of development overhead
Reduce the risks associated with traditional drivers
Stop causing blue screens
Where can you use UMDF?Where can you use UMDF?
Primary Scenarios“Protocol Bus” devices
Devices attached to USB, 1394, TCP/IP, etc...
Software-only driversFilter drivers, virtualized serial port, etc…
Current DevicesPortable Media Players, Cell Phones, PDAs/ActiveSync, Auxiliary Display, Cameras
Future DevicesDevices on future protocol busses
Devices where driver can be split into ...Small kernel-mode component to do hardware access
Larger user-mode driver to provide complex functionality
When and How To Use UMDFWhen and How To Use UMDF
UMDF is a standard Windows codenamed “Longhorn” feature
Support in WDK
Build with the WDK Build EnvironmentStandard device driver build environment
No integration with Visual Studio
Why Use UMDF?Why Use UMDF?
Uses the WDF Driver ModelCan learn a single model that applies to KM and UM drivers
Faster development cycleEasier debugging on a single machine
Crashes during development don’t require a reboot
Access to user-mode servicesWin32 file I/O, Function Discovery, WINSOCK, RPC, Crypto
But you have to be careful…
Why Use UMDF?Why Use UMDF?
Improved stabilityUser-Mode Drivers are isolated from other drivers
Kernel is isolated from user-mode drivers
Increased securityCompromised driver does not crash the system
Lower privileges restrain a compromised driver
RecoverabilitySystem can recover after a driver crash – no blue-screens
The driver can be restarted without rebooting
Kernel-Mode or User-Mode Driver?Kernel-Mode or User-Mode Driver?
You must use kernel mode when you:
Need direct hardware access, for example,Require DMA
Must handle interrupts
Need access to device registers
Have strict timing requirementsUMDF will have increased latency
Need kernel-only resourcesOr kernel components need access to your driver
Features You Can Use in Your DriverFeatures You Can Use in Your Driver
General WDF capabilitiesPnP/PM provides “opt-in” callbacks for various events
Object model has context management & flow control
I/O Targets allow driver to send new I/O requestsRegardless of where the target device driver is running
Coordinated with cancellation and cleanup
Escape to Win32 and user-mode services
Standard facilities for Windows I/O modelPnP Device Discovery
Synchronous & Asynchronous I/O with Cancellation
Buffered and Direct I/O transfers
Standard INF Driven setup
Common ConcernsCommon Concerns
Will a user-mode driver be fast enough?UMDF driver can already flood a portable media device
UMDF may increase latency, but throughput remains high
Performance is one of our top priorities
But it’s not always the top priority for driver developersBalanced with improvements in quality, stability, security, etc...
Will a user-mode driver be secure?As secure as any other user-mode service
RPC, LSASS, WinLogon, etc...
A compromised user-mode driver is more containedCannot crash the system or expose kernel secrets
Will user-mode drivers be high quality drivers?We’ll continue to push to improve driver quality in all models
UMDF will prevent badly behaved drivers from crashing the system
What’s Next?What’s Next?
Development platform is the WDK/LDK
Currently allows developing drivers for Longhorn
But we know that’s not enough…Plan to support Windows XP in Longhorn time-frame
Versioning supportSupport for side-by-side installation
Beta programWindows Driver Foundation Beta Program Invitation
http://www.microsoft.com/whdc/driver/wdf/beta.mspx
Call To ActionCall To Action
Install the Windows Driver Kit
Join the WDF Beta ProgramAt http://beta.microsoft.com
Guest ID: Guest4WDF
Evaluate UMDF for your driver projectsConsider development time, customer support for system crashes, etc.
Send Us Feedback - We want to knowIf UMDF will meet your needs
What stops you from writing your drivers with UMDF
Email: umdffdbk @ microsoft.com
Additional ResourcesAdditional Resources
Web Resources:WDF Information:
http://www.microsoft.com/whdc/driver/wdf/default.mspx
Windows Debugger:http://www.microsoft.com/whdc/devtools/debugging/default.mspx
External Resources“Introduction to the Windows Driver Foundation: How To Develop Device Drivers Using the Kernel Mode Driver Framework” from OSR Press
Release date is September 2005
Focuses on KMDF but provides general WDF information as well
© 2005 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.