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

📄 simpleappcpp.cpp

📁 CardBus代码驱动等有用资料
💻 CPP
字号:
// simpleappCpp.cpp : Defines the entry point for the console application.
//
#include "Ioctls.h"
#include "stdafx.h"
#include <winioctl.h>
#include <iostream.h>
#include <fstream.h>
#include <stdio.h>
#include <time.h>

int main(int argc, char* argv[])
	{							

	DWORD retcode = 0;
	int address = 0;
	time_t start, end;
	double diff;

	HANDLE hdevice = CreateFile("\\\\.\\comblock_cardbus_0", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
	if (hdevice == INVALID_HANDLE_VALUE)
		{
		printf("Unable to open com1300 - error %d\n", GetLastError());
		return 1;
		}

	// "Calculate" the the start address.
	UCHAR inData [4];

	memcpy(&inData[0], &address, 4);


	DWORD noOfBytesRead = 0;
	unsigned int noOfBytesToRead = 0;
	unsigned int buffer_ptr = 0;
	
    unsigned char bufferForReadValues[1024];

	time(&start);

	for ( int i = 0; i < 50000; i++)
	{
		// Call the driver
		buffer_ptr = 0;
		noOfBytesToRead = 1024;
		while(noOfBytesToRead > 0){
			DeviceIoControl(hdevice, MEM_READ_32_BIT_FIX_ADDR, &inData, sizeof(inData), 
					&bufferForReadValues[buffer_ptr], noOfBytesToRead, &noOfBytesRead, NULL);
			noOfBytesToRead -= noOfBytesRead;
			buffer_ptr += noOfBytesRead;
		}
	}

	time(&end);

	diff = difftime(end,start);

	printf("time taken %f seconds\n", diff);


	CloseHandle(hdevice);

	return retcode;
	}

⌨️ 快捷键说明

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