modernized driver development - cuvix · 2012. 10. 25. · (engine and ui) windows sdk online...

Post on 27-Sep-2020

5 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

C++ 개발자들을 위한 Visual Studio 2012 세미나

Modernized Driver Development

Kim Sung-eun INCA Internet Co.,Ltd.

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

Design

Implement

Test

Assess

and

Certify

Customer

and Partner

Connections

Driver development lifecycle

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)

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)

Types of driver models

#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);

}

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

- 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

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

Code analysis in Visual Studio 2012

- Analyze one function at a time

- Finds common reliability and security defects

- Supersedes PREfast for drivers

• 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

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

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

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

Debugger Connections

Windows 7 Windows 8

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

Deploying a driver to a

remote test machine is

easy.

You access these

options via the

project’s properties

Driver Deployment & Install

“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

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

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

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

Hardware

Driver test

deployment

Driver test

results

Driver verifier settings

Driver deployment

Rules

Rules

Driver testing architecture

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

Demos

Summary

Integrated Driver Dev. In VS2012

-Make developers more productive

-Find defects early

-Ease creation of more reliable, better performing drivers

QnA

© 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.

top related