-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmemory.h
More file actions
681 lines (640 loc) · 19 KB
/
memory.h
File metadata and controls
681 lines (640 loc) · 19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
#pragma once
#pragma pack(push, 8)
#pragma region memory_information
using MEMORY_INFORMATION_CLASS = enum _MEMORY_INFORMATION_CLASS : std::uint32_t
{
MemoryBasicInformation = 0,
MemoryWorkingSetInformation = 1,
MemoryMappedFilenameInformation = 2,
MemoryRegionInformation = 3,
#if Q_NT_VERSION >= Q_NT_VISTA
MemoryWorkingSetExInformation = 4,
#endif
#if Q_NT_VERSION >= Q_NT_WIN8
MemorySharedCommitInformation = 5,
MemoryImageInformation = 6,
MemoryRegionInformationEx = 7,
MemoryPrivilegedBasicInformation = 8,
#endif
#if Q_NT_VERSION >= Q_NT_WIN10_RS3
MemoryEnclaveImageInformation = 9,
MemoryBasicInformationCapped = 10,
#endif
#if Q_NT_VERSION >= Q_NT_WIN10_20H1
MemoryPhysicalContiguityInformation = 11,
#endif
#if Q_NT_VERSION >= Q_NT_WIN10_21H2
MemoryBadInformation = 12,
#endif
#if Q_NT_VERSION >= Q_NT_WIN11_22H2
MemoryBadInformationAllProcesses = 13,
#endif
#if Q_NT_VERSION >= Q_NT_WIN11_24H2
MemoryImageExtensionInformation = 14,
#endif
MaxMemoryInfoClass
};
template <std::size_t>
struct MEMORY_BASIC_INFORMATION { };
template <>
struct MEMORY_BASIC_INFORMATION<32U>
{
private:
template <typename T>
using BitnessType_t = DETAIL::BitnessConditional_t<32U, T>;
public:
BitnessType_t<void*> BaseAddress; // 0x00
BitnessType_t<void*> AllocationBase; // 0x04
std::uint32_t AllocationProtect; // 0x08
BitnessType_t<std::size_t> RegionSize; // 0x0C
std::uint32_t State; // 0x10
std::uint32_t Protect; // 0x14
std::uint32_t Type; // 0x18
};
template <>
struct MEMORY_BASIC_INFORMATION<64U>
{
private:
template <typename T>
using BitnessType_t = DETAIL::BitnessConditional_t<64U, T>;
public:
BitnessType_t<void*> BaseAddress; // 0x00
BitnessType_t<void*> AllocationBase; // 0x08
std::uint32_t AllocationProtect; // 0x10
#if Q_NT_VERSION >= Q_NT_WIN10_20H1
std::uint16_t PartitionId; // 0x14
#endif
BitnessType_t<std::size_t> RegionSize; // 0x18
std::uint32_t State; // 0x20
std::uint32_t Protect; // 0x24
std::uint32_t Type; // 0x28
};
_Q_NT_BIT_ASSERT(MEMORY_BASIC_INFORMATION, 0x1C, 0x30);
template <std::size_t>
struct MEMORY_WORKING_SET_BLOCK { };
template <>
struct MEMORY_WORKING_SET_BLOCK<32U>
{
std::uint32_t Protection : 5;
std::uint32_t ShareCount : 3;
std::uint32_t Shared : 1;
std::uint32_t Node : 3;
std::uint32_t VirtualPage : 20;
};
static_assert(sizeof(MEMORY_WORKING_SET_BLOCK<32U>) == 0x4);
template <>
struct MEMORY_WORKING_SET_BLOCK<64U>
{
std::uint64_t Protection : 5;
std::uint64_t ShareCount : 3;
std::uint64_t Shared : 1;
std::uint64_t Node : 3;
std::uint64_t VirtualPage : 52;
};
static_assert(sizeof(MEMORY_WORKING_SET_BLOCK<64U>) == 0x8);
_Q_NT_BIT_TEMPLATE struct MEMORY_WORKING_SET_INFORMATION
{
private:
_Q_NT_BIT_TYPE
public:
BitnessType_t<std::size_t> NumberOfEntries; // 0x00
MEMORY_WORKING_SET_BLOCK<nBitness> WorkingSetInfo[ANYSIZE_ARRAY]; // 0x04 / 0x08
};
_Q_NT_BIT_TEMPLATE struct MEMORY_REGION_INFORMATION
{
private:
_Q_NT_BIT_TYPE
public:
BitnessType_t<void*> AllocationBase; // 0x00
std::uint32_t AllocationProtect; // 0x04 / 0x08
#if Q_NT_VERSION >= Q_NT_WIN10_RS1
union
{
std::uint32_t RegionType;
struct
{
std::uint32_t Private : 1;
std::uint32_t MappedDataFile : 1;
std::uint32_t MappedImage : 1;
std::uint32_t MappedPageFile : 1;
std::uint32_t MappedPhysical : 1;
std::uint32_t DirectMapped : 1;
#if Q_NT_VERSION >= Q_NT_WIN10_RS3
std::uint32_t SoftwareEnclave : 1;
std::uint32_t PageSize64K : 1;
#if Q_NT_VERSION >= Q_NT_WIN10_RS4
std::uint32_t PlaceholderReservation : 1;
#if Q_NT_VERSION >= Q_NT_WIN10_21H2
std::uint32_t MappedAwe : 1;
std::uint32_t MappedWriteWatch : 1;
std::uint32_t PageSizeLarge : 1;
std::uint32_t PageSizeHuge : 1;
std::uint32_t Reserved : 19;
#else
std::uint32_t Reserved : 23;
#endif
#else
std::uint32_t Reserved : 24;
#endif
#else
std::uint32_t Reserved : 26;
#endif
};
}; // 0x08 / 0x0C
#else
std::uint32_t RegionType; // 0x08 / 0x0C
#endif
BitnessType_t<std::size_t> RegionSize; // 0x0C / 0x10
#if Q_NT_VERSION >= Q_NT_WIN8
BitnessType_t<std::size_t> CommitSize; // 0x10 / 0x18
#endif
#if Q_NT_VERSION >= Q_NT_WIN10_19H1
BitnessType_t<std::uintptr_t> PartitionId; // 0x14 / 0x20
#endif
#if Q_NT_VERSION >= Q_NT_WIN10_20H1
BitnessType_t<std::uintptr_t> NodePreference; // 0x18 / 0x28
#endif
};
_Q_NT_BIT_ASSERT(MEMORY_REGION_INFORMATION, 0x1C, 0x30);
#if Q_NT_VERSION >= Q_NT_VISTA
template <std::size_t>
union MEMORY_WORKING_SET_EX_BLOCK { };
template <>
union MEMORY_WORKING_SET_EX_BLOCK<32U>
{
std::uint32_t Flags;
union
{
struct
{
std::uint32_t Valid : 1;
std::uint32_t ShareCount : 3;
std::uint32_t Win32Protection : 11;
std::uint32_t Shared : 1;
std::uint32_t Node : 6;
std::uint32_t Locked : 1;
std::uint32_t LargePage : 1;
std::uint32_t Priority : 3;
#if Q_NT_VERSION >= Q_NT_WIN10
std::uint32_t Reserved : 3;
std::uint32_t SharedOriginal : 1;
std::uint32_t Bad : 1;
#else
std::uint32_t Reserved : 5;
#endif
};
struct
{
std::uint32_t Valid : 1;
std::uint32_t Reserved0 : 14;
std::uint32_t Shared : 1;
#if Q_NT_VERSION >= Q_NT_WIN10
std::uint32_t Reserved1 : 5;
std::uint32_t PageTable : 1;
#else
std::uint32_t Reserved1 : 6;
#endif
std::uint32_t Location : 2;
#if Q_NT_VERSION >= Q_NT_WIN10
std::uint32_t Priority : 3;
std::uint32_t ModifiedList : 1;
std::uint32_t Reserved2 : 2;
std::uint32_t SharedOriginal : 1;
std::uint32_t Bad : 1;
#else
std::uint32_t Reserved2 : 8;
#endif
} Invalid;
};
};
template <>
union MEMORY_WORKING_SET_EX_BLOCK<64U>
{
std::uint64_t Flags;
union
{
struct
{
std::uint64_t Valid : 1;
std::uint64_t ShareCount : 3;
std::uint64_t Win32Protection : 11;
std::uint64_t Shared : 1;
std::uint64_t Node : 6;
std::uint64_t Locked : 1;
std::uint64_t LargePage : 1;
std::uint64_t Priority : 3;
#if Q_NT_VERSION >= Q_NT_WIN10
std::uint64_t Reserved : 3;
std::uint64_t SharedOriginal : 1;
std::uint64_t Bad : 1;
#else
std::uint64_t Reserved : 5;
#endif
#if Q_NT_VERSION >= Q_NT_WIN10_19H1
std::uint64_t Win32GraphicsProtection : 4;
std::uint64_t ReservedUlong : 28;
#else
std::uint64_t ReservedUlong : 32;
#endif
};
struct
{
std::uint64_t Valid : 1;
std::uint64_t Reserved0 : 14;
std::uint64_t Shared : 1;
#if Q_NT_VERSION >= Q_NT_WIN10
std::uint64_t Reserved1 : 5;
std::uint64_t PageTable : 1;
#else
std::uint64_t Reserved1 : 6;
#endif
std::uint64_t Location : 2;
#if Q_NT_VERSION >= Q_NT_WIN10
std::uint64_t Priority : 3;
std::uint64_t ModifiedList : 1;
std::uint64_t Reserved2 : 2;
std::uint64_t SharedOriginal : 1;
std::uint64_t Bad : 1;
#else
std::uint64_t Reserved2 : 8;
#endif
std::uint64_t ReservedUlong : 32;
} Invalid;
};
};
_Q_NT_BIT_ASSERT(MEMORY_WORKING_SET_EX_BLOCK, 0x4, 0x8);
_Q_NT_BIT_TEMPLATE struct MEMORY_WORKING_SET_EX_INFORMATION
{
private:
_Q_NT_BIT_TYPE
public:
BitnessType_t<void*> VirtualAddress; // 0x0
MEMORY_WORKING_SET_EX_BLOCK<nBitness> VirtualAttributes; // 0x4 / 0x8
};
_Q_NT_BIT_ASSERT(MEMORY_WORKING_SET_EX_INFORMATION, 0x8, 0x10);
#endif
#if Q_NT_VERSION >= Q_NT_WINBLUE
_Q_NT_BIT_TEMPLATE struct MEMORY_SHARED_COMMIT_INFORMATION
{
private:
_Q_NT_BIT_TYPE
public:
BitnessType_t<std::size_t> CommitSize; // 0x0
};
_Q_NT_BIT_ASSERT(MEMORY_SHARED_COMMIT_INFORMATION, 0x4, 0x8);
_Q_NT_BIT_TEMPLATE struct MEMORY_IMAGE_INFORMATION
{
private:
_Q_NT_BIT_TYPE
public:
BitnessType_t<void*> ImageBase; // 0x00
BitnessType_t<std::size_t> SizeOfImage; // 0x04 / 0x08
union
{
std::uint32_t ImageFlags;
struct
{
std::uint32_t ImagePartialMap : 1;
std::uint32_t ImageNotExecutable : 1;
#if Q_NT_VERSION >= Q_NT_WIN10_RS3
std::uint32_t ImageSigningLevel : 4;
#if Q_NT_VERSION >= Q_NT_WIN11_24H2
std::uint32_t ImageExtensionPresent : 1;
std::uint32_t Reserved : 25;
#else
std::uint32_t Reserved : 26;
#endif
#else
std::uint32_t Reserved : 30;
#endif
};
}; // 0x08 / 0x10
};
_Q_NT_BIT_ASSERT(MEMORY_IMAGE_INFORMATION, 0xC, 0x18);
#endif
#if Q_NT_VERSION >= Q_NT_WIN10_RS3
_Q_NT_BIT_TEMPLATE struct MEMORY_ENCLAVE_IMAGE_INFORMATION
{
private:
_Q_NT_BIT_TYPE
public:
MEMORY_IMAGE_INFORMATION<nBitness> ImageInfo; // 0x00
std::uint8_t UniqueID[32]; // 0x0C / 0x18
std::uint8_t AuthorID[32]; // 0x2C / 0x38
};
_Q_NT_BIT_ASSERT(MEMORY_ENCLAVE_IMAGE_INFORMATION, 0x4C, 0x58);
#endif
#if Q_NT_VERSION >= Q_NT_WIN10_20H2
using MEMORY_PHYSICAL_CONTIGUITY_UNIT_STATE = enum _MEMORY_PHYSICAL_CONTIGUITY_UNIT_STATE
{
MemoryNotContiguous = 0,
MemoryAlignedAndContiguous = 1,
MemoryNotResident = 2,
MemoryNotEligibleToMakeContiguous = 3,
MemoryContiguityStateMax = 4
};
struct MEMORY_PHYSICAL_CONTIGUITY_UNIT_INFORMATION
{
union
{
std::uint32_t AllInformation;
struct
{
std::uint32_t State : 2;
std::uint32_t Reserved : 30;
};
};
};
static_assert(sizeof(MEMORY_PHYSICAL_CONTIGUITY_UNIT_INFORMATION) == 0x4);
_Q_NT_BIT_TEMPLATE struct MEMORY_PHYSICAL_CONTIGUITY_INFORMATION
{
private:
_Q_NT_BIT_TYPE
public:
BitnessType_t<void*> VirtualAddress; // 0x00
BitnessType_t<std::size_t> Size; // 0x04 / 0x08
BitnessType_t<std::size_t> ContiguityUnitSize; // 0x08 / 0x10
std::uint32_t Flags; // 0x0C / 0x18
BitnessType_t<MEMORY_PHYSICAL_CONTIGUITY_UNIT_INFORMATION*> ContiguityUnitInformation; // 0x10 / 0x20
};
_Q_NT_BIT_ASSERT(MEMORY_PHYSICAL_CONTIGUITY_INFORMATION, 0x14, 0x28);
#endif
#if Q_NT_VERSION >= Q_NT_WIN11_24H2
using MEMORY_IMAGE_EXTENSION_TYPE = enum _MEMORY_IMAGE_EXTENSION_TYPE
{
MemoryImageExtensionCfgScp = 0,
MemoryImageExtensionCfgEmulatedScp = 1,
MemoryImageExtensionTypeMax = 2
};
_Q_NT_BIT_TEMPLATE struct MEMORY_IMAGE_EXTENSION_INFORMATION
{
private:
_Q_NT_BIT_TYPE
public:
MEMORY_IMAGE_EXTENSION_TYPE ExtensionType; // 0x00
std::uint32_t Flags; // 0x04
BitnessType_t<void*> ExtensionImageBaseRva; // 0x08
BitnessType_t<std::size_t> ExtensionSize; // 0x0C / 0x10
};
_Q_NT_BIT_ASSERT(MEMORY_IMAGE_EXTENSION_INFORMATION, 0x10, 0x18);
#endif
#pragma endregion
#pragma region memory_partition_information
#if Q_NT_VERSION >= Q_NT_WIN10
#if Q_NT_VERSION >= Q_NT_WIN10_RS3
using PARTITION_INFORMATION_CLASS = enum _PARTITION_INFORMATION_CLASS : std::uint32_t
#else
using MEMORY_PARTITION_INFORMATION_CLASS = enum _MEMORY_PARTITION_INFORMATION_CLASS : std::uint32_t
#endif
{
SystemMemoryPartitionInformation = 0, // MEMORY_PARTITION_CONFIGURATION_INFORMATION
SystemMemoryPartitionMoveMemory = 1, // MEMORY_PARTITION_TRANSFER_INFORMATION
SystemMemoryPartitionAddPagefile = 2, // MEMORY_PARTITION_PAGEFILE_INFORMATION
SystemMemoryPartitionCombineMemory = 3, // MEMORY_PARTITION_PAGE_COMBINE_INFORMATION
SystemMemoryPartitionInitialAddMemory = 4, // MEMORY_PARTITION_INITIAL_ADD_INFORMATION
#if Q_NT_VERSION >= Q_NT_WIN10_RS2
SystemMemoryPartitionGetMemoryEvents = 5, // MEMORY_PARTITION_MEMORY_EVENTS_INFORMATION
#endif
#if Q_NT_VERSION >= Q_NT_WIN10_20H1
SystemMemoryPartitionSetAttributes = 6, // MEMORY_PARTITION_ATTRIBUTE_INFORMATION
SystemMemoryPartitionNodeInformation = 7, // MEMORY_PARTITION_NODE_INFORMATION
SystemMemoryPartitionCreateLargePages = 8, // MEMORY_PARTITION_CREATE_LARGE_PAGES_INFORMATION
#endif
#if Q_NT_VERSION >= Q_NT_WIN11
SystemMemoryPartitionDedicatedMemoryInformation = 9, // MEMORY_PARTITION_DEDICATED_MEMORY_INFORMATION
SystemMemoryPartitionOpenDedicatedMemory = 10, // MEMORY_PARTITION_DEDICATED_MEMORY_OPEN_INFORMATION
SystemMemoryPartitionMemoryChargeAttributes = 11, // MEMORY_PARTITION_CHARGE_SHARING_ATTRIBUTES
SystemMemoryPartitionClearAttributes = 12,
#endif
#if Q_NT_VERSION >= Q_NT_WIN11_22H2
SystemMemoryPartitionSetMemoryThresholds = 13, // MEMORY_PARTITION_MEMORY_THRESHOLDS_INFORMATION
#endif
#if Q_NT_VERSION >= Q_NT_WIN11_24H2
SystemMemoryPartitionMemoryListCommand = 14,
#endif
SystemMemoryPartitionMax
};
_Q_NT_BIT_TEMPLATE struct MEMORY_PARTITION_CONFIGURATION_INFORMATION
{
private:
_Q_NT_BIT_TYPE
public:
std::uint32_t Flags; // 0x00
#if Q_NT_VERSION >= Q_NT_WIN10_RS1
std::uint32_t NumaNode; // 0x04
std::uint32_t Channel; // 0x08
std::uint32_t NumberOfNumaNodes; // 0x0C
#else
BitnessType_t<std::size_t> TotalNumberOfPages; // 0x04 / 0x08
BitnessType_t<std::size_t> ResidentAvailablePages; // 0x08 / 0x10
BitnessType_t<std::size_t> AvailablePages; // 0x0C / 0x18
#endif
BitnessType_t<std::size_t> ResidentAvailablePages; // 0x10 / 0x10
BitnessType_t<std::size_t> CommittedPages; // 0x14 / 0x18
BitnessType_t<std::size_t> CommitLimit; // 0x18 / 0x20
BitnessType_t<std::size_t> PeakCommitment; // 0x1C / 0x28
#if Q_NT_VERSION >= Q_NT_WIN10_RS1
BitnessType_t<std::size_t> TotalNumberOfPages; // 0x20 / 0x30
BitnessType_t<std::size_t> AvailablePages; // 0x24 / 0x38
BitnessType_t<std::size_t> ZeroPages; // 0x28 / 0x40
BitnessType_t<std::size_t> FreePages; // 0x2C / 0x48
BitnessType_t<std::size_t> StandbyPages; // 0x30 / 0x50
#endif
#if Q_NT_VERSION >= Q_NT_WIN10_RS2
BitnessType_t<std::size_t> StandbyPageCountByPriority[8]; // 0x34 / 0x58
BitnessType_t<std::size_t> RepurposedPagesByPriority[8]; // 0x54 / 0x98
BitnessType_t<std::size_t> MaximumCommitLimit; // 0x74 / 0xD8
#if Q_NT_VERSION >= Q_NT_WIN11
BitnessType_t<std::size_t> Reserved; // 0x78 / 0xE0
#else
BitnessType_t<std::size_t> DonatedPagesToPartitions; // 0x78 / 0xE0
#endif
#endif
#if Q_NT_VERSION >= Q_NT_WIN10_RS3
std::uint32_t PartitionId; // 0x7C / 0xE8
#endif
};
_Q_NT_BIT_ASSERT(MEMORY_PARTITION_CONFIGURATION_INFORMATION, 0x80, 0xF0);
_Q_NT_BIT_TEMPLATE struct MEMORY_PARTITION_TRANSFER_INFORMATION
{
private:
_Q_NT_BIT_TYPE
public:
BitnessType_t<std::size_t> NumberOfPages; // 0x0
std::uint32_t NumaNode; // 0x4 / 0x8
std::uint32_t Flags; // 0x8 / 0xC
};
_Q_NT_BIT_ASSERT(MEMORY_PARTITION_TRANSFER_INFORMATION, 0xC, 0x10);
_Q_NT_BIT_TEMPLATE struct MEMORY_PARTITION_PAGEFILE_INFORMATION
{
UNICODE_STRING<nBitness> PageFileName; // 0x00
LARGE_INTEGER MinimumSize; // 0x08 / 0x10
LARGE_INTEGER MaximumSize; // 0x10 / 0x18
std::uint32_t Flags; // 0x18 / 0x20
};
_Q_NT_BIT_ASSERT(MEMORY_PARTITION_PAGEFILE_INFORMATION, 0x20, 0x28);
_Q_NT_BIT_TEMPLATE struct MEMORY_PARTITION_PAGE_COMBINE_INFORMATION
{
private:
_Q_NT_BIT_TYPE
public:
BitnessType_t<void*> StopHandle; // 0x00
std::uint32_t Flags; // 0x04 / 0x08
BitnessType_t<std::size_t> TotalNumberOfPages; // 0x08 / 0x10
};
_Q_NT_BIT_ASSERT(MEMORY_PARTITION_PAGE_COMBINE_INFORMATION, 0xC, 0x18);
#if Q_NT_VERSION >= Q_NT_WIN10_RS1
_Q_NT_BIT_TEMPLATE struct MEMORY_PARTITION_PAGE_RANGE
{
private:
_Q_NT_BIT_TYPE
public:
BitnessType_t<std::size_t> StartPage; // 0x0
BitnessType_t<std::size_t> NumberOfPages; // 0x4 / 0x8
};
_Q_NT_BIT_ASSERT(MEMORY_PARTITION_PAGE_RANGE, 0x8, 0x10);
#endif
_Q_NT_BIT_TEMPLATE struct MEMORY_PARTITION_INITIAL_ADD_INFORMATION
{
private:
_Q_NT_BIT_TYPE
public:
#if Q_NT_VERSION >= Q_NT_WIN10_RS1
std::uint32_t Flags; // 0x00
std::uint32_t NumberOfRanges; // 0x04
BitnessType_t<std::size_t> NumberOfPagesAdded; // 0x08
#if Q_NT_VERSION >= Q_NT_WIN11
BitnessType_t<std::size_t> DedicatedMemoryAttributes[4]; // 0x10
#endif
MEMORY_PARTITION_PAGE_RANGE<nBitness> PartitionRanges[ANYSIZE_ARRAY]; // 0x1C / 0x30
#else
BitnessType_t<std::size_t> StartPage; // 0x00
BitnessType_t<std::size_t> NumberOfPages; // 0x04 / 0x08
std::uint32_t Flags; // 0x08 / 0x10
#endif
};
#if Q_NT_VERSION >= Q_NT_WIN10_RS2
_Q_NT_BIT_TEMPLATE struct MEMORY_PARTITION_MEMORY_EVENTS_INFORMATION
{
private:
_Q_NT_BIT_TYPE
public:
union
{
std::uint32_t AllFlags;
struct
{
std::uint32_t CommitEvents : 1;
std::uint32_t Spare : 31;
};
} Flags; // 0x00
std::uint32_t HandleAttributes; // 0x04
std::uint32_t DesiredAccess; // 0x08
BitnessType_t<void*> LowCommitCondition; // 0x0C / 0x10
BitnessType_t<void*> HighCommitCondition; // 0x10 / 0x18
BitnessType_t<void*> MaximumCommitCondition; // 0x14 / 0x20
};
_Q_NT_BIT_ASSERT(MEMORY_PARTITION_MEMORY_EVENTS_INFORMATION, 0x18, 0x28);
#endif
#if Q_NT_VERSION >= Q_NT_WIN10_20H1
struct MEMORY_PARTITION_ATTRIBUTE_INFORMATION
{
std::uint64_t Flags;
};
static_assert(sizeof(MEMORY_PARTITION_ATTRIBUTE_INFORMATION) == 0x8);
struct MEMORY_PARTITION_NODE_PAGE_INFORMATION
{
std::uint64_t TotalPageCount; // 0x00
std::uint64_t SmallFreePageCount; // 0x08
std::uint64_t SmallZeroPageCount; // 0x10
std::uint64_t MediumFreePageCount; // 0x18
std::uint64_t MediumZeroPageCount; // 0x20
std::uint64_t LargeFreePageCount; // 0x28
std::uint64_t LargeZeroPageCount; // 0x30
std::uint64_t HugeFreePageCount; // 0x38
std::uint64_t HugeZeroPageCount; // 0x40
};
static_assert(sizeof(MEMORY_PARTITION_NODE_PAGE_INFORMATION) == 0x48);
_Q_NT_BIT_TEMPLATE struct MEMORY_PARTITION_NODE_INFORMATION
{
private:
_Q_NT_BIT_TYPE
public:
std::uint32_t NumaNodeCount; // 0x0
std::uint32_t Flags; // 0x4
BitnessType_t<MEMORY_PARTITION_NODE_PAGE_INFORMATION*> NodePageInformation; // 0x8
};
_Q_NT_BIT_ASSERT(MEMORY_PARTITION_NODE_INFORMATION, 0xC, 0x10);
_Q_NT_BIT_TEMPLATE struct MEMORY_PARTITION_CREATE_LARGE_PAGES_INFORMATION
{
private:
_Q_NT_BIT_TYPE
public:
std::uint32_t Flags; // 0x00
std::uint32_t NumaNode; // 0x04
BitnessType_t<std::size_t> LargePageSize; // 0x08
BitnessType_t<std::size_t> NumberOfLargePagesToCreate; // 0x0C / 0x10
BitnessType_t<std::size_t> NumberOfLargePagesCreated; // 0x10 / 0x18
};
_Q_NT_BIT_ASSERT(MEMORY_PARTITION_CREATE_LARGE_PAGES_INFORMATION, 0x14, 0x20);
#endif
#if Q_NT_VERSION >= Q_NT_WIN11
struct MEMORY_PARTITION_DEDICATED_MEMORY_INFORMATION
{
std::uint32_t NextEntryOffset; // 0x00
std::uint32_t SizeOfInformation; // 0x04
std::uint32_t Flags; // 0x08
std::uint32_t AttributesOffset; // 0x0C
std::uint32_t AttributeCount; // 0x10
std::uint32_t Reserved; // 0x14
std::uint64_t TypeId; // 0x18
};
static_assert(sizeof(MEMORY_PARTITION_DEDICATED_MEMORY_INFORMATION) == 0x20);
struct MEMORY_PARTITION_DEDICATED_MEMORY_OPEN_INFORMATION
{
private:
template <typename T>
using BitnessType_t = DETAIL::BitnessConditional_t<64U, T>;
public:
std::uint64_t DedicatedMemoryTypeId; // 0x00
std::uint32_t HandleAttributes; // 0x08
std::uint32_t DesiredAccess; // 0x0C
BitnessType_t<void*> DedicatedMemoryPartitionHandle; // 0x10
};
static_assert(sizeof(MEMORY_PARTITION_DEDICATED_MEMORY_OPEN_INFORMATION) == 0x18);
using MEMORY_PARTITION_CHARGE_SHARING_TYPE = enum _MEMORY_PARTITION_CHARGE_SHARING_TYPE
{
MemoryPartitionMemorySharingTypeVirtual = 0,
MemoryPartitionMemorySharingTypePhysical = 1,
MemoryPartitionMemorySharingTypeMaximum = 2
};
struct MEMORY_PARTITION_CHARGE_SHARING_ATTRIBUTES
{
private:
template <typename T>
using BitnessType_t = DETAIL::BitnessConditional_t<64U, T>;
public:
MEMORY_PARTITION_CHARGE_SHARING_TYPE Type; // 0x00
BitnessType_t<std::size_t> CurrentChargeInPages; // 0x04 / 0x08
BitnessType_t<std::size_t> PeakChargeInPages; // 0x08 / 0x10
BitnessType_t<std::size_t> ChargeLimitInPages; // 0x0C / 0x18
BitnessType_t<std::size_t> ChargeFailures; // 0x10 / 0x20
};
static_assert(sizeof(MEMORY_PARTITION_CHARGE_SHARING_ATTRIBUTES) == 0x28);
#endif
#if Q_NT_VERSION >= Q_NT_WIN11_22H2
struct MEMORY_PARTITION_MEMORY_THRESHOLDS_INFORMATION
{
private:
template <typename T>
using BitnessType_t = DETAIL::BitnessConditional_t<64U, T>;
public:
std::uint32_t Flags; // 0x00
BitnessType_t<std::size_t> LowMemoryThresholdInPages; // 0x08
BitnessType_t<std::size_t> HighMemoryThresholdInPages; // 0x10
};
static_assert(sizeof(MEMORY_PARTITION_MEMORY_THRESHOLDS_INFORMATION) == 0x18);
#endif
#endif
#pragma endregion
#pragma pack(pop)