building “old” windows drivers (xp, vista, 2003 and 2008) with visual studio 2013

20
Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio 2013 Dmitry Fleytman, [email protected] Yan Vugenfirer, [email protected] Daynix Computing LTD

Upload: yan-vugenfirer

Post on 07-Jul-2015

1.134 views

Category:

Software


1 download

DESCRIPTION

Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio 2013

TRANSCRIPT

Page 1: Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio 2013

 Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio 2013

Dmitry Fleytman, [email protected] Yan Vugenfirer, [email protected]

Daynix Computing LTD

Page 2: Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio 2013

Daynix Computing LTD

Agenda

Motivation

XP\Vista\Server 2003\Server 2008 WDM driver step by step configuration

And don’t forget KMDF

2

Page 3: Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio 2013

Daynix Computing LTD

Motivation

Maintain single code base for variety of Windows OSes

Build XP and Vista drivers with Visual Studio 2013

Use C++11 features of Visual Studio 2013 compiler for the development of kernel drivers

3

Page 4: Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio 2013

Daynix Computing LTD

What are the basic steps?

Use VS2013 compiler

Compile XP and Vista drivers using legacy DDK for include files and libraries

Change appropriate preprocessor definitions

Adjust linker options

Adjust packaging for KMDF

4

Page 5: Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio 2013

Daynix Computing LTD

Create configuration

Create configuration for desired OS and platform by copying existing configuration (for example Windows 7)

5

Page 6: Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio 2013

Daynix Computing LTD

Adjust includes and libraries paths

Include directories (when using Win7 DDK):

C:\WinDDK\7600.16385.1\inc\ddk;C:\WinDDK\7600.16385.1\inc\crt;C:\WinDDK\7600.16385.1\inc\api

6

Page 7: Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio 2013

Daynix Computing LTD

Adjust libraries path

7

XP 32bit C:\WinDDK\7600.16385.1\lib\wxp\i386

Windows Server 32 bit C:\WinDDK\7600.16385.1\lib\wnet\i386

Windows Server 64 bit

C:\WinDDK\7600.16385.1\lib\wnet\amd64

Vista 32bit C:\WinDDK\7600.16385.1\lib\wlh\i386

Vista 64bit C:\WinDDK\7600.16385.1\lib\wlh\amd64

Change your libraries path according to the following table:

Page 8: Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio 2013

Daynix Computing LTD

Adjust preprocessor definitions

Use the following link to set correct versions according to the target OS for:

WINVER

NTDDI_VERSION

_WIN32_WINNT

Example for Windows Vista:

_WIN32_WINNT=0x0600;WINVER=0x0600;NTDDI_VERSION=0x06000000

8

Page 9: Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio 2013

Daynix Computing LTD

Adjust linker settings (1)

Adjust “Additional Library Directories” to point to legacy DDK directory according to your platform (see also “Adjust libraries path” slide)

9

Page 10: Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio 2013

Daynix Computing LTD

Adjust linker settings (2)Change “Additional dependencies” to reflect needed libraries

The screenshot is an example of NDIS miniport driver

For WDM driver remove ndis.lib and add wdm.lib

10

Page 11: Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio 2013

Daynix Computing LTD

Adjust linker settings (3)Change “version” and “subsystem” parameter to reflect correct Windows version.

For the versions numbers check http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745(v=vs.

11

Page 12: Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio 2013

Daynix Computing LTD

Package project

Adjust OS list for Inf2Cat

Possible options: XP_X86, Server2003_X86, XP_X64, Server2003_X64, Server2003_IA64, Vista_X86, Server2008_X86, Vista_X64, Server2008_X64, Server2008_IA64

12

Page 13: Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio 2013

Daynix Computing LTD

Check command lines of compiler and linker

Check compiler (C\C++) and linker command line for references to new WDK (Windows Kits\8.1 or Windows Kits\8.0)

Check that all the version numbers reflect correct Windows version

Fix if needed according to previous slides

13

Page 14: Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio 2013

BUILD THE DRIVER

14

Page 15: Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio 2013

Daynix Computing LTD

KMDF driver configuration (1)

Add paths to KMDF libraries and include directories as well

15

Page 16: Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio 2013

Daynix Computing LTD

KMDF driver configuration (2)Change driver model setting to “WDM”

This will allow to copy correct version of the WDF coinstaller from old DDK

16

Page 17: Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio 2013

Daynix Computing LTD

KMDF driver configuration (3)

Change driver entry point

17

Page 18: Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio 2013

Daynix Computing LTD

KMDF driver configuration (4)

In package project add a correct version of the WDF coinstaller from old DDK (can be a post build step or add it as a file that is part of the package).

18

Page 19: Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio 2013

BUILD THE DRIVER

19

Page 20: Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio 2013

Daynix Computing LTD

Links

Download Windows 7 DDK - http://www.microsoft.com/en-us/download/details.aspx?id=11800

Values for versions definitions - http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745(v=vs.85).aspx

20