main.cpp

来自「<windows驱动开发技术详解>源代码」· C++ 代码 · 共 37 行

CPP
37
字号
#include <windows.h>
#include <stdio.h>
#include <winioctl.h>

#include "function.h"

#include "../SDIO_Driver/guid.h"
#define BUFFER_SIZE 0x7c00
UCHAR buffer[BUFFER_SIZE];

int main()
{
	HANDLE hDevice = GetDeviceViaInterface((LPGUID)&GUID_DEVINTERFACE_SDIO_DEVICE,0);

	if (hDevice == INVALID_HANDLE_VALUE)
	{
		printf("Failed to obtain file handle to device: "
			"%s with Win32 error code: %d\n",
			"MyWDMDevice", GetLastError() );
		return 1;
	}

	EnableInt(hDevice);

	Sleep(2000);

 	DWORD dwRead;
 	ReadFile(hDevice,buffer,BUFFER_SIZE,&dwRead,NULL);
	printf("read %x\n",dwRead);

	DisableInt(hDevice);

	CloseHandle(hDevice);

	return 0;

}

⌨️ 快捷键说明

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