亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? test_test.cpp

?? 一個典型的USB驅動開發
?? CPP
字號:
// Test_test.cpp
//
// Generated by DriverWizard version DriverStudio 3.1.0 (Build 1722)
//
// 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 "..\TestDeviceinterface.h"

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

#include <winioctl.h>
#include "..\testioctl.h"

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

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

typedef void VOIDFUNC();

// Prototypes
void Usage(void);
void ShowIoctlValues(void);

//	TODO:
//		You can redefine the IOCTL handler prototypes as needed, adding
//		appropriate parameters that can be collected from the command line.
//		To do this you must modify the command line parsing logic.  An
//		example of this is shown in comments throughout the test application.
//
//=== Parameterized IOCTL Example ===
// void Test_IOCTL_PARAMETERIZED(int nVal, ULONG dwVal);
void Test_D12_DRIVER_READ(void);
void Test_D12_DRIVER_WRITE(void);
void Test_D12_DRIVER_BULK_IN(void);
void Test_D12_DRIVER_BULK_OUT(void);

void CloseIfOpen(void);
void doRead(int i);
void doWrite(int i);

// Global data


#define N_IOCODES	4

// Names of IOCTL codes
//
char *IOnames[N_IOCODES+1] =
{

//=== Parameterized IOCTL Example ===
//	"IOCTL_PARAMETERIZED",
	"D12_DRIVER_READ",
	"D12_DRIVER_WRITE",
	"D12_DRIVER_BULK_IN",
	"D12_DRIVER_BULK_OUT",
	""
};

// IOCTL codes
//
int IOcodes[N_IOCODES+1] =
{

//=== Parameterized IOCTL Example ===
//	IOCTL_PARAMETERIZED,
	D12_DRIVER_READ,
	D12_DRIVER_WRITE,
	D12_DRIVER_BULK_IN,
	D12_DRIVER_BULK_OUT,
	0
};


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

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


////////////////////////////////////////////////////////////////////////
// Exit
//
//		Print a message and exit
//
   void Exit(int res)
{
	printf("Exiting...\n\n");
	CloseIfOpen();
	exit(res);
}


////////////////////////////////////////////////////////////////////////
// Main entry point
//
//
int __cdecl main(int argc, char *argv[])
{
	int		nArgIndex;				// Walk through command line arguments
	int		nArgIncrement = 0;
	int		val;

//=== Parameterized IOCTL Example ===
//	int		nVal;
//	ULONG	dwVal;
	DWORD	Error;

	printf("Test application Test_test 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");
	}

	// Parse the command line

	if (argc < 2) Usage();

	nArgIndex = 1;
	while (nArgIndex < argc)
	{
		// Parse ahead to determine numeric value of argument

		if (nArgIndex+1 >= argc) Usage();
		if (!isdigit(argv[nArgIndex+1][0])) Usage();
		val = atoi(argv[nArgIndex+1]);

		switch (argv[nArgIndex][0])
		{

			case 'r':
			case 'R':
				doRead(val);
				nArgIncrement = 2;
				break;

			case 'w':
			case 'W':
				doWrite(val);
				nArgIncrement = 2;
				break;

			case 'i':
			case 'I':
				if (val >= N_IOCODES)
				{
					printf("IO control code index must be less than %d\n", N_IOCODES);
					ShowIoctlValues();
					Exit(1);
				}
				switch (IOcodes[val])
				{

//=== Parameterized IOCTL Example ===
//					case IOCTL_PARAMETERIZED:
//						if (nArgIndex+3 >= argc) Usage();
//						nVal = atoi(argv[nArgIndex+2]);
//						dwVal = strtoul(argv[nArgIndex+3], NULL, 0);
//						Test_IOCTL_PARAMETERIZED(nVal, dwVal);
//						nArgIncrement = 4;
//						break;

					case D12_DRIVER_READ:
						Test_D12_DRIVER_READ();
						nArgIncrement = 2;
						break;

					case D12_DRIVER_WRITE:
						Test_D12_DRIVER_WRITE();
						nArgIncrement = 2;
						break;

					case D12_DRIVER_BULK_IN:
						Test_D12_DRIVER_BULK_IN();
						nArgIncrement = 2;
						break;

					case D12_DRIVER_BULK_OUT:
						Test_D12_DRIVER_BULK_OUT();
						nArgIncrement = 2;
						break;

					default:
						printf("IO control code not valid\n");
						Exit(1);

				}
				break;

			case '?':
			case 'h':
			default:
				Usage();
		}
		nArgIndex += nArgIncrement;
	}

	return 0;
}


////////////////////////////////////////////////////////////////////////
// CloseIfOpen
//
//		Close the device if we previously opened a handle to it.
//
void CloseIfOpen(void)
{
	if (hDevice != INVALID_HANDLE_VALUE)
	{
		// Close the handle to the driver
		if (!CloseHandle(hDevice))
		{
			printf("ERROR: CloseHandle returns %0x.\n", GetLastError());
		}
		hDevice = INVALID_HANDLE_VALUE;
	}
}


////////////////////////////////////////////////////////////////////////
// doRead
//
//		Read 'n' bytes of data from the device
//
// Note: This simple test app reads data from the device and displays the
//			data as characters.  This behavior can be modified as appropriate
//			for your device.
//
void doRead(int n)
{
	char	*buf;
	ULONG	nRead;
	int		i;
	int		j;

	buf = (char *) malloc(n);
	if (buf == NULL)
	{
		printf("Failed to allocate buffer for read");
		Exit(1);
	}

	// Read data from driver
	printf("Reading from device - ");
	ReadFile(hDevice, buf, n, &nRead, NULL);
	printf("%d bytes read from device (%d requested).\n", nRead, n);

	// Print what was read
	i = 0;
	while(i < n)
	{
		j = min((i+26),n);
		for(; i < j; i++)
		{
			printf("%c, ", buf[i]);
		}
		printf("\n");
	}

	free(buf);
}


////////////////////////////////////////////////////////////////////////
// doWrite
//
//		Write 'n' bytes of data to the device
//
// Note: This simple test app writes sequential characters to the
// 			device.  This behavior can be modified as appropriate
//			for your device.
//
void doWrite(int n)
{
	char	*buf;
	ULONG	nWritten;
	int		i;
	int		j;

	buf = (char *) malloc(n);
	if (buf == NULL)
	{
		printf("Failed to allocate buffer for write");
		Exit(1);
	}

	// start with the mod26 letter of the number of bytes to write
	j = (n % 26);
	// load buffer with dummy data (abcdefg...)
	for (i=0; i<n; i++, j=(j + 1)%26)
	{
		buf[i] = 'a' + j;
	}

	// Write data to driver
	printf("Writing to device - ");
	WriteFile(hDevice, buf, n, &nWritten, NULL);
	printf("%d bytes written to device (%d attempted).\n", nWritten, n);

	// Print what was written
	i = 0;
	while(i < n)
	{
		j = min((i+26),n);
		for(; i < j; i++)
		{
			printf("%c, ", buf[i]);
		}
		printf("\n");
	}

	free(buf);
}


////////////////////////////////////////////////////////////////////////
// Usage
//
//		Print a usage message describing arguments to this program
//
void Usage(void)
{
	printf("Usage: Test_test [r n] [w n] [i n]\n");
	printf("       r initiates a read of specified number of bytes\n");
	printf("       w initiates a write of specified number of bytes\n");
	printf("       i initiates an IO Control Code message with specified index value\n");
	ShowIoctlValues();
	printf("Example:\n");
	printf("    Test_test r 32 w 32\n");
	printf("        read 32 bytes, then write 32 bytes\n");

	Exit(1);
}



#define	IOCTL_INBUF_SIZE	512
#define	IOCTL_OUTBUF_SIZE	512

//=== Parameterized IOCTL Example ===
//void Test_IOCTL_PARAMETERIZED(int nVal, ULONG dwVal)
//{
//  Function body same as other IOCTL handlers, with command line
//	parameters 'nVal' and 'dwVal' available as input.
//}

////////////////////////////////////////////////////////////////////////
// Test_D12_DRIVER_READ
//
//		Test one Io Control Code
//
// TODO:
//		Pass appropriate arguments to your device and check
//		the return value
//
void Test_D12_DRIVER_READ(void)
{
// Note that Input and Output are named from the point of view
// of the DEVICE:
//		bufInput  supplies data to the device
//		bufOutput is written by the device to return data to this application

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

	// Call device IO Control interface (D12_DRIVER_READ) in driver
	printf("Issuing Ioctl to device - ");
	if (!DeviceIoControl(hDevice,
						 D12_DRIVER_READ,
						 bufInput,
						 IOCTL_INBUF_SIZE,
						 bufOutput,
						 IOCTL_OUTBUF_SIZE,
						 &nOutput,
						 NULL)
	   )
	{
		printf("ERROR: DeviceIoControl returns %0x.", GetLastError());
		Exit(1);
	}
}

////////////////////////////////////////////////////////////////////////
// Test_D12_DRIVER_WRITE
//
//		Test one Io Control Code
//
// TODO:
//		Pass appropriate arguments to your device and check
//		the return value
//
void Test_D12_DRIVER_WRITE(void)
{
// Note that Input and Output are named from the point of view
// of the DEVICE:
//		bufInput  supplies data to the device
//		bufOutput is written by the device to return data to this application

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

	// Call device IO Control interface (D12_DRIVER_WRITE) in driver
	printf("Issuing Ioctl to device - ");
	if (!DeviceIoControl(hDevice,
						 D12_DRIVER_WRITE,
						 bufInput,
						 IOCTL_INBUF_SIZE,
						 bufOutput,
						 IOCTL_OUTBUF_SIZE,
						 &nOutput,
						 NULL)
	   )
	{
		printf("ERROR: DeviceIoControl returns %0x.", GetLastError());
		Exit(1);
	}
}

////////////////////////////////////////////////////////////////////////
// Test_D12_DRIVER_BULK_IN
//
//		Test one Io Control Code
//
// TODO:
//		Pass appropriate arguments to your device and check
//		the return value
//
void Test_D12_DRIVER_BULK_IN(void)
{
// Note that Input and Output are named from the point of view
// of the DEVICE:
//		bufInput  supplies data to the device
//		bufOutput is written by the device to return data to this application

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

	// Call device IO Control interface (D12_DRIVER_BULK_IN) in driver
	printf("Issuing Ioctl to device - ");
	if (!DeviceIoControl(hDevice,
						 D12_DRIVER_BULK_IN,
						 bufInput,
						 IOCTL_INBUF_SIZE,
						 bufOutput,
						 IOCTL_OUTBUF_SIZE,
						 &nOutput,
						 NULL)
	   )
	{
		printf("ERROR: DeviceIoControl returns %0x.", GetLastError());
		Exit(1);
	}
}

////////////////////////////////////////////////////////////////////////
// Test_D12_DRIVER_BULK_OUT
//
//		Test one Io Control Code
//
// TODO:
//		Pass appropriate arguments to your device and check
//		the return value
//
void Test_D12_DRIVER_BULK_OUT(void)
{
// Note that Input and Output are named from the point of view
// of the DEVICE:
//		bufInput  supplies data to the device
//		bufOutput is written by the device to return data to this application

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

	// Call device IO Control interface (D12_DRIVER_BULK_OUT) in driver
	printf("Issuing Ioctl to device - ");
	if (!DeviceIoControl(hDevice,
						 D12_DRIVER_BULK_OUT,
						 bufInput,
						 IOCTL_INBUF_SIZE,
						 bufOutput,
						 IOCTL_OUTBUF_SIZE,
						 &nOutput,
						 NULL)
	   )
	{
		printf("ERROR: DeviceIoControl returns %0x.", GetLastError());
		Exit(1);
	}
}


////////////////////////////////////////////////////////////////////////
// ShowIoctlValues
//
//		Print list of IO Control Code values for usage display
//
void ShowIoctlValues(void)
{
	int i;

	for (i=0; i<N_IOCODES; i++)
	{
		if (i==0)
			printf( "         IO control code index\n");
		printf( "           %d is code %s [%x]\n", i, IOnames[i], IOcodes[i]);

//=== Parameterized IOCTL Example ===
//		if (IOcodes[i] == IOCTL_PARAMETERIZED)
//		{
//			printf( "               and has two arguments: <arg1 desc.> <arg1 desc.>\n");
//			printf( "               Example: i %d <IOCTL index> <ex. arg1> <ex. arg2>\n", i);
//		}
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩欧美一区电影| 日韩不卡一二三区| 日本一区二区久久| 精品对白一区国产伦| 日韩精品最新网址| 日韩欧美一级精品久久| 日韩欧美国产系列| 精品免费一区二区三区| 欧美精品一区二区三区一线天视频| 91精品国产乱| 欧美xxxx在线观看| 久久这里只有精品视频网| 国产午夜精品一区二区三区四区| 久久婷婷综合激情| 欧美国产精品一区二区三区| 国产欧美日韩精品在线| 中文字幕精品三区| 亚洲欧美日韩国产手机在线| 一区二区三区在线观看国产| 亚洲图片有声小说| 蜜臀国产一区二区三区在线播放| 九色综合狠狠综合久久| 成人免费视频国产在线观看| k8久久久一区二区三区| 色综合色综合色综合| 欧美亚洲国产bt| 91精品国产91热久久久做人人| 欧美xxxxxxxx| 国产精品久线观看视频| 亚洲自拍偷拍图区| 免费高清在线视频一区·| 国产经典欧美精品| 91香蕉视频在线| 欧美久久久一区| 久久欧美一区二区| 亚洲日本在线视频观看| 亚洲成在线观看| 国产精品资源网站| 欧美性大战久久久| 337p粉嫩大胆色噜噜噜噜亚洲 | 亚洲国产精品传媒在线观看| **性色生活片久久毛片| 午夜精品久久久久| 国产成a人亚洲| 欧美日韩黄色一区二区| 国产亚洲一区二区三区在线观看| 亚洲一区二区三区免费视频| 极品少妇xxxx精品少妇| 一本久道久久综合中文字幕| 欧美成人伊人久久综合网| 中文字幕一区二区不卡| 免费在线观看精品| av一本久道久久综合久久鬼色| 欧美一二三四区在线| 国产精品超碰97尤物18| 蜜臀av在线播放一区二区三区| 91网站最新地址| 欧美tickling挠脚心丨vk| 亚洲黄色片在线观看| 国产一区二区三区久久悠悠色av| 欧美日韩国产免费一区二区 | 日本欧美在线观看| 99久久精品费精品国产一区二区| 91精品国产一区二区三区 | 国产电影一区在线| 欧美丰满高潮xxxx喷水动漫| 亚洲欧洲美洲综合色网| 极品少妇xxxx精品少妇偷拍| 欧美精品vⅰdeose4hd| 国产精品国产自产拍高清av | 国产69精品久久久久毛片| 欧美精品乱人伦久久久久久| 亚洲欧美一区二区三区孕妇| 国产大片一区二区| 精品三级av在线| 日韩制服丝袜av| 色欧美日韩亚洲| 中文字幕制服丝袜一区二区三区| 激情成人综合网| 3d成人h动漫网站入口| 亚洲午夜激情网页| 99久久777色| 中文一区二区在线观看| 国产一区二区在线影院| 日韩免费观看高清完整版在线观看| 亚洲国产欧美在线人成| 在线看日本不卡| 亚洲日本一区二区| 99re成人在线| 国产精品传媒视频| 99天天综合性| 中文字幕人成不卡一区| 成人黄色在线视频| 国产精品久久久久影院亚瑟| 国v精品久久久网| 久久精品无码一区二区三区| 国产一区二区美女诱惑| 精品久久久久香蕉网| 精品在线观看免费| 欧美精品一区二区久久婷婷| 精品亚洲成av人在线观看| 日韩欧美一级特黄在线播放| 久久99精品国产麻豆婷婷洗澡| 日韩欧美综合一区| 蜜臀国产一区二区三区在线播放| 日韩一区二区在线观看| 美女一区二区视频| 精品乱人伦一区二区三区| 精品在线一区二区三区| 精品国产一区二区三区av性色 | 粉嫩嫩av羞羞动漫久久久| 久久精品亚洲一区二区三区浴池| 韩国欧美国产一区| 久久久久久久久久看片| 粗大黑人巨茎大战欧美成人| 国产精品女同互慰在线看| 99久久99久久精品国产片果冻| 一区二区三区四区在线| 欧美午夜理伦三级在线观看| 蜜臀久久久99精品久久久久久| 337p粉嫩大胆噜噜噜噜噜91av| 从欧美一区二区三区| 亚洲人xxxx| 6080国产精品一区二区| 国产一区在线看| 国产精品欧美经典| 欧美亚洲日本一区| 蜜桃视频在线观看一区| 久久久久久99久久久精品网站| 91在线观看地址| 午夜不卡av免费| 久久久久久一级片| 97精品电影院| 琪琪久久久久日韩精品| 中文无字幕一区二区三区 | 久久久噜噜噜久噜久久综合| 成人av网站免费| 亚洲高清在线视频| 久久亚洲一区二区三区明星换脸| caoporn国产精品| 丝袜亚洲精品中文字幕一区| 亚洲精品在线三区| 91色婷婷久久久久合中文| 日本中文字幕一区二区有限公司| 国产女人18毛片水真多成人如厕| 在线国产电影不卡| 狠狠色丁香婷婷综合久久片| 亚洲免费观看高清完整版在线观看 | 亚洲专区一二三| 精品第一国产综合精品aⅴ| 99国产精品国产精品毛片| 视频一区视频二区中文字幕| 中文无字幕一区二区三区| 欧美日韩一区二区三区不卡| 国产福利精品导航| 午夜精品爽啪视频| 中文字幕成人在线观看| 欧美丰满高潮xxxx喷水动漫| caoporn国产精品| 九一九一国产精品| 亚洲伊人色欲综合网| 国产欧美精品一区二区色综合| 欧美色视频在线观看| 国产999精品久久| 奇米精品一区二区三区在线观看一| 国产精品成人一区二区艾草| 日韩丝袜情趣美女图片| 在线看一区二区| eeuss鲁一区二区三区| 久久99久久久久| 亚洲午夜久久久久久久久电影网| 欧美韩国日本一区| 91麻豆精品国产91久久久久久| 色婷婷综合激情| 成人免费福利片| 韩国精品主播一区二区在线观看 | 亚洲一二三区在线观看| 国产视频在线观看一区二区三区| 欧美一区二区大片| 欧美三电影在线| 91蜜桃网址入口| 懂色av噜噜一区二区三区av| 久草在线在线精品观看| 日韩成人免费在线| 亚洲一区二区三区四区在线免费观看 | 91福利小视频| 成人av影视在线观看| 国内外成人在线| 蜜桃视频一区二区| 午夜精品福利视频网站| 亚洲欧美电影一区二区| 国产精品久久久久久久久免费相片| 精品国产一区a| 日韩精品一区二区在线| 91精品国产综合久久久蜜臀粉嫩| 欧美群妇大交群中文字幕| 在线亚洲免费视频| 91国偷自产一区二区使用方法| av不卡免费电影| 99久久伊人久久99|