⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_charsample.cpp

📁 Windows 2000/XP WDM設備驅動程式開發 使用 Numega 公司出版的軟體快速建置驅動程式
💻 CPP
字号:
// Test_CharSample.cpp
//
// Generated by DriverWizard version DriverStudio 2.6.0 (Build 336)
//
// This console application demonstrates how to open a handle
// to a device in your driver, and communicate with the driver
// using Read, Write, and DeviceIoControl calls, as appropriate.
//
// This test program attempts to open the device using the
// GUID defined in "..\CharSampleDeviceinterface.h"

#include <stdio.h>
#include <conio.h>
#include <windows.h>

#include "..\CharSampleioctl.h"

#include "..\CharSampleDeviceinterface.h"	// Has class GUID definition

// This function is found in module OpenByIntf.cpp
HANDLE OpenByInterface(GUID* pClassGuid, DWORD instance, PDWORD pError);

// Handle to device opened in driver.
//
HANDLE	hDevice = INVALID_HANDLE_VALUE;

// Class GUID used to open device
//
GUID ClassGuid = CharSampleDevice_CLASS_GUID;

int __cdecl main(int argc, char *argv[])
{
	DWORD	Error;

	printf("Test application Test_CharSample starting...\n");

	hDevice = OpenByInterface( &ClassGuid, 0, &Error);
	if (hDevice == INVALID_HANDLE_VALUE)
	{
		printf("ERROR opening device: (%0x) returned from CreateFile\n", GetLastError());
		exit(1);
	}
	else
	{
		printf("Device found, handle open.\n");
	}

	CHAR	bufInput[1];		// Input to device
	CHAR	bufOutput[2];	// Output from device
	ULONG	nOutput;						// Count written to bufOutput

	printf("叫块

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -