Even though a driver may be far from complete when only the DriverEntry, Unload, and Dispatch routines are present, significant code paths can be tested at this point. In particular, all of the following can be verified with a simple Win32 console program:
While the successful completion of these tests is hardly earth-shattering, it does form a tried-and-true recipe for driver authoring: Build a driver framework that is proven before adding hardware interaction. Testing ProcedureThe following procedure checks all the code paths through a driver's Dispatch routines:
Sample Test ProgramThis is an example of a Win32 console test program that can be used to verify code paths through a driver's Dispatch routines. #include <windows.h> #include <stdio.h> void main() { HANDLE hDevice; BOOL status; hDevice = CreateFile( "\\\\.\\LBK1" ... ); : status = ReadFile( hDevice, ... ); : status = WriteFile( hDevice, ... ); : status = DeviceIoControl( hDevice, ... ); : status = CloseHandle( hDevice ); }
|