阅读:2791回复:4
请教IRP_MJ_READ 和 IRP_MJ_WRITE IO偏移的问题
WDK中关于IRP_MJ_READ有如下描述:
Pointer to a LARGE_INTEGER variable that specifies the starting byte offset within the file of the data to be read. Under certain circumstances, this parameter might validly contain a NULL or negative value. For example, if the file object was opened for synchronous I/O, and one of the following conditions is true, this indicates that the current file position should be used instead of an explicit file offset value: IrpSp->Parameters.Read.ByteOffset == NULL IrpSp->Parameters.Read.ByteOffset.LowPart == FILE_USE_FILE_POINTER_POSITION and IrpSp->Parameters.Read.ByteOffset.HighPart == -1. WDK中关于IRP_MJ_WRITE有如下描述: A pointer to a LARGE_INTEGER variable that specifies the starting byte offset within the file of the data to be written. Under certain circumstances, this parameter might validly contain a NULL or negative value. For example: If the following condition is true, this indicates that the current end of file should be used instead of an explicit file offset value: IrpSp->Parameters.Write.ByteOffset.LowPart == FILE_WRITE_TO_END_OF_FILE and IrpSp->Parameters.Write.ByteOffset.HighPart == -1 If the file object was opened for synchronous I/O, and one of the following conditions is true, this indicates that the current file position should be used instead of an explicit file offset value: IrpSp->Parameters.Write.ByteOffset == NULL IrpSp->Parameters.Write.ByteOffset.LowPart == FILE_USE_FILE_POINTER_POSITION and IrpSp->Parameters.Write.ByteOffset.HighPart == -1 *************************************************************************************************************************************** 其中有IrpSp->Parameters.Read.ByteOffset == NULL和IrpSp->Parameters.Write.ByteOffset == NULL, 可结构中IrpSp->Parameters.xxx.ByteOffset 并不是指针,请问是WDK上写错了吗? 如果是WDK写错了,那么关于IrpSp->Parameters.Write.ByteOffset == NULL的情况,正确的应该是怎样呢? 如果没有写错,请问该怎么理解呢? |
|
沙发#
发布于:2009-11-27 11:00
NULL = 0
|
|
板凳#
发布于:2009-11-27 11:16
IrpSp->Parameters.Read.ByteOffset == NULL或者
IrpSp->Parameters.Read.ByteOffset == 0 编译通不过, IrpSp->Parameters.Read.ByteOffset 是个结构体。 如果IrpSp->Parameters.Read.ByteOffset == NULL时,也就是 IrpSp->Parameters.Read.ByteOffset .QuadPart == 0 ,这个哪儿有文档可循呢? |
|
地板#
发布于:2009-11-27 11:44
ByteOffset 是不个LargerInteger
|
|
地下室#
发布于:2009-11-27 11:53
ByteOffset 是联合体 LARGE_INTEGER
包含两个结构体和一个LONGLONG类型 #if defined(MIDL_PASS) typedef struct _LARGE_INTEGER { #else // MIDL_PASS typedef union _LARGE_INTEGER { struct { ULONG LowPart; LONG HighPart; } DUMMYSTRUCTNAME; struct { ULONG LowPart; LONG HighPart; } u; #endif //MIDL_PASS LONGLONG QuadPart; } LARGE_INTEGER; IrpSp->Parameters.Read.ByteOffset == NULL 的意思是 IrpSp->Parameters.Read.ByteOffset .QuadPart == 0 吗? |
|