Skip to content

Commit 505e37f

Browse files
committed
Fix incorrect PEB offsets
1 parent 5cb8e7a commit 505e37f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

phnt/include/ntpebteb.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ typedef struct _PEB
124124
ULONG NumberOfProcessors;
125125
ULONG NtGlobalFlag;
126126

127-
LARGE_INTEGER CriticalSectionTimeout;
127+
ULARGE_INTEGER CriticalSectionTimeout;
128128
SIZE_T HeapSegmentReserve;
129129
SIZE_T HeapSegmentCommit;
130130
SIZE_T HeapDeCommitTotalFreeThreshold;
@@ -200,6 +200,14 @@ typedef struct _PEB
200200
ULONG CloudFileFlags;
201201
} PEB, *PPEB;
202202

203+
#ifdef _WIN64
204+
C_ASSERT(FIELD_OFFSET(PEB, SessionId) == 0x2C0);
205+
C_ASSERT(sizeof(PEB) == 0x7B0);
206+
#else
207+
C_ASSERT(FIELD_OFFSET(PEB, SessionId) == 0x1D4);
208+
C_ASSERT(sizeof(PEB) == 0x468);
209+
#endif
210+
203211
#define GDI_BATCH_BUFFER_SIZE 310
204212

205213
typedef struct _GDI_TEB_BATCH

phnt/include/ntpsapi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#define GDI_HANDLE_BUFFER_SIZE32 34
4545
#define GDI_HANDLE_BUFFER_SIZE64 60
4646

47-
#ifndef WIN64
47+
#ifndef _WIN64
4848
#define GDI_HANDLE_BUFFER_SIZE GDI_HANDLE_BUFFER_SIZE32
4949
#else
5050
#define GDI_HANDLE_BUFFER_SIZE GDI_HANDLE_BUFFER_SIZE64

0 commit comments

Comments
 (0)