-
Notifications
You must be signed in to change notification settings - Fork 219
Expand file tree
/
Copy pathntbcd.h
More file actions
2764 lines (2666 loc) · 130 KB
/
Copy pathntbcd.h
File metadata and controls
2764 lines (2666 loc) · 130 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
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Boot Configuration Data (BCD) support functions
*
* This file is part of System Informer.
*/
#ifndef _NTBCD_H
#define _NTBCD_H
//
// BCD.dll Exported Types
//
#ifndef PHNT_INLINE_BCD_GUIDS
// 5189B25C-5558-4BF2-BCA4-289B11BD29E2 // {badmemory}
DEFINE_GUID(GUID_BAD_MEMORY_GROUP, 0x5189B25C, 0x5558, 0x4BF2, 0xBC, 0xA4, 0x28, 0x9B, 0x11, 0xBD, 0x29, 0xE2);
// 6EFB52BF-1766-41DB-A6B3-0EE5EFF72BD7 // {bootloadersettings}
DEFINE_GUID(GUID_BOOT_LOADER_SETTINGS_GROUP, 0x6EFB52BF, 0x1766, 0x41DB, 0xA6, 0xB3, 0x0E, 0xE5, 0xEF, 0xF7, 0x2B, 0xD7);
// FA926493-6F1C-4193-A414-58F0B2456D1E // {current}
DEFINE_GUID(GUID_CURRENT_BOOT_ENTRY, 0xFA926493, 0x6F1C, 0x4193, 0xA4, 0x14, 0x58, 0xF0, 0xB2, 0x45, 0x6D, 0x1E);
// 4636856E-540F-4170-A130-A84776F4C654 // {eventsettings} {dbgsettings}
DEFINE_GUID(GUID_DEBUGGER_SETTINGS_GROUP, 0x4636856E, 0x540F, 0x4170, 0xA1, 0x30, 0xA8, 0x47, 0x76, 0xF4, 0xC6, 0x54);
// 1CAE1EB7-A0DF-4D4D-9851-4860E34EF535 // {default}
DEFINE_GUID(GUID_DEFAULT_BOOT_ENTRY, 0x1CAE1EB7, 0xA0DF, 0x4D4D, 0x98, 0x51, 0x48, 0x60, 0xE3, 0x4E, 0xF5, 0x35);
// 0CE4991B-E6B3-4B16-B23C-5E0D9250E5D9 // {emssettings}
DEFINE_GUID(GUID_EMS_SETTINGS_GROUP, 0x0CE4991B, 0xE6B3, 0x4B16, 0xB2, 0x3C, 0x5E, 0x0D, 0x92, 0x50, 0xE5, 0xD9);
// A5A30FA2-3D06-4E9F-B5F4-A01DF9D1FCBA // {fwbootmgr}
DEFINE_GUID(GUID_FIRMWARE_BOOTMGR, 0xA5A30FA2, 0x3D06, 0x4E9F, 0xB5, 0xF4, 0xA0, 0x1D, 0xF9, 0xD1, 0xFC, 0xBA);
// 7EA2E1AC-2E61-4728-AAA3-896D9D0A9F0E // {globalsettings}
DEFINE_GUID(GUID_GLOBAL_SETTINGS_GROUP, 0x7EA2E1AC, 0x2E61, 0x4728, 0xAA, 0xA3, 0x89, 0x6D, 0x9D, 0x0A, 0x9F, 0x0E);
// 7FF607E0-4395-11DB-B0DE-0800200C9A66 // {hypervisorsettings}
DEFINE_GUID(GUID_HYPERVISOR_SETTINGS_GROUP, 0x7FF607E0, 0x4395, 0x11DB, 0xB0, 0xDE, 0x08, 0x00, 0x20, 0x0C, 0x9A, 0x66);
// 313E8EED-7098-4586-A9BF-309C61F8D449 // {kerneldbgsettings}
DEFINE_GUID(GUID_KERNEL_DEBUGGER_SETTINGS_GROUP, 0x313E8EED, 0x7098, 0x4586, 0xA9, 0xBF, 0x30, 0x9C, 0x61, 0xF8, 0xD4, 0x49);
// 1AFA9C49-16AB-4A5C-4A90-212802DA9460 // {resumeloadersettings}
DEFINE_GUID(GUID_RESUME_LOADER_SETTINGS_GROUP, 0x1AFA9C49, 0x16AB, 0x4A5C, 0x4A, 0x90, 0x21, 0x28, 0x02, 0xDA, 0x94, 0x60);
// 9DEA862C-5CDD-4E70-ACC1-F32B344D4795 // {bootmgr}
DEFINE_GUID(GUID_WINDOWS_BOOTMGR, 0x9DEA862C, 0x5CDD, 0x4E70, 0xAC, 0xC1, 0xF3, 0x2B, 0x34, 0x4D, 0x47, 0x95);
// 466F5A88-0AF2-4F76-9038-095B170DC21C // {ntldr} {legacy}
DEFINE_GUID(GUID_WINDOWS_LEGACY_NTLDR, 0x466F5A88, 0x0AF2, 0x4F76, 0x90, 0x38, 0x09, 0x5B, 0x17, 0x0D, 0xC2, 0x1C);
// B2721D73-1DB4-4C62-BF78-C548A880142D // {memdiag}
DEFINE_GUID(GUID_WINDOWS_MEMORY_TESTER, 0xB2721D73, 0x1DB4, 0x4C62, 0xBF, 0x78, 0xC5, 0x48, 0xA8, 0x80, 0x14, 0x2D);
// B012B84D-C47C-4ED5-B722-C0C42163E569
DEFINE_GUID(GUID_WINDOWS_OS_TARGET_TEMPLATE_EFI, 0xB012B84D, 0xC47C, 0x4ED5, 0xB7, 0x22, 0xC0, 0xC4, 0x21, 0x63, 0xE5, 0x69);
// A1943BBC-EA85-487C-97C7-C9EDE908A38A
DEFINE_GUID(GUID_WINDOWS_OS_TARGET_TEMPLATE_PCAT, 0xA1943BBC, 0xEA85, 0x487C, 0x97, 0xC7, 0xC9, 0xED, 0xE9, 0x08, 0xA3, 0x8A);
// 0C334284-9A41-4DE1-99B3-A7E87E8FF07E
DEFINE_GUID(GUID_WINDOWS_RESUME_TARGET_TEMPLATE_EFI, 0x0C334284, 0x9A41, 0x4DE1, 0x99, 0xB3, 0xA7, 0xE8, 0x7E, 0x8F, 0xF0, 0x7E);
// 98B02A23-0674-4CE7-BDAD-E0A15A8FF97B
DEFINE_GUID(GUID_WINDOWS_RESUME_TARGET_TEMPLATE_PCAT, 0x98B02A23, 0x0674, 0x4CE7, 0xBD, 0xAD, 0xE0, 0xA1, 0x5A, 0x8F, 0xF9, 0x7B);
// 7254a080-1510-4e85-ac0f-e7fb3d444736
DEFINE_GUID(GUID_WINDOWS_SETUP_EFI, 0x7254A080, 0x1510, 0x4E85, 0xAC, 0x0F, 0xE7, 0xFB, 0x3D, 0x44, 0x47, 0x36);
// CBD971BF-B7B8-4885-951A-FA03044F5D71
DEFINE_GUID(GUID_WINDOWS_SETUP_PCAT, 0xCBD971BF, 0xB7B8, 0x4885, 0x95, 0x1A, 0xFA, 0x03, 0x04, 0x4F, 0x5D, 0x71);
// AE5534E0-A924-466C-B836-758539A3EE3A // {ramdiskoptions}
DEFINE_GUID(GUID_WINDOWS_SETUP_RAMDISK_OPTIONS, 0xAE5534E0, 0xA924, 0x466C, 0xB8, 0x36, 0x75, 0x85, 0x39, 0xA3, 0xEE, 0x3A);
// 7619dcc9-fafe-11d9-b411-000476eba25f
DEFINE_GUID(GUID_WINDOWS_SETUP_BOOT_ENTRY, 0x7619dcc9, 0xfafe, 0x11d9, 0xb4, 0x11, 0x00, 0x04, 0x76, 0xeb, 0xa2, 0x5f);
// A62C8016-CA4E-4687-8032-D666C51A280C
DEFINE_GUID(GUID_VHD_BOOT_OPTIONS, 0xa62c8016, 0xca4e, 0x4687, 0x80, 0x32, 0xd6, 0x66, 0xc5, 0x1a, 0x28, 0x0c);
// C63C9BDF-5FA5-4208-B03F-6B458B365592
DEFINE_GUID(GUID_VMBFS_BOOT_INSTANCE, 0xc63c9bdf, 0x5fa5, 0x4208, 0xb0, 0x3f, 0x6b, 0x45, 0x8b, 0x36, 0x55, 0x92);
// EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
DEFINE_GUID(PARTITION_BASIC_DATA_GUID, 0xebd0a0a2, 0xb9e5, 0x4433, 0x87, 0xc0, 0x68, 0xb6, 0xb7, 0x26, 0x99, 0xc7);
// DB97DBA9-0840-4BAE-97F0-FFB9A327C7E1
DEFINE_GUID(PARTITION_CLUSTER_GUID, 0xdb97dba9, 0x0840, 0x4bae, 0x97, 0xf0, 0xff, 0xb9, 0xa3, 0x27, 0xc7, 0xe1);
// 00000000-0000-0000-0000-000000000000
DEFINE_GUID(PARTITION_ENTRY_UNUSED_GUID, 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
// AF9B60A0-1431-4F62-BC68-3311714A69AD
DEFINE_GUID(PARTITION_LDM_DATA_GUID, 0xaf9b60a0, 0x1431, 0x4f62, 0xbc, 0x68, 0x33, 0x11, 0x71, 0x4a, 0x69, 0xad);
// 5808C8AA-7E8F-42E0-85D2-E1E90434CFB3
DEFINE_GUID(PARTITION_LDM_METADATA_GUID, 0x5808c8aa, 0x7e8f, 0x42e0, 0x85, 0xd2, 0xe1, 0xe9, 0x04, 0x34, 0xcf, 0xb3);
// DE94BBA4-06D1-4D40-A16A-BFD50179D6AC
DEFINE_GUID(PARTITION_MSFT_RECOVERY_GUID, 0xde94bba4, 0x06d1, 0x4d40, 0xa1, 0x6a, 0xbf, 0xd5, 0x01, 0x79, 0xd6, 0xac);
// E3C9E316-0B5C-4DB8-817D-F92DF00215AE
DEFINE_GUID(PARTITION_MSFT_RESERVED_GUID, 0xe3c9e316, 0x0b5c, 0x4db8, 0x81, 0x7d, 0xf9, 0x2d, 0xf0, 0x02, 0x15, 0xae);
// CADDEBF1-4400-4DE8-B103-12117DCF3CC
DEFINE_GUID(PARTITION_MSFT_SNAPSHOT_GUID, 0xcaddebf1, 0x4400, 0x4de8, 0xb1, 0x03, 0x12, 0x11, 0x7d, 0xcf, 0x3c, 0xcf);
// E75CAF8F-F680-4CEE-AFA3-B001E56EFC2D
DEFINE_GUID(PARTITION_SPACES_GUID, 0xe75caf8f, 0xf680, 0x4cee, 0xaf, 0xa3, 0xb0, 0x01, 0xe5, 0x6e, 0xfc, 0x2d);
// C12A7328-F81F-11D2-BA4B-00A0C93EC93B
DEFINE_GUID(PARTITION_SYSTEM_GUID, 0xc12a7328, 0xf81f, 0x11d2, 0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b);
#else
NTSYSAPI GUID GUID_BAD_MEMORY_GROUP; // {badmemory}
NTSYSAPI GUID GUID_BOOT_LOADER_SETTINGS_GROUP; // {bootloadersettings}
NTSYSAPI GUID GUID_CURRENT_BOOT_ENTRY; // {current}
NTSYSAPI GUID GUID_DEBUGGER_SETTINGS_GROUP; // {eventsettings} {dbgsettings}
NTSYSAPI GUID GUID_DEFAULT_BOOT_ENTRY; // {default}
NTSYSAPI GUID GUID_EMS_SETTINGS_GROUP; // {emssettings}
NTSYSAPI GUID GUID_FIRMWARE_BOOTMGR; // {fwbootmgr}
NTSYSAPI GUID GUID_GLOBAL_SETTINGS_GROUP; // {globalsettings}
NTSYSAPI GUID GUID_HYPERVISOR_SETTINGS_GROUP; // {hypervisorsettings}
NTSYSAPI GUID GUID_KERNEL_DEBUGGER_SETTINGS_GROUP; // {kerneldbgsettings}
NTSYSAPI GUID GUID_RESUME_LOADER_SETTINGS_GROUP; // {resumeloadersettings}
NTSYSAPI GUID GUID_WINDOWS_BOOTMGR; // {bootmgr}
NTSYSAPI GUID GUID_WINDOWS_LEGACY_NTLDR; // {ntldr} {legacy}
NTSYSAPI GUID GUID_WINDOWS_MEMORY_TESTER; // {memdiag}
NTSYSAPI GUID GUID_WINDOWS_OS_TARGET_TEMPLATE_EFI;
NTSYSAPI GUID GUID_WINDOWS_OS_TARGET_TEMPLATE_PCAT;
NTSYSAPI GUID GUID_WINDOWS_RESUME_TARGET_TEMPLATE_EFI;
NTSYSAPI GUID GUID_WINDOWS_RESUME_TARGET_TEMPLATE_PCAT;
NTSYSAPI GUID GUID_WINDOWS_SETUP_EFI;
NTSYSAPI GUID GUID_WINDOWS_SETUP_PCAT;
NTSYSAPI GUID GUID_WINDOWS_SETUP_RAMDISK_OPTIONS; // {ramdiskoptions}
NTSYSAPI GUID GUID_VHD_BOOT_OPTIONS;
NTSYSAPI GUID PARTITION_BASIC_DATA_GUID;
NTSYSAPI GUID PARTITION_CLUSTER_GUID;
NTSYSAPI GUID PARTITION_ENTRY_UNUSED_GUID;
NTSYSAPI GUID PARTITION_LDM_DATA_GUID;
NTSYSAPI GUID PARTITION_LDM_METADATA_GUID;
NTSYSAPI GUID PARTITION_MSFT_RECOVERY_GUID;
NTSYSAPI GUID PARTITION_MSFT_RESERVED_GUID;
NTSYSAPI GUID PARTITION_MSFT_SNAPSHOT_GUID;
NTSYSAPI GUID PARTITION_SPACES_GUID;
NTSYSAPI GUID PARTITION_SYSTEM_GUID;
#endif // PHNT_INLINE_BCD_GUIDS
/**
* The BCD_MESSAGE_TYPE enumeration represents the types of messages for BCD operations.
*/
typedef enum _BCD_MESSAGE_TYPE
{
BCD_MESSAGE_TYPE_NONE,
BCD_MESSAGE_TYPE_TRACE,
BCD_MESSAGE_TYPE_INFORMATION,
BCD_MESSAGE_TYPE_WARNING,
BCD_MESSAGE_TYPE_ERROR,
BCD_MESSAGE_TYPE_MAXIMUM
} BCD_MESSAGE_TYPE;
typedef _Function_class_(BCD_MESSAGE_CALLBACK)
VOID NTAPI BCD_MESSAGE_CALLBACK(
_In_ BCD_MESSAGE_TYPE type,
_In_ PCWSTR Message
);
typedef BCD_MESSAGE_CALLBACK* PBCD_MESSAGE_CALLBACK;
/**
* Sets the logging level and callback function for BCD messages.
*
* \param BcdLoggingLevel The logging level to set.
* \param BcdMessageCallbackRoutine The callback routine for BCD messages.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdSetLogging(
_In_ BCD_MESSAGE_TYPE BcdLoggingLevel,
_In_ PBCD_MESSAGE_CALLBACK BcdMessageCallbackRoutine
);
/**
* The BcdInitializeBcdSyncMutant function initializes the BCD synchronization mutant.
*/
NTSYSAPI
VOID
NTAPI
BcdInitializeBcdSyncMutant(
VOID
);
/**
* The BcdGetSystemStorePath function retrieves the file name for the BCD.
*
* \param BcdSystemStorePath The pointer to receive the system store path.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdGetSystemStorePath(
_Out_ PWSTR* BcdSystemStorePath // RtlFreeHeap(RtlProcessHeap(), 0, BcdSystemStorePath);
);
/**
* The BcdSetSystemStoreDevice function sets the device for the system BCD store.
*
* \param SystemPartition The system partition to set.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdSetSystemStoreDevice(
_In_ PCUNICODE_STRING SystemPartition
);
/**
* The BcdOpenSystemStore function opens the BCD system store.
*
* \param BcdStoreHandle The handle to receive the system store.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdOpenSystemStore(
_Out_ PHANDLE BcdStoreHandle
);
/**
* The BcdOpenStoreFromFile function opens a BCD store from a file.
*
* \param BcdFilePath The file path of the BCD store.
* \param BcdStoreHandle The handle to receive the BCD store.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdOpenStoreFromFile(
_In_ PCUNICODE_STRING BcdFilePath,
_Out_ PHANDLE BcdStoreHandle
);
/**
* The BcdCreateStore function creates a BCD store.
*
* \param BcdFilePath The file path to create the BCD store.
* \param BcdStoreHandle The handle to receive the BCD store.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdCreateStore(
_In_ PCUNICODE_STRING BcdFilePath,
_Out_ PHANDLE BcdStoreHandle
);
/**
* The BcdExportStore function exports the BCD store to a file.
*
* \param BcdFilePath The file path to export the BCD store.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdExportStore(
_In_ PCUNICODE_STRING BcdFilePath
);
#if (PHNT_VERSION > PHNT_WINDOWS_11)
/**
* The BcdExportStoreEx function exports the BCD store to a file with additional flags.
*
* \param BcdStoreHandle The handle to the BCD store.
* \param Flags The flags for exporting the store.
* \param BcdFilePath The file path to export the BCD store.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdExportStoreEx(
_In_ HANDLE BcdStoreHandle,
_In_ ULONG Flags,
_In_ PCUNICODE_STRING BcdFilePath
);
#endif // PHNT_VERSION > PHNT_WINDOWS_11
/**
* The BcdImportStore function imports a BCD store from a file.
*
* \param BcdFilePath The file path to import the BCD store.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdImportStore(
_In_ PCUNICODE_STRING BcdFilePath
);
typedef enum _BCD_IMPORT_FLAGS
{
BCD_IMPORT_NONE,
BCD_IMPORT_DELETE_FIRMWARE_OBJECTS
} BCD_IMPORT_FLAGS;
/**
* The BcdImportStoreWithFlags function imports a BCD store from a file with additional flags.
*
* \param BcdFilePath The file path to import the BCD store.
* \param BcdImportFlags The flags for importing the store.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdImportStoreWithFlags(
_In_ PCUNICODE_STRING BcdFilePath,
_In_ BCD_IMPORT_FLAGS BcdImportFlags
);
/**
* The BcdDeleteObjectReferences function deletes object references in the BCD store.
*
* \param BcdStoreHandle The handle to the BCD store.
* \param Identifier The identifier of the object to delete references for.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdDeleteObjectReferences(
_In_ HANDLE BcdStoreHandle,
_In_ PCGUID Identifier
);
/**
* The BcdDeleteSystemStore function deletes the system store for BCD.
*
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdDeleteSystemStore(
VOID
);
typedef enum _BCD_OPEN_FLAGS
{
BCD_OPEN_NONE,
BCD_OPEN_OPEN_STORE_OFFLINE,
BCD_OPEN_SYNC_FIRMWARE_ENTRIES
} BCD_OPEN_FLAGS;
/**
* The BcdOpenStore function opens a BCD store with additional flags.
*
* \param BcdFilePath The file path of the BCD store.
* \param BcdOpenFlags The flags for opening the store.
* \param BcdStoreHandle The handle to receive the BCD store.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdOpenStore(
_In_ PCUNICODE_STRING BcdFilePath,
_In_ BCD_OPEN_FLAGS BcdOpenFlags,
_Out_ PHANDLE BcdStoreHandle
);
/**
* The BcdCloseStore function closes a BCD store.
*
* \param BcdStoreHandle The handle to the BCD store.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdCloseStore(
_In_ HANDLE BcdStoreHandle
);
/**
* The BcdFlushStore function flushes a BCD store.
*
* \param BcdStoreHandle The handle to the BCD store.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdFlushStore(
_In_ HANDLE BcdStoreHandle
);
/**
* The BcdForciblyUnloadStore function forcibly unloads a BCD store.
*
* \param BcdStoreHandle The handle to the BCD store.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdForciblyUnloadStore(
_In_ HANDLE BcdStoreHandle
);
/**
* The BcdMarkAsSystemStore function marks the specified BCD store as the system store
* and used by the boot manager and other boot components as the primary source of boot configuration data.
*
* \param BcdStoreHandle Handle to the BCD store to be marked as the system store.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdMarkAsSystemStore(
_In_ HANDLE BcdStoreHandle
);
/**
* The BCD_OBJECT_TYPE enumeration represents the types of BCD (Boot Configuration Data) objects.
*/
typedef enum _BCD_OBJECT_TYPE
{
BCD_OBJECT_TYPE_NONE,
BCD_OBJECT_TYPE_APPLICATION, // 0x10000000
BCD_OBJECT_TYPE_INHERITED, // 0x20000000
BCD_OBJECT_TYPE_DEVICE, // 0x30000000
} BCD_OBJECT_TYPE;
/**
* The BCD_APPLICATION_OBJECT_TYPE enumeration represents the various types
* of application objects in the Boot Configuration Data (BCD).
*/
typedef enum _BCD_APPLICATION_OBJECT_TYPE
{
BCD_APPLICATION_OBJECT_NONE = 0,
BCD_APPLICATION_OBJECT_FIRMWARE_BOOT_MANAGER = 1, // 0x00000001
BCD_APPLICATION_OBJECT_WINDOWS_BOOT_MANAGER = 2, // 0x00000002
BCD_APPLICATION_OBJECT_WINDOWS_BOOT_LOADER = 3, // 0x00000003
BCD_APPLICATION_OBJECT_WINDOWS_RESUME_APPLICATION = 4, // 0x00000004
BCD_APPLICATION_OBJECT_MEMORY_TESTER = 5, // 0x00000005
BCD_APPLICATION_OBJECT_LEGACY_NTLDR = 6, // 0x00000006
BCD_APPLICATION_OBJECT_LEGACY_SETUPLDR = 7, // 0x00000007
BCD_APPLICATION_OBJECT_BOOT_SECTOR = 8, // 0x00000008
BCD_APPLICATION_OBJECT_STARTUP_MODULE = 9, // 0x00000009
BCD_APPLICATION_OBJECT_GENERIC_APPLICATION = 10, // 0x0000000a
BCD_APPLICATION_OBJECT_RESERVED = 0xFFFFF // 0x000fffff
} BCD_APPLICATION_OBJECT_TYPE;
/**
* The BCD_APPLICATION_IMAGE_TYPE enumeration represents the types of images for BCD applications.
*/
typedef enum _BCD_APPLICATION_IMAGE_TYPE
{
BCD_APPLICATION_IMAGE_NONE,
BCD_APPLICATION_IMAGE_FIRMWARE_APPLICATION, // 0x00100000
BCD_APPLICATION_IMAGE_BOOT_APPLICATION, // 0x00200000
BCD_APPLICATION_IMAGE_LEGACY_LOADER, // 0x00300000
BCD_APPLICATION_IMAGE_REALMODE_CODE, // 0x00400000
} BCD_APPLICATION_IMAGE_TYPE;
/**
* The BCD_INHERITED_CLASS_TYPE enumeration represents the classes of inherited BCD objects.
*/
typedef enum _BCD_INHERITED_CLASS_TYPE
{
BCD_INHERITED_CLASS_NONE,
BCD_INHERITED_CLASS_LIBRARY,
BCD_INHERITED_CLASS_APPLICATION,
BCD_INHERITED_CLASS_DEVICE
} BCD_INHERITED_CLASS_TYPE;
/**
* Constructs a BCD (Boot Configuration Data) object identifier with the specified
* object type, image type, and application type into a single ULONG value.
* \param ObjectType The type of the BCD object (placed in the highest 4 bits).
* \param ImageType The type of the image (placed in the next 4 bits).
* \param ApplicationType The type of the application (placed in the lowest 20 bits).
* \returns A ULONG value representing the combined BCD object identifier.
* \remarks Bit Layout:
* | 31 ... 28 | 27 ... 24 | 23 ... 20 | 19 .......... 0 |
* | ObjectType| Reserved | ImageType | ApplicationType |
*/
#define MAKE_BCD_OBJECT(ObjectType, ImageType, ApplicationType) \
(((ULONG)(ObjectType) << 28) | \
(((ULONG)(ImageType) & 0xF) << 20) | \
((ULONG)(ApplicationType) & 0xFFFFF))
/**
* Constructs a BCD (Boot Configuration Data) application object identifier.
* This macro creates a BCD object identifier for an application by combining the object type,
* image type, and application type into a single value using the MAKE_BCD_OBJECT macro.
* \param ImageType The type of the image (e.g., Windows Boot Loader, Windows Resume Application).
* \param ApplicationType The specific application type within the image type.
* \return A value representing the BCD application object identifier.
*/
#define MAKE_BCD_APPLICATION_OBJECT(ImageType, ApplicationType) \
MAKE_BCD_OBJECT(BCD_OBJECT_TYPE_APPLICATION, (ULONG)(ImageType), (ULONG)(ApplicationType))
/**
* Macro to extract the BCD (Boot Configuration Data) object type from a given DataType value.
* The macro shifts the input DataType 28 bits to the right and masks the result with 0xF,
* effectively extracting the upper 4 bits, which represent the BCD object type.
* \param DataType The value containing the BCD object type in its upper 4 bits.
* \return The extracted BCD_OBJECT_TYPE value.
*/
#define GET_BCD_OBJECT_TYPE(DataType) \
((BCD_OBJECT_TYPE)(((((ULONG)(DataType))) >> 28) & 0xF))
/**
* Extracts the BCD (Boot Configuration Data) application image type from a given data type value.
* This macro shifts the input value 20 bits to the right and masks the result with 0xF (4 bits),
* effectively extracting bits 20-23, which represent the BCD application image type.
* \param DataType The value containing the BCD application image type encoded in bits 20-23.
* \return The extracted BCD_APPLICATION_IMAGE_TYPE value.
*/
#define GET_BCD_APPLICATION_IMAGE(DataType) \
((BCD_APPLICATION_IMAGE_TYPE)(((((ULONG)(DataType))) >> 20) & 0xF))
/**
* Macro to extract the BCD application object type from a given data type value.
* \param DataType The value containing the BCD application object type information.
* \return The extracted BCD_APPLICATION_OBJECT_TYPE, obtained by masking the lower 20 bits of DataType.
*/
#define GET_BCD_APPLICATION_OBJECT(DataType) \
((BCD_APPLICATION_OBJECT_TYPE)((((ULONG)(DataType))) & 0xFFFFF))
#define BCD_OBJECT_OSLOADER_TYPE \
MAKE_BCD_APPLICATION_OBJECT(BCD_APPLICATION_IMAGE_BOOT_APPLICATION, BCD_APPLICATION_OBJECT_WINDOWS_BOOT_LOADER)
/**
* The BCD_OBJECT_DATATYPE provides multiple views of the packed value for different BCD (Boot Configuration Data) objects.
* \remarks This union allows for flexible interpretation of BCD object data depending on the context in which it is used.
*/
typedef union _BCD_OBJECT_DATATYPE
{
ULONG PackedValue;
union
{
struct
{
ULONG Reserved : 28;
BCD_OBJECT_TYPE ObjectType : 4;
};
struct
{
BCD_APPLICATION_OBJECT_TYPE ApplicationType : 20;
BCD_APPLICATION_IMAGE_TYPE ImageType : 4;
ULONG Reserved : 4;
BCD_OBJECT_TYPE ObjectType : 4;
} Application;
struct
{
ULONG Value : 20;
BCD_INHERITED_CLASS_TYPE Class : 4;
ULONG Reserved : 4;
BCD_OBJECT_TYPE ObjectType : 4;
} Inherit;
struct
{
ULONG Reserved : 28;
BCD_OBJECT_TYPE ObjectType : 4;
} Device;
};
} BCD_OBJECT_DATATYPE, *PBCD_OBJECT_DATATYPE;
static_assert(sizeof(BCD_OBJECT_DATATYPE) == sizeof(ULONG), "sizeof(BCD_OBJECT_DATATYPE) is invalid.");
#define BCD_OBJECT_DESCRIPTION_VERSION 0x1
/**
* The BCD_OBJECT_DESCRIPTION structure contains metadata about a BCD object, including its version and type.
*/
typedef struct _BCD_OBJECT_DESCRIPTION
{
ULONG Version; // BCD_OBJECT_DESCRIPTION_VERSION
ULONG Type; // BCD_OBJECT_DATATYPE
} BCD_OBJECT_DESCRIPTION, *PBCD_OBJECT_DESCRIPTION;
/**
* The BCD_OBJECT structure contains the identifier and description of a BCD object.
*/
typedef struct _BCD_OBJECT
{
GUID Identifier;
PBCD_OBJECT_DESCRIPTION Description;
} BCD_OBJECT, *PBCD_OBJECT;
/**
* The BcdEnumerateObjects function enumerates BCD objects in the specified BCD store.
*
* \param BcdStoreHandle Handle to the BCD store.
* \param BcdEnumDescriptor Pointer to a BCD_OBJECT_DESCRIPTION structure that specifies the type of objects to enumerate.
* \param Buffer Optional pointer to a buffer that receives an array of BCD_OBJECT structures.
* \param BufferSize On input, the size of the buffer in bytes. On output, the required or actual size.
* \param ObjectCount Receives the number of objects returned.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdEnumerateObjects(
_In_ HANDLE BcdStoreHandle,
_In_ PBCD_OBJECT_DESCRIPTION BcdEnumDescriptor,
_Out_writes_bytes_opt_(*BufferSize) PVOID Buffer, // BCD_OBJECT[]
_Inout_ PULONG BufferSize,
_Out_ PULONG ObjectCount
);
/**
* The BcdOpenObject function opens a BCD object by its identifier.
*
* \param BcdStoreHandle Handle to the BCD store.
* \param Identifier Pointer to the GUID of the object to open.
* \param BcdObjectHandle Receives the handle to the opened BCD object.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdOpenObject(
_In_ HANDLE BcdStoreHandle,
_In_ PCGUID Identifier,
_Out_ PHANDLE BcdObjectHandle
);
/**
* The BcdCreateObject function creates a new BCD object in the specified store.
*
* \param BcdStoreHandle Handle to the BCD store.
* \param Identifier Pointer to the GUID for the new object.
* \param Description Pointer to a BCD_OBJECT_DESCRIPTION structure describing the object.
* \param BcdObjectHandle Receives the handle to the created BCD object.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdCreateObject(
_In_ HANDLE BcdStoreHandle,
_In_ PCGUID Identifier,
_In_ PBCD_OBJECT_DESCRIPTION Description,
_Out_ PHANDLE BcdObjectHandle
);
/**
* The BcdDeleteObject function deletes a BCD object.
*
* \param BcdObjectHandle Handle to the BCD object to delete.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdDeleteObject(
_In_ HANDLE BcdObjectHandle
);
/**
* The BcdCloseObject function closes a handle to a BCD object.
*
* \param BcdObjectHandle Handle to the BCD object to close.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdCloseObject(
_In_ HANDLE BcdObjectHandle
);
/**
* The BCD_COPY_FLAGS specify the behavior of Boot Configuration Data (BCD) copy operations,
* controlling how objects and elements are handled during BCD copy procedures.
*/
_Enum_is_bitflag_
typedef enum _BCD_COPY_FLAGS
{
BCD_COPY_NONE = 0x0,
BCD_COPY_COPY_CREATE_NEW_OBJECT_IDENTIFIER = 0x1,
BCD_COPY_COPY_DELETE_EXISTING_OBJECT = 0x2,
BCD_COPY_COPY_UNKNOWN_FIRMWARE_APPLICATION = 0x4,
BCD_COPY_IGNORE_SETUP_TEMPLATE_ELEMENTS = 0x8,
BCD_COPY_RETAIN_ELEMENT_DATA = 0x10,
BCD_COPY_MIGRATE_ELEMENT_DATA = 0x20
} BCD_COPY_FLAGS;
DEFINE_ENUM_FLAG_OPERATORS(BCD_COPY_FLAGS);
/**
* The BcdCopyObject function copies a BCD object from one store to another.
*
* \param BcdStoreHandle Handle to the source BCD store.
* \param BcdObjectHandle Handle to the BCD object to copy.
* \param BcdCopyFlags Flags that control the copy operation.
* \param TargetStoreHandle Handle to the target BCD store.
* \param TargetObjectHandle Receives the handle to the copied BCD object in the target store.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdCopyObject(
_In_ HANDLE BcdStoreHandle,
_In_ HANDLE BcdObjectHandle,
_In_ BCD_COPY_FLAGS BcdCopyFlags,
_In_ HANDLE TargetStoreHandle,
_Out_ PHANDLE TargetObjectHandle
);
/**
* The BcdCopyObjectEx function copies a BCD object from one store to another, specifying the target object identifier.
*
* \param BcdStoreHandle Handle to the source BCD store.
* \param BcdObjectHandle Handle to the BCD object to copy.
* \param BcdCopyFlags Flags that control the copy operation.
* \param TargetStoreHandle Handle to the target BCD store.
* \param TargetObjectId Pointer to the GUID for the new object in the target store.
* \param TargetObjectHandle Receives the handle to the copied BCD object in the target store.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdCopyObjectEx(
_In_ HANDLE BcdStoreHandle,
_In_ HANDLE BcdObjectHandle,
_In_ BCD_COPY_FLAGS BcdCopyFlags,
_In_ HANDLE TargetStoreHandle,
_In_ PCGUID TargetObjectId,
_Out_ PHANDLE TargetObjectHandle
);
/**
* The BcdCopyObjects function copies multiple BCD objects from one store to another based on specified characteristics.
*
* \param BcdStoreHandle Handle to the source BCD store.
* \param Characteristics Pointer to a BCD_OBJECT_DESCRIPTION structure specifying the objects to copy.
* \param BcdCopyFlags Flags that control the copy operation.
* \param TargetStoreHandle Handle to the target BCD store.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdCopyObjects(
_In_ HANDLE BcdStoreHandle,
_In_ PBCD_OBJECT_DESCRIPTION Characteristics,
_In_ BCD_COPY_FLAGS BcdCopyFlags,
_In_ HANDLE TargetStoreHandle
);
/**
* The BcdMigrateObjectElementValues function migrates element values from a source BCD object to a target BCD object using a template.
*
* \param TemplateObjectHandle Handle to the template BCD object.
* \param SourceObjectHandle Handle to the source BCD object.
* \param TargetObjectHandle Handle to the target BCD object.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdMigrateObjectElementValues(
_In_ HANDLE TemplateObjectHandle,
_In_ HANDLE SourceObjectHandle,
_In_ HANDLE TargetObjectHandle
);
/**
* The BcdQueryObject function queries a BCD object for its description and identifier.
*
* \param BcdObjectHandle Handle to the BCD object to query.
* \param BcdVersion The version of the BCD object description structure (use BCD_OBJECT_DESCRIPTION_VERSION).
* \param Description Receives the BCD_OBJECT_DESCRIPTION structure for the object.
* \param Identifier Receives the GUID identifier of the object.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdQueryObject(
_In_ HANDLE BcdObjectHandle,
_In_ ULONG BcdVersion, // BCD_OBJECT_DESCRIPTION_VERSION
_Out_ BCD_OBJECT_DESCRIPTION Description,
_Out_ PGUID Identifier
);
/**
* The BCD_ELEMENT_DATATYPE_FORMAT enumeration represents the data formats for BCD elements.
*/
typedef enum _BCD_ELEMENT_DATATYPE_FORMAT
{
BCD_ELEMENT_DATATYPE_FORMAT_UNKNOWN,
BCD_ELEMENT_DATATYPE_FORMAT_DEVICE, // 0x01000000
BCD_ELEMENT_DATATYPE_FORMAT_STRING, // 0x02000000
BCD_ELEMENT_DATATYPE_FORMAT_OBJECT, // 0x03000000
BCD_ELEMENT_DATATYPE_FORMAT_OBJECTLIST, // 0x04000000
BCD_ELEMENT_DATATYPE_FORMAT_INTEGER, // 0x05000000
BCD_ELEMENT_DATATYPE_FORMAT_BOOLEAN, // 0x06000000
BCD_ELEMENT_DATATYPE_FORMAT_INTEGERLIST, // 0x07000000
BCD_ELEMENT_DATATYPE_FORMAT_BINARY // 0x08000000
} BCD_ELEMENT_DATATYPE_FORMAT;
/**
* The BCD_ELEMENT_DATATYPE_CLASS enumeration represents the classes for BCD elements.
*/
typedef enum _BCD_ELEMENT_DATATYPE_CLASS
{
BCD_ELEMENT_DATATYPE_CLASS_NONE,
BCD_ELEMENT_DATATYPE_CLASS_LIBRARY, // 0x10000000
BCD_ELEMENT_DATATYPE_CLASS_APPLICATION, // 0x20000000
BCD_ELEMENT_DATATYPE_CLASS_DEVICE, // 0x30000000
BCD_ELEMENT_DATATYPE_CLASS_SETUPTEMPLATE, // 0x40000000
BCD_ELEMENT_DATATYPE_CLASS_OEM // 0x50000000
} BCD_ELEMENT_DATATYPE_CLASS;
/**
* The BCD_ELEMENT_DEVICE_TYPE enumeration represents the types of devices for BCD elements.
*/
typedef enum _BCD_ELEMENT_DEVICE_TYPE
{
BCD_ELEMENT_DEVICE_TYPE_NONE,
BCD_ELEMENT_DEVICE_TYPE_BOOT_DEVICE,
BCD_ELEMENT_DEVICE_TYPE_PARTITION,
BCD_ELEMENT_DEVICE_TYPE_FILE,
BCD_ELEMENT_DEVICE_TYPE_RAMDISK,
BCD_ELEMENT_DEVICE_TYPE_UNKNOWN,
BCD_ELEMENT_DEVICE_TYPE_QUALIFIED_PARTITION,
BCD_ELEMENT_DEVICE_TYPE_VMBUS,
BCD_ELEMENT_DEVICE_TYPE_LOCATE_DEVICE,
BCD_ELEMENT_DEVICE_TYPE_URI,
BCD_ELEMENT_DEVICE_TYPE_COMPOSITE
} BCD_ELEMENT_DEVICE_TYPE;
/**
* Macro to construct a BCD element data type value from its class, format, and subtype.
*
* \param Class The class of the BCD element.
* \param Format The format of the BCD element data.
* \param Subtype The subtype identifier for the element.
* \return A ULONG value representing the combined BCD element data type.
*/
#define MAKE_BCDE_DATA_TYPE(Class, Format, Subtype) \
(((((ULONG)(Class)) & 0xF) << 28) | ((((ULONG)(Format)) & 0xF) << 24) | (((ULONG)(Subtype)) & 0x00FFFFFF))
/**
* Macro to extract the BCD element class from a given data type value.
*
* \param DataType The value containing the BCD element information.
* \return The extracted BCD_ELEMENT_DATATYPE_CLASS.
*/
#define GET_BCDE_DATA_CLASS(DataType) \
((BCD_ELEMENT_DATATYPE_CLASS)(((((ULONG)(DataType))) >> 28) & 0xF))
/**
* Macro to extract the BCD element data format from a given data type value.
*
* \param DataType The value containing the BCD element information.
* \return The extracted BCD_ELEMENT_DATATYPE_FORMAT.
*/
#define GET_BCDE_DATA_FORMAT(DataType) \
((BCD_ELEMENT_DATATYPE_FORMAT)(((((ULONG)(DataType))) >> 24) & 0xF))
/**
* Macro to extract the BCD element subtype identifier from a given data type value.
*
* \param DataType The value containing the BCD element information.
* \return The extracted subtype identifier as a ULONG value.
*/
#define GET_BCDE_DATA_SUBTYPE(DataType) \
((ULONG)((((ULONG)(DataType))) & 0x00FFFFFF))
/**
* The BCD_ELEMENT_DATATYPE union represents the data type for a BCD element.
*/
typedef union _BCD_ELEMENT_DATATYPE
{
ULONG PackedValue;
struct
{
ULONG SubType : 24;
BCD_ELEMENT_DATATYPE_FORMAT Format : 4;
BCD_ELEMENT_DATATYPE_CLASS Class : 4;
};
} BCD_ELEMENT_DATATYPE, *PBCD_ELEMENT_DATATYPE;
static_assert(sizeof(BCD_ELEMENT_DATATYPE) == sizeof(ULONG), "sizeof(BCD_ELEMENT_DATATYPE) is invalid.");
/**
* The BcdEnumerateElementTypes function enumerates the element types present in a specified BCD object.
*
* \param BcdObjectHandle Handle to the BCD object whose element types are to be enumerated.
* \param Buffer Optional pointer to a buffer that receives an array of BCD_ELEMENT_DATATYPE values.
* If this parameter is NULL, the function will return the required buffer size in BufferSize.
* \param BufferSize On input, specifies the size of the buffer in bytes. On output, receives the required or actual size of the buffer.
* \param ElementCount Receives the number of element types returned in the buffer.
* \return NTSTATUS Successful or errant status.
*/
NTSYSAPI
NTSTATUS
NTAPI
BcdEnumerateElementTypes(
_In_ HANDLE BcdObjectHandle,
_Out_writes_bytes_opt_(*BufferSize) PVOID Buffer, // BCD_ELEMENT_DATATYPE[]
_Inout_ PULONG BufferSize,
_Out_ PULONG ElementCount
);
/**
* The BCD_ELEMENT_DEVICE_QUALIFIED_PARTITION structure contains information about a qualified partition.
*/
typedef struct _BCD_ELEMENT_DEVICE_QUALIFIED_PARTITION
{
ULONG PartitionStyle;
ULONG Reserved;
struct
{
union
{
ULONG DiskSignature;
ULONG64 PartitionOffset;
} Mbr;
union
{
GUID DiskSignature;
GUID PartitionSignature;
} Gpt;
};
} BCD_ELEMENT_DEVICE_QUALIFIED_PARTITION, *PBCD_ELEMENT_DEVICE_QUALIFIED_PARTITION;
/**
* The BCD_ELEMENT_DEVICE structure contains information about a BCD device element.
*/
typedef struct _BCD_ELEMENT_DEVICE
{
ULONG DeviceType;
GUID AdditionalOptions;
struct
{
union
{
ULONG ParentOffset;
WCHAR Path[ANYSIZE_ARRAY];
} File;
union
{
WCHAR Path[ANYSIZE_ARRAY];
} Partition;
union
{
ULONG Type;
ULONG ParentOffset;
ULONG ElementType;
WCHAR Path[ANYSIZE_ARRAY];
} Locate;
union
{
GUID InterfaceInstance;
} Vmbus;
union
{
ULONG Data[ANYSIZE_ARRAY];
} Unknown;
BCD_ELEMENT_DEVICE_QUALIFIED_PARTITION QualifiedPartition;
};
} BCD_ELEMENT_DEVICE, *PBCD_ELEMENT_DEVICE;
/**
* The BCD_ELEMENT_STRING structure contains a string value for a BCD element.
*/
typedef struct _BCD_ELEMENT_STRING
{
WCHAR Value[ANYSIZE_ARRAY];
} BCD_ELEMENT_STRING, *PBCD_ELEMENT_STRING;
/**
* The BCD_ELEMENT_OBJECT structure contains a GUID value for a BCD object element.
*/
typedef struct _BCD_ELEMENT_OBJECT
{
GUID Object;
} BCD_ELEMENT_OBJECT, *PBCD_ELEMENT_OBJECT;
/**
* The BCD_ELEMENT_OBJECT_LIST structure contains a list of GUIDs for a BCD object list element.
*/
typedef struct _BCD_ELEMENT_OBJECT_LIST
{
GUID ObjectList[ANYSIZE_ARRAY];
} BCD_ELEMENT_OBJECT_LIST, *PBCD_ELEMENT_OBJECT_LIST;
/**
* The BCD_ELEMENT_INTEGER structure contains a 64-bit integer value for a BCD element.
*/
typedef struct _BCD_ELEMENT_INTEGER
{
ULONG64 Value;
} BCD_ELEMENT_INTEGER, *PBCD_ELEMENT_INTEGER;
/**
* The BCD_ELEMENT_INTEGER_LIST structure contains a list of 64-bit integers for a BCD element.
*/
typedef struct _BCD_ELEMENT_INTEGER_LIST
{
ULONG64 Value[ANYSIZE_ARRAY];
} BCD_ELEMENT_INTEGER_LIST, *PBCD_ELEMENT_INTEGER_LIST;
/**
* The BCD_ELEMENT_BOOLEAN structure contains a boolean value for a BCD element.
*/
typedef struct _BCD_ELEMENT_BOOLEAN
{
BOOLEAN Value;
//BOOLEAN Pad; // sym
} BCD_ELEMENT_BOOLEAN, *PBCD_ELEMENT_BOOLEAN;
#define BCD_ELEMENT_DESCRIPTION_VERSION 0x1