资源简介
代码调试成功,能生成对话框,正确采集数据。
只需要在VC++6.0中运行即可。
MFC,同步传输
代码片段和文件信息
#include “usbdriver.h“
ULONG UsbGetCurrentframeNumber(IN PDEVICE_object fdo);
ULONG UsbGetDeviceDescriptor(IN PDEVICE_object fdo
PVOID pvOutputBuffer);
ULONG UsbGetStringDescriptor(IN PDEVICE_object fdo
UCHAR Index
USHORT LanguageId
PVOID pvOutputBuffer
ULONG ulLength);
ULONG UsbGetConfigDescriptor(IN PDEVICE_object fdo
PVOID pvOutputBuffer
ULONG ulLength);
NTSTATUS UsbStartIsoTransfer(IN PDEVICE_object fdoIN PIRP Irp);
NTSTATUS InitTransferobject(IN OUT PISO_STREAM_object streamobjectIN ULONG index);
NTSTATUS IsoTransferComplete(IN PDEVICE_object bunkfdoIN PIRP IrpIN PVOID Context);
//
NTSTATUS TestCreate(IN PDEVICE_object fdo IN PIRP Irp)
{
NTSTATUS ntStatus=STATUS_SUCCESS;
PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION )fdo->DeviceExtension;
pdx->OpenHandles++;
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IoCompleteRequest (Irp IO_NO_INCREMENT);
return ntStatus;
}
//
NTSTATUS TestClose(IN PDEVICE_object fdo IN PIRP Irp)
{
NTSTATUS ntStatus=STATUS_SUCCESS;
PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION )fdo->DeviceExtension;
pdx->OpenHandles--;
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IoCompleteRequest (Irp IO_NO_INCREMENT);
return ntStatus;
}
//
NTSTATUS TestIOCTL(IN PDEVICE_object fdoIN PIRP Irp)
{
NTSTATUS ntStatus;
PIO_STACK_LOCATION IrpStack;
PDEVICE_EXTENSION pdx;
ULONG IoControlCode;
PVOID IoBuffer;
ULONG InputBufferLength;
ULONG OutputBufferLength;
ULONG length;
PUCHAR pch;
pdx = (PDEVICE_EXTENSION )fdo->DeviceExtension;
if (!LockDevice(fdo))
return CompleteRequest(Irp STATUS_DELETE_PENDING 0);
IrpStack = IoGetCurrentIrpStackLocation (Irp);
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IoBuffer = Irp->AssociatedIrp.SystemBuffer;
InputBufferLength = IrpStack->Parameters.DeviceIoControl.InputBufferLength;
OutputBufferLength = IrpStack->Parameters.DeviceIoControl.OutputBufferLength;
IoControlCode = IrpStack->Parameters.DeviceIoControl.IoControlCode;
switch (IoControlCode) {
case IOCTL_EZUSB_GET_CURRENT_frame_NUMBER:
{
ULONG frameNumber = 0;
if (OutputBufferLength < sizeof(ULONG)) {
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
break;
}
frameNumber = UsbGetCurrentframeNumber (fdo);
if (frameNumber) {
*((PULONG)IoBuffer) = frameNumber;
Irp->IoStatus.Information = sizeof(ULONG);
Irp->IoStatus.Status = STATUS_SUCCESS;
}
else
Irp->IoStatus.Status
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 0 2003-10-20 19:31 isotransfer\DRIVER\build.err
文件 4014 2003-06-02 22:21 isotransfer\DRIVER\build.log
文件 0 2003-10-20 19:32 isotransfer\DRIVER\build.wrn
文件 634 2003-05-20 16:53 isotransfer\DRIVER\DrvBuild.bat
文件 670 1997-04-11 11:23 isotransfer\DRIVER\MAKEFILE
文件 77784 2003-06-02 22:17 isotransfer\DRIVER\OBJ\I386\Checked\usbad.sys
文件 11092 2003-06-02 22:21 isotransfer\DRIVER\OBJ\I386\Free\usbad.sys
文件 410 2001-12-11 13:45 isotransfer\DRIVER\RESOURCE.H
文件 2574 2003-06-02 22:17 isotransfer\DRIVER\resource.rc
文件 314 2003-06-02 22:16 isotransfer\DRIVER\Sources
文件 20470 2003-10-20 19:36 isotransfer\DRIVER\TestDispatch.c
文件 744 2003-10-20 19:37 isotransfer\DRIVER\TestInit.c
文件 14978 2003-10-20 19:41 isotransfer\DRIVER\TestPnp.c
文件 1741 2003-10-20 19:42 isotransfer\DRIVER\TestPower.c
文件 5003 2003-10-20 19:43 isotransfer\DRIVER\usbdriver.h
文件 3597 2003-05-26 07:38 isotransfer\host\ReadMe.txt
文件 804 2012-07-31 16:55 isotransfer\host\Release\StdAfx.obj
文件 1538828 2012-07-31 16:55 isotransfer\host\Release\StdAfx.sbr
文件 3499008 2012-08-02 17:22 isotransfer\host\Release\usbhost.bsc
文件 36864 2012-08-02 17:22 isotransfer\host\Release\usbhost.exe
文件 9862 2012-08-02 17:22 isotransfer\host\Release\usbhost.obj
文件 7198092 2012-07-31 16:55 isotransfer\host\Release\usbhost.pch
文件 3764 2012-07-31 16:47 isotransfer\host\Release\usbhost.res
文件 0 2012-08-02 17:22 isotransfer\host\Release\usbhost.sbr
文件 55333 2012-08-02 17:22 isotransfer\host\Release\usbhostDlg.obj
文件 0 2012-08-02 17:22 isotransfer\host\Release\usbhostDlg.sbr
文件 50176 2012-08-02 17:22 isotransfer\host\Release\vc60.idb
文件 1078 2003-05-27 16:30 isotransfer\host\res\usbhost.ico
文件 399 2003-05-26 07:38 isotransfer\host\res\usbhost.rc2
文件 766 2003-05-27 16:25 isotransfer\host\res\Ysu.ico
............此处省略63个文件信息
评论
共有 条评论