阅读:938回复:0
编程中的几个问题
我用ReadFile的方式进行读操作,遇到几个问题,希望那个高手指点一二,多谢!
1。我用I.ReadOffset()获得偏移地址,但返回值是LARGE_INTEGER,inb函数要求的偏移地址是ULON,不知如何是好。 2。怎样才能获得已读的字节数? 3。怎样才能得到操作是否成功的状态,inb()的返回值是void. 下面是我的程序,有什么错误,还往指出,多谢! NTSTATUS status = STATUS_SUCCESS; // Declare a memory object KMemory Mem(I.Mdl()); PUCHAR pBuffer = (PUCHAR) Mem.MapToSystemSpace(); ULONG dwTotalSize = I.ReadSize(CURRENT); // Requested read size ULONG dwBytesRead = 0; // Count of bytes read LARGE_INTEGER offset=(ULONG)I.ReadOffset(CURRENT); m_MemoryRange0.inb(offset,pBuffer,dwTotalSize); I.Information() = dwBytesRead; I.Status() = status; // PnpNextIrp completes this IRP and starts processing // for the next IRP in the driver managed queue. // TODO: The Wizard creates a single queue for all Irps. // If you have created additional queues, select // the appropriate queue for this Irp here. m_DriverManagedQueue.PnpNextIrp(I); |
|