示例#1
0
文件: main.cpp 项目: caidongyun/libs
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;

}
示例#2
0
int main()
{
	HANDLE hDevice = GetDeviceViaInterface((LPGUID)&MY_WDM_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;
	}

	CloseHandle(hDevice);
	return 0;
}