进程环境块PEB笔记

      The operating system allocates a structure for every running process that can always be found at fs:[0x30] from within the process.The PEB structure holds information about the process's heaps,binary image information and ,most importantly,three linked lists regarding loaded modules that have been mapped into process space.The linked lists themseleves differ in purpose from showing the order in which the modules were loaded to the order in which the modules were initialized.The initialization order linked list is of most interest as the order in which kernel32.dll is initialized is always constant as the second module to be initialized.By walking the list to the second entry,one can deterministically extract the base address for kernel32.dll.
      Declarations for PEB:
Code
      The LoaderData member of PEB structure is of type PEB_LDR_DATA,as you can see,it's at the 0x0c offset from the head of PEB,and it is defined as below:

Code
      Declaration for LIST_ENTRY:
1 typedef struct _LIST_ENTRY 
2{
3       struct _LIST_ENTRY *Flink; 
4       struct _LIST_ENTRY *Blink; 
5}
 LIST_ENTRY, *PLIST_ENTRY; 
      All the modules loaded by the process is cascaded by a list member InInitializationOrderModuleList,and "Kernel32.dll" is always the second item.
The element type of InInitializationOrderModuleList is defined like this:
Code
      So,to get the base address of "kernel32.dll",you can try this:
Code

posted on 2009-09-16 16:15  Joshua Leung  阅读(1757)  评论(0编辑  收藏  举报

导航