wdext 0.1.0

A DbgEng wrapper framework
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
// SPDX-FileCopyrightText: 2026 takubokudori
// SPDX-License-Identifier: MIT OR Apache-2.0
//! A wrapper around the extsfns API.
//!
//! Work-in-progress
use crate::enum_flags;
use windows::Win32::System::Diagnostics::Debug::Extensions::*;

pub mod fa_entry_tags;
pub mod failure_analysis;

pub use fa_entry_tags::*;
pub use failure_analysis::*;

pub type FaTag = DebugFlrParamType;

enum_flags! {
    pub enum DebugFailureType: u32 {
        Unknown = 0,
        Kernel  = 1,
        User    = 2,
    }
}

impl From<DEBUG_FAILURE_TYPE> for DebugFailureType {
    fn from(value: DEBUG_FAILURE_TYPE) -> Self {
        Self::try_from(value.0 as u32).unwrap()
    }
}

impl From<DebugFailureType> for DEBUG_FAILURE_TYPE {
    fn from(value: DebugFailureType) -> Self {
        DEBUG_FAILURE_TYPE(value as i32)
    }
}

bitflags::bitflags! {
    #[derive(Debug, Copy, Clone, Eq, PartialEq)]
    pub struct DebugFlrParamType: u32 {
        const Invalid = 0x0;
        const Reserved = 0x1;
        const DriverObject = 0x2;
        const DeviceObject = 0x3;
        const InvalidPfn = 0x4;
        const WorkerRoutine = 0x5;
        const WorkItem = 0x6;
        const InvalidDpcFound = 0x7;
        const ProcessObject = 0x8;
        const FailedInstructionAddress = 0x9;
        const LastControlTransfer = 0xA;
        const AcpiExtension = 0xB;
        const AcpiResconflict = 0xC;
        const AcpiObject = 0xD;
        const ReadAddress = 0xE;
        const WriteAddress = 0xF;
        const CriticalSection = 0x10;
        const BadHandle = 0x11;
        const InvalidHeapAddress = 0x12;
        const ChkimgExtension = 0x13;
        const UsbportOcadata = 0x14;
        const WorkQueueItem = 0x15;
        const EresourceAddress = 0x16;
        const PnpTriageDataDeprecated = 0x17;
        const HandleValue = 0x18;
        const WheaErrorRecord = 0x19;
        const VerifierFoundDeadlock = 0x1A;
        const PgMismatch = 0x1B;
        const DeviceNode = 0x1C;
        const PowerrequestAddress = 0x1D;
        const ExecuteAddress = 0x1E;
        const IrpAddress = 0x100;
        const IrpMajorFn = 0x101;
        const IrpMinorFn = 0x102;
        const IrpCancelRoutine = 0x103;
        const IosbAddress = 0x104;
        const InvalidUserevent = 0x105;
        const VideoTdrContext = 0x106;
        const VerifierDriverEntry = 0x107;
        const PnpIrpAddressDeprecated = 0x108;
        const PreviousMode = 0x109;
        const CurrentIrql = 0x200;
        const PreviousIrql = 0x201;
        const RequestedIrql = 0x202;
        const AssertData = 0x300;
        const AssertFile = 0x301;
        const ExceptionParameter1 = 0x302;
        const ExceptionParameter2 = 0x303;
        const ExceptionParameter3 = 0x304;
        const ExceptionParameter4 = 0x305;
        const ExceptionRecord = 0x306;
        const IoErrorCode = 0x307;
        const ExceptionStr = 0x308;
        const ExceptionDoesnotMatchCode = 0x309;
        const AssertInstruction = 0x30A;
        const PoolAddress = 0x400;
        const SpecialPoolCorruptionType = 0x401;
        const CorruptingPoolAddress = 0x402;
        const CorruptingPoolTag = 0x403;
        const FreedPoolTag = 0x404;
        const LeakedSessionPoolTag = 0x405;
        const InstrSessionPoolTag = 0x406;
        const ClientDriver = 0x407;
        const FileId = 0x500;
        const FileLine = 0x501;
        const BugcheckStr = 0x600;
        const BugcheckSpecifier = 0x601;
        const BugcheckDesc = 0x602;
        const ManagedCode = 0x700;
        const ManagedObject = 0x701;
        const ManagedExceptionObject = 0x702;
        const ManagedExceptionMessageDeprecated = 0x703;
        const ManagedStackString = 0x704;
        const ManagedBitnessMismatch = 0x705;
        const ManagedObjectName = 0x706;
        const ManagedExceptionContextMessage = 0x707;
        const ManagedStackCommand = 0x708;
        const ManagedKernelDebugger = 0x709;
        const ManagedHresultString = 0x70A;
        const ManagedEngineModule = 0x70B;
        const ManagedAnalysisProvider = 0x70C;
        const ManagedExceptionAddress = 0x800;
        const ManagedExceptionHresult = 0x801;
        const ManagedExceptionType = 0x802;
        const ManagedExceptionMessage = 0x803;
        const ManagedExceptionCallstack = 0x804;
        const ManagedExceptionInnerAddress = 0x810;
        const ManagedExceptionInnerHresult = 0x811;
        const ManagedExceptionInnerType = 0x812;
        const ManagedExceptionInnerMessage = 0x813;
        const ManagedExceptionInnerCallstack = 0x814;
        const ManagedExceptionNestedAddress = 0x820;
        const ManagedExceptionNestedHresult = 0x821;
        const ManagedExceptionNestedType = 0x822;
        const ManagedExceptionNestedMessage = 0x823;
        const ManagedExceptionNestedCallstack = 0x824;
        const ManagedExceptionCmd = 0x8F0;
        const ManagedThreadId = 0x900;
        const ManagedThreadCmdCallstack = 0x9F0;
        const ManagedThreadCmdStackobjects = 0x9F1;
        const DriverVerifierIoViolationType = 0x1000;
        const ExceptionCode = 0x1001;
        const ExceptionCodeStr = 0x1002;
        const IocontrolCode = 0x1003;
        const MmInternalCode = 0x1004;
        const DrvpowerstateSubcode = 0x1005;
        const StatusCode = 0x1006;
        const SymbolStackIndex = 0x1007;
        const SymbolOnRawStack = 0x1008;
        const SecurityCookies = 0x1009;
        const ThreadpoolWaiter = 0x100A;
        const TargetMode = 0x100B;
        const BugcheckCode = 0x100C;
        const BadpagesDetected = 0x100D;
        const DpcTimeoutType = 0x100E;
        const DpcRuntime = 0x100F;
        const DpcTimelimit = 0x1010;
        const DumpFileAttributes = 0x1011;
        const PageHashErrors = 0x1012;
        const BugcheckP1 = 0x1013;
        const BugcheckP2 = 0x1014;
        const BugcheckP3 = 0x1015;
        const BugcheckP4 = 0x1016;
        const CriticalProcess = 0x1017;
        const ResourceCallType = 0x1100;
        const ResourceCallTypeStr = 0x1101;
        const CorruptModuleList = 0x2000;
        const BadStack = 0x2001;
        const ZeroedStack = 0x2002;
        const WrongSymbols = 0x2003;
        const FollowupDriverOnly = 0x2004;
        const Unused001 = 0x2005;
        const CpuOverclocked = 0x2006;
        const PossibleInvalidControlTransfer = 0x2007;
        const PoisonedTb = 0x2008;
        const UnknownModule = 0x2009;
        const AnalyzablePoolCorruption = 0x200A;
        const SingleBitError = 0x200B;
        const TwoBitError = 0x200C;
        const InvalidKernelContext = 0x200D;
        const DiskHardwareError = 0x200E;
        const ShowErrorlog = 0x200F;
        const ManualBreakin = 0x2010;
        const Hang = 0x2011;
        const BadMemoryReference = 0x2012;
        const BadObjectReference = 0x2013;
        const Appkill = 0x2014;
        const SingleBitPfnPageError = 0x2015;
        const HardwareError = 0x2016;
        const NoImageInBucket = 0x2017;
        const NoBugcheckInBucket = 0x2018;
        const SkipStackAnalysis = 0x2019;
        const InvalidOpcode = 0x201A;
        const AddProcessInBucket = 0x201B;
        const RaisedIrqlUserFault = 0x201C;
        const UseDefaultContext = 0x201D;
        const BoostFollowupToSpecific = 0x201E;
        const SwitchProcessContext = 0x201F;
        const VerifierStop = 0x2020;
        const UserbreakPebPagedout = 0x2021;
        const ModSpecificDataOnly = 0x2022;
        const OverlappedModule = 0x2023;
        const CpuMicrocodeZeroIntel = 0x2024;
        const IntelCpuBiosUpgradeNeeded = 0x2025;
        const OverlappedUnloadedModule = 0x2026;
        const InvalidUserContext = 0x2027;
        const MilcoreBreak = 0x2028;
        const NoImageTimestampInBucket = 0x2029;
        const KernelVerifierEnabled = 0x202A;
        const SkipCorruptModuleDetection = 0x202B;
        const GsfailureFalsePositive = 0x202C;
        const IgnoreLargeModuleCorruption = 0x202D;
        const IgnoreBucketIdOffset = 0x202E;
        const NoArchInBucket = 0x202F;
        const IgnoreModuleHardwareId = 0x2030;
        const ArmWriteAvCaveat = 0x2031;
        const OnDpcStack = 0x2032;
        const LiveKernelDump = 0x2033;
        const CoverageBuild = 0x2034;
        const PossibleStackOverflow = 0x2035;
        const WrongSymbolsTimestamp = 0x2036;
        const WrongSymbolsSize = 0x2037;
        const MissingImportantSymbol = 0x2038;
        const MissingClrSymbol = 0x2039;
        const TargetTime = 0x203A;
        const LowSystemCommit = 0x203B;
        const LegacyPageTableAccess = 0x203C;
        const HighProcessCommit = 0x203D;
        const HighServiceCommit = 0x203E;
        const HighNonpagedPoolUsage = 0x203F;
        const HighPagedPoolUsage = 0x2040;
        const HighSharedCommitUsage = 0x2041;
        const AppsNotTerminated = 0x2042;
        const PoolCorruptor = 0x3000;
        const MemoryCorruptor = 0x3001;
        const UnalignedStackPointer = 0x3002;
        const OsVersionDeprecated = 0x3003;
        const BugcheckingDriver = 0x3004;
        const SolutionId = 0x3005;
        const DefaultSolutionId = 0x3006;
        const SolutionType = 0x3007;
        const RecurringStack = 0x3008;
        const FaultingInstrCode = 0x3009;
        const SystemLocaleDeprecated = 0x300A;
        const CustomerCrashCount = 0x300B;
        const TrapFrameRecursion = 0x300C;
        const StackOverflow = 0x300D;
        const StackPointerError = 0x300E;
        const StackPointerOnebitError = 0x300F;
        const StackPointerMisaligned = 0x3010;
        const InstrPointerMisaligned = 0x3011;
        const InstrPointerClifault = 0x3012;
        const RegistrytxtStressId = 0x3013;
        const CorruptServiceTable = 0x3014;
        const LopStackhash = 0x3015;
        const GsfailureFunction = 0x3016;
        const GsfailureModuleCookie = 0x3017;
        const GsfailureFrameCookie = 0x3018;
        const GsfailureFrameCookieComplement = 0x3019;
        const GsfailureCorruptedCookie = 0x301A;
        const GsfailureCorruptedEbp = 0x301B;
        const GsfailureOverrunLocal = 0x301C;
        const GsfailureOverrunLocalName = 0x301D;
        const GsfailureCorruptedEbpesp = 0x301E;
        const GsfailurePositivelyCorruptedEbpesp = 0x301F;
        const GsfailureMemoryReadError = 0x3020;
        const GsfailureProbablyNotUsingGs = 0x3021;
        const GsfailurePositiveBufferOverflow = 0x3022;
        const GsfailureAnalysisText = 0x3023;
        const GsfailureOffByOneOverrun = 0x3024;
        const GsfailureRaSmashed = 0x3025;
        const GsfailureNotUp2date = 0x3026;
        const GsfailureUp2dateUnknown = 0x3027;
        const TriagerOsBuildName = 0x3028;
        const CpuMicrocodeVersion = 0x3029;
        const CpuCount = 0x302A;
        const CpuSpeed = 0x302B;
        const CpuVendor = 0x302C;
        const CpuFamily = 0x302D;
        const CpuModel = 0x302E;
        const CpuStepping = 0x302F;
        const InstrPointerOnStack = 0x3030;
        const InstrPointerOnHeap = 0x3031;
        const EventCodeDataMismatch = 0x3032;
        const ProcessorInfo = 0x3033;
        const InstrPointerInUnloadedModule = 0x3034;
        const MemdiagLastrunStatus = 0x3035;
        const MemdiagLastrunTime = 0x3036;
        const InstrPointerInFreeBlock = 0x3037;
        const InstrPointerInReservedBlock = 0x3038;
        const InstrPointerInVmMappedModule = 0x3039;
        const InstrPointerInModuleNotInList = 0x303A;
        const InstrPointerNotInStream = 0x303B;
        const MemoryCorruptionSignature = 0x303C;
        const BuildnameInBucket = 0x303D;
        const CancellationNotSupported = 0x303E;
        const DetouredImage = 0x303F;
        const ExceptionContextRecursion = 0x3040;
        const DiskioReadFailure = 0x3041;
        const DiskioWriteFailure = 0x3042;
        const GsfailureMissingEstablisherFrame = 0x3043;
        const GsfailureCookiesMatchExh = 0x3044;
        const GsfailureManaged = 0x3045;
        const ManagedFrameChainCorruption = 0x3046;
        const GsfailureManagedThreadid = 0x3047;
        const GsfailureManagedFrameid = 0x3048;
        const StackusageImage = 0x3049;
        const StackusageImageSize = 0x304A;
        const StackusageFunction = 0x304B;
        const StackusageFunctionSize = 0x304C;
        const StackusageRecursionCount = 0x304D;
        const XboxSystemUptime = 0x304E;
        const XboxSystemCrashtime = 0x304F;
        const XboxLiveEnvironment = 0x3050;
        const LargeTickIncrement = 0x3051;
        const InstrPointerInPagedCode = 0x3052;
        const ServicetableModified = 0x3053;
        const Alureon = 0x3054;
        const InternalRaidBug = 0x4000;
        const InternalBucketUrl = 0x4001;
        const InternalSolutionText = 0x4002;
        const InternalBucketHitcount = 0x4003;
        const InternalRaidBugDatabaseString = 0x4004;
        const InternalBucketContinuable = 0x4005;
        const InternalBucketStatusText = 0x4006;
        const WatsonModule = 0x4100;
        const WatsonModuleVersion = 0x4101;
        const WatsonModuleOffset = 0x4102;
        const WatsonProcessVersion = 0x4103;
        const WatsonIbucket = 0x4104;
        const WatsonModuleTimestamp = 0x4105;
        const WatsonProcessTimestamp = 0x4106;
        const WatsonGenericEventName = 0x4107;
        const WatsonGenericBucketing00 = 0x4108;
        const WatsonGenericBucketing01 = 0x4109;
        const WatsonGenericBucketing02 = 0x410A;
        const WatsonGenericBucketing03 = 0x410B;
        const WatsonGenericBucketing04 = 0x410C;
        const WatsonGenericBucketing05 = 0x410D;
        const WatsonGenericBucketing06 = 0x410E;
        const WatsonGenericBucketing07 = 0x410F;
        const WatsonGenericBucketing08 = 0x4110;
        const WatsonGenericBucketing09 = 0x4111;
        const SysxmlLocaleid = 0x4200;
        const SysxmlChecksum = 0x4201;
        const WqlEventCount = 0x4202;
        const WqlEventlogInfo = 0x4203;
        const SysinfoSystemManufacturer = 0x4300;
        const SysinfoSystemProduct = 0x4301;
        const SysinfoSystemSku = 0x4302;
        const SysinfoSystemVersion = 0x4303;
        const SysinfoBaseboardManufacturer = 0x4304;
        const SysinfoBaseboardProduct = 0x4305;
        const SysinfoBaseboardVersion = 0x4306;
        const SysinfoBiosVendor = 0x4307;
        const SysinfoBiosVersion = 0x4308;
        const SysinfoBiosDate = 0x4309;
        const VirtualMachine = 0x430A;
        const Service = 0x5000;
        const ServiceName = 0x5001;
        const ServiceGroup = 0x5002;
        const ServiceDisplayname = 0x5003;
        const ServiceDescription = 0x5004;
        const ServiceDependonservice = 0x5005;
        const ServiceDependongroup = 0x5006;
        const Svchost = 0x5100;
        const SvchostGroup = 0x5101;
        const SvchostImagepath = 0x5102;
        const SvchostServicedll = 0x5103;
        const Scm = 0x5200;
        const ScmBlackbox = 0x52F0;
        const ScmBlackboxEntry = 0x52F1;
        const ScmBlackboxEntryControlcode = 0x52F2;
        const ScmBlackboxEntryStarttime = 0x52F3;
        const ScmBlackboxEntryServicename = 0x52F4;
        const Acpi = 0x6000;
        const AcpiBlackbox = 0x6100;
        const PoBlackbox = 0x6101;
        const Bootstat = 0x7000;
        const BootstatBlackbox = 0x7100;
        const Storage = 0x7400;
        const StorageOrgid = 0x7401;
        const StorageModel = 0x7402;
        const StorageMfgid = 0x7403;
        const StorageIssuedescstring = 0x7404;
        const StoragePublicTotsize = 0x7405;
        const StoragePublicOffset = 0x7406;
        const StoragePublicDatasize = 0x7407;
        const StoragePrivateTotsize = 0x7408;
        const StoragePrivateOffset = 0x7409;
        const StoragePrivateDatasize = 0x740A;
        const StorageTotalsize = 0x740B;
        const StorageReason = 0x740C;
        const StorageBlackbox = 0x74F0;
        const FilesystemsNtfs = 0x7600;
        const FilesystemsNtfsBlackbox = 0x76F0;
        const FilesystemsRefs = 0x7800;
        const FilesystemsRefsBlackbox = 0x78F0;
        const Pnp = 0x8000;
        const PnpTriageData = 0x8001;
        const PnpIrpAddress = 0x8002;
        const PnpBlackbox = 0x8100;
        const BucketId = 0x10000;
        const ImageName = 0x10001;
        const SymbolName = 0x10002;
        const FollowupName = 0x10003;
        const StackCommand = 0x10004;
        const StackText = 0x10005;
        const ModuleName = 0x10006;
        const FixedInOsversion = 0x10007;
        const DefaultBucketId = 0x10008;
        const ModuleBucketId = 0x10009;
        const AdditionalDebugtext = 0x1000A;
        const ProcessName = 0x1000B;
        const UserName = 0x1000C;
        const MarkerFile = 0x1000D;
        const InternalResponse = 0x1000E;
        const ContextRestoreCommand = 0x1000F;
        const DriverHardwareid = 0x10010;
        const DriverHardwareVendorId = 0x10011;
        const DriverHardwareDeviceId = 0x10012;
        const DriverHardwareSubsysId = 0x10013;
        const DriverHardwareRevId = 0x10014;
        const DriverHardwareIdBusType = 0x10015;
        const MarkerModuleFile = 0x10016;
        const BugcheckingDriverIdtag = 0x10017;
        const MarkerBucket = 0x10018;
        const FailureBucketId = 0x10019;
        const DriverXmlDescription = 0x1001A;
        const DriverXmlProductname = 0x1001B;
        const DriverXmlManufacturer = 0x1001C;
        const DriverXmlVersion = 0x1001D;
        const BuildVersionString = 0x1001E;
        const BuildOsFullVersionString = 0x1001F;
        const OriginalCabName = 0x10020;
        const FaultingSourceCode = 0x10021;
        const FaultingServiceName = 0x10022;
        const FileInCab = 0x10023;
        const UnresponsiveUiSymbolName = 0x10024;
        const UnresponsiveUiFollowupName = 0x10025;
        const UnresponsiveUiStack = 0x10026;
        const ProcessProductname = 0x10027;
        const ModuleProductname = 0x10028;
        const CollectDataForBucket = 0x10029;
        const ComputerName = 0x1002A;
        const ImageClass = 0x1002B;
        const SymbolRoutineName = 0x1002C;
        const HardwareBucketTag = 0x1002D;
        const KernelLogProcessName = 0x1002E;
        const KernelLogStatus = 0x1002F;
        const RegistrytxtSource = 0x10030;
        const FaultingSourceLine = 0x10031;
        const FaultingSourceFile = 0x10032;
        const FaultingSourceLineNumber = 0x10033;
        const SkipModuleSpecificBucketInfo = 0x10034;
        const BucketIdFuncOffset = 0x10035;
        const XhciFirmwareVersion = 0x10036;
        const FailureAnalysisSource = 0x10037;
        const FailureIdHash = 0x10038;
        const FailureIdHashString = 0x10039;
        const FailureIdReportLink = 0x1003A;
        const Holdinfo = 0x1003B;
        const HoldinfoActiveHoldCount = 0x1003C;
        const HoldinfoTenetSocre = 0x1003D;
        const HoldinfoHistoricHoldCount = 0x1003E;
        const HoldinfoAlwaysIgnore = 0x1003F;
        const HoldinfoAlwaysHold = 0x10040;
        const HoldinfoMaxHoldLimit = 0x10041;
        const HoldinfoManualHold = 0x10042;
        const HoldinfoNotificationAliases = 0x10043;
        const HoldinfoLastSeenHoldDate = 0x10044;
        const HoldinfoRecommendHold = 0x10045;
        const FailureProblemClass = 0x10046;
        const FailureExceptionCode = 0x10047;
        const FailureImageName = 0x10048;
        const FailureFunctionName = 0x10049;
        const FailureSymbolName = 0x1004A;
        const FollowupBeforeRetracer = 0x1004B;
        const EndMessage = 0x1004C;
        const FeaturePath = 0x1004D;
        const UserModeBucket = 0x1004E;
        const UserModeBucketIndex = 0x1004F;
        const UserModeBucketEventtype = 0x10050;
        const UserModeBucketReportguid = 0x10051;
        const UserModeBucketReportcreationtime = 0x10052;
        const UserModeBucketP0 = 0x10053;
        const UserModeBucketP1 = 0x10054;
        const UserModeBucketP2 = 0x10055;
        const UserModeBucketP3 = 0x10056;
        const UserModeBucketP4 = 0x10057;
        const UserModeBucketP5 = 0x10058;
        const UserModeBucketP6 = 0x10059;
        const UserModeBucketP7 = 0x1005A;
        const UserModeBucketString = 0x1005B;
        const CriticalProcessReportguid = 0x1005C;
        const FailureModuleName = 0x1005D;
        const PlatformBucketString = 0x1005E;
        const DriverHardwareVendorName = 0x1005F;
        const DriverHardwareSubvendorName = 0x10060;
        const DriverHardwareDeviceName = 0x10061;
        const FaultingSourceCommitId = 0x10062;
        const FaultingSourceControlType = 0x10063;
        const FaultingSourceProject = 0x10064;
        const FaultingSourceRepoId = 0x10065;
        const FaultingSourceRepoUrl = 0x10066;
        const FaultingSourceSrvCommand = 0x10067;
        const UsermodeData = 0x100000;
        const ThreadAttributes = 0x100001;
        const ProblemClasses = 0x100002;
        const PrimaryProblemClass = 0x100003;
        const PrimaryProblemClassData = 0x100004;
        const UnresponsiveUiProblemClass = 0x100005;
        const UnresponsiveUiProblemClassData = 0x100006;
        const DerivedWaitChain = 0x100007;
        const HangDataNeeded = 0x100008;
        const ProblemCodePathHash = 0x100009;
        const SuspectCodePathHash = 0x10000A;
        const LoaderlockInWaitChain = 0x10000B;
        const XprocHang = 0x10000C;
        const DeadlockInproc = 0x10000D;
        const DeadlockXproc = 0x10000E;
        const WctXmlAvailable = 0x10000F;
        const XprocDumpAvailable = 0x100010;
        const DesktopHeapMissing = 0x100011;
        const HangReportThreadIsIdle = 0x100012;
        const FaultThreadSha1HashMf = 0x100013;
        const FaultThreadSha1HashMfo = 0x100014;
        const FaultThreadSha1HashM = 0x100015;
        const WaitChainCommand = 0x100016;
        const Ntglobalflag = 0x100017;
        const Appveriferflags = 0x100018;
        const ModlistSha1Hash = 0x100019;
        const DumpType = 0x10001A;
        const XcsPath = 0x10001B;
        const LoaderlockOwnerApi = 0x10001C;
        const LoaderlockBlockedApi = 0x10001D;
        const ModlistTschksumSha1Hash = 0x10001E;
        const ModlistUnloadedSha1Hash = 0x10001F;
        const MachineInfoSha1Hash = 0x100020;
        const UrlsDiscovered = 0x100021;
        const Urls = 0x100022;
        const UrlEntry = 0x100023;
        const WatsonIbucketS1Resp = 0x100024;
        const WatsonIbuckettableS1Resp = 0x100025;
        const SearchHang = 0x100026;
        const WerDataCollectionInfo = 0x100027;
        const WerMachineId = 0x100028;
        const UlsScriptException = 0x100029;
        const LcieIsoAvailable = 0x10002A;
        const ShowLcieIsoData = 0x10002B;
        const UrlLcieEntry = 0x10002C;
        const UrlUrlmonEntry = 0x10002D;
        const UrlXmlhttpreqSyncEntry = 0x10002E;
        const FaultingLocalVariableName = 0x10002F;
        const ModuleList = 0x100030;
        const DumpFlags = 0x100031;
        const ApplicationVerifierLoaded = 0x100032;
        const DumpClass = 0x100033;
        const DumpQualifier = 0x100034;
        const KmModuleList = 0x100035;
        const ExceptionCodeStrDeprecated = 0x101000;
        const BucketIdPrefixStr = 0x101001;
        const BucketIdModuleStr = 0x101002;
        const BucketIdModverStr = 0x101003;
        const BucketIdFunctionStr = 0x101004;
        const BucketIdOffset = 0x101005;
        const OsBuild = 0x101006;
        const OsServicepack = 0x101007;
        const OsBranch = 0x101008;
        const OsBuildTimestampLab = 0x101009;
        const OsVersion = 0x10100A;
        const BucketIdTimedatestamp = 0x10100B;
        const BucketIdChecksum = 0x10100C;
        const OsFlavor = 0x10100D;
        const BucketIdFlavorStr = 0x10100E;
        const OsSku = 0x10100F;
        const OsProductType = 0x101010;
        const OsSuiteMask = 0x101011;
        const UserLcid = 0x101012;
        const OsRevision = 0x101013;
        const OsName = 0x101014;
        const OsNameEdition = 0x101015;
        const OsPlatformArch = 0x101016;
        const OsServicepackDeprecated = 0x101017;
        const OsLocale = 0x101018;
        const OsBuildTimestampIso = 0x101019;
        const UserLcidStr = 0x10101A;
        const AnalysisSessionTime = 0x10101B;
        const AnalysisSessionHost = 0x10101C;
        const AnalysisSessionElapsedTime = 0x10101D;
        const AnalysisVersion = 0x10101E;
        const BucketIdImageStr = 0x10101F;
        const BucketIdPrivate = 0x101020;
        const AnalysisReprocess = 0x101021;
        const OsMajor = 0x101022;
        const OsMinor = 0x101023;
        const OsBuildString = 0x101024;
        const OsLocaleLcid = 0x101025;
        const OsPlatformId = 0x101026;
        const OsBuildLayersXml = 0x101027;
        const OsbuildDeprecated = 0x101100;
        const BuildosverStrDeprecated = 0x101101;
        const DebugAnalysis = 0x111000;
        const KeyvalueAnalysis = 0x112000;
        const KeyValuesString = 0x112100;
        const KeyValuesVariant = 0x112200;
        const TimelineAnalysis = 0x113000;
        const TimelineTimes = 0x113001;
        const StreamAnalysis = 0x114000;
        const MemoryAnalysis = 0x115000;
        const StackhashAnalysis = 0x116000;
        const ProcessesAnalysis = 0x117000;
        const ServiceAnalysis = 0x118000;
        const AdditionalXml = 0x119000;
        const Stack = 0x200000;
        const FollowupContext = 0x200001;
        const XmlModuleList = 0x200002;
        const StackFrame = 0x200003;
        const StackFrameNumber = 0x200004;
        const StackFrameInstruction = 0x200005;
        const StackFrameSymbol = 0x200006;
        const StackFrameSymbolOffset = 0x200007;
        const StackFrameModule = 0x200008;
        const StackFrameImage = 0x200009;
        const StackFrameFunction = 0x20000A;
        const StackFrameFlags = 0x20000B;
        const ContextCommand = 0x20000C;
        const ContextFlags = 0x20000D;
        const ContextOrder = 0x20000E;
        const ContextSystem = 0x20000F;
        const ContextId = 0x200010;
        const XmlModuleInfo = 0x200011;
        const XmlModuleInfoIndex = 0x200012;
        const XmlModuleInfoName = 0x200013;
        const XmlModuleInfoImageName = 0x200014;
        const XmlModuleInfoImagePath = 0x200015;
        const XmlModuleInfoChecksum = 0x200016;
        const XmlModuleInfoTimestamp = 0x200017;
        const XmlModuleInfoUnloaded = 0x200018;
        const XmlModuleInfoOnStack = 0x200019;
        const XmlModuleInfoFixedFileVer = 0x20001A;
        const XmlModuleInfoFixedProdVer = 0x20001B;
        const XmlModuleInfoStringFileVer = 0x20001C;
        const XmlModuleInfoStringProdVer = 0x20001D;
        const XmlModuleInfoCompanyName = 0x20001E;
        const XmlModuleInfoFileDescription = 0x20001F;
        const XmlModuleInfoInternalName = 0x200020;
        const XmlModuleInfoOrigFileName = 0x200021;
        const XmlModuleInfoBase = 0x200022;
        const XmlModuleInfoSize = 0x200023;
        const XmlModuleInfoProductName = 0x200024;
        const ProcessInfo = 0x200025;
        const ExceptionModuleInfo = 0x200026;
        const ContextFollowupIndex = 0x200027;
        const XmlGlobalattributeList = 0x200028;
        const XmlAttributeList = 0x200029;
        const XmlAttribute = 0x20002A;
        const XmlAttributeName = 0x20002B;
        const XmlAttributeValue = 0x20002C;
        const XmlAttributeD1value = 0x20002D;
        const XmlAttributeD2value = 0x20002E;
        const XmlAttributeDovalue = 0x20002F;
        const XmlAttributeValueType = 0x200030;
        const XmlAttributeFrameNumber = 0x200031;
        const XmlAttributeThreadIndex = 0x200032;
        const XmlProblemclassList = 0x200033;
        const XmlProblemclass = 0x200034;
        const XmlProblemclassName = 0x200035;
        const XmlProblemclassValue = 0x200036;
        const XmlProblemclassValueType = 0x200037;
        const XmlProblemclassFrameNumber = 0x200038;
        const XmlProblemclassThreadIndex = 0x200039;
        const XmlStackFrameTriageStatus = 0x20003A;
        const ContextMetadata = 0x20003B;
        const StackFrames = 0x20003C;
        const XmlEncodedOffsets = 0x20003D;
        const FaPerfData = 0x20003E;
        const FaPerfItem = 0x20003F;
        const FaPerfItemName = 0x200040;
        const FaPerfIterations = 0x200041;
        const FaPerfElapsedMs = 0x200042;
        const StackSha1HashMf = 0x200043;
        const StackSha1HashMfo = 0x200044;
        const StackSha1HashM = 0x200045;
        const XmlModuleInfoSymbolType = 0x200046;
        const XmlModuleInfoFileFlags = 0x200047;
        const StackFrameModuleBase = 0x200048;
        const StackFrameSrc = 0x200049;
        const XmlSysteminfo = 0x20004A;
        const XmlSysteminfoSystemmanufacturer = 0x20004B;
        const XmlSysteminfoSystemmodel = 0x20004C;
        const XmlSysteminfoSystemmarker = 0x20004D;
        const FaAdhocAnalysisItems = 0x20004E;
        const XmlApplicationName = 0x20004F;
        const XmlPackageMoniker = 0x200050;
        const XmlPackageRelativeApplicationId = 0x200051;
        const XmlModernAsyncRequestOutstanding = 0x200052;
        const XmlEventtype = 0x200053;
        const XmlPackageName = 0x200054;
        const XmlPackageVersion = 0x200055;
        const FailureList = 0x200056;
        const FailureDisplayName = 0x200057;
        const FrameSourceFileName = 0x200058;
        const FrameSourceFilePath = 0x200059;
        const FrameSourceLineNumber = 0x20005A;
        const XmlModuleInfoSymsrvImageStatus = 0x20005B;
        const XmlModuleInfoSymsrvImageError = 0x20005C;
        const XmlModuleInfoSymsrvImageDetail = 0x20005D;
        const XmlModuleInfoSymsrvImageSec = 0x20005E;
        const XmlModuleInfoSymsrvPdbStatus = 0x20005F;
        const XmlModuleInfoSymsrvPdbError = 0x200060;
        const XmlModuleInfoSymsrvPdbDetail = 0x200061;
        const XmlModuleInfoSymsrvPdbSec = 0x200062;
        const XmlModuleInfoDriverGroup = 0x200063;
        const RegistryData = 0x300000;
        const WmiQueryData = 0x301000;
        const UserGlobalAttributes = 0x302000;
        const UserThreadAttributes = 0x303000;
        const UserProblemClasses = 0x304000;
        const SmCompressionFormat = 0x50000000;
        const SmSourcePfn1 = 0x50000001;
        const SmSourcePfn2 = 0x50000002;
        const SmSourceOffset = 0x50000003;
        const SmSourceSize = 0x50000004;
        const SmTargetPfn = 0x50000005;
        const SmBufferHash = 0x50000006;
        const SmOnebitSolutionCount = 0x50000007;
        const StoreProductId = 0x60000000;
        const StoreProductDisplayName = 0x60000001;
        const StoreProductDescription = 0x60000002;
        const StoreProductExtendedName = 0x60000003;
        const StorePublisherId = 0x60000004;
        const StorePublisherName = 0x60000005;
        const StorePublisherCertificateName = 0x60000006;
        const StoreDeveloperName = 0x60000007;
        const StorePackageFamilyName = 0x60000008;
        const StorePackageIdentityName = 0x60000009;
        const StorePrimaryParentProductId = 0x6000000A;
        const StoreLegacyParentProductId = 0x6000000B;
        const StoreLegacyWindowsStoreProductId = 0x6000000C;
        const StoreLegacyWindowsPhoneProductId = 0x6000000D;
        const StoreLegacyXboxOneProductId = 0x6000000E;
        const StoreLegacyXbox360ProductId = 0x6000000F;
        const StoreXboxTitleId = 0x60000010;
        const StorePreferredSkuId = 0x60000011;
        const StoreIsMicrosoftProduct = 0x60000012;
        const StoreUrlApp = 0x60000013;
        const StoreUrlApphealth = 0x60000014;
        const PhoneVersionmajor = 0x70000000;
        const PhoneVersionminor = 0x70000001;
        const PhoneBuildnumber = 0x70000002;
        const PhoneBuildtimestamp = 0x70000003;
        const PhoneBuildbranch = 0x70000004;
        const PhoneBuilder = 0x70000005;
        const PhoneLcid = 0x70000006;
        const PhoneQfe = 0x70000007;
        const PhoneOperator = 0x70000008;
        const PhoneMccmnc = 0x70000009;
        const PhoneFirmwarerevision = 0x7000000A;
        const PhoneRam = 0x7000000B;
        const PhoneRomversion = 0x7000000C;
        const PhoneSocversion = 0x7000000D;
        const PhoneHardwarerevision = 0x7000000E;
        const PhoneRadiohardwarerevision = 0x7000000F;
        const PhoneRadiosoftwarerevision = 0x70000010;
        const PhoneBootloaderversion = 0x70000011;
        const PhoneReportguid = 0x70000012;
        const PhoneSource = 0x70000013;
        const PhoneSourceexternal = 0x70000014;
        const PhoneUseralias = 0x70000015;
        const PhoneReporttimestamp = 0x70000016;
        const PhoneAppid = 0x70000017;
        const PhoneSkuid = 0x70000018;
        const PhoneAppversion = 0x70000019;
        const PhoneUifComment = 0x7000001A;
        const PhoneUifAppname = 0x7000001B;
        const PhoneUifAppid = 0x7000001C;
        const PhoneUifCategory = 0x7000001D;
        const PhoneUifOrigin = 0x7000001E;
        const SimultaneousTelsvcInstances = 0x7000001F;
        const SimultaneousTelwpInstances = 0x70000020;
        const MinutesSinceLastEvent = 0x70000021;
        const MinutesSinceLastEventOfThisType = 0x70000022;
        const ReportInfoGuid = 0x70000023;
        const ReportInfoSource = 0x70000024;
        const ReportInfoCreationTime = 0x70000025;
        const FaultingIp = 0x80000000;
        const FaultingModule = 0x80000001;
        const ImageTimestamp = 0x80000002;
        const FollowupIp = 0x80000003;
        const FrameOneInvalid = 0x80000004;
        const SymbolFromRawStackAddress = 0x80000005;
        const ImageVersion = 0x80000006;
        const FollowupBucketId = 0x80000007;
        const CustomAnalysisTagMin = 0xA0000000;
        const CustomAnalysisTagMax = 0xB0000000;
        const FaultingThread = 0xC0000000;
        const Context = 0xC0000001;
        const TrapFrame = 0xC0000002;
        const Tss = 0xC0000003;
        const BlockingThread = 0xC0000004;
        const UnresponsiveUiThread = 0xC0000005;
        const BlockedThread0 = 0xC0000006;
        const BlockedThread1 = 0xC0000007;
        const BlockedThread2 = 0xC0000008;
        const BlockingProcessid = 0xC0000009;
        const ProcessorId = 0xC000000A;
        const XdvViolatedCondition = 0xC000000B;
        const XdvStateVariable = 0xC000000C;
        const XdvHelpLink = 0xC000000D;
        const XdvRuleInfo = 0xC000000E;
        const DpcStackBase = 0xC000000F;
        const Testresultserver = 0xF0000000;
        const Testresultguid = 0xF0000001;
        const Customreporttag = 0xF0000002;
        const DisksecOrgidDeprecated = 0xF0000003;
        const DisksecModelDeprecated = 0xF0000004;
        const DisksecMfgidDeprecated = 0xF0000005;
        const DisksecIssuedescstringDeprecated = 0xF0000006;
        const DisksecPublicTotsizeDeprecated = 0xF0000007;
        const DisksecPublicOffsetDeprecated = 0xF0000008;
        const DisksecPublicDatasizeDeprecated = 0xF0000009;
        const DisksecPrivateTotsizeDeprecated = 0xF000000A;
        const DisksecPrivateOffsetDeprecated = 0xF000000B;
        const DisksecPrivateDatasizeDeprecated = 0xF000000C;
        const DisksecTotalsizeDeprecated = 0xF000000D;
        const DisksecReasonDeprecated = 0xF000000E;
        const WercollectionProcessterminated = 0xF000000F;
        const WercollectionProcessheapdumpRequestFailure = 0xF0000010;
        const WercollectionMinidumpWriteFailure = 0xF0000011;
        const WercollectionDefaultcollectionFailure = 0xF0000012;
        const ProcessBamCurrentThrottled = 0xF0000013;
        const ProcessBamPreviousThrottled = 0xF0000014;
        const DumpstreamCommenta = 0xF0000015;
        const DumpstreamCommentw = 0xF0000016;
        const ChpeProcess = 0xF0000017;
        const WinlogonBlackbox = 0xF0000018;
        const CustomCommand = 0xF0000019;
        const CustomCommandOutput = 0xF000001A;
        const MaskAll = 0xFFFFFFFF;
    }
}

impl From<DebugFlrParamType> for DEBUG_FLR_PARAM_TYPE {
    fn from(value: DebugFlrParamType) -> Self { Self(value.bits() as i32) }
}

impl From<DEBUG_FLR_PARAM_TYPE> for DebugFlrParamType {
    fn from(value: DEBUG_FLR_PARAM_TYPE) -> Self {
        Self::from_bits_retain(value.0 as u32)
    }
}

#[repr(transparent)]
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct FaEntry(FA_ENTRY);

impl FaEntry {
    pub fn tag(&self) -> FaTag { FaTag::from(self.0.Tag) }

    pub fn full_size(&self) -> usize { self.0.FullSize as usize }

    pub fn data_size(&self) -> usize { self.0.DataSize as usize }
}

impl Eq for FaEntry {}

impl From<FA_ENTRY> for FaEntry {
    fn from(value: FA_ENTRY) -> Self { Self(value) }
}

impl From<FaEntry> for FA_ENTRY {
    fn from(value: FaEntry) -> Self { value.0 }
}

enum_flags! {
    pub enum FaEntryType: u32 {
        NoType=0,
        Ulong=1,
        Ulong64=2,
        InstructionOffset=3,
        Pointer=4,
        AnsiString=5,
        AnsiStrings=6,
        ExtensionCmd=7,
        StructuredData=8,
        UnicodeString=9,
        Array=0x8000,
    }
}

impl From<FaEntryType> for FA_ENTRY_TYPE {
    fn from(value: FaEntryType) -> Self { Self(value as i32) }
}

impl From<FA_ENTRY_TYPE> for FaEntryType {
    fn from(value: FA_ENTRY_TYPE) -> Self {
        Self::try_from(value.0 as u32).unwrap()
    }
}

enum_flags! {
    pub enum DebugFailureClass: u32 {
        Uninitialized = DEBUG_CLASS_UNINITIALIZED,
        Kernel        = DEBUG_CLASS_KERNEL,
        UserWindows   = DEBUG_CLASS_USER_WINDOWS,
    }
}