The sample WinDriver\samples\pci_diag\kp_pci Kernel PlugIn directory and the
generated DriverWizard Kernel PlugIn
<project_dir>\kermode directory (where
<project_dir> is the directory in which you
selected to save the generated driver project) contain the following
Kernel PlugIn project files (where
xxx is the driver name —
pci for the sample / the name you selected
when generating the code with the wizard):
- x86 — 32-bit project files:
- msdev_2012\kp_xxx.vcproj —
32-bit MS Visual Studio 2012 project.
- msdev_2010\kp_xxx.vcproj —
32-bit MS Visual Studio 2010 project.
- msdev_2008\kp_xxx.vcproj —
32-bit MS Visual Studio 2008 project.
- msdev_2005\kp_xxx.vcproj —
32-bit MS Visual Studio 2005 project.
- win_gcc/makefile —
32-bit Windows GCC (MinGW/Cygwin) makefile
-
amd64 — 64-bit project files:
- msdev_2012\kp_xxx.vcproj —
64-bit MS Visual Studio 2012 project.
- msdev_2010\kp_xxx.vcproj —
64-bit MS Visual Studio 2010 project.
- msdev_2008\kp_xxx.vcproj —
64-bit MS Visual Studio 2008 project.
- msdev_2005\kp_xxx.vcproj —
64-bit MS Visual Studio 2005 project.
- win_gcc/makefile —
64-bit Windows GCC (MinGW/Cygwin) makefile
The sample
WinDriver\samples\pci_diag
directory and the generated <project_dir>
directory contain the following project files for the user-mode
application that drives the respective Kernel PlugIn driver (where
xxx is the driver name —
pci for the sample / the name you selected
when generating the code with the wizard):
- x86 — 32-bit project files:
- msdev_2012\xxx_diag.vcproj —
32-bit MS Visual Studio 2012 project.
- msdev_2010\xxx_diag.vcproj —
32-bit MS Visual Studio 2010 project.
- msdev_2008\xxx_diag.vcproj —
32-bit MS Visual Studio 2008 project.
- msdev_2005\xxx_diag.vcproj —
32-bit MS Visual Studio 2005 project.
- win_gcc/makefile —
32-bit Windows GCC (MinGW/Cygwin) makefile
-
amd64 — 64-bit project files:
- msdev_2012\xxx_diag.vcproj —
64-bit MS Visual Studio 2012 project.
- msdev_2010\xxx_diag.vcproj —
64-bit MS Visual Studio 2010 project.
- msdev_2008\xxx_diag.vcproj —
64-bit MS Visual Studio 2008 project.
- msdev_2005\xxx_diag.vcproj —
64-bit MS Visual Studio 2005 project.
- win_gcc/makefile —
64-bit Windows GCC (MinGW/Cygwin) makefile
The msdev_* MS Visual Studio directories listed above also contain
xxx_diag.dsw/.sln workspace/solution files
that include both the Kernel PlugIn and user-mode projects.
To build your Kernel PlugIn driver and respective user-mode application on
Windows, follow these steps:
-
Verify that the Windows Driver Kit (WDK) is installed.
-
Set the BASEDIR environment variable to point to the location of the
directory in which WDK is installed.
-
Build the Kernel PlugIn SYS driver
(kp_pci.sys — sample /
kp_xxx.sys — wizard-generated code):
-
Using MS Visual Studio — Start Microsoft Visual Studio, and do the following:
From your driver project directory, open the Visual Studio
Kernel PlugIn workspace/solution file —
<project_dir>\msdev_*\xxx_diag.dsw/.sln,
where <project_dir> is your driver
project directory (pci_diag for the sample
code / the directory in which you selected to save the generated
DriverWizard code), msdev_* is your target Visual Studio
directory (e.g., msdev_2012), and
xxx is the driver name
(pci for the sample / the name you
selected when generating the code with the wizard).
![[Note]](scripts/images/note.png) | |
|---|
-
When using DriverWizard to generate code for MS Visual Studio, you can
use the IDE to Invoke option to have the
wizard automatically open the generated workspace/solution file
in your selected IDE, after generating the code files.
-
To successfully build a Kernel PlugIn project using MS Visual Studio, the path to
the project directory must not contain any spaces.
|
-
Set the Kernel PlugIn project
(kp_pci.dsp/vcproj /
kp_xxx.dsp/vcproj) as the active
project.
-
Select the active configuration for your target platform: From the
menu, choose
(Visual Studio 2003/2005/2008) /
(Visual Studio 6.0), and select the desired configuration.
![[Note]](scripts/images/note.png) | |
|---|
|
To build the driver for multiple operating systems, select the
lowest OS version that the driver must support. For example, to
support Windows XP and higher (32-bit), select either
(release mode) or
(debug mode).
|
-
Build your driver: Build the project from the
menu or using the relevant shortcut
key (e.g., in Visual Studio 6.0).
-
Using Windows GCC — Do the following from your selected
Windows GCC development environment (MinGW/Cygwin):
-
Change directory to your target Windows GCC Kernel PlugIn
project directory —
<project_dir>/<kernel_dir>/<CPU>/win_gcc,
where <project_dir> is your driver
project directory (pci_diag for the sample
code / the directory in which you selected to save the generated
DriverWizard code), <kernel_dir> is
the project's Kernel PlugIn directory (kp_pci
for the sample code / kermode for the
generated code), and <CPU> is the target CPU
architecture (x86 for x86 platforms, and amd64 for
x64 platforms).
For example:
-
When building a 32-bit version of the sample KP_PCI
driver —
$ cd WinDriver/samples/pci_diag/kp_pci/x86/win_gcc
-
When building a 64-bit wizard-generated
Kernel PlugIn driver —
$ cd <project_dir>/kermode/amd64/win_gcc
— where <project_dir> signifies the path to
your generated DriverWizard project directory (for example,
~/WinDriver/wizard/my_projects/my_kp).
-
Edit the ddk_make.bat command in
the Kernel PlugIn makefile, to set the desired build
configuration — namely, the target OS and build mode
(release —
free, or debug —
checked). By default, the WinDriver sample and
wizard-generated makefiles set the target OS parameter to
Windows XP (winxp for 32-bit / x64 for
64-bit), and the build mode to release (free).
![[Note]](scripts/images/note.png) | |
|---|
-
The ddk_make.bat utility is provided
under the WinDriver\util directory, and should be
automatically identified by Windows when running the build command.
Run
ddk_make.bat with no parameters to view the available
options for this utility.
-
The selected build OS must match the CPU architecture of your WinDriver
installation. For example, you cannot select the 64-bit
win7_x64 OS flag when using a 32-bit WinDriver installation.
-
To build the driver for multiple operating systems, select the
lowest OS version that the driver must support. For example, to
support Windows XP and higher, set the OS parameter to
winxp (for 32-bit) or x64 (for
64-bit).
|
-
Build the Kernel PlugIn driver using the
make command.
-
Build the user-mode application that drives the Kernel PlugIn
driver (pci_diag.exe — sample /
xxx_diag.exe — wizard-generated
code):
-
Using MS Visual Studio —
-
Set the user-mode project
(pci_diag.dsp/vcproj —
sample / xxx_diag.dsp/vcproj
— wizard-generated code) as the active project.
-
Build the application: Build the project from the
menu or using the relevant shortcut
key (e.g., in Visual Studio 6.0).
-
Using Windows GCC — Do the following from your selected
Windows GCC development environment (MinGW/Cygwin):
-
Change directory to your target Windows GCC application directory
—
<project_dir>/<CPU>/win_gcc,
where <project_dir> is your driver
project directory (pci_diag for the sample
code / the directory in which you selected to save the generated
DriverWizard code), and <CPU> is the target CPU
architecture (x86 for x86 platforms, and amd64 for
x64 platforms).
For example:
-
When building a 32-bit version of the sample
pci_diag application, which
drives the sample KP_PCI driver —
$ cd
WinDriver/samples/pci_diag/x86/win_gcc
-
When building a 64-bit wizard-generated user-mode
application that drivers a wizard-generated Kernel PlugIn
driver —
$ cd <project_dir>/amd64/win_gcc
— where <project_dir> signifies the path to
your generated DriverWizard project directory (for example,
~/WinDriver/wizard/my_projects/my_kp).
-
Build the application using the
make command.