This sample demonstrates a simple virtual serial driver. This driver supports sending and receiving AT commands using the ReadFile/WriteFile calls or via a TAPI interface using an application such as HyperTerminal.
This sample driver is a minimal driver meant to demonstrate the usage of the User-Mode Driver Framework. It is not intended for use in a production environment.
See the UMDF Readme.htm file for more information about supported operating systems and building the samples.
Start a build environment window as described under Building and Testing the Samples the UMDF Readme file.
Change to the directory containing the device source code.
Run build -ceZ, or use the macro BLD. This command invokes the Microsoft make routines to build the components. If the build succeeds, you will find the driver, Virtualserial.dll in the binary output directory specified for the build environment. You can get the output path from the buildxxx.log file.. If it fails you can find errors and warnings in the build error (.err) and warning (.wrn) log files respectively (buildfre_wlh_x86.err for example).
To test the sample you will need to setup your test system as described Building and Testing the Samples the UMDF Readme file.
To install the VirtualSerial driver:
- First copy the driver binary and the VirtualSerial.inf file to a directory on your test machine (for example c:\VirtualSerial.)
- Copy the UMDF coinstaller WUDFUpdate_01009.dll from c:\winddk\<bld>\redist\wdf\<arch> to the same directory (for example c:\VirtualSerial).
- Change to the directory containing the inf and binaries (for example cd /d c:\VirtualSerial.)
- Next run devcon.exe as follows:
devcon.exe install VirtualSerial.inf UMDF\VirtualSerial
DevCon can be found in the tools directory of your WDK enlistment (for example: c:\winddk\<bld>\tools\devcon\i386\devcon.exe.)
To update the VirtualSerial driver after making any changes:
- Increment the version number found in the INF. While this is not strictly necessary, it will help ensure PnP selects your new driver as a better match for the device.
- Copy the updated driver binary and the VirtualSerial.inf file to a directory on your test machine (for example c:\VirtualSerial.)
- Change to the directory containing the inf and binaries (for example cd /d c:\VirtualSerial.)
- Next run devcon.exe as follows:
devcon.exe update VirtualSerial.inf UMDF\VirtualSerial
To test the VirtualSerial driver, you can run HyperTerminal (hypertrm.exe)
First install the device as described above. Then run hypertrm.exe Once installed, you can talk to the virtualserial driver through HyperTerminal, or via ReadFile/WriteFile calls. The AT command set supported by virtualserial includes:
AT returns
OK
ATA returns CONNECT
ATD<number> returns
CONNECT
File |
Description |
VirtualSerial.htm |
Documentation for this sample (this file). |
comsup.cpp & comsup.h |
COM Support code - specifically base classes which provide implementations for the standard COM interfaces IUnknown and IClassFactory which are used throughout this sample. The implementation of IClassFactory is designed to create instances of the CMyDriver class. If you should change the name of your base driver class, you would also need to modify this file. |
dllsup.cpp |
DLL Support code - provides the DLL's entry point as well as the single required export (DllGetClassObject). These depend on comsup.cpp to perform the necessary class creation. |
exports.def |
This file lists the functions that the driver DLL exports. |
makefile |
This file redirects to the real makefile, which is shared by all the driver components of the Windows Driver Kit. |
internal.h |
This is the main header file for this driver. |
Driver.cpp & Driver.h |
DriverEntry and Events on the Driver Object. |
Device.cpp & Device.h |
Events on the Device Object. |
Queue.cpp & Queue.h |
Contains Events on the I/O Queue Objects. |
VirtualSerial.rc |
Resource file for the driver. |
Sources |
Generic file that lists source files and all the build options. |
VirtualSerial.inf |
INF file that describes the installation of this driver |
virtualserial.ctl |
This file lists the WPP trace control GUID(s) for the sample driver. This file can be used with the tracelog command's -guid flag to enable the collection of these trace events within an established trace session. These GUIDs must remain in sync with the trace control guids defined in internal.h |
© 2008 Microsoft Corporation