WinDriver supports driver development for the following 64-bit
architectures:
- Windows AMD64 or Intel EM64T (x64)
- Linux AMD64 or Intel EM64T (x86_64)
By default, applications created using the 64-bit versions of
WinDriver are 64-bit applications. Such applications are more
efficient than 32-bit applications. However, you can also use the
64-bit versions of WinDriver to create 32-bit
applications that will run on the supported 64-bit platforms.
This document outlines two methods for creating such applications:
NOTE
In the following documentation
- <WD64> signifies the path to a 64-bit
WinDriver installation directory for your target operating system (e.g.,
C:\WinDriver64), and <WD32> signifies
the path to a 32-bit WinDriver installation directory for
the same operating system (e.g., C:\WinDriver).
- <ver> signifies the version of the WinDriver
installation that you are using — for example,
1120 for version 11.2.0.
Developing a 32-bit WinDriver Application for
64-bit Platforms
To create a 32-bit WinDriver application for 64-bit
platforms, using a 64-bit WinDriver installation, do the following:
- Create a WinDriver application, as outlined in the WinDriver User's
Manual — for example, by generating code with DriverWizard, or
using one of the WinDriver samples.
- Build the application with an appropriate 32-bit compiler
for your target operating system, using the following configuration:
- Add the
KERNEL_64BIT preprocessor
definition.
NOTE
In the makefiles, the definition is added using the
-D flag: -DKERNEL_64BIT.
The sample and wizard-generated Linux and Windows GCC makefiles
and Windows MS Visual Studio projects, in the
64-bit WinDriver toolkit, already add this
definition.
- Link the application with the specific version of the WinDriver
API library/shared object for 32-bit applications
executed on 64-bit platforms —
<WD64>\lib\amd64\x86\wdapi<ver>.lib
on Windows (e.g.,
C:\WinDriver64\lib\amd64\x86\wdapi1120.lib)
/
<WD64>/lib/libwdapi<ver>_32.so
on Linux (e.g.,
~/WinDriver64/lib/libwdapi1120_32.so).
The sample and wizard-generated project and make files for
32-bit applications in the 64-bit
WinDriver toolkit already link to the correct library:
On Windows, the MS Visual Studio project files and Windows GCC
makefiles are defined to link with
<WD64>\lib\amd64\x86\wdapi1120.lib.
On Linux, the installation of the 64-bit WinDriver
toolkit on the development machine creates a
libwdapi<ver>.so symbolic link in the
/usr/lib directory — which links to
<WD64>/lib/libwdapi<ver>_32.so
— and in the /usr/lib64 directory
— which links to
<WD64>/lib/libwdapi<ver>_32.so
(the 64-bit version of this shared object).
The sample and wizard-generated WinDriver makefiles rely on
these symbolic links to link with the appropriate shared object,
depending on whether the code is compiled using a
32-bit or 64-bit compiler.
NOTE
- When distributing your application to target 64-bit
platforms, you need to provide with it the WinDriver API DLL/shared
object for 32-bit applications executed on
64-bit platforms —
<WD64>\redist\wdapi<ver>_32.dll on
Windows (e.g.,
C:\WinDriver64\redist\wdapi1120_32.dll)
/
<WD64>/lib/libwdapi<ver>_32.so on Linux
(e.g.,
~/WinDriver64/lib/libwdapi1120_32.so).
Before distributing this file, rename the copy of the file in your
distribution package by removing the _32 portion. The
installation on the target should copy the renamed DLL/shared object to
the relevant OS directory — %windir%\sysWOW64
on Windows or /usr/lib on Linux. All other
distribution files are the same as for any other 64-bit
WinDriver driver distribution, as detailed in the WinDriver
distribution instructions in the manuals.
- An application created using this method will not work on
32-bit platforms. A WinDriver application for
32-bit platforms needs to be compiled without the
KERNEL_64BIT definition; it needs to be linked with the
standard 32-bit version of the WinDriver API
library/shared object from the 32-bit WinDriver
installation
(<WD32>\lib\x86\wdapi<ver>.lib on
Windows / <WD32>/lib/libwdapi<ver>.so
on Linux); and it should be distributed with the standard
32-bit WinDriver API DLL/shared object
(<WD32>\redist\wdapi<ver>.dll on
Windows / <WD32>/lib/libwdapi<ver>.so
on Linux) and any other required 32-bit distribution file,
as outlined in the WinDriver distribution instructions in the manuals.
Developing a 32-bit Application for Both 32-bit
and 64-bit Platforms
If you have both 64-bit and 32-bit WinDriver
installations, you can also create a single 32-bit application
that can be executed on both 32-bit and 64-bit
platforms. This can be done using the following method:
- Create a DLL (on Windows) or a shared object (on Linux) that
concentrates the calls to the WinDriver APIs.
If you created a WinDriver application using the generated DriverWizard
code or one of the WinDriver samples, convert this application to a
DLL/shared object.
- Compile two versions of your DLL/shared object:
- A version for 32-bit platforms: This
version should be compiled using a 32-bit
compiler, without the
KERNEL_64BIT
definition, and linked with the standard 32-bit
WinDriver API library/shared object from the
32-bit WinDriver installation —
<WD32>\lib\x86\wdapi<ver>.lib
on Windows (e.g.,
C:\WinDriver\lib\x86\wdapi1120.lib)
/ <WD32>/lib/libwdapi<ver>.so
on Linux (e.g.,
~/WinDriver/lib/libwdapi1120.so).
- A version for 64-bit platforms: This
version should be compiled using a 32-bit
compiler, with the
KERNEL_64BIT definition,
and linked with the standard 32-bit WinDriver API
library/shared object from the 64-bit WinDriver
installation —
<WD64>\lib\amd64\x86\wdapi<ver>_32.lib
on Windows (e.g.,
C:\WinDriver64\lib\x86\wdapi1120.lib)
/ <WD64>/lib/libwdapi<ver>_32.so
on Linux (e.g.,
~/WinDriver64/lib/libwdapi1120_32.so)
(see details
above regarding
compilation of 32-bit applications for
64-bit platforms).
- Write a 32-bit application that communicates with
WinDriver via the DLL/shared object that you created; the application
should be implemented to load the relevant version of the DLL/shared
object — 32-bit or 64-bit —
depending on the platform on which it is run.
Note: This application should be compiled using an appropriate
32-bit compiler, without the
KERNEL_64BIT definition.
NOTE
When distributing a driver that was developed using this method, be sure to
distribute the relevant files for each target platform:
- For 32-bit platforms, distribute the application together
with the 32-bit version of your WinDriver-wrapper
DLL/shared object, and with the standard 32-bit files from
the 32-bit WinDriver installation, including the
32-bit WinDriver DLL/shared object
(<WD32>\redist\wdapi<ver>.dll on
Windows / <WD32>/lib/libwdapi<ver>.so
on Linux).
- For 64-bit platforms, distribute the application together
with the 64-bit version of your WinDriver-wrapper
DLL/shared object, and with the standard 64-bit files from
the 64-bit WinDriver installation, including the
64-bit WinDriver DLL/shared object
(<WD64>\redist\wdapi<ver>.dll on
Windows / <WD64>/lib/libwdapi<ver>.so
on Linux).
For detailed distribution instructions, refer to the WinDriver User's Manual.
|