www.pudn.com > Windows 2000设备驱动程序设计指南 .zip > Testor.cpp
// Testor for Chapter 11 Timer-based Parallel Port Driver #include#include int main() { HANDLE hDevice; BOOL status; printf("Beginning test of Timer-based Parallel Port Driver (CH11)...\n"); hDevice = CreateFile("\\\\.\\TMRPP1", GENERIC_READ | GENERIC_WRITE, 0, // share mode none NULL, // no security OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); // no template if (hDevice == INVALID_HANDLE_VALUE) { printf("Failed to obtain file handle to device: " "%s with Win32 error code: %d\n", "TMRPP1", GetLastError() ); return 1; } printf("Succeeded in obtaining handle to TMRPP1 device.\n"); printf("Attempting write to device...\n"); char outBuffer[20]; for (DWORD i=0; i