问题总算是搞清楚了,是SECTION的第一个成员的类型写错了,导致后边的偏移出错
。之前也是读取的!_SEGMENT_OBJECT的第一个成员的,现在可以正常读取了。
顺便我也看了下输出,发现跟大家的有点不同,BasedAddress 和 ControlArea的成员刚好相反,难道我的系统特别?我发现WRK中的_SEGMENT定义也是如此.
kd> dt _section_object 0xe1c1a908
nt!_SECTION_OBJECT
+0x000 StartingVa : (null)
+0x004 EndingVa : 0x0007dbc0
+0x008 Parent : (null)
+0x00c LeftChild : 0x000e7258
+0x010 RightChild : 0x0007dbb0
+0x014 Segment : 0xe1b3b298 _SEGMENT_OBJECT
kd> dt _segment 0xe1b3b298
nt!_SEGMENT
+0x000 ControlArea : 0x8211f610 _CONTROL_AREA
+0x004 TotalNumberOfPtes : 6
+0x008 NonExtendedPtes : 6
+0x00c WritableUserReferences : 1
+0x010 SizeOfSegment : 0x5e00
+0x018 SegmentPteTemplate : _MMPTE
+0x020 NumberOfCommittedPages : 0
+0x024 ExtendInfo : (null)
+0x028 SystemImageBase : (null)
+0x02c BasedAddress : (null) +0x030 u1 : __unnamed
+0x034 u2 : __unnamed
+0x038 PrototypePte : 0x00010208 _MMPTE
+0x040 ThePtes : [1] _MMPTE
kd> dt _control_area
0x8211f610
nt!_CONTROL_AREA
+0x000 Segment : 0xe1b3b298 _SEGMENT
+0x004 DereferenceList : _LIST_ENTRY [ 0x0 - 0x0 ]
+0x00c NumberOfSectionReferences : 1
+0x010 NumberOfPfnReferences : 0
+0x014 NumberOfMappedViews : 0
+0x018 NumberOfSubsections : 1
+0x01a FlushInProgressCount : 0
+0x01c NumberOfUserReferences : 1
+0x020 u : __unnamed
+0x024 FilePointer : 0x820b4658 _FILE_OBJECT
+0x028 WaitingForDeletion : (null)
+0x02c ModifiedWriteCount : 0
+0x02e NumberOfSystemCacheViews : 0
kd> dt _file_object 0x820b4658
ntdll!_FILE_OBJECT
+0x000 Type : 5
+0x002 Size : 112
+0x004 DeviceObject : 0x81bf2c08 _DEVICE_OBJECT
+0x008 Vpb : 0x81fe6d80 _VPB
+0x00c FsContext : 0xe1e8c990
+0x010 FsContext2 : 0xe1e8cae8
+0x014 SectionObjectPointer : 0x820fa144 _SECTION_OBJECT_POINTERS
+0x018 PrivateCacheMap : (null)
+0x01c FinalStatus : 0
+0x020 RelatedFileObject : (null)
+0x024 LockOperation : 0 ''
+0x025 DeletePending : 0 ''
+0x026 ReadAccess : 0x1 ''
+0x027 WriteAccess : 0x1 ''
+0x028 DeleteAccess : 0 ''
+0x029 SharedRead : 0x1 ''
+0x02a SharedWrite : 0 ''
+0x02b SharedDelete : 0 ''
+0x02c Flags : 0x40042
+0x030 FileName : _UNICODE_STRING "\test.doc"
+0x038 CurrentByteOffset : _LARGE_INTEGER 0x0
+0x040 Waiters : 0
+0x044 Busy : 0
+0x048 LastLock : (null)
+0x04c Lock : _KEVENT
+0x05c Event : _KEVENT
+0x06c CompletionContext : (null)
kd> !fileobj 0x820b4658
\test.doc
Device Object: 0x81bf2c08 \Driver\Ftdisk
Vpb: 0x81fe6d80
Event signalled
Access: Read Write SharedRead
Flags: 0x40042
Synchronous IO
Cache Supported
Handle Created
FsContext: 0xe1e8c990 FsContext2: 0xe1e8cae8
CurrentByteOffset: 0
Cache Data:
Section Object Pointers: 820fa144
Shared Cache Map: 00000000
还是要谢谢楼上两位的讲解。