-
Notifications
You must be signed in to change notification settings - Fork 175
/
ntbcd.h
2133 lines (2042 loc) · 91.4 KB
/
ntbcd.h
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
#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);
// A1943BBC-EA85-487C-97C7-C9EDE908A38A
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);
#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}
#endif
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 VOID (NTAPI* BCD_MESSAGE_CALLBACK)(
_In_ BCD_MESSAGE_TYPE type,
_In_ PWSTR Message
);
NTSYSAPI
NTSTATUS
NTAPI
BcdSetLogging(
_In_ BCD_MESSAGE_TYPE BcdLoggingLevel,
_In_ BCD_MESSAGE_CALLBACK BcdMessageCallbackRoutine
);
NTSYSAPI
VOID
NTAPI
BcdInitializeBcdSyncMutant(
VOID
);
NTSYSAPI
NTSTATUS
NTAPI
BcdGetSystemStorePath(
_Out_ PWSTR* BcdSystemStorePath // RtlFreeHeap(RtlProcessHeap(), 0, BcdSystemStorePath);
);
NTSYSAPI
NTSTATUS
NTAPI
BcdSetSystemStoreDevice(
_In_ UNICODE_STRING SystemPartition
);
NTSYSAPI
NTSTATUS
NTAPI
BcdOpenSystemStore(
_Out_ PHANDLE BcdStoreHandle
);
NTSYSAPI
NTSTATUS
NTAPI
BcdOpenStoreFromFile(
_In_ UNICODE_STRING BcdFilePath,
_Out_ PHANDLE BcdStoreHandle
);
NTSYSAPI
NTSTATUS
NTAPI
BcdCreateStore(
_In_ UNICODE_STRING BcdFilePath,
_Out_ PHANDLE BcdStoreHandle
);
NTSYSAPI
NTSTATUS
NTAPI
BcdExportStore(
_In_ UNICODE_STRING BcdFilePath
);
#if (PHNT_VERSION > PHNT_WIN11)
NTSYSAPI
NTSTATUS
NTAPI
BcdExportStoreEx(
_In_ HANDLE BcdStoreHandle,
_In_ ULONG Flags,
_In_ UNICODE_STRING BcdFilePath
);
#endif
NTSYSAPI
NTSTATUS
NTAPI
BcdImportStore(
_In_ UNICODE_STRING BcdFilePath
);
typedef enum _BCD_IMPORT_FLAGS
{
BCD_IMPORT_NONE,
BCD_IMPORT_DELETE_FIRMWARE_OBJECTS
} BCD_IMPORT_FLAGS;
NTSYSAPI
NTSTATUS
NTAPI
BcdImportStoreWithFlags(
_In_ UNICODE_STRING BcdFilePath,
_In_ BCD_IMPORT_FLAGS BcdImportFlags
);
NTSYSAPI
NTSTATUS
NTAPI
BcdDeleteObjectReferences(
_In_ HANDLE BcdStoreHandle,
_In_ PGUID Identifier
);
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;
NTSYSAPI
NTSTATUS
NTAPI
BcdOpenStore(
_In_ UNICODE_STRING BcdFilePath,
_In_ BCD_OPEN_FLAGS BcdOpenFlags,
_Out_ PHANDLE BcdStoreHandle
);
NTSYSAPI
NTSTATUS
NTAPI
BcdCloseStore(
_In_ HANDLE BcdStoreHandle
);
NTSYSAPI
NTSTATUS
NTAPI
BcdFlushStore(
_In_ HANDLE BcdStoreHandle
);
NTSYSAPI
NTSTATUS
NTAPI
BcdForciblyUnloadStore(
_In_ HANDLE BcdStoreHandle
);
NTSYSAPI
NTSTATUS
NTAPI
BcdMarkAsSystemStore(
_In_ HANDLE BcdStoreHandle
);
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;
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;
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;
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;
#define MAKE_BCD_OBJECT(ObjectType, ImageType, ApplicationType) \
(((ULONG)(ObjectType) << 28) | \
(((ULONG)(ImageType) & 0xF) << 20) | \
((ULONG)(ApplicationType) & 0xFFFFF))
#define MAKE_BCD_APPLICATION_OBJECT(ImageType, ApplicationType) \
MAKE_BCD_OBJECT(BCD_OBJECT_TYPE_APPLICATION, (ULONG)(ImageType), (ULONG)(ApplicationType))
#define GET_BCD_OBJECT_TYPE(DataType) \
((BCD_OBJECT_TYPE)(((((ULONG)DataType)) >> 28) & 0xF))
#define GET_BCD_APPLICATION_IMAGE(DataType) \
((BCD_APPLICATION_IMAGE_TYPE)(((((ULONG)DataType)) >> 20) & 0xF))
#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)
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
typedef struct _BCD_OBJECT_DESCRIPTION
{
ULONG Version; // BCD_OBJECT_DESCRIPTION_VERSION
ULONG Type; // BCD_OBJECT_DATATYPE
} BCD_OBJECT_DESCRIPTION, *PBCD_OBJECT_DESCRIPTION;
typedef struct _BCD_OBJECT
{
GUID Identifer;
PBCD_OBJECT_DESCRIPTION Description;
} BCD_OBJECT, *PBCD_OBJECT;
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
);
NTSYSAPI
NTSTATUS
NTAPI
BcdOpenObject(
_In_ HANDLE BcdStoreHandle,
_In_ const GUID* Identifier,
_Out_ PHANDLE BcdObjectHandle
);
NTSYSAPI
NTSTATUS
NTAPI
BcdCreateObject(
_In_ HANDLE BcdStoreHandle,
_In_ PGUID Identifier,
_In_ PBCD_OBJECT_DESCRIPTION Description,
_Out_ PHANDLE BcdObjectHandle
);
NTSYSAPI
NTSTATUS
NTAPI
BcdDeleteObject(
_In_ HANDLE BcdObjectHandle
);
NTSYSAPI
NTSTATUS
NTAPI
BcdCloseObject(
_In_ HANDLE BcdObjectHandle
);
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;
NTSYSAPI
NTSTATUS
NTAPI
BcdCopyObject(
_In_ HANDLE BcdStoreHandle,
_In_ HANDLE BcdObjectHandle,
_In_ BCD_COPY_FLAGS BcdCopyFlags,
_In_ HANDLE TargetStoreHandle,
_Out_ PHANDLE TargetObjectHandle
);
NTSYSAPI
NTSTATUS
NTAPI
BcdCopyObjectEx(
_In_ HANDLE BcdStoreHandle,
_In_ HANDLE BcdObjectHandle,
_In_ BCD_COPY_FLAGS BcdCopyFlags,
_In_ HANDLE TargetStoreHandle,
_In_ PGUID TargetObjectId,
_Out_ PHANDLE TargetObjectHandle
);
NTSYSAPI
NTSTATUS
NTAPI
BcdCopyObjects(
_In_ HANDLE BcdStoreHandle,
_In_ BCD_OBJECT_DESCRIPTION Characteristics,
_In_ BCD_COPY_FLAGS BcdCopyFlags,
_In_ HANDLE TargetStoreHandle
);
NTSYSAPI
NTSTATUS
NTAPI
BcdMigrateObjectElementValues(
_In_ HANDLE TemplateObjectHandle,
_In_ HANDLE SourceObjectHandle,
_In_ HANDLE TargetObjectHandle
);
NTSYSAPI
NTSTATUS
NTAPI
BcdQueryObject(
_In_ HANDLE BcdObjectHandle,
_In_ ULONG BcdVersion, // BCD_OBJECT_DESCRIPTION_VERSION
_Out_ BCD_OBJECT_DESCRIPTION Description,
_Out_ PGUID Identifier
);
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;
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;
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;
#define MAKE_BCDE_DATA_TYPE(Class, Format, Subtype) \
(((((ULONG)Class) & 0xF) << 28) | ((((ULONG)Format) & 0xF) << 24) | (((ULONG)Subtype) & 0x00FFFFFF))
#define GET_BCDE_DATA_CLASS(DataType) \
((BCD_ELEMENT_DATATYPE_CLASS)(((((ULONG)DataType)) >> 28) & 0xF))
#define GET_BCDE_DATA_FORMAT(DataType) \
((BCD_ELEMENT_DATATYPE_FORMAT)(((((ULONG)DataType)) >> 24) & 0xF))
#define GET_BCDE_DATA_SUBTYPE(DataType) \
((ULONG)((((ULONG)DataType)) & 0x00FFFFFF))
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.");
NTSYSAPI
NTSTATUS
NTAPI
BcdEnumerateElementTypes(
_In_ HANDLE BcdObjectHandle,
_Out_writes_bytes_opt_(*BufferSize) PVOID Buffer, // BCD_ELEMENT_DATATYPE[]
_Inout_ PULONG BufferSize,
_Out_ PULONG ElementCount
);
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;
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;
typedef struct _BCD_ELEMENT_STRING
{
WCHAR Value[ANYSIZE_ARRAY];
} BCD_ELEMENT_STRING, *PBCD_ELEMENT_STRING;
typedef struct _BCD_ELEMENT_OBJECT
{
GUID Object;
} BCD_ELEMENT_OBJECT, *PBCD_ELEMENT_OBJECT;
typedef struct _BCD_ELEMENT_OBJECT_LIST
{
GUID ObjectList[ANYSIZE_ARRAY];
} BCD_ELEMENT_OBJECT_LIST, *PBCD_ELEMENT_OBJECT_LIST;
typedef struct _BCD_ELEMENT_INTEGER
{
ULONG64 Value;
} BCD_ELEMENT_INTEGER, *PBCD_ELEMENT_INTEGER;
typedef struct _BCD_ELEMENT_INTEGER_LIST
{
ULONG64 Value[ANYSIZE_ARRAY];
} BCD_ELEMENT_INTEGER_LIST, *PBCD_ELEMENT_INTEGER_LIST;
typedef struct _BCD_ELEMENT_BOOLEAN
{
BOOLEAN Value;
//BOOLEAN Pad; // sym
} BCD_ELEMENT_BOOLEAN, *PBCD_ELEMENT_BOOLEAN;
#define BCD_ELEMENT_DESCRIPTION_VERSION 0x1
typedef struct BCD_ELEMENT_DESCRIPTION
{
ULONG Version; // BCD_ELEMENT_DESCRIPTION_VERSION
ULONG Type;
ULONG DataSize;
} BCD_ELEMENT_DESCRIPTION, *PBCD_ELEMENT_DESCRIPTION;
typedef struct _BCD_ELEMENT
{
PBCD_ELEMENT_DESCRIPTION Description;
PVOID Data;
} BCD_ELEMENT, *PBCD_ELEMENT;
NTSYSAPI
NTSTATUS
NTAPI
BcdEnumerateElements(
_In_ HANDLE BcdObjectHandle,
_Out_writes_bytes_opt_(*BufferSize) PVOID Buffer, // BCD_ELEMENT[]
_Inout_ PULONG BufferSize,
_Out_ PULONG ElementCount
);
typedef enum _BCD_FLAGS
{
BCD_FLAG_NONE = 0x0,
BCD_FLAG_QUALIFIED_PARTITION = 0x1,
BCD_FLAG_NO_DEVICE_TRANSLATION = 0x2,
BCD_FLAG_ENUMERATE_INHERITED_OBJECTS = 0x4,
BCD_FLAG_ENUMERATE_DEVICE_OPTIONS = 0x8,
BCD_FLAG_OBSERVE_PRECEDENCE = 0x10,
BCD_FLAG_DISABLE_VHD_NT_TRANSLATION = 0x20,
BCD_FLAG_DISABLE_VHD_DEVICE_DETECTION = 0x40,
BCD_FLAG_DISABLE_POLICY_CHECKS = 0x80
} BCD_FLAGS;
NTSYSAPI
NTSTATUS
NTAPI
BcdEnumerateElementsWithFlags(
_In_ HANDLE BcdObjectHandle,
_In_ BCD_FLAGS BcdFlags,
_Out_writes_bytes_opt_(*BufferSize) PVOID Buffer, // BCD_ELEMENT[]
_Inout_ PULONG BufferSize,
_Out_ PULONG ElementCount
);
NTSYSAPI
NTSTATUS
NTAPI
BcdEnumerateAndUnpackElements(
_In_ HANDLE BcdStoreHandle,
_In_ HANDLE BcdObjectHandle,
_In_ BCD_FLAGS BcdFlags,
_Out_writes_bytes_opt_(*BufferSize) PVOID Buffer, // BCD_ELEMENT[]
_Inout_ PULONG BufferSize,
_Out_ PULONG ElementCount
);
NTSYSAPI
NTSTATUS
NTAPI
BcdGetElementData(
_In_ HANDLE BcdObjectHandle,
_In_ ULONG BcdElement, // BCD_ELEMENT_DATATYPE
_Out_writes_bytes_opt_(*BufferSize) PVOID Buffer,
_Inout_ PULONG BufferSize
);
NTSYSAPI
NTSTATUS
NTAPI
BcdGetElementDataWithFlags(
_In_ HANDLE BcdObjectHandle,
_In_ ULONG BcdElement, // BCD_ELEMENT_DATATYPE
_In_ BCD_FLAGS BcdFlags,
_Out_writes_bytes_opt_(*BufferSize) PVOID Buffer,
_Inout_ PULONG BufferSize
);
NTSYSAPI
NTSTATUS
NTAPI
BcdSetElementData(
_In_ HANDLE BcdObjectHandle,
_In_ ULONG BcdElement, // BCD_ELEMENT_DATATYPE
_In_reads_bytes_opt_(BufferSize) PVOID Buffer,
_In_ ULONG BufferSize
);
NTSYSAPI
NTSTATUS
NTAPI
BcdSetElementDataWithFlags(
_In_ HANDLE BcdObjectHandle,
_In_ ULONG BcdElement, // BCD_ELEMENT_DATATYPE
_In_ BCD_FLAGS BcdFlags,
_In_reads_bytes_opt_(BufferSize) PVOID Buffer,
_In_ ULONG BufferSize
);
NTSYSAPI
NTSTATUS
NTAPI
BcdDeleteElement(
_In_ HANDLE BcdObjectHandle,
_In_ ULONG BcdElement // BCD_ELEMENT_DATATYPE
);
// Element types
typedef enum _BcdBootMgrElementTypes
{
/// <summary>
/// The order in which BCD objects should be displayed.
/// Objects are displayed using the string specified by the BcdLibraryString_Description element.
/// </summary>
/// <remarks>0x24000001</remarks>
BcdBootMgrObjectList_DisplayOrder = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_APPLICATION, BCD_ELEMENT_DATATYPE_FORMAT_OBJECTLIST, 1),
/// <summary>
/// List of boot environment applications the boot manager should execute.
/// The applications are executed in the order they appear in this list.
/// If the firmware boot manager does not support loading multiple applications, this list cannot contain more than one entry.
/// </summary>
/// <remarks>0x24000002</remarks>
BcdBootMgrObjectList_BootSequence = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_APPLICATION, BCD_ELEMENT_DATATYPE_FORMAT_OBJECTLIST, 2),
/// <summary>
/// The default boot environment application to load if the user does not select one.
/// </summary>
/// <remarks>0x23000003</remarks>
BcdBootMgrObject_DefaultObject = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_APPLICATION, BCD_ELEMENT_DATATYPE_FORMAT_OBJECT, 3),
/// <summary>
/// The maximum number of seconds a boot selection menu is to be displayed to the user.
/// The menu is displayed until the user selects an option or the time-out expires.
/// If this value is not specified, the boot manager waits for the user to make a selection.
/// </summary>
/// <remarks>0x25000004</remarks>
BcdBootMgrInteger_Timeout = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_APPLICATION, BCD_ELEMENT_DATATYPE_FORMAT_INTEGER, 4),
/// <summary>
/// Indicates that a resume operation should be attempted during a system restart.
/// </summary>
/// <remarks>0x26000005</remarks>
BcdBootMgrBoolean_AttemptResume = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_APPLICATION, BCD_ELEMENT_DATATYPE_FORMAT_BOOLEAN, 5),
/// <summary>
/// The resume application object.
/// </summary>
/// <remarks>0x23000006</remarks>
BcdBootMgrObject_ResumeObject = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_APPLICATION, BCD_ELEMENT_DATATYPE_FORMAT_OBJECT, 6),
/// <summary>
///
/// </summary>
/// <remarks>0x24000007</remarks>
BcdBootMgrObjectList_StartupSequence = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_APPLICATION, BCD_ELEMENT_DATATYPE_FORMAT_OBJECTLIST, 7),
/// <summary>
/// The boot manager tools display order list.
/// </summary>
/// <remarks>0x24000010</remarks>
BcdBootMgrObjectList_ToolsDisplayOrder = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_APPLICATION, BCD_ELEMENT_DATATYPE_FORMAT_OBJECTLIST, 16),
/// <summary>
/// Forces the display of the legacy boot menu, regardless of the number of OS entries in the BCD store and their BcdOSLoaderInteger_BootMenuPolicy.
/// </summary>
/// <remarks>0x26000020</remarks>
BcdBootMgrBoolean_DisplayBootMenu = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_APPLICATION, BCD_ELEMENT_DATATYPE_FORMAT_BOOLEAN, 32),
/// <summary>
/// Indicates whether the display of errors should be suppressed.
/// If this setting is enabled, the boot manager exits to the multi-OS menu on OS launch error.
/// </summary>
/// <remarks>0x26000021</remarks>
BcdBootMgrBoolean_NoErrorDisplay = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_APPLICATION, BCD_ELEMENT_DATATYPE_FORMAT_BOOLEAN, 33),
/// <summary>
/// The device on which the boot application resides.
/// </summary>
/// <remarks>0x21000022</remarks>
BcdBootMgrDevice_BcdDevice = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_APPLICATION, BCD_ELEMENT_DATATYPE_FORMAT_DEVICE, 34),
/// <summary>
/// The boot application.
/// </summary>
/// <remarks>0x22000023</remarks>
BcdBootMgrString_BcdFilePath = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_APPLICATION, BCD_ELEMENT_DATATYPE_FORMAT_STRING, 35),
/// <summary>
///
/// </summary>
/// <remarks>0x26000024</remarks>
BcdBootMgrBoolean_HormEnabled = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_APPLICATION, BCD_ELEMENT_DATATYPE_FORMAT_BOOLEAN, 36),
/// <summary>
///
/// </summary>
/// <remarks>0x26000025</remarks>
BcdBootMgrBoolean_HiberRoot = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_APPLICATION, BCD_ELEMENT_DATATYPE_FORMAT_BOOLEAN, 37),
/// <summary>
///
/// </summary>
/// <remarks>0x22000026</remarks>
BcdBootMgrString_PasswordOverride = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_APPLICATION, BCD_ELEMENT_DATATYPE_FORMAT_STRING, 38),
/// <summary>
///
/// </summary>
/// <remarks>0x22000027</remarks>
BcdBootMgrString_PinpassPhraseOverride = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_APPLICATION, BCD_ELEMENT_DATATYPE_FORMAT_STRING, 39),
/// <summary>
/// Controls whether custom actions are processed before a boot sequence.
/// Note This value is supported starting in Windows 8 and Windows Server 2012.
/// </summary>
/// <remarks>0x26000028</remarks>
BcdBootMgrBoolean_ProcessCustomActionsFirst = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_APPLICATION, BCD_ELEMENT_DATATYPE_FORMAT_BOOLEAN, 40),
/// <summary>
/// Custom Bootstrap Actions.
/// </summary>
/// <remarks>0x27000030</remarks>
BcdBootMgrIntegerList_CustomActionsList = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_APPLICATION, BCD_ELEMENT_DATATYPE_FORMAT_INTEGERLIST, 48),
/// <summary>
/// Controls whether a boot sequence persists across multiple boots.
/// Note This value is supported starting in Windows 8 and Windows Server 2012.
/// </summary>
/// <remarks>0x26000031</remarks>
BcdBootMgrBoolean_PersistBootSequence = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_APPLICATION, BCD_ELEMENT_DATATYPE_FORMAT_BOOLEAN, 49),
/// <summary>
///
/// </summary>
/// <remarks>0x26000032</remarks>
BcdBootMgrBoolean_SkipStartupSequence = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_APPLICATION, BCD_ELEMENT_DATATYPE_FORMAT_BOOLEAN, 50),
} BcdBootMgrElementTypes;
typedef enum _BcdLibrary_FirstMegabytePolicy
{
/// <summary>
/// Use none of the first megabyte of memory.
/// </summary>
FirstMegabytePolicyUseNone,
/// <summary>
/// Use all of the first megabyte of memory.
/// </summary>
FirstMegabytePolicyUseAll,
/// <summary>
/// Reserved for future use.
/// </summary>
FirstMegabytePolicyUsePrivate
} BcdLibrary_FirstMegabytePolicy;
typedef enum _BcdLibrary_DebuggerType
{
DebuggerSerial = 0,
Debugger1394 = 1,
DebuggerUsb = 2,
DebuggerNet = 3,
DebuggerLocal = 4
} BcdLibrary_DebuggerType;
typedef enum _BcdLibrary_DebuggerStartPolicy
{
/// <summary>
/// The debugger will start active.
/// </summary>
DebuggerStartActive,
/// <summary>
/// The debugger will start in the auto-enabled state.
/// If a debugger is attached it will be used; otherwise the debugger port will be available for other applications.
/// </summary>
DebuggerStartAutoEnable,
/// <summary>
/// The debugger will not start.
/// </summary>
DebuggerStartDisable
} BcdLibrary_DebuggerStartPolicy;
typedef enum _BcdLibrary_ConfigAccessPolicy
{
/// <summary>
/// Access to PCI configuration space through the memory-mapped region is allowed.
/// </summary>
ConfigAccessPolicyDefault,
/// <summary>
/// Access to PCI configuration space through the memory-mapped region is not allowed.
/// This setting is used for platforms that implement memory-mapped configuration space incorrectly.
/// The CFC/CF8 access mechanism can be used to access configuration space on these platforms.
/// </summary>
ConfigAccessPolicyDisallowMmConfig
} BcdLibrary_ConfigAccessPolicy;
typedef enum _BcdLibrary_UxDisplayMessageType
{
DisplayMessageTypeDefault = 0,
DisplayMessageTypeResume = 1,
DisplayMessageTypeHyperV = 2,
DisplayMessageTypeRecovery = 3,
DisplayMessageTypeStartupRepair = 4,
DisplayMessageTypeSystemImageRecovery = 5,
DisplayMessageTypeCommandPrompt = 6,
DisplayMessageTypeSystemRestore = 7,
DisplayMessageTypePushButtonReset = 8,
} BcdLibrary_UxDisplayMessageType;
typedef enum BcdLibrary_SafeBoot
{
/// <summary>
/// Load the drivers and services specified by name or group under the following registry key:
/// HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal.
/// </summary>
SafemodeMinimal = 0,
/// <summary>
/// Load the drivers and services specified by name or group under the following registry key:
/// HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot\Network
/// </summary>
SafemodeNetwork = 1,
/// <summary>
/// Boot the system into a repair mode that restores the Active Directory service from backup medium.
/// </summary>
SafemodeDsRepair = 2
} BcdLibrary_SafeBoot;
// BcdLibraryElementTypes based on geoffchappell: https://www.geoffchappell.com/notes/windows/boot/bcd/elements.htm (dmex)
typedef enum _BcdLibraryElementTypes
{
/// <summary>
/// Device on which a boot environment application resides.
/// </summary>
/// <remarks>0x11000001</remarks>
BcdLibraryDevice_ApplicationDevice = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_LIBRARY, BCD_ELEMENT_DATATYPE_FORMAT_DEVICE, 1),
/// <summary>
/// Path to a boot environment application.
/// </summary>
/// <remarks>0x12000002</remarks>
BcdLibraryString_ApplicationPath = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_LIBRARY, BCD_ELEMENT_DATATYPE_FORMAT_STRING, 2),
/// <summary>
/// Display name of the boot environment application.
/// </summary>
/// <remarks>0x12000004</remarks>
BcdLibraryString_Description = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_LIBRARY, BCD_ELEMENT_DATATYPE_FORMAT_STRING, 4),
/// <summary>
/// Preferred locale, in RFC 3066 format.
/// </summary>
/// <remarks>0x12000005</remarks>
BcdLibraryString_PreferredLocale = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_LIBRARY, BCD_ELEMENT_DATATYPE_FORMAT_STRING, 5),
/// <summary>
/// List of BCD objects from which the current object should inherit elements.
/// </summary>
/// <remarks>0x14000006</remarks>
BcdLibraryObjectList_InheritedObjects = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_LIBRARY, BCD_ELEMENT_DATATYPE_FORMAT_OBJECTLIST, 6),
/// <summary>
/// Maximum physical address a boot environment application should recognize. All memory above this address is ignored.
/// </summary>
/// <remarks>0x15000007</remarks>
BcdLibraryInteger_TruncatePhysicalMemory = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_LIBRARY, BCD_ELEMENT_DATATYPE_FORMAT_INTEGER, 7),
/// <summary>
/// List of boot environment applications to be executed if the associated application fails. The applications are executed in the order they appear in this list.
/// </summary>
/// <remarks>0x14000008</remarks>
BcdLibraryObjectList_RecoverySequence = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_LIBRARY, BCD_ELEMENT_DATATYPE_FORMAT_OBJECTLIST, 8),
/// <summary>
/// Indicates whether the recovery sequence executes automatically if the boot application fails. Otherwise, the recovery sequence only runs on demand.
/// </summary>
/// <remarks>0x16000009</remarks>
BcdLibraryBoolean_AutoRecoveryEnabled = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_LIBRARY, BCD_ELEMENT_DATATYPE_FORMAT_BOOLEAN, 9),
/// <summary>
/// List of page frame numbers describing faulty memory in the system.
/// </summary>
/// <remarks>0x1700000A</remarks>
BcdLibraryIntegerList_BadMemoryList = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_LIBRARY, BCD_ELEMENT_DATATYPE_FORMAT_INTEGERLIST, 10),
/// <summary>
/// If TRUE, indicates that a boot application can use memory listed in the BcdLibraryIntegerList_BadMemoryList.
/// </summary>
/// <remarks>0x1600000B</remarks>
BcdLibraryBoolean_AllowBadMemoryAccess = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_LIBRARY, BCD_ELEMENT_DATATYPE_FORMAT_BOOLEAN, 11),
/// <summary>
/// Indicates how the first megabyte of memory is to be used. The Integer property is one of the values from the BcdLibrary_FirstMegabytePolicy enumeration.
/// </summary>
/// <remarks>0x1500000C</remarks>
BcdLibraryInteger_FirstMegabytePolicy = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_LIBRARY, BCD_ELEMENT_DATATYPE_FORMAT_INTEGER, 12),
/// <summary>
/// Relocates physical memory on certain AMD processors.
/// This value is not used in Windows 8 or Windows Server 2012.
/// </summary>
/// <remarks>0x1500000D</remarks>
BcdLibraryInteger_RelocatePhysicalMemory = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_LIBRARY, BCD_ELEMENT_DATATYPE_FORMAT_INTEGER, 13),
/// <summary>
/// Specifies a minimum physical address to use in the boot environment.
/// </summary>
/// <remarks>0x1500000E</remarks>
BcdLibraryInteger_AvoidLowPhysicalMemory = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_LIBRARY, BCD_ELEMENT_DATATYPE_FORMAT_INTEGER, 14),
/// <summary>
///
/// </summary>
/// <remarks>0x1600000F</remarks>
BcdLibraryBoolean_TraditionalKsegMappings = MAKE_BCDE_DATA_TYPE(BCD_ELEMENT_DATATYPE_CLASS_LIBRARY, BCD_ELEMENT_DATATYPE_FORMAT_BOOLEAN, 15),
/// <summary>
/// Indicates whether the boot debugger should be enabled.