三种链表是InLoadOrderModuleList , InMemoryOrderModuleList , InInitializationOrderModuleList
lkd> !peb
PEB at 7ffd5000
InheritedAddressSpace: No
ReadImageFileExecOptions: No
BeingDebugged: No
ImageBaseAddress: 01000000
Ldr 00191e90
Ldr.Initialized: Yes
Ldr.InInitializationOrderModuleList: 00191f28 . 00195a38
Ldr.InLoadOrderModuleList: 00191ec0 . 00195a28
Ldr.InMemoryOrderModuleList: 00191ec8 . 00195a30
lkd> dt nt!_PEB_LDR_DATA 00191e90
+0×000 Length : 0×28
+0×004 Initialized : 0×1 ”
+0×008 SsHandle : (null)
+0×00c InLoadOrderModuleList : _LIST_ENTRY [ 0x191ec0 - 0x195a28 ]
+0×014 InMemoryOrderModuleList : _LIST_ENTRY [ 0x191ec8 - 0x195a30 ]
+0×01c InInitializationOrderModuleList : _LIST_ENTRY [ 0x191f28 - 0x195a38 ]
+0×024 EntryInProgress : (null)
lkd> dt nt!_LDR_DATA_TABLE_ENTRY 0×191ec0
+0×000 InLoadOrderLinks : _LIST_ENTRY [ 0x191f18 - 0x191e9c ]
+0×008 InMemoryOrderLinks : _LIST_ENTRY [ 0x191f20 - 0x191ea4 ]
+0×010 InInitializationOrderLinks : _LIST_ENTRY [ 0x0 - 0x0 ]
+0×018 DllBase : 0×01000000
+0×01c EntryPoint : 0×01056217
+0×020 SizeOfImage : 0×93000
+0×024 FullDllName : _UNICODE_STRING "C:\Program Files\Debugging Tools for Windows (x86)\windbg.exe"
+0×02c BaseDllName : _UNICODE_STRING "windbg.exe"
+0×034 Flags : 0×5000
+0×038 LoadCount : 0xffff
+0×03a TlsIndex : 0
+0×03c HashLinks : _LIST_ENTRY [ 0x19362c - 0x7c99b310 ]
+0×03c SectionPointer : 0×0019362c
+0×040 CheckSum : 0×7c99b310
+0×044 TimeDateStamp : 0×47e30f97
+0×044 LoadedImports : 0×47e30f97
+0×048 EntryPointActivationContext : (null)
+0×04c PatchInformation : (null)
lkd> dt nt!_LDR_DATA_TABLE_ENTRY 0×191ec8-0×8
+0×000 InLoadOrderLinks : _LIST_ENTRY [ 0x191f18 - 0x191e9c ]
+0×008 InMemoryOrderLinks : _LIST_ENTRY [ 0x191f20 - 0x191ea4 ]
+0×010 InInitializationOrderLinks : _LIST_ENTRY [ 0x0 - 0x0 ]
+0×018 DllBase : 0×01000000
+0×01c EntryPoint : 0×01056217
+0×020 SizeOfImage : 0×93000
+0×024 FullDllName : _UNICODE_STRING "C:\Program Files\Debugging Tools for Windows (x86)\windbg.exe"
+0×02c BaseDllName : _UNICODE_STRING "windbg.exe"
+0×034 Flags : 0×5000
+0×038 LoadCount : 0xffff
+0×03a TlsIndex : 0
+0×03c HashLinks : _LIST_ENTRY [ 0x19362c - 0x7c99b310 ]
+0×03c SectionPointer : 0×0019362c
+0×040 CheckSum : 0×7c99b310
+0×044 TimeDateStamp : 0×47e30f97
+0×044 LoadedImports : 0×47e30f97
+0×048 EntryPointActivationContext : (null)
+0×04c PatchInformation : (null)
lkd> dt nt!_LDR_DATA_TABLE_ENTRY 0×191f28-0×10
+0×000 InLoadOrderLinks : _LIST_ENTRY [ 0x191fc0 - 0x191ec0 ]
+0×008 InMemoryOrderLinks : _LIST_ENTRY [ 0x191fc8 - 0x191ec8 ]
+0×010 InInitializationOrderLinks : _LIST_ENTRY [ 0x191fd0 - 0x191eac ]
+0×018 DllBase : 0×7c920000
+0×01c EntryPoint : 0×7c932c28
+0×020 SizeOfImage : 0×93000
+0×024 FullDllName : _UNICODE_STRING "C:\WINDOWS\system32\ntdll.dll"
+0×02c BaseDllName : _UNICODE_STRING "ntdll.dll"
+0×034 Flags : 0×80084004
+0×038 LoadCount : 0xffff
+0×03a TlsIndex : 0
+0×03c HashLinks : _LIST_ENTRY [ 0x1936d4 - 0x7c99b2c8 ]
+0×03c SectionPointer : 0×001936d4
+0×040 CheckSum : 0×7c99b2c8
+0×044 TimeDateStamp : 0×4802bdc5
+0×044 LoadedImports : 0×4802bdc5
+0×048 EntryPointActivationContext : (null)
+0×04c PatchInformation : (null)
可以看出来前2个链表InLoadOrderModuleList , InMemoryOrderModuleList 这2个表是一样的, 以进程exe为链首. InInitializationOrderModuleList 以ntdll.dll为链首.
进程exe不加入到InInitializationOrderModuleList 链表, 其他顺序3个表一致, 这也是为什么进程exe在InLoadOrderModuleList , InMemoryOrderModuleList里+0×010 InInitializationOrderLinks : _LIST_ENTRY [ 0x0 - 0x0 ]为空的原因