#pragma once // ke_userenv.h - kernel view of the user-mode process/thread environment. // This is this OS' ABI, not a Windows compatibility structure. #include #include #include #define SYS_PEB_MAGIC 0x30424550u /* "PEB0" */ #define SYS_TEB_MAGIC 0x30424554u /* "TEB0" */ #define SYS_ENV_VERSION 1u #define SYS_CWD_MAX 520u #ifndef SYS_USER_ENV_TYPES_DEFINED #define SYS_USER_ENV_TYPES_DEFINED 1 typedef struct SYS_PEB { uint32_t Magic; uint32_t Version; uint32_t ProcessId; SYS_STRING_VIEW ImagePath; SYS_STRING_VIEW CommandLine; SYS_STRING_VIEW CurrentDirectory; } SYS_PEB; typedef struct SYS_TEB { SYS_PEB* Peb; void* StackBase; void* StackLimit; struct SYS_TEB* Self; uint32_t ThreadId; uint32_t Magic; // Native per-thread extension pointer. The kernel leaves this NULL; // user-mode personalities/libraries may hang their own thread-local // state here without baking subsystem semantics into SYS_TEB. void* SubsystemData; } SYS_TEB; #endif // SYS_USER_ENV_TYPES_DEFINED