forked from gentilkiwi/mimikatz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WDBGEXTS.H
2805 lines (2394 loc) · 74.8 KB
/
WDBGEXTS.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
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
wdbgexts.h
Abstract:
This file contains the necessary prototypes and data types for a user
to write a debugger extension DLL. This header file is also included
by the NT debuggers (WINDBG & KD).
This header file must be included after "windows.h" and "dbghelp.h".
Please see the NT DDK documentation for specific information about
how to write your own debugger extension DLL.
Environment:
Win32 only.
Revision History:
--*/
#ifndef _WDBGEXTS_
#define _WDBGEXTS_
#if _MSC_VER > 1000
#pragma once
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if _MSC_VER >= 1200
#pragma warning(push)
#endif
#pragma warning(disable:4115 4201 4204 4214 4221)
// Maximum value of MAXIMUM_PROCESSORS for all platforms.
#define CROSS_PLATFORM_MAXIMUM_PROCESSORS 256
#if !defined(WDBGAPI)
#define WDBGAPI __stdcall
#endif
#if !defined(WDBGAPIV)
#define WDBGAPIV __cdecl
#endif
#ifndef _WINDEF_
typedef CONST void *LPCVOID;
#endif
#ifndef _ULONGLONG_
typedef unsigned __int64 ULONGLONG;
typedef ULONGLONG *PULONGLONG;
#endif
#ifndef __specstrings
// Should include SpecStrings.h to get proper definitions.
#define __field_ecount_opt(x)
#endif
#define WDBGEXTS_MAXSIZE_T ((SIZE_T)~((SIZE_T)0))
typedef
VOID
(WDBGAPIV*PWINDBG_OUTPUT_ROUTINE)(
PCSTR lpFormat,
...
);
typedef
ULONG_PTR
(WDBGAPI*PWINDBG_GET_EXPRESSION)(
PCSTR lpExpression
);
typedef
ULONG
(WDBGAPI*PWINDBG_GET_EXPRESSION32)(
PCSTR lpExpression
);
typedef
ULONG64
(WDBGAPI*PWINDBG_GET_EXPRESSION64)(
PCSTR lpExpression
);
typedef
VOID
(WDBGAPI*PWINDBG_GET_SYMBOL)(
PVOID offset,
PCHAR pchBuffer,
ULONG_PTR *pDisplacement
);
typedef
VOID
(WDBGAPI*PWINDBG_GET_SYMBOL32)(
ULONG offset,
PCHAR pchBuffer,
PULONG pDisplacement
);
typedef
VOID
(WDBGAPI*PWINDBG_GET_SYMBOL64)(
ULONG64 offset,
PCHAR pchBuffer,
PULONG64 pDisplacement
);
typedef
ULONG
(WDBGAPI*PWINDBG_DISASM)(
ULONG_PTR *lpOffset,
PCSTR lpBuffer,
ULONG fShowEffectiveAddress
);
typedef
ULONG
(WDBGAPI*PWINDBG_DISASM32)(
ULONG *lpOffset,
PCSTR lpBuffer,
ULONG fShowEffectiveAddress
);
typedef
ULONG
(WDBGAPI*PWINDBG_DISASM64)(
ULONG64 *lpOffset,
PCSTR lpBuffer,
ULONG fShowEffectiveAddress
);
typedef
ULONG
(WDBGAPI*PWINDBG_CHECK_CONTROL_C)(
VOID
);
typedef
ULONG
(WDBGAPI*PWINDBG_READ_PROCESS_MEMORY_ROUTINE)(
ULONG_PTR offset,
PVOID lpBuffer,
ULONG cb,
PULONG lpcbBytesRead
);
typedef
ULONG
(WDBGAPI*PWINDBG_READ_PROCESS_MEMORY_ROUTINE32)(
ULONG offset,
PVOID lpBuffer,
ULONG cb,
PULONG lpcbBytesRead
);
typedef
ULONG
(WDBGAPI*PWINDBG_READ_PROCESS_MEMORY_ROUTINE64)(
ULONG64 offset,
PVOID lpBuffer,
ULONG cb,
PULONG lpcbBytesRead
);
typedef
ULONG
(WDBGAPI*PWINDBG_WRITE_PROCESS_MEMORY_ROUTINE)(
ULONG_PTR offset,
LPCVOID lpBuffer,
ULONG cb,
PULONG lpcbBytesWritten
);
typedef
ULONG
(WDBGAPI*PWINDBG_WRITE_PROCESS_MEMORY_ROUTINE32)(
ULONG offset,
LPCVOID lpBuffer,
ULONG cb,
PULONG lpcbBytesWritten
);
typedef
ULONG
(WDBGAPI*PWINDBG_WRITE_PROCESS_MEMORY_ROUTINE64)(
ULONG64 offset,
LPCVOID lpBuffer,
ULONG cb,
PULONG lpcbBytesWritten
);
typedef
ULONG
(WDBGAPI*PWINDBG_GET_THREAD_CONTEXT_ROUTINE)(
ULONG Processor,
PCONTEXT lpContext,
ULONG cbSizeOfContext
);
typedef
ULONG
(WDBGAPI*PWINDBG_SET_THREAD_CONTEXT_ROUTINE)(
ULONG Processor,
PCONTEXT lpContext,
ULONG cbSizeOfContext
);
typedef
ULONG
(WDBGAPI*PWINDBG_IOCTL_ROUTINE)(
USHORT IoctlType,
PVOID lpvData,
ULONG cbSize
);
typedef
ULONG
(WDBGAPI*PWINDBG_OLDKD_READ_PHYSICAL_MEMORY)(
ULONGLONG address,
PVOID buffer,
ULONG count,
PULONG bytesread
);
typedef
ULONG
(WDBGAPI*PWINDBG_OLDKD_WRITE_PHYSICAL_MEMORY)(
ULONGLONG address,
PVOID buffer,
ULONG length,
PULONG byteswritten
);
typedef struct _EXTSTACKTRACE {
ULONG FramePointer;
ULONG ProgramCounter;
ULONG ReturnAddress;
ULONG Args[4];
} EXTSTACKTRACE, *PEXTSTACKTRACE;
typedef struct _EXTSTACKTRACE32 {
ULONG FramePointer;
ULONG ProgramCounter;
ULONG ReturnAddress;
ULONG Args[4];
} EXTSTACKTRACE32, *PEXTSTACKTRACE32;
typedef struct _EXTSTACKTRACE64 {
ULONG64 FramePointer;
ULONG64 ProgramCounter;
ULONG64 ReturnAddress;
ULONG64 Args[4];
} EXTSTACKTRACE64, *PEXTSTACKTRACE64;
typedef
ULONG
(WDBGAPI*PWINDBG_STACKTRACE_ROUTINE)(
ULONG FramePointer,
ULONG StackPointer,
ULONG ProgramCounter,
PEXTSTACKTRACE StackFrames,
ULONG Frames
);
typedef
ULONG
(WDBGAPI*PWINDBG_STACKTRACE_ROUTINE32)(
ULONG FramePointer,
ULONG StackPointer,
ULONG ProgramCounter,
PEXTSTACKTRACE32 StackFrames,
ULONG Frames
);
typedef
ULONG
(WDBGAPI*PWINDBG_STACKTRACE_ROUTINE64)(
ULONG64 FramePointer,
ULONG64 StackPointer,
ULONG64 ProgramCounter,
PEXTSTACKTRACE64 StackFrames,
ULONG Frames
);
typedef struct _WINDBG_EXTENSION_APIS {
ULONG nSize;
PWINDBG_OUTPUT_ROUTINE lpOutputRoutine;
PWINDBG_GET_EXPRESSION lpGetExpressionRoutine;
PWINDBG_GET_SYMBOL lpGetSymbolRoutine;
PWINDBG_DISASM lpDisasmRoutine;
PWINDBG_CHECK_CONTROL_C lpCheckControlCRoutine;
PWINDBG_READ_PROCESS_MEMORY_ROUTINE lpReadProcessMemoryRoutine;
PWINDBG_WRITE_PROCESS_MEMORY_ROUTINE lpWriteProcessMemoryRoutine;
PWINDBG_GET_THREAD_CONTEXT_ROUTINE lpGetThreadContextRoutine;
PWINDBG_SET_THREAD_CONTEXT_ROUTINE lpSetThreadContextRoutine;
PWINDBG_IOCTL_ROUTINE lpIoctlRoutine;
PWINDBG_STACKTRACE_ROUTINE lpStackTraceRoutine;
} WINDBG_EXTENSION_APIS, *PWINDBG_EXTENSION_APIS;
typedef struct _WINDBG_EXTENSION_APIS32 {
ULONG nSize;
PWINDBG_OUTPUT_ROUTINE lpOutputRoutine;
PWINDBG_GET_EXPRESSION32 lpGetExpressionRoutine;
PWINDBG_GET_SYMBOL32 lpGetSymbolRoutine;
PWINDBG_DISASM32 lpDisasmRoutine;
PWINDBG_CHECK_CONTROL_C lpCheckControlCRoutine;
PWINDBG_READ_PROCESS_MEMORY_ROUTINE32 lpReadProcessMemoryRoutine;
PWINDBG_WRITE_PROCESS_MEMORY_ROUTINE32 lpWriteProcessMemoryRoutine;
PWINDBG_GET_THREAD_CONTEXT_ROUTINE lpGetThreadContextRoutine;
PWINDBG_SET_THREAD_CONTEXT_ROUTINE lpSetThreadContextRoutine;
PWINDBG_IOCTL_ROUTINE lpIoctlRoutine;
PWINDBG_STACKTRACE_ROUTINE32 lpStackTraceRoutine;
} WINDBG_EXTENSION_APIS32, *PWINDBG_EXTENSION_APIS32;
typedef struct _WINDBG_EXTENSION_APIS64 {
ULONG nSize;
PWINDBG_OUTPUT_ROUTINE lpOutputRoutine;
PWINDBG_GET_EXPRESSION64 lpGetExpressionRoutine;
PWINDBG_GET_SYMBOL64 lpGetSymbolRoutine;
PWINDBG_DISASM64 lpDisasmRoutine;
PWINDBG_CHECK_CONTROL_C lpCheckControlCRoutine;
PWINDBG_READ_PROCESS_MEMORY_ROUTINE64 lpReadProcessMemoryRoutine;
PWINDBG_WRITE_PROCESS_MEMORY_ROUTINE64 lpWriteProcessMemoryRoutine;
PWINDBG_GET_THREAD_CONTEXT_ROUTINE lpGetThreadContextRoutine;
PWINDBG_SET_THREAD_CONTEXT_ROUTINE lpSetThreadContextRoutine;
PWINDBG_IOCTL_ROUTINE lpIoctlRoutine;
PWINDBG_STACKTRACE_ROUTINE64 lpStackTraceRoutine;
} WINDBG_EXTENSION_APIS64, *PWINDBG_EXTENSION_APIS64;
typedef struct _WINDBG_OLD_EXTENSION_APIS {
ULONG nSize;
PWINDBG_OUTPUT_ROUTINE lpOutputRoutine;
PWINDBG_GET_EXPRESSION lpGetExpressionRoutine;
PWINDBG_GET_SYMBOL lpGetSymbolRoutine;
PWINDBG_DISASM lpDisasmRoutine;
PWINDBG_CHECK_CONTROL_C lpCheckControlCRoutine;
} WINDBG_OLD_EXTENSION_APIS, *PWINDBG_OLD_EXTENSION_APIS;
typedef struct _WINDBG_OLDKD_EXTENSION_APIS {
ULONG nSize;
PWINDBG_OUTPUT_ROUTINE lpOutputRoutine;
PWINDBG_GET_EXPRESSION32 lpGetExpressionRoutine;
PWINDBG_GET_SYMBOL32 lpGetSymbolRoutine;
PWINDBG_DISASM32 lpDisasmRoutine;
PWINDBG_CHECK_CONTROL_C lpCheckControlCRoutine;
PWINDBG_READ_PROCESS_MEMORY_ROUTINE32 lpReadVirtualMemRoutine;
PWINDBG_WRITE_PROCESS_MEMORY_ROUTINE32 lpWriteVirtualMemRoutine;
PWINDBG_OLDKD_READ_PHYSICAL_MEMORY lpReadPhysicalMemRoutine;
PWINDBG_OLDKD_WRITE_PHYSICAL_MEMORY lpWritePhysicalMemRoutine;
} WINDBG_OLDKD_EXTENSION_APIS, *PWINDBG_OLDKD_EXTENSION_APIS;
typedef
VOID
(WDBGAPI*PWINDBG_OLD_EXTENSION_ROUTINE)(
ULONG dwCurrentPc,
PWINDBG_EXTENSION_APIS lpExtensionApis,
PCSTR lpArgumentString
);
typedef
VOID
(WDBGAPI*PWINDBG_EXTENSION_ROUTINE)(
HANDLE hCurrentProcess,
HANDLE hCurrentThread,
ULONG dwCurrentPc,
ULONG dwProcessor,
PCSTR lpArgumentString
);
typedef
VOID
(WDBGAPI*PWINDBG_EXTENSION_ROUTINE32)(
HANDLE hCurrentProcess,
HANDLE hCurrentThread,
ULONG dwCurrentPc,
ULONG dwProcessor,
PCSTR lpArgumentString
);
typedef
VOID
(WDBGAPI*PWINDBG_EXTENSION_ROUTINE64)(
HANDLE hCurrentProcess,
HANDLE hCurrentThread,
ULONG64 dwCurrentPc,
ULONG dwProcessor,
PCSTR lpArgumentString
);
typedef
VOID
(WDBGAPI*PWINDBG_OLDKD_EXTENSION_ROUTINE)(
ULONG dwCurrentPc,
PWINDBG_OLDKD_EXTENSION_APIS lpExtensionApis,
PCSTR lpArgumentString
);
typedef
VOID
(WDBGAPI*PWINDBG_EXTENSION_DLL_INIT)(
PWINDBG_EXTENSION_APIS lpExtensionApis,
USHORT MajorVersion,
USHORT MinorVersion
);
typedef
VOID
(WDBGAPI*PWINDBG_EXTENSION_DLL_INIT32)(
PWINDBG_EXTENSION_APIS32 lpExtensionApis,
USHORT MajorVersion,
USHORT MinorVersion
);
typedef
VOID
(WDBGAPI*PWINDBG_EXTENSION_DLL_INIT64)(
PWINDBG_EXTENSION_APIS64 lpExtensionApis,
USHORT MajorVersion,
USHORT MinorVersion
);
typedef
ULONG
(WDBGAPI*PWINDBG_CHECK_VERSION)(
VOID
);
#define EXT_API_VERSION_NUMBER 5
#define EXT_API_VERSION_NUMBER32 5
#define EXT_API_VERSION_NUMBER64 6
typedef struct EXT_API_VERSION {
USHORT MajorVersion;
USHORT MinorVersion;
USHORT Revision;
USHORT Reserved;
} EXT_API_VERSION, *LPEXT_API_VERSION;
typedef
LPEXT_API_VERSION
(WDBGAPI*PWINDBG_EXTENSION_API_VERSION)(
VOID
);
#define IG_KD_CONTEXT 1
#define IG_READ_CONTROL_SPACE 2
#define IG_WRITE_CONTROL_SPACE 3
#define IG_READ_IO_SPACE 4
#define IG_WRITE_IO_SPACE 5
#define IG_READ_PHYSICAL 6
#define IG_WRITE_PHYSICAL 7
#define IG_READ_IO_SPACE_EX 8
#define IG_WRITE_IO_SPACE_EX 9
#define IG_KSTACK_HELP 10 // obsolete
#define IG_SET_THREAD 11
#define IG_READ_MSR 12
#define IG_WRITE_MSR 13
#define IG_GET_DEBUGGER_DATA 14
#define IG_GET_KERNEL_VERSION 15
#define IG_RELOAD_SYMBOLS 16
#define IG_GET_SET_SYMPATH 17
#define IG_GET_EXCEPTION_RECORD 18
#define IG_IS_PTR64 19
#define IG_GET_BUS_DATA 20
#define IG_SET_BUS_DATA 21
#define IG_DUMP_SYMBOL_INFO 22
#define IG_LOWMEM_CHECK 23
#define IG_SEARCH_MEMORY 24
#define IG_GET_CURRENT_THREAD 25
#define IG_GET_CURRENT_PROCESS 26
#define IG_GET_TYPE_SIZE 27
#define IG_GET_CURRENT_PROCESS_HANDLE 28
#define IG_GET_INPUT_LINE 29
#define IG_GET_EXPRESSION_EX 30
#define IG_TRANSLATE_VIRTUAL_TO_PHYSICAL 31
#define IG_GET_CACHE_SIZE 32
#define IG_READ_PHYSICAL_WITH_FLAGS 33
#define IG_WRITE_PHYSICAL_WITH_FLAGS 34
#define IG_POINTER_SEARCH_PHYSICAL 35
#define IG_OBSOLETE_PLACEHOLDER_36 36
#define IG_GET_THREAD_OS_INFO 37
#define IG_GET_CLR_DATA_INTERFACE 38
#define IG_MATCH_PATTERN_A 39
#define IG_FIND_FILE 40
#define IG_TYPED_DATA_OBSOLETE 41
#define IG_QUERY_TARGET_INTERFACE 42
#define IG_TYPED_DATA 43
#define IG_DISASSEMBLE_BUFFER 44
#define IG_GET_ANY_MODULE_IN_RANGE 45
#define IG_VIRTUAL_TO_PHYSICAL 46
#define IG_PHYSICAL_TO_VIRTUAL 47
#define IG_GET_CONTEXT_EX 48
#define IG_GET_TEB_ADDRESS 128
#define IG_GET_PEB_ADDRESS 129
typedef struct _PROCESSORINFO {
USHORT Processor; // current processor
USHORT NumberProcessors; // total number of processors
} PROCESSORINFO, *PPROCESSORINFO;
typedef struct _READCONTROLSPACE {
USHORT Processor;
ULONG Address;
ULONG BufLen;
UCHAR Buf[1];
} READCONTROLSPACE, *PREADCONTROLSPACE;
typedef struct _READCONTROLSPACE32 {
USHORT Processor;
ULONG Address;
ULONG BufLen;
UCHAR Buf[1];
} READCONTROLSPACE32, *PREADCONTROLSPACE32;
typedef struct _READCONTROLSPACE64 {
USHORT Processor;
ULONG64 Address;
ULONG BufLen;
UCHAR Buf[1];
} READCONTROLSPACE64, *PREADCONTROLSPACE64;
typedef struct _IOSPACE {
ULONG Address;
ULONG Length; // 1, 2, or 4 bytes
ULONG Data;
} IOSPACE, *PIOSPACE;
typedef struct _IOSPACE32 {
ULONG Address;
ULONG Length; // 1, 2, or 4 bytes
ULONG Data;
} IOSPACE32, *PIOSPACE32;
typedef struct _IOSPACE64 {
ULONG64 Address;
ULONG Length; // 1, 2, or 4 bytes
ULONG Data;
} IOSPACE64, *PIOSPACE64;
typedef struct _IOSPACE_EX {
ULONG Address;
ULONG Length; // 1, 2, or 4 bytes
ULONG Data;
ULONG InterfaceType;
ULONG BusNumber;
ULONG AddressSpace;
} IOSPACE_EX, *PIOSPACE_EX;
typedef struct _IOSPACE_EX32 {
ULONG Address;
ULONG Length; // 1, 2, or 4 bytes
ULONG Data;
ULONG InterfaceType;
ULONG BusNumber;
ULONG AddressSpace;
} IOSPACE_EX32, *PIOSPACE_EX32;
typedef struct _IOSPACE_EX64 {
ULONG64 Address;
ULONG Length; // 1, 2, or 4 bytes
ULONG Data;
ULONG InterfaceType;
ULONG BusNumber;
ULONG AddressSpace;
} IOSPACE_EX64, *PIOSPACE_EX64;
typedef struct _GETSETBUSDATA {
ULONG BusDataType;
ULONG BusNumber;
ULONG SlotNumber;
PVOID Buffer;
ULONG Offset;
ULONG Length;
} BUSDATA, *PBUSDATA;
typedef struct _SEARCHMEMORY {
ULONG64 SearchAddress;
ULONG64 SearchLength;
ULONG64 FoundAddress;
ULONG PatternLength;
PVOID Pattern;
} SEARCHMEMORY, *PSEARCHMEMORY;
typedef struct _PHYSICAL {
ULONGLONG Address;
ULONG BufLen;
UCHAR Buf[1];
} PHYSICAL, *PPHYSICAL;
#define PHYS_FLAG_DEFAULT 0
#define PHYS_FLAG_CACHED 1
#define PHYS_FLAG_UNCACHED 2
#define PHYS_FLAG_WRITE_COMBINED 3
typedef struct _PHYSICAL_WITH_FLAGS {
ULONGLONG Address;
ULONG BufLen;
ULONG Flags;
UCHAR Buf[1];
} PHYSICAL_WITH_FLAGS, *PPHYSICAL_WITH_FLAGS;
typedef struct _READ_WRITE_MSR {
ULONG Msr;
LONGLONG Value;
} READ_WRITE_MSR, *PREAD_WRITE_MSR;
typedef struct _GET_SET_SYMPATH {
PCSTR Args; // args to !reload command
PSTR Result; // returns new path
int Length; // Length of result buffer
} GET_SET_SYMPATH, *PGET_SET_SYMPATH;
typedef struct _GET_TEB_ADDRESS {
ULONGLONG Address;
} GET_TEB_ADDRESS, *PGET_TEB_ADDRESS;
typedef struct _GET_PEB_ADDRESS {
ULONG64 CurrentThread;
ULONGLONG Address;
} GET_PEB_ADDRESS, *PGET_PEB_ADDRESS;
typedef struct _GET_CURRENT_THREAD_ADDRESS {
ULONG Processor;
ULONG64 Address;
} GET_CURRENT_THREAD_ADDRESS, *PGET_CURRENT_THREAD_ADDRESS;
typedef struct _GET_CURRENT_PROCESS_ADDRESS {
ULONG Processor;
ULONG64 CurrentThread;
ULONG64 Address;
} GET_CURRENT_PROCESS_ADDRESS, *PGET_CURRENT_PROCESS_ADDRESS;
typedef struct _GET_INPUT_LINE {
PCSTR Prompt;
PSTR Buffer;
ULONG BufferSize;
ULONG InputSize;
} GET_INPUT_LINE, *PGET_INPUT_LINE;
typedef struct _GET_EXPRESSION_EX {
PCSTR Expression;
PCSTR Remainder;
ULONG64 Value;
} GET_EXPRESSION_EX, *PGET_EXPRESSION_EX;
typedef struct _TRANSLATE_VIRTUAL_TO_PHYSICAL {
ULONG64 Virtual;
ULONG64 Physical;
} TRANSLATE_VIRTUAL_TO_PHYSICAL, *PTRANSLATE_VIRTUAL_TO_PHYSICAL;
typedef struct _VIRTUAL_TO_PHYSICAL {
ULONG Status;
ULONG Size;
ULONG64 PdeAddress;
ULONG64 Virtual;
ULONG64 Physical;
} VIRTUAL_TO_PHYSICAL, *PVIRTUAL_TO_PHYSICAL;
typedef struct _PHYSICAL_TO_VIRTUAL {
ULONG Status;
ULONG Size;
ULONG64 PdeAddress;
} PHYSICAL_TO_VIRTUAL, *PPHYSICAL_TO_VIRTUAL;
typedef struct _GET_CONTEXT_EX {
ULONG Status;
ULONG ContextSize;
PVOID pContext;
} GET_CONTEXT_EX, *PGET_CONTEXT_EX;
#define PTR_SEARCH_PHYS_ALL_HITS 0x00000001
#define PTR_SEARCH_PHYS_PTE 0x00000002
#define PTR_SEARCH_PHYS_RANGE_CHECK_ONLY 0x00000004
#define PTR_SEARCH_PHYS_SIZE_SHIFT 3
#define PTR_SEARCH_PHYS_SIZE_MASK (0xf << PTR_SEARCH_PHYS_SIZE_SHIFT)
#define PTR_SEARCH_NO_SYMBOL_CHECK 0x80000000
typedef struct _POINTER_SEARCH_PHYSICAL {
IN ULONG64 Offset;
IN ULONG64 Length;
IN ULONG64 PointerMin;
IN ULONG64 PointerMax;
IN ULONG Flags;
OUT PULONG64 MatchOffsets;
IN ULONG MatchOffsetsSize;
OUT ULONG MatchOffsetsCount;
} POINTER_SEARCH_PHYSICAL, *PPOINTER_SEARCH_PHYSICAL;
typedef struct _WDBGEXTS_THREAD_OS_INFO {
// System thread ID input.
ULONG ThreadId;
//
// Output information.
//
// Exit status is STILL_ACTIVE by default.
ULONG ExitStatus;
// Priority class is zero if not known.
ULONG PriorityClass;
// Priority defaults to normal.
ULONG Priority;
// Times can be zero if not known.
ULONG64 CreateTime;
ULONG64 ExitTime;
ULONG64 KernelTime;
ULONG64 UserTime;
// Start offset is zero if not known.
ULONG64 StartOffset;
// Affinity is zero if not known.
ULONG64 Affinity;
} WDBGEXTS_THREAD_OS_INFO, *PWDBGEXTS_THREAD_OS_INFO;
typedef struct _WDBGEXTS_CLR_DATA_INTERFACE {
// Interface requested.
const IID* Iid;
// Interface pointer return.
PVOID Iface;
} WDBGEXTS_CLR_DATA_INTERFACE, *PWDBGEXTS_CLR_DATA_INTERFACE;
typedef struct _EXT_MATCH_PATTERN_A {
IN PCSTR Str;
IN PCSTR Pattern;
IN ULONG CaseSensitive;
} EXT_MATCH_PATTERN_A, *PEXT_MATCH_PATTERN_A;
#define EXT_FIND_FILE_ALLOW_GIVEN_PATH 0x00000001
typedef struct _EXT_FIND_FILE {
IN PCWSTR FileName;
IN ULONG64 IndexedSize;
IN ULONG ImageTimeDateStamp;
// Pass zero to ignore.
IN ULONG ImageCheckSum;
IN OPTIONAL PVOID ExtraInfo;
IN ULONG ExtraInfoSize;
IN ULONG Flags;
// Free with UnmapViewOfFile.
OUT PVOID FileMapping;
OUT ULONG64 FileMappingSize;
// Free with CloseHandle.
OUT HANDLE FileHandle;
// Must be at least MAX_PATH characters if set.
OUT OPTIONAL PWSTR FoundFileName;
OUT ULONG FoundFileNameChars;
} EXT_FIND_FILE, *PEXT_FIND_FILE;
#define DEBUG_TYPED_DATA_IS_IN_MEMORY 0x00000001
#define DEBUG_TYPED_DATA_PHYSICAL_DEFAULT 0x00000002
#define DEBUG_TYPED_DATA_PHYSICAL_CACHED 0x00000004
#define DEBUG_TYPED_DATA_PHYSICAL_UNCACHED 0x00000006
#define DEBUG_TYPED_DATA_PHYSICAL_WRITE_COMBINED 0x00000008
// Mask for all physical flags.
#define DEBUG_TYPED_DATA_PHYSICAL_MEMORY 0x0000000e
typedef struct _DEBUG_TYPED_DATA
{
ULONG64 ModBase;
ULONG64 Offset;
ULONG64 EngineHandle;
ULONG64 Data;
ULONG Size;
ULONG Flags;
ULONG TypeId;
ULONG BaseTypeId;
ULONG Tag;
ULONG Register;
ULONG64 Internal[9];
} DEBUG_TYPED_DATA, *PDEBUG_TYPED_DATA;
typedef enum _EXT_TDOP {
EXT_TDOP_COPY,
EXT_TDOP_RELEASE,
EXT_TDOP_SET_FROM_EXPR,
EXT_TDOP_SET_FROM_U64_EXPR,
EXT_TDOP_GET_FIELD,
EXT_TDOP_EVALUATE,
EXT_TDOP_GET_TYPE_NAME,
EXT_TDOP_OUTPUT_TYPE_NAME,
EXT_TDOP_OUTPUT_SIMPLE_VALUE,
EXT_TDOP_OUTPUT_FULL_VALUE,
EXT_TDOP_HAS_FIELD,
EXT_TDOP_GET_FIELD_OFFSET,
EXT_TDOP_GET_ARRAY_ELEMENT,
EXT_TDOP_GET_DEREFERENCE,
EXT_TDOP_GET_TYPE_SIZE,
EXT_TDOP_OUTPUT_TYPE_DEFINITION,
EXT_TDOP_GET_POINTER_TO,
EXT_TDOP_SET_FROM_TYPE_ID_AND_U64,
EXT_TDOP_SET_PTR_FROM_TYPE_ID_AND_U64,
EXT_TDOP_COUNT
} EXT_TDOP;
// EXT_TDF physical flags must match DEBUG_TYPED.
#define EXT_TDF_PHYSICAL_DEFAULT 0x00000002
#define EXT_TDF_PHYSICAL_CACHED 0x00000004
#define EXT_TDF_PHYSICAL_UNCACHED 0x00000006
#define EXT_TDF_PHYSICAL_WRITE_COMBINED 0x00000008
#define EXT_TDF_PHYSICAL_MEMORY 0x0000000e
// NOTE: Every DEBUG_TYPED_DATA should be released
// via EXT_TDOP_RELEASE when it is no longer needed.
typedef struct _EXT_TYPED_DATA {
IN EXT_TDOP Operation;
IN ULONG Flags;
IN DEBUG_TYPED_DATA InData;
OUT DEBUG_TYPED_DATA OutData;
IN ULONG InStrIndex;
IN ULONG In32;
OUT ULONG Out32;
IN ULONG64 In64;
OUT ULONG64 Out64;
OUT ULONG StrBufferIndex;
IN ULONG StrBufferChars;
OUT ULONG StrCharsNeeded;
IN OUT ULONG DataBufferIndex;
IN ULONG DataBufferBytes;
OUT ULONG DataBytesNeeded;
OUT HRESULT Status;
// Must be zeroed.
ULONG64 Reserved[8];
} EXT_TYPED_DATA, *PEXT_TYPED_DATA;
typedef struct _WDBGEXTS_QUERY_INTERFACE {
// Interface requested.
const IID* Iid;
// Interface pointer return.
PVOID Iface;
} WDBGEXTS_QUERY_INTERFACE, *PWDBGEXTS_QUERY_INTERFACE;
#define WDBGEXTS_ADDRESS_DEFAULT 0x00000000
#define WDBGEXTS_ADDRESS_SEG16 0x00000001
#define WDBGEXTS_ADDRESS_SEG32 0x00000002
#define WDBGEXTS_ADDRESS_RESERVED0 0x80000000
typedef struct _WDBGEXTS_DISASSEMBLE_BUFFER {
IN ULONG64 InOffset;
OUT ULONG64 OutOffset;
// AddrFlags are from above.
IN ULONG AddrFlags;
// FormatFlags are from dbgeng's DEBUG_DISASM_*.
IN ULONG FormatFlags;
IN ULONG DataBufferBytes;
IN ULONG DisasmBufferChars;
IN OPTIONAL PVOID DataBuffer;
OUT PWSTR DisasmBuffer;
IN ULONG64 Reserved0[3];
} WDBGEXTS_DISASSEMBLE_BUFFER, *PWDBGEXTS_DISASSEMBLE_BUFFER;
typedef struct _WDBGEXTS_MODULE_IN_RANGE {
IN ULONG64 Start;
// Inclusive ending offset.
IN ULONG64 End;
OUT ULONG64 FoundModBase;
OUT ULONG FoundModSize;
} WDBGEXTS_MODULE_IN_RANGE, *PWDBGEXTS_MODULE_IN_RANGE;
//
// If DBGKD_VERS_FLAG_DATA is set in Flags, info should be retrieved from
// the KDDEBUGGER_DATA block rather than from the DBGKD_GET_VERSION
// packet. The data will remain in the version packet for a while to
// reduce compatibility problems.
//
#define DBGKD_VERS_FLAG_MP 0x0001 // kernel is MP built
#define DBGKD_VERS_FLAG_DATA 0x0002 // DebuggerDataList is valid
#define DBGKD_VERS_FLAG_PTR64 0x0004 // native pointers are 64 bits
#define DBGKD_VERS_FLAG_NOMM 0x0008 // No MM - don't decode PTEs
#define DBGKD_VERS_FLAG_HSS 0x0010 // hardware stepping support
#define DBGKD_VERS_FLAG_PARTITIONS 0x0020 // multiple OS partitions exist
#define KDBG_TAG 'GBDK'
//
// KD version MajorVersion high-byte identifiers.
//
typedef enum _DBGKD_MAJOR_TYPES
{
DBGKD_MAJOR_NT,
DBGKD_MAJOR_XBOX,
DBGKD_MAJOR_BIG,
DBGKD_MAJOR_EXDI,
DBGKD_MAJOR_NTBD,
DBGKD_MAJOR_EFI,
DBGKD_MAJOR_TNT,
DBGKD_MAJOR_SINGULARITY,
DBGKD_MAJOR_HYPERVISOR,
DBGKD_MAJOR_MIDORI,
DBGKD_MAJOR_COUNT
} DBGKD_MAJOR_TYPES;
#define DBGKD_MAJOR_TYPE(MajorVersion) \
((DBGKD_MAJOR_TYPES)((MajorVersion) >> 8))
// **********************************************************************
// DO NOT CHANGE THESE 32 BIT STRUCTURES!
// ONLY MAKE CHAGES TO THE 64 BIT VERSION BELOW!!
// **********************************************************************
//
// The following structure has changed in more than pointer size.
//
// This is the version packet for pre-NT5 Beta 2 systems.
// For now, it is also still used on x86
//
typedef struct _DBGKD_GET_VERSION32 {
USHORT MajorVersion;
USHORT MinorVersion;
USHORT ProtocolVersion;
USHORT Flags;
ULONG KernBase;
ULONG PsLoadedModuleList;
USHORT MachineType;
//
// help for walking stacks with user callbacks:
//
//
// The address of the thread structure is provided in the
// WAIT_STATE_CHANGE packet. This is the offset from the base of
// the thread structure to the pointer to the kernel stack frame
// for the currently active usermode callback.
//
USHORT ThCallbackStack; // offset in thread data
//
// these values are offsets into that frame:
//
USHORT NextCallback; // saved pointer to next callback frame
USHORT FramePointer; // saved frame pointer
//
// Address of the kernel callout routine.
//
ULONG KiCallUserMode; // kernel routine
//
// Address of the usermode entry point for callbacks.
//
ULONG KeUserCallbackDispatcher; // address in ntdll
//
// DbgBreakPointWithStatus is a function which takes a ULONG argument
// and hits a breakpoint. This field contains the address of the
// breakpoint instruction. When the debugger sees a breakpoint
// at this address, it may retrieve the argument from the first
// argument register, or on x86 the eax register.
//
ULONG BreakpointWithStatus; // address of breakpoint
//
// Components may register a debug data block for use by
// debugger extensions. This is the address of the list head.
//
ULONG DebuggerDataList;
} DBGKD_GET_VERSION32, *PDBGKD_GET_VERSION32;
//
// This is the debugger data packet for pre NT5 Beta 2 systems.
// For now, it is still used on x86
//
typedef struct _DBGKD_DEBUG_DATA_HEADER32 {
LIST_ENTRY32 List;
ULONG OwnerTag;
ULONG Size;