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

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

?? test_usbsoftlock.cpp

?? fpga介紹及其相關實驗代碼等等,fpga介紹及其相關實驗代碼
?? CPP
字號:
                // Test_USBSoftLock.cpp
//
// Generated by DriverWizard version DriverStudio 2.7.0 (Build 562)
//
// 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 with link name
// USBSoftLockDevice, which corresponds to Unit 0 of the
// USBSoftLockDevice device class in the driver.

//
// You can build this application using the command line compiler with
// the following command:
//
//		cl Test_USBSoftLock.cpp
//


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

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


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_USBSOFTLOCK_IOCTL_GET_PASSWORD(void);
void Test_USBSOFTLOCK_IOCTL_SET_PASSWORD(void);

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

// Global data


#define N_IOCODES	2

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

//=== Parameterized IOCTL Example ===
//	"IOCTL_PARAMETERIZED",
	"USBSOFTLOCK_IOCTL_GET_PASSWORD",
	"USBSOFTLOCK_IOCTL_SET_PASSWORD",
	""
};

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

//=== Parameterized IOCTL Example ===
//	IOCTL_PARAMETERIZED,
	USBSOFTLOCK_IOCTL_GET_PASSWORD,
	USBSOFTLOCK_IOCTL_SET_PASSWORD,
	0
};


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

// Name used to open device
//
char *sLinkName = "\\\\.\\USBSoftLockDevice0";

////////////////////////////////////////////////////////////////////////
// OpenByName
//
//		Open a handle to the requested device
//
HANDLE OpenByName(void)
{
	// Create a handle to the driver
	return CreateFile(sLinkName,
					  GENERIC_READ | GENERIC_WRITE,
					  FILE_SHARE_READ,
					  NULL,
					  OPEN_EXISTING,
					  0,
					  NULL);
}



////////////////////////////////////////////////////////////////////////
// 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;

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

	hDevice = OpenByName();
	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 USBSOFTLOCK_IOCTL_GET_PASSWORD:
						Test_USBSOFTLOCK_IOCTL_GET_PASSWORD();
						nArgIncrement = 2;
						break;

					case USBSOFTLOCK_IOCTL_SET_PASSWORD:
						Test_USBSOFTLOCK_IOCTL_SET_PASSWORD();
						nArgIncrement = 2;
						break;

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

				}
				break;

			case '?':
			case 'h':
			default:
				Usage();
		}
		nArgIndex += nArgIncrement;
	}
	
	printf("\n");
	system("pause");

	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_USBSoftLock [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_USBSoftLock 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

#define BUFFER_LENGTH		512

#define PASSWORD_LENGTH		8

//=== 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_USBSOFTLOCK_IOCTL_GET_PASSWORD
//
//		Test one Io Control Code
//
// TODO:
//		Pass appropriate arguments to your device and check
//		the return value
//
void Test_USBSOFTLOCK_IOCTL_GET_PASSWORD(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[BUFFER_LENGTH];		// Input to device
	CHAR	bufOutput[BUFFER_LENGTH];	// Output from device
	ULONG	nOutput;						// Count written to bufOutput

	memset(bufInput, 0, BUFFER_LENGTH);
	memset(bufOutput, 0, BUFFER_LENGTH);

	printf("bufInput : 0x%X, bufOutput : 0x%X\n", (LONG)bufInput, (LONG)bufOutput);

	// Call device IO Control interface (USBSOFTLOCK_IOCTL_GET_PASSWORD) in driver
	printf("Issuing Ioctl to device - ");
	if (!DeviceIoControl(hDevice,
						 USBSOFTLOCK_IOCTL_GET_PASSWORD,
						 bufInput,
						 PASSWORD_LENGTH,
						 bufOutput,
						 PASSWORD_LENGTH,
						 &nOutput,
						 NULL) )
	{
		printf("ERROR: DeviceIoControl returns %0x.", GetLastError());
		Exit(1);
	}
	else {
		printf("input buffer is : %s, output buffer is %s, output buffer size is %d", 
			bufInput, 
			bufOutput,
			nOutput);
	}
}

////////////////////////////////////////////////////////////////////////
// Test_USBSOFTLOCK_IOCTL_SET_PASSWORD
//
//		Test one Io Control Code
//
// TODO:
//		Pass appropriate arguments to your device and check
//		the return value
//
void Test_USBSOFTLOCK_IOCTL_SET_PASSWORD(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

	memset(bufInput, 0, BUFFER_LENGTH);
	memset(bufOutput, 0, BUFFER_LENGTH);

	strcpy(bufInput, "ABCDEFGH");

	// Call device IO Control interface (USBSOFTLOCK_IOCTL_SET_PASSWORD) in driver
	printf("Issuing Ioctl to device - ");
	if (!DeviceIoControl(hDevice,
						 USBSOFTLOCK_IOCTL_SET_PASSWORD,
						 bufInput,
						 PASSWORD_LENGTH,
						 bufOutput,
						 PASSWORD_LENGTH,
						 &nOutput,
						 NULL) )
	{
		printf("ERROR: DeviceIoControl returns %0x.", GetLastError());
		Exit(1);
	}
	else {
		printf("input buffer is : %s, output buffer is %s, output buffer size is %d", 
			bufInput, 
			bufOutput,
			nOutput);
	}
}


////////////////////////////////////////////////////////////////////////
// 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浏览器入口在线观看| 白白色 亚洲乱淫| 在线不卡中文字幕播放| 国产精品全国免费观看高清 | 久久精品国产秦先生| 色综合天天做天天爱| 精品国产乱码久久久久久闺蜜| 亚洲图片另类小说| 国产不卡视频在线播放| 日韩精品一区二区三区四区视频| 亚洲欧洲中文日韩久久av乱码| 国产精品1区2区3区| 日韩免费高清av| 精品视频一区二区三区免费| 国产成人在线免费| 久久青草国产手机看片福利盒子| 亚洲电影在线播放| 欧美色男人天堂| 一区二区不卡在线播放| 91久久精品午夜一区二区| 亚洲人精品午夜| 99精品视频一区| 中文字幕一区二区三区精华液| 国产成人av在线影院| 国产欧美日韩精品一区| 国产成人丝袜美腿| 国产欧美一区二区精品性| 国产精品18久久久| 欧美国产成人在线| 91视频91自| 亚洲精选一二三| 欧美图片一区二区三区| 亚洲成av人片一区二区三区| 欧美福利视频导航| 日本欧美一区二区| 欧美精品一区二区三区蜜臀| 国产精品自拍毛片| 中文字幕在线观看一区| 色婷婷综合久色| 婷婷六月综合网| 欧美日韩亚洲丝袜制服| 日韩二区三区四区| 久久综合九色欧美综合狠狠| 国产寡妇亲子伦一区二区| 国产精品三级av在线播放| 91视频91自| 日韩av在线免费观看不卡| 精品伦理精品一区| 99免费精品在线观看| 一区二区国产盗摄色噜噜| 欧美一区二区三区精品| 国产成人免费在线| 亚洲乱码一区二区三区在线观看| 欧美性大战xxxxx久久久| 日本在线播放一区二区三区| 久久精品人人做| 欧美性猛交xxxx黑人交| 久久99国内精品| 亚洲人亚洲人成电影网站色| 91精品国产aⅴ一区二区| 丁香一区二区三区| 天堂成人免费av电影一区| 久久久三级国产网站| 色偷偷久久人人79超碰人人澡| 日本亚洲最大的色成网站www| 国产亚洲欧美一级| 欧美日韩不卡在线| 成人免费三级在线| 日韩电影一区二区三区| 国产精品久久久久9999吃药| 9191精品国产综合久久久久久| 高清av一区二区| 另类中文字幕网| 一区二区三区美女视频| 26uuu国产电影一区二区| 色88888久久久久久影院野外| 激情久久久久久久久久久久久久久久| 国产精品成人一区二区艾草 | 国产精品美女久久久久久久网站| 色综合久久综合网| 国内精品久久久久影院薰衣草| 一二三四社区欧美黄| 国产亚洲一区二区三区四区 | 日韩成人免费在线| 亚洲女同ⅹxx女同tv| 精品国产99国产精品| 欧美区视频在线观看| 成人app在线| 国产综合成人久久大片91| 亚洲bt欧美bt精品| 艳妇臀荡乳欲伦亚洲一区| 中文天堂在线一区| 久久久久久综合| 精品日韩成人av| 日韩亚洲电影在线| 在线综合+亚洲+欧美中文字幕| 日本二三区不卡| 一本色道久久综合亚洲91| 成人av免费在线播放| 成人综合婷婷国产精品久久蜜臀| 久久99精品国产91久久来源| 日本欧美在线观看| 男人操女人的视频在线观看欧美| 亚洲自拍偷拍麻豆| 亚洲自拍偷拍综合| 亚洲一区精品在线| 亚洲国产aⅴ成人精品无吗| 综合在线观看色| 中文字幕在线一区二区三区| 国产精品美女久久久久久2018 | 久久综合九色综合97婷婷女人| 欧美日本乱大交xxxxx| 欧美日韩综合不卡| 欧美猛男gaygay网站| 欧美高清精品3d| 欧美精品在线一区二区| 欧美精品 国产精品| 欧美性猛交一区二区三区精品| 国产专区综合网| 国产大陆精品国产| 成人免费视频视频| 91尤物视频在线观看| 91免费观看国产| 欧美亚洲日本一区| 91精品国产欧美一区二区18| 在线91免费看| 久久网站最新地址| 精品美女被调教视频大全网站| 精品欧美一区二区久久| 久久亚洲影视婷婷| 亚洲欧美偷拍三级| 亚洲一区中文日韩| 蜜桃视频一区二区三区| 国产成人在线视频网站| 91香蕉视频mp4| 91精品国产综合久久久久久久| 精品国产成人在线影院| 亚洲欧洲韩国日本视频| 亚洲成av人片在www色猫咪| 精品在线观看免费| bt7086福利一区国产| 欧美无砖砖区免费| 国产亚洲精品aa午夜观看| 亚洲欧美日韩在线播放| 日韩中文字幕1| 99精品在线观看视频| 欧美精品三级日韩久久| 欧美韩国日本一区| 婷婷久久综合九色综合伊人色| 国产一区二区三区美女| 91国偷自产一区二区使用方法| 欧美一级欧美三级在线观看| 国产精品久久久久久一区二区三区 | 91麻豆精品国产91久久久久久| 国产无人区一区二区三区| 亚洲午夜久久久久中文字幕久| 国产一区二区成人久久免费影院| 91国偷自产一区二区开放时间 | 7777精品伊人久久久大香线蕉完整版 | 国产精品资源网| 91免费观看在线| 精品国产露脸精彩对白| 亚洲国产va精品久久久不卡综合| 国产精品996| 日韩精品一区二区在线观看| 一区二区免费看| av电影在线观看不卡| 久久美女高清视频| 美女在线观看视频一区二区| 91精品91久久久中77777| 国产精品免费视频观看| 经典三级视频一区| 欧美日韩中文一区| 伊人婷婷欧美激情| 99久久伊人精品| 欧美国产精品劲爆| 国产一本一道久久香蕉| 日韩视频免费观看高清在线视频| 亚洲一区二区成人在线观看| 国产高清一区日本| 久久精品亚洲一区二区三区浴池| 免费在线视频一区| 91精品国产色综合久久久蜜香臀| 亚洲国产精品影院| 91国产免费看| 亚洲国产另类av| 欧美色图第一页| 亚洲永久精品大片| 欧美日韩国产精品成人| 亚洲一级在线观看| 在线观看日韩一区| 亚洲香肠在线观看| 欧美日韩在线免费视频| 亚洲综合一区二区| 欧美日韩久久久一区| 亚洲一区二区视频在线观看| 国产日产欧美一区二区视频| 国产在线精品视频| 中文欧美字幕免费|