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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? test_test1.cpp

?? 一個(gè)典型的USB驅(qū)動(dòng)開(kāi)發(fā)
?? CPP
字號(hào):
// Test_test1.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 "..\Test1Deviceinterface.h"

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

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

#include "..\Test1Deviceinterface.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 = Test1Device_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_test1 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_test1 [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_test1 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);
//		}
	}
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品电影一区二区三区| 日韩美女视频在线| 91在线精品一区二区三区| 国产激情偷乱视频一区二区三区| 日韩精品高清不卡| 丝袜a∨在线一区二区三区不卡| 亚洲mv大片欧洲mv大片精品| 亚洲国产成人tv| 五月天一区二区| 麻豆一区二区99久久久久| 日本女人一区二区三区| 久久精品国产亚洲一区二区三区| 久久99精品久久只有精品| 国产在线一区观看| 在线综合亚洲欧美在线视频| 欧美精品少妇一区二区三区| 69堂成人精品免费视频| 日韩码欧中文字| 狠狠色丁香久久婷婷综| 国产麻豆精品视频| 成人美女视频在线看| 91视频免费看| 欧美日韩国产免费一区二区| 日韩午夜激情视频| 久久久精品人体av艺术| 亚洲免费观看高清| 免费人成黄页网站在线一区二区 | 九九**精品视频免费播放| 极品少妇xxxx偷拍精品少妇| 国产91丝袜在线观看| 99在线精品免费| 欧美军同video69gay| 久久美女高清视频| 亚洲黄色在线视频| 久久国产欧美日韩精品| 成人av电影观看| 欧美麻豆精品久久久久久| 久久无码av三级| 亚洲欧美日韩精品久久久久| 天堂一区二区在线| 丁香五精品蜜臀久久久久99网站 | 欧美视频日韩视频| 日韩欧美一区二区免费| 国产精品视频一区二区三区不卡| 亚洲午夜电影网| 国产精品亚洲综合一区在线观看| 色又黄又爽网站www久久| 欧美精品高清视频| 欧美激情一区三区| 免费日本视频一区| 一本到高清视频免费精品| 欧美videofree性高清杂交| 国产精品麻豆久久久| 日本亚洲最大的色成网站www| 国产成人综合网| 8v天堂国产在线一区二区| 中文字幕乱码一区二区免费| 亚洲电影一区二区三区| 成人亚洲精品久久久久软件| 欧美一区日韩一区| 亚洲精品视频在线观看网站| 国内久久精品视频| 欧美精品日韩综合在线| 最新国产精品久久精品| 激情偷乱视频一区二区三区| 欧美日韩精品欧美日韩精品一综合| 日本一区二区免费在线观看视频| 日日摸夜夜添夜夜添亚洲女人| av资源网一区| 久久久综合精品| 免费不卡在线视频| 欧美日韩日本视频| 亚洲人快播电影网| 国产a久久麻豆| 欧美精品一区二区在线观看| 日韩在线播放一区二区| 日本久久精品电影| 国产精品毛片高清在线完整版| 精品一区二区在线播放| 欧美另类z0zxhd电影| 亚洲人123区| 成人美女在线视频| 欧美国产欧美综合| 国产麻豆精品theporn| 日韩亚洲欧美高清| 日韩精品一区第一页| 欧洲亚洲精品在线| 亚洲精品国产无套在线观| www.亚洲精品| 中文字幕一区av| 成人av网站在线观看| 中文字幕精品一区二区三区精品| 国产综合色产在线精品| 4438成人网| 日韩在线播放一区二区| 91精品综合久久久久久| 日日夜夜精品视频免费| 欧美一区二区三区在| 日韩电影网1区2区| 日韩一区和二区| 免费成人在线视频观看| 日韩天堂在线观看| 久久成人18免费观看| 久久亚洲影视婷婷| 国产精品夜夜爽| 国产精品欧美一级免费| 成人av影视在线观看| 1024亚洲合集| 在线观看亚洲成人| 亚洲成av人综合在线观看| 欧美日韩精品一区二区| 日韩不卡一区二区| 精品国产一区二区三区av性色| 久久se精品一区精品二区| 久久久亚洲综合| www.欧美日韩国产在线| 亚洲精品免费在线| 欧美日韩国产美| 美女尤物国产一区| 国产亚洲福利社区一区| 成人激情免费视频| 亚洲女与黑人做爰| 欧美日韩高清在线播放| 美女视频第一区二区三区免费观看网站| 精品久久久久久最新网址| 国产不卡在线一区| 亚洲丝袜精品丝袜在线| 欧美日韩中文字幕精品| 麻豆精品一区二区综合av| 国产视频一区二区在线| 91女厕偷拍女厕偷拍高清| 亚洲综合在线视频| 精品日韩一区二区三区免费视频| 国产电影一区在线| 一区二区三区在线播放| 日韩三级电影网址| 波多野结衣亚洲一区| 亚洲国产精品久久久久婷婷884 | 中文字幕成人在线观看| 在线看日本不卡| 国内成人精品2018免费看| 国产精品国产三级国产aⅴ入口 | 亚洲精品国产一区二区精华液| 91麻豆精品国产自产在线| 国产精品一区二区免费不卡 | 中文在线资源观看网站视频免费不卡| 91麻豆蜜桃一区二区三区| 日韩国产欧美视频| 国产精品久久久久影院亚瑟 | 亚洲图片另类小说| 欧美一区二区二区| 不卡的av中国片| 日本中文字幕一区二区有限公司| 久久久噜噜噜久噜久久综合| 在线视频亚洲一区| 国内精品久久久久影院色| 一区二区三区波多野结衣在线观看| 欧美一级二级三级乱码| aa级大片欧美| 精品中文字幕一区二区小辣椒| 中文字幕一区二区三区在线观看| 欧美丰满高潮xxxx喷水动漫| 国产999精品久久| 免费高清视频精品| 一区二区三区四区中文字幕| 久久青草国产手机看片福利盒子 | 中日韩av电影| 日韩一区二区视频在线观看| 色综合天天综合色综合av| 精彩视频一区二区三区| 五月婷婷欧美视频| 亚洲裸体在线观看| 国产亚洲欧美日韩俺去了| 在线播放日韩导航| 色综合激情久久| 国产精品一区2区| 免费人成黄页网站在线一区二区| 亚洲精品一二三四区| 欧美国产精品一区二区三区| 日韩欧美国产综合| 欧美高清精品3d| 在线免费观看视频一区| 99精品视频在线免费观看| 精品一区精品二区高清| 日韩电影在线观看一区| 亚洲五月六月丁香激情| 亚洲另类一区二区| 国产精品国产三级国产aⅴ无密码| 欧美tickle裸体挠脚心vk| 91精品国产综合久久婷婷香蕉| 一本到高清视频免费精品| 北岛玲一区二区三区四区| 国产传媒日韩欧美成人| 国产美女精品人人做人人爽| 久久精品国产澳门| 日本欧美一区二区三区乱码| 首页国产欧美久久| 三级影片在线观看欧美日韩一区二区| 亚洲伊人伊色伊影伊综合网| 一区二区三区在线视频观看|