modernized driver development - cuvix · 2012. 10. 25. · (engine and ui) windows sdk online...
TRANSCRIPT
![Page 1: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/1.jpg)
C++ 개발자들을 위한 Visual Studio 2012 세미나
Modernized Driver Development
Kim Sung-eun INCA Internet Co.,Ltd.
![Page 2: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/2.jpg)
1. Integrated build environment in Visual Studio
2. Introduce of Development Environment
-Integrated Build environment
-Code Analysis
-Debugging
-Deployment, Install, Auto Test
3. Demos
4. Summary
5. QnA
Agenda
![Page 3: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/3.jpg)
![Page 4: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/4.jpg)
Design
Implement
Test
Assess
and
Certify
Customer
and Partner
Connections
Driver development lifecycle
![Page 5: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/5.jpg)
WDK (Visual Studio add-on)
Visual Studio 2012
Kernel-mode
headers/libs
Kernel debugger
(engine and UI)
Windows SDK
Visual Studio Core
Driver development in Visual
Studio 2012 Component Layout
Driver analysis
tools
VS driver
templates
VS driver toolbar
(build, package,
sign)
Driver testing and deployment
tools
Online
Documents
(MSDN)
Samples
(Code Gallery)
Redistributables
(Developer Portal)
![Page 6: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/6.jpg)
Added Windows Driver Type
- Monolithic / Layered Driver
- FileSystem / Port-Miniport / Mini-Driver
- WDM / Legacy NT Kernel Mode Driver
- Bus / Function/ filter / Class Driver
- nonPNP(Software) / PNP Driver
- WDM/ WDF (KMDF/UMDF)
- WinCE / Embeded / x86 / x64 / ARM (WinRT)
![Page 7: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/7.jpg)
Types of driver models
![Page 8: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/8.jpg)
![Page 9: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/9.jpg)
![Page 10: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/10.jpg)
#include <wdk.h>
#include <wdf.h>
DRIVER_INITIALIZE DriverEntry;
EVT_WDF_DRIVER_DEVICE_ADD OnDeviceAdd;
NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject,
PUNICODE_STRING RegistryPath) {
WDF_DRIVER_CONFIG config;
WDF_DRIVER_CONFIG_INIT(&config, OnDeviceAdd);
return WdfDriverCreate(DriverObject,
RegistryPath,
WDF_NO_OBJECT_ATTRIBUTES,
&config,
WDF_NO_HANDLE);
}
NTSTATUS OnDeviceAdd(WDFDRIVER Driver,
PWDFDEVICE_INIT DeviceInit) {
return WdfDeviceCreate(&DeviceInit,
WDF_NO_OBJECT_ATTRIBUTES,
WDF_NO_HANDLE);
}
![Page 11: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/11.jpg)
Get going quickly
New Visual Studio templates provided for networking, storage,
printing, WDF (KMDF and UMDF) and WDM drivers
New tool automates migration of existing Windows 7 driver projects
Write less code
The Windows Driver Framework (WDF 1.11) has new support for
power management, kernel-mode DMA, Passive-level Interrupt and
user-mode hardware access(UMDF)
Getting started
![Page 12: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/12.jpg)
- Provides driver templates and samples
- Conversion tool eases migration from dirs/sources to
projects/solutions
- F5 will build sign, package, deploy, and debug a driver
- Code Analysis and Static Driver Verifier integrated
- Provides a library of driver tests
- Easily run tests against drivers on test machine(s)
- Write and easily run your own driver tests using test templates
Integrated build environment in
Visual Studio
![Page 13: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/13.jpg)
Compiler enhancements ease driver development
C++ is a “first class citizen” for creating drivers
New “/kernel” switch catches illegal driver code at compile-time
Integrated analysis tools find bugs early
Static Driver Verifier (SDV)
Code Analysis (was PREfast/PFD)
Driving quality “upstream” Tools
![Page 14: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/14.jpg)
Code analysis in Visual Studio 2012
- Analyze one function at a time
- Finds common reliability and security defects
- Supersedes PREfast for drivers
![Page 15: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/15.jpg)
• Verifies complete driver including libraries together
• Determines if a driver obeys OS interaction rules
• WDM, KMDF, NDIS & storage driver support
• C++ support added for Windows 8
Static driver verifier
![Page 16: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/16.jpg)
Code Analysis Static Driver Verifier
What General Technology for applications and drivers. Driver extensions.
Specifically for drivers
Driver Models Any WDM
KMDF
NDIS
StorPort (new for Windows 8)
C and C++ (new for Windows 8)
Issues found Local defects
Easy to fix
High volume
Global defects
Harder to fix
Low volume
Scope Function level
Local violations
Inter-procedural
Finds deep bugs
Annotations Annotations of code needed -
Development Cycle
Apply early:
“When the driver compiles”
Runs in minutes
Apply later:
“When the basic structure of the driver is in place”
Longer runtime, run periodically overnight
Static Tools Summary
![Page 17: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/17.jpg)
USB3.0 XHCI and Network Debugging - Easy to setup
- No special cables needed
- Much faster than serial and USB2
- Ship in modern form factor machines
Network Kernel Debugging
- Kernel debug target machines directly over the network
- Can debug single NIC machines and still use Windows Networking
- Debug connection requires encryption and authentication, and this
requires a shared secret 256 bit key.
- Supports a number of Ethernet NICs from different vendors
USB 3.0 Debugging
- Supports USB3 XHCI Debug Compatible Hardware
- USB3 XHCI controllers with XHCI debug will support debugging on
any of their ports
- Much faster than USB2 debugging.
Modern Kernel Debug Transports
![Page 18: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/18.jpg)
Kernel Debug Setup Automatic Setup
Use Visual Studio target machine configuration
Manual Setup
Target machine(NET)
Bcdedit –dbgsettings net hostip:w.x.y.z port:50000
Bcdedit –debug on
Host machine(NET)
Windbg –k net:port=50000, key=paste.your.generated.keyhere
Target machine(USB3)
Bcdedit –dbgsettings usb targetname:mytestmachine
Bcdedit –set dbgtransport kdusb3.dll
Bcdedit –debug on
Host machine(USB3)
Windbg –k usb:targetname=mytestmachine
![Page 19: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/19.jpg)
Debugger Connections
Windows 7 Windows 8
![Page 20: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/20.jpg)
Debugging optimized code as source, not machine code
-Show correct values even when optimized into registers
-Step through optimized code
-Show source code for inline functions
- Set breakpoints on inline functions
More accurate information
![Page 21: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/21.jpg)
Deploying a driver to a
remote test machine is
easy.
You access these
options via the
project’s properties
Driver Deployment & Install
![Page 22: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/22.jpg)
“Easily run tests” automates build-debug cycle for developers
- Automated driver build, packaging, signing and deployment
- Test library pre-loaded with “Device Fundamentals” tests
- Remote machine provisioning and integrated kernel debugging
“Easily write tests” simplifies creation of new driver tests
- Create new driver tests with Visual Studio templates
![Page 23: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/23.jpg)
You easily and automatically:
-Provision machines for driver testing
-Deploy and install driver packages
-Debug drivers
-Execute driver tests
-Save and share test results with other developers
Runtime driver testing in Visual Studio
![Page 24: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/24.jpg)
Microsoft provides a library of tests in the WDK
Device fundamentals tests - Use these tests as your driver exposes new functionality (e.g. Plug and
Play)
- You can write a plugin to tailor the tests for your device using a WDK
supplied template
Certification tests - Many are now available in the WDK.
- The developer can run these to Identify and resolve driver certification
issues earlier
Driver Tests
![Page 25: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/25.jpg)
Uncovers issues at 1st offense - easier to debug root cause
Checks for illegal function calls and potential actions that can
lead to system corruption
Easy to enable and configure in WDK driver projects
Is always enabled during certification, so you should also enable
it while testing.
Driver verifier
![Page 26: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/26.jpg)
Hardware
Driver test
deployment
Driver test
results
Driver verifier settings
Driver deployment
Rules
Rules
Driver testing architecture
![Page 27: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/27.jpg)
Code Analysis
Static Driver
Verifier
Easily Run Tests
Device
Fundamentals Tests
Driver Verifier
Write Device
Specific Tests
Design
Implement
Test
Assess
and
Certify
Customer
and Partner
Connection
s
![Page 28: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/28.jpg)
Demos
![Page 29: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/29.jpg)
Summary
Integrated Driver Dev. In VS2012
-Make developers more productive
-Find defects early
-Ease creation of more reliable, better performing drivers
![Page 30: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/30.jpg)
QnA
![Page 31: Modernized Driver Development - Cuvix · 2012. 10. 25. · (engine and UI) Windows SDK Online Visual Studio Core ... Getting started - Provides driver templates and samples - Conversion](https://reader034.vdocuments.mx/reader034/viewer/2022052001/6013f1721e71112df73e3172/html5/thumbnails/31.jpg)
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market
conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT
MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.