@@ -10237,6 +10237,7 @@ NTSTATUS PhGetProcessHeapSignature(
10237
10237
10238
10238
if (WindowsVersion >= WINDOWS_7 )
10239
10239
{
10240
+ // dt _HEAP SegmentSignature
10240
10241
status = NtReadVirtualMemory (
10241
10242
ProcessHandle ,
10242
10243
PTR_ADD_OFFSET (HeapAddress , IsWow64 ? 0x8 : 0x10 ),
@@ -10255,6 +10256,57 @@ NTSTATUS PhGetProcessHeapSignature(
10255
10256
return status ;
10256
10257
}
10257
10258
10259
+ NTSTATUS PhGetProcessHeapFrontEndType (
10260
+ _In_ HANDLE ProcessHandle ,
10261
+ _In_ PVOID HeapAddress ,
10262
+ _In_ ULONG IsWow64 ,
10263
+ _Out_ UCHAR * HeapFrontEndType
10264
+ )
10265
+ {
10266
+ NTSTATUS status = STATUS_UNSUCCESSFUL ;
10267
+ UCHAR heapFrontEndType = UCHAR_MAX ;
10268
+
10269
+ if (WindowsVersion >= WINDOWS_10 )
10270
+ {
10271
+ // dt _HEAP FrontEndHeapType
10272
+ status = NtReadVirtualMemory (
10273
+ ProcessHandle ,
10274
+ PTR_ADD_OFFSET (HeapAddress , IsWow64 ? 0x0ea : 0x1a2 ),
10275
+ & heapFrontEndType ,
10276
+ sizeof (UCHAR ),
10277
+ NULL
10278
+ );
10279
+ }
10280
+ else if (WindowsVersion >= WINDOWS_8_1 )
10281
+ {
10282
+ status = NtReadVirtualMemory (
10283
+ ProcessHandle ,
10284
+ PTR_ADD_OFFSET (HeapAddress , IsWow64 ? 0x0d6 : 0x17a ),
10285
+ & heapFrontEndType ,
10286
+ sizeof (UCHAR ),
10287
+ NULL
10288
+ );
10289
+ }
10290
+ else if (WindowsVersion >= WINDOWS_7 )
10291
+ {
10292
+ status = NtReadVirtualMemory (
10293
+ ProcessHandle ,
10294
+ PTR_ADD_OFFSET (HeapAddress , IsWow64 ? 0x0da : 0x182 ),
10295
+ & heapFrontEndType ,
10296
+ sizeof (UCHAR ),
10297
+ NULL
10298
+ );
10299
+ }
10300
+
10301
+ if (NT_SUCCESS (status ))
10302
+ {
10303
+ if (HeapFrontEndType )
10304
+ * HeapFrontEndType = heapFrontEndType ;
10305
+ }
10306
+
10307
+ return status ;
10308
+ }
10309
+
10258
10310
NTSTATUS PhQueryProcessHeapInformation (
10259
10311
_In_ HANDLE ProcessId ,
10260
10312
_Out_ PPH_PROCESS_DEBUG_HEAP_INFORMATION * HeapInformation
@@ -10342,6 +10394,7 @@ NTSTATUS PhQueryProcessHeapInformation(
10342
10394
10343
10395
heapDebugInfo -> Heaps [i ].Flags = heapInfo -> Flags ;
10344
10396
heapDebugInfo -> Heaps [i ].Signature = ULONG_MAX ;
10397
+ heapDebugInfo -> Heaps [i ].HeapFrontEndType = UCHAR_MAX ;
10345
10398
heapDebugInfo -> Heaps [i ].NumberOfEntries = heapInfo -> NumberOfEntries ;
10346
10399
heapDebugInfo -> Heaps [i ].BaseAddress = heapInfo -> BaseAddress ;
10347
10400
heapDebugInfo -> Heaps [i ].BytesAllocated = allocated ;
@@ -10354,6 +10407,7 @@ NTSTATUS PhQueryProcessHeapInformation(
10354
10407
)))
10355
10408
{
10356
10409
ULONG signature = ULONG_MAX ;
10410
+ UCHAR frontEndType = UCHAR_MAX ;
10357
10411
#ifndef _WIN64
10358
10412
BOOLEAN isWow64 = TRUE;
10359
10413
#else
@@ -10371,6 +10425,16 @@ NTSTATUS PhQueryProcessHeapInformation(
10371
10425
heapDebugInfo -> Heaps [i ].Signature = signature ;
10372
10426
}
10373
10427
10428
+ if (NT_SUCCESS (PhGetProcessHeapFrontEndType (
10429
+ processHandle ,
10430
+ heapInfo -> BaseAddress ,
10431
+ isWow64 ,
10432
+ & frontEndType
10433
+ )))
10434
+ {
10435
+ heapDebugInfo -> Heaps [i ].HeapFrontEndType = frontEndType ;
10436
+ }
10437
+
10374
10438
NtClose (processHandle );
10375
10439
}
10376
10440
}
0 commit comments