sync with trunk r46493
[reactos.git] / include / ndk / pstypes.h
index 45e27f2..d423b7a 100644 (file)
@@ -26,6 +26,7 @@ Author:
 #include <ldrtypes.h>
 #include <mmtypes.h>
 #include <obtypes.h>
+#include <rtltypes.h>
 #ifndef NTOS_MODE_USER
 #include <extypes.h>
 #include <setypes.h>
@@ -616,133 +617,6 @@ typedef struct _INITIAL_PEB
     HANDLE Mutant;
 } INITIAL_PEB, *PINITIAL_PEB;
 
-//
-// Process Environment Block (PEB)
-//
-typedef struct _PEB
-{
-    BOOLEAN InheritedAddressSpace;
-    BOOLEAN ReadImageFileExecOptions;
-    BOOLEAN BeingDebugged;
-#if (NTDDI_VERSION >= NTDDI_WS03)
-    struct
-    {
-        BOOLEAN ImageUsesLargePages:1;
-    #if (NTDDI_VERSION >= NTDDI_LONGHORN)
-        BOOLEAN IsProtectedProcess:1;
-        BOOLEAN IsLegacyProcess:1;
-        BOOLEAN SpareBits:5;
-    #else
-        BOOLEAN SpareBits:7;
-    #endif
-    };
-#else
-    BOOLEAN SpareBool;
-#endif
-    HANDLE Mutant;
-    PVOID ImageBaseAddress;
-    PPEB_LDR_DATA Ldr;
-    struct _RTL_USER_PROCESS_PARAMETERS *ProcessParameters;
-    PVOID SubSystemData;
-    PVOID ProcessHeap;
-#if (NTDDI_VERSION >= NTDDI_LONGHORN)
-    struct _RTL_CRITICAL_SECTION *FastPebLock;
-    PVOID AltThunkSListPtr;
-    PVOID IFEOKey;
-    ULONG Spare;
-    union
-    {
-        PVOID* KernelCallbackTable;
-        PVOID UserSharedInfoPtr;
-    };
-    ULONG SystemReserved[1];
-    ULONG SpareUlong;
-#else
-    PVOID FastPebLock;
-    PPEBLOCKROUTINE FastPebLockRoutine;
-    PPEBLOCKROUTINE FastPebUnlockRoutine;
-    ULONG EnvironmentUpdateCount;
-    PVOID* KernelCallbackTable;
-    PVOID EventLogSection;
-    PVOID EventLog;
-#endif
-    PPEB_FREE_BLOCK FreeList;
-    ULONG TlsExpansionCounter;
-    PVOID TlsBitmap;
-    ULONG TlsBitmapBits[0x2];
-    PVOID ReadOnlySharedMemoryBase;
-    PVOID ReadOnlySharedMemoryHeap;
-    PVOID* ReadOnlyStaticServerData;
-    PVOID AnsiCodePageData;
-    PVOID OemCodePageData;
-    PVOID UnicodeCaseTableData;
-    ULONG NumberOfProcessors;
-    ULONG NtGlobalFlag;
-    LARGE_INTEGER CriticalSectionTimeout;
-    ULONG HeapSegmentReserve;
-    ULONG HeapSegmentCommit;
-    ULONG HeapDeCommitTotalFreeThreshold;
-    ULONG HeapDeCommitFreeBlockThreshold;
-    ULONG NumberOfHeaps;
-    ULONG MaximumNumberOfHeaps;
-    PVOID* ProcessHeaps;
-    PVOID GdiSharedHandleTable;
-    PVOID ProcessStarterHelper;
-    ULONG GdiDCAttributeList;
-#if (NTDDI_VERSION >= NTDDI_LONGHORN)
-    struct _RTL_CRITICAL_SECTION *LoaderLock;
-#else
-    PVOID LoaderLock;
-#endif
-    ULONG OSMajorVersion;
-    ULONG OSMinorVersion;
-    USHORT OSBuildNumber;
-    USHORT OSCSDVersion;
-    ULONG OSPlatformId;
-    ULONG ImageSubSystem;
-    ULONG ImageSubSystemMajorVersion;
-    ULONG ImageSubSystemMinorVersion;
-    ULONG ImageProcessAffinityMask;
-    ULONG GdiHandleBuffer[0x22];
-    PPOST_PROCESS_INIT_ROUTINE PostProcessInitRoutine;
-    struct _RTL_BITMAP *TlsExpansionBitmap;
-    ULONG TlsExpansionBitmapBits[0x20];
-    ULONG SessionId;
-#if (NTDDI_VERSION >= NTDDI_WINXP)
-    ULARGE_INTEGER AppCompatFlags;
-    ULARGE_INTEGER AppCompatFlagsUser;
-    PVOID pShimData;
-    PVOID AppCompatInfo;
-    UNICODE_STRING CSDVersion;
-    struct _ACTIVATION_CONTEXT_DATA *ActivationContextData;
-    struct _ASSEMBLY_STORAGE_MAP *ProcessAssemblyStorageMap;
-    struct _ACTIVATION_CONTEXT_DATA *SystemDefaultActivationContextData;
-    struct _ASSEMBLY_STORAGE_MAP *SystemAssemblyStorageMap;
-    ULONG MinimumStackCommit;
-#endif
-#if (NTDDI_VERSION >= NTDDI_WS03)
-    PVOID *FlsCallback;
-    LIST_ENTRY FlsListHead;
-    struct _RTL_BITMAP *FlsBitmap;
-    ULONG FlsBitmapBits[4];
-    ULONG FlsHighIndex;
-#endif
-#if (NTDDI_VERSION >= NTDDI_LONGHORN)
-    PVOID WerRegistrationData;
-    PVOID WerShipAssertPtr;
-#endif
-} PEB, *PPEB;
-
-//
-// GDI Batch Descriptor
-//
-typedef struct _GDI_TEB_BATCH
-{
-    ULONG Offset;
-    HANDLE HDC;
-    ULONG Buffer[0x136];
-} GDI_TEB_BATCH, *PGDI_TEB_BATCH;
-
 //
 // Initial TEB
 //
@@ -771,146 +645,50 @@ typedef struct _TEB_ACTIVE_FRAME
     PTEB_ACTIVE_FRAME_CONTEXT Context;
 } TEB_ACTIVE_FRAME, *PTEB_ACTIVE_FRAME;
 
+typedef struct _CLIENT_ID32
+{
+    ULONG UniqueProcess;
+    ULONG UniqueThread;
+} CLIENT_ID32, *PCLIENT_ID32;
+
+typedef struct _CLIENT_ID64
+{
+    ULONG64 UniqueProcess;
+    ULONG64 UniqueThread;
+} CLIENT_ID64, *PCLIENT_ID64;
+
+#if (NTDDI_VERSION < NTDDI_WS03)
+typedef struct _Wx86ThreadState
+{
+    PULONG  CallBx86Eip;
+    PVOID   DeallocationCpu;
+    BOOLEAN UseKnownWx86Dll;
+    CHAR    OleStubInvoked;
+} Wx86ThreadState, *PWx86ThreadState;
+#endif
+
+
 //
+// Process Environment Block (PEB)
 // Thread Environment Block (TEB)
 //
-typedef struct _TEB
-{
-    NT_TIB Tib;
-    PVOID EnvironmentPointer;
-    CLIENT_ID ClientId;
-    PVOID ActiveRpcHandle;
-    PVOID ThreadLocalStoragePointer;
-    struct _PEB *ProcessEnvironmentBlock;
-    ULONG LastErrorValue;
-    ULONG CountOfOwnedCriticalSections;
-    PVOID CsrClientThread;
-    struct _W32THREAD* Win32ThreadInfo;
-    ULONG User32Reserved[0x1A];
-    ULONG UserReserved[5];
-    PVOID WOW32Reserved;
-    LCID CurrentLocale;
-    ULONG FpSoftwareStatusRegister;
-    PVOID SystemReserved1[0x36];
-    LONG ExceptionCode;
-    struct _ACTIVATION_CONTEXT_STACK *ActivationContextStackPointer;
-#ifdef _WIN64
-    UCHAR SpareBytes1[24];
-#else
-    UCHAR SpareBytes1[0x24];
-#endif
-    ULONG TxFsContext;
-    GDI_TEB_BATCH GdiTebBatch;
-    CLIENT_ID RealClientId;
-    PVOID GdiCachedProcessHandle;
-    ULONG GdiClientPID;
-    ULONG GdiClientTID;
-    PVOID GdiThreadLocalInfo;
-    SIZE_T Win32ClientInfo[62];
-    PVOID glDispatchTable[0xE9];
-    SIZE_T glReserved1[0x1D];
-    PVOID glReserved2;
-    PVOID glSectionInfo;
-    PVOID glSection;
-    PVOID glTable;
-    PVOID glCurrentRC;
-    PVOID glContext;
-    NTSTATUS LastStatusValue;
-    UNICODE_STRING StaticUnicodeString;
-    WCHAR StaticUnicodeBuffer[0x105];
-    PVOID DeallocationStack;
-    PVOID TlsSlots[0x40];
-    LIST_ENTRY TlsLinks;
-    PVOID Vdm;
-    PVOID ReservedForNtRpc;
-    PVOID DbgSsReserved[0x2];
-    ULONG HardErrorDisabled;
+#include "peb_teb.h"
+
 #ifdef _WIN64
-    PVOID Instrumentation[11];
-#else
-    PVOID Instrumentation[9];
-#endif
-    GUID ActivityId;
-    PVOID SubProcessTag;
-    PVOID EtwTraceData;
-#if (NTDDI_VERSION >= NTDDI_LONGHORN)
-    PVOID EtwLocalData;
-#endif
-    PVOID WinSockData;
-    ULONG GdiBatchCount;
-#if (NTDDI_VERSION >= NTDDI_LONGHORN)
-    BOOLEAN SpareBool0;
-    BOOLEAN SpareBool1;
-    BOOLEAN SpareBool2;
-#else
-    BOOLEAN InDbgPrint;
-    BOOLEAN FreeStackOnTermination;
-    BOOLEAN HasFiberData;
-#endif
-    UCHAR IdealProcessor;
-    ULONG GuaranteedStackBytes;
-    PVOID ReservedForPerf;
-    PVOID ReservedForOle;
-    ULONG WaitingOnLoaderLock;
-#if (NTDDI_VERSION >= NTDDI_LONGHORN)
-    PVOID SavedPriorityState;
-#else
-    ULONG SparePointer1;
-#endif
-    ULONG SoftPatchPtr1;
-    ULONG SoftPatchPtr2;
-    PVOID *TlsExpansionSlots;
-    ULONG ImpersonationLocale;
-    ULONG IsImpersonating;
-    PVOID NlsCache;
-    PVOID pShimData;
-    ULONG HeapVirualAffinity;
-    PVOID CurrentTransactionHandle;
-    PTEB_ACTIVE_FRAME ActiveFrame;
-#if (NTDDI_VERSION >= NTDDI_WS03)
-    PVOID FlsData;
-#endif
-#if (NTDDI_VERSION >= NTDDI_LONGHORN)
-    PVOID PreferredLangauges;
-    PVOID UserPrefLanguages;
-    PVOID MergedPrefLanguages;
-    ULONG MuiImpersonation;
-    union
-    {
-        struct
-        {
-            USHORT SpareCrossTebFlags:16;
-        };
-        USHORT CrossTebFlags;
-    };
-    union
-    {
-        struct
-        {
-            USHORT DbgSafeThunkCall:1;
-            USHORT DbgInDebugPrint:1;
-            USHORT DbgHasFiberData:1;
-            USHORT DbgSkipThreadAttach:1;
-            USHORT DbgWerInShipAssertCode:1;
-            USHORT DbgIssuedInitialBp:1;
-            USHORT DbgClonedThread:1;
-            USHORT SpareSameTebBits:9;
-        };
-        USHORT SameTebFlags;
-    };
-    PVOID TxnScopeEntercallback;
-    PVOID TxnScopeExitCAllback;
-    PVOID TxnScopeContext;
-    ULONG LockCount;
-    ULONG ProcessRundown;
-    ULONGLONG LastSwitchTime;
-    ULONGLONG TotalSwitchOutTime;
-    LARGE_INTEGER WaitReasonBitMap;
-#else
-    UCHAR SafeThunkCall;
-    UCHAR BooleanSpare[3];
+//
+// Explicit 32 bit PEB/TEB
+//
+#define EXPLICIT_32BIT
+#include "peb_teb.h"
+#undef EXPLICIT_32BIT
+
+//
+// Explicit 64 bit PEB/TEB
+//
+#define EXPLICIT_64BIT
+#include "peb_teb.h"
+#undef EXPLICIT_64BIT
 #endif
-} TEB, *PTEB;
 
 #ifdef NTOS_MODE_USER