阅读:1123回复:3
DeviceIoControl的问题!
DeviceIoControl
{ HANDLE hDevice, // 设备句柄 DWORD dwIoControlCode, // I/O请求码 LPVOID lpInBuffer, // 输入数据缓冲区 <A> DWORD nInBufferSize, // 输入数据缓冲区长度 <B> LPVOID lpOutBuffer, // 输出数据缓冲区 <C> DWORD nOutBufferSize, // 输出数据缓冲区长度 <D> LPDWORD lpBytesReturned, // 实际读到的数据量 <E> LPOVERLAPPED lpOverlapped // 重叠方式 } 驱动中分别指定了METHOD_BUFFERED(缓冲I/O)和METHOD_IN/OUT_DIRECT(直接I/O)方式时,参数ABCDE到底是怎么和DS做的驱动联系上的呀! |
|
沙发#
发布于:2003-05-17 13:27
在看EzUsb的驱动代码时,看到在NTSTATUS EzUsbDevice::DeviceControl(KIrp I)中有两个用户自定义请求,一个是复位端口,一个是复位管道
case IOCTL_EZUSB_RESET: { t << \"IOCTL_EZUSB_RESET \\n\"; ULONG_PTR nInfo = NULL; status = m_Lower.DeviceIoControl( IOCTL_INTERNAL_USB_RESET_PORT, NULL, 0, NULL, 0, TRUE, &nInfo ); break; } ///////////////////////////////////////////////////////////// case IOCTL_EZUSB_RESETPIPE: { t << \"IOCTL_EZUSB_RESETPIPE \\n\"; ULONG dwPipeNum = *( reinterpret_cast<PULONG>(pBuffer) ); KUsbPipe* pipe = FindPipe(dwPipeNum); if(NULL == pipe) { status = STATUS_INVALID_PARAMETER; } else { status = pipe->Reset(); } break; } 这两个请求有什么区别吗? |
|
板凳#
发布于:2003-05-17 17:08
DeviceIoControl KIrp::IoctlBuffer PVOID& IoctlBuffer( void ); Accessor to the buffer for a buffered DeviceIoControl operation. Returns Returns a reference to field AssociatedIrp.SystemBuffer. KIrp::IoctlOutputBufferSize ULONG& IoctlOutputBufferSize( EStackLocation s ); Returns the size of the output buffer for an IRP whose major function is IRP_MJ_DEVICECONTROL. Parameters s Either CURRENT or NEXT. The default value is CURRENT. KIrp::IoctlInputBufferSize ULONG& IoctlInputBufferSize( EStackLocation s ); Returns the size of the input buffer for an IRP whose major function is IRP_MJ_DEVICECONTROL. Parameters s Either CURRENT or NEXT. The default value is CURRENT. KIrp::Information ULONG& Information( void ); Accessor to the information field. Returns Returns a reference to IRP field IoStatus.Information. 不看书的人。 |
|
地板#
发布于:2003-05-17 21:22
呵呵,接受大虾的批评!偶看ing... :D |
|