Process Environment Block
{{Short description|Windows NT data structure}}
In computing the Process Environment Block (abbreviated PEB) is a data structure in the Windows NT operating system family. It is an opaque data structure that is used by the operating system internally, most of whose fields are not intended for use by anything other than the operating system. Microsoft notes, in its MSDN Library documentation — which documents only a few of the fields — that the structure "may be altered in future versions of Windows". The PEB contains data structures that apply across a whole process, including global context, startup parameters, data structures for the program image loader, the program image base address, and synchronization objects used to provide mutual exclusion for process-wide data structures.
The PEB is closely associated with the kernel mode
In WinDbg, the command that dumps the contents of a PEB is the !peb
command, which is passed the address of the PEB within a process' application address space. That information, in turn, is obtained by the !process
command, which displays the information from the
class="wikitable sortable" | ||
Field | meaning | notes |
---|---|---|
BeingDebugged | Whether the process is being debugged | Microsoft recommends not using this field but using the official Win32 |
Ldr | A pointer to a | Contains the base address of kernel32 and ntdll. |
ProcessParameters | A pointer to a | The |
PostProcessInitRoutine | A pointer to a callback function called after DLL initialization but before the main executable code is invoked | This callback function is used on Windows 2000, but is not guaranteed to be used on later versions of Windows NT. |
SessionId | The session ID of the Terminal Services session that the process is part of | The |
The contents of the PEB are initialized by the fork()
function in the Windows NT POSIX library, posix.dll.
For Windows NT POSIX processes, the contents of a new process' PEB are initialized by
The WineHQ project provides a fuller PEB definition in its version of winternl.h.{{cite web |title=wine winternl.h: typedef struct _PEB |url=https://github.com/wine-mirror/wine/blob/1aff1e6a370ee8c0213a0fd4b220d121da8527aa/include/winternl.h#L269 |website=GitHub |publisher=wine-mirror |date=29 October 2019}} Later versions of Windows have adjusted the number and purpose of some fields.{{cite web |last1=Chappel |first1=Geoff |title=PEB |url=https://www.geoffchappell.com/studies/windows/win32/ntdll/structs/peb/index.htm |accessdate=30 October 2019}}
References
{{cite web|work=MSDN Library|publisher=Microsoft|title=Process and Thread structures: PEB Structure|url=http://msdn.microsoft.com/library/aa813706(VS.85).aspx|date=2010-07-15|accessdate=2010-07-15|archive-url=https://web.archive.org/web/20121022182726/http://msdn.microsoft.com/library/aa813706(VS.85).aspx|archive-date=2012-10-22|url-status=dead}}
{{cite web|work=MSDN Library|publisher=Microsoft|title=Process and Thread structures: RTL_USER_PROCESS_PARAMETERS Structure|url=http://msdn.microsoft.com/library/aa813741(VS.85).aspx|date=2010-07-15|accessdate=2010-07-15}}
{{cite book|title=Windows internals|series=Microsoft Press Series|author=Mark E. Russinovich, David A. Solomon, and Alex Ionescu|edition=5th|publisher=Microsoft Press|year=2009|isbn=9780735625303|pages=335–336,341–342,348,357–358}}
External links
- [https://www.vergiliusproject.com/kernels/x64/Windows%2010%20%7C%202016/1809%20Redstone%205%20(October%20Update)/_PEB PEB definitions for various Windows versions]