-
Notifications
You must be signed in to change notification settings - Fork 0
/
_breakpoint_commands_8c.html
1754 lines (1719 loc) · 240 KB
/
_breakpoint_commands_8c.html
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.11.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>HyperDbg Debugger: hyperdbg/hyperkd/code/debugger/commands/BreakpointCommands.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="clipboard.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">HyperDbg Debugger
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.11.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search',true);
$(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
$(function(){initNavTree('_breakpoint_commands_8c.html',''); initResizable(true); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle"><div class="title">BreakpointCommands.c File Reference</div></div>
</div><!--header-->
<div class="contents">
<p>Routines for breakpoint commands.
<a href="#details">More...</a></p>
<div class="textblock"><code>#include "pch.h"</code><br />
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a70160ffe7c755f58fbe996b53a0405da" id="r_a70160ffe7c755f58fbe996b53a0405da"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#a70160ffe7c755f58fbe996b53a0405da">BreakpointCheckAndPerformActionsOnTrapFlags</a> (<a class="el" href="_basic_types_8h.html#ae1e6edbbc26d6fbc71a90190d0266018">UINT32</a> ProcessId, <a class="el" href="_basic_types_8h.html#ae1e6edbbc26d6fbc71a90190d0266018">UINT32</a> ThreadId, <a class="el" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> *TrapSetByDebugger)</td></tr>
<tr class="memdesc:a70160ffe7c755f58fbe996b53a0405da"><td class="mdescLeft"> </td><td class="mdescRight">Check and perform actions on RFLAGS.TF. <br /></td></tr>
<tr class="separator:a70160ffe7c755f58fbe996b53a0405da"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a6228e6bee67f388f8ef0a730c7d5626b" id="r_a6228e6bee67f388f8ef0a730c7d5626b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#a6228e6bee67f388f8ef0a730c7d5626b">BreakpointTriggerCallbacks</a> (<a class="el" href="hyperkd_2header_2debugger_2core_2_state_8h.html#aa35afece6adc9a29a7bf7a2e76476037">PROCESSOR_DEBUGGING_STATE</a> *DbgState, <a class="el" href="_basic_types_8h.html#ae1e6edbbc26d6fbc71a90190d0266018">UINT32</a> ProcessId, <a class="el" href="_basic_types_8h.html#ae1e6edbbc26d6fbc71a90190d0266018">UINT32</a> ThreadId)</td></tr>
<tr class="memdesc:a6228e6bee67f388f8ef0a730c7d5626b"><td class="mdescLeft"> </td><td class="mdescRight">Trigger callback for breakpoint hit. <br /></td></tr>
<tr class="separator:a6228e6bee67f388f8ef0a730c7d5626b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac0e535f6d443deb15a20ffbf8e2252c6" id="r_ac0e535f6d443deb15a20ffbf8e2252c6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#ac0e535f6d443deb15a20ffbf8e2252c6">BreakpointRestoreTheTrapFlagOnceTriggered</a> (<a class="el" href="_basic_types_8h.html#ae1e6edbbc26d6fbc71a90190d0266018">UINT32</a> ProcessId, <a class="el" href="_basic_types_8h.html#ae1e6edbbc26d6fbc71a90190d0266018">UINT32</a> ThreadId)</td></tr>
<tr class="memdesc:ac0e535f6d443deb15a20ffbf8e2252c6"><td class="mdescLeft"> </td><td class="mdescRight">This function makes sure to unset the RFLAGS.TF on next trigger of #DB on the target process/thread. <br /></td></tr>
<tr class="separator:ac0e535f6d443deb15a20ffbf8e2252c6"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a6de84d2bb5c24bf8c4edcbad8e9dc055" id="r_a6de84d2bb5c24bf8c4edcbad8e9dc055"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#a6de84d2bb5c24bf8c4edcbad8e9dc055">BreakpointCheckAndHandleDebugBreakpoint</a> (<a class="el" href="_basic_types_8h.html#ae1e6edbbc26d6fbc71a90190d0266018">UINT32</a> CoreId)</td></tr>
<tr class="memdesc:a6de84d2bb5c24bf8c4edcbad8e9dc055"><td class="mdescLeft"> </td><td class="mdescRight">Check and handle debug breakpoint exceptions. <br /></td></tr>
<tr class="separator:a6de84d2bb5c24bf8c4edcbad8e9dc055"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af932a37c8259ad673a40b551f12f58c8" id="r_af932a37c8259ad673a40b551f12f58c8"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#af932a37c8259ad673a40b551f12f58c8">BreakpointClear</a> (<a class="el" href="hyperkd_2header_2debugger_2core_2_state_8h.html#afc83bebf92c71a6a4203755970b9cf2c">PDEBUGGEE_BP_DESCRIPTOR</a> BreakpointDescriptor)</td></tr>
<tr class="memdesc:af932a37c8259ad673a40b551f12f58c8"><td class="mdescLeft"> </td><td class="mdescRight">clears the 0xcc and removes the breakpoint @detail this function won't remove the descriptor from the list <br /></td></tr>
<tr class="separator:af932a37c8259ad673a40b551f12f58c8"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a15e8a59a7b3e9d6c7fd68539075564c8" id="r_a15e8a59a7b3e9d6c7fd68539075564c8"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_basic_types_8h.html#a7f319bfc2492a2136964194204e7a8cf">VOID</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#a15e8a59a7b3e9d6c7fd68539075564c8">BreakpointClearAndDeallocateMemory</a> (<a class="el" href="hyperkd_2header_2debugger_2core_2_state_8h.html#afc83bebf92c71a6a4203755970b9cf2c">PDEBUGGEE_BP_DESCRIPTOR</a> BreakpointDesc)</td></tr>
<tr class="memdesc:a15e8a59a7b3e9d6c7fd68539075564c8"><td class="mdescLeft"> </td><td class="mdescRight">Clears the breakpoint and remove the entry from the breakpoint list. <br /></td></tr>
<tr class="separator:a15e8a59a7b3e9d6c7fd68539075564c8"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac2d64f1a4448078440fa5e05a511e3bb" id="r_ac2d64f1a4448078440fa5e05a511e3bb"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#ac2d64f1a4448078440fa5e05a511e3bb">BreakpointCheckAndHandleReApplyingBreakpoint</a> (<a class="el" href="_basic_types_8h.html#ae1e6edbbc26d6fbc71a90190d0266018">UINT32</a> CoreId)</td></tr>
<tr class="memdesc:ac2d64f1a4448078440fa5e05a511e3bb"><td class="mdescLeft"> </td><td class="mdescRight">Check and reapply breakpoint. <br /></td></tr>
<tr class="separator:ac2d64f1a4448078440fa5e05a511e3bb"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af249a8d277f3fe6fdeeb1796e537572b" id="r_af249a8d277f3fe6fdeeb1796e537572b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#af249a8d277f3fe6fdeeb1796e537572b">BreakpointCheckAndHandleDebuggerDefinedBreakpoints</a> (<a class="el" href="hyperkd_2header_2debugger_2core_2_state_8h.html#aa35afece6adc9a29a7bf7a2e76476037">PROCESSOR_DEBUGGING_STATE</a> *DbgState, <a class="el" href="_basic_types_8h.html#aae17ebb9ef7279d026817fb22f8aebe9">UINT64</a> GuestRip, <a class="el" href="_connection_8h.html#ac834b5b60f3a3213636632ea482a26a3">DEBUGGEE_PAUSING_REASON</a> Reason, <a class="el" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> ChangeMtfState)</td></tr>
<tr class="memdesc:af249a8d277f3fe6fdeeb1796e537572b"><td class="mdescLeft"> </td><td class="mdescRight">Check if the breakpoint vm-exit relates to 'bp' command or not. <br /></td></tr>
<tr class="separator:af249a8d277f3fe6fdeeb1796e537572b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a025f2b7843dcad65fd555dcd0fc3e830" id="r_a025f2b7843dcad65fd555dcd0fc3e830"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#a025f2b7843dcad65fd555dcd0fc3e830">BreakpointHandleBreakpoints</a> (<a class="el" href="_basic_types_8h.html#ae1e6edbbc26d6fbc71a90190d0266018">UINT32</a> CoreId)</td></tr>
<tr class="memdesc:a025f2b7843dcad65fd555dcd0fc3e830"><td class="mdescLeft"> </td><td class="mdescRight">Handle breakpoint vm-exits (#BP) <br /></td></tr>
<tr class="separator:a025f2b7843dcad65fd555dcd0fc3e830"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:adbfa823a7d6541668573fc9467ee4355" id="r_adbfa823a7d6541668573fc9467ee4355"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#adbfa823a7d6541668573fc9467ee4355">BreakpointWrite</a> (<a class="el" href="hyperkd_2header_2debugger_2core_2_state_8h.html#afc83bebf92c71a6a4203755970b9cf2c">PDEBUGGEE_BP_DESCRIPTOR</a> BreakpointDescriptor)</td></tr>
<tr class="memdesc:adbfa823a7d6541668573fc9467ee4355"><td class="mdescLeft"> </td><td class="mdescRight">writes the 0xcc and applies the breakpoint @detail this function won't remove the descriptor from the list <br /></td></tr>
<tr class="separator:adbfa823a7d6541668573fc9467ee4355"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af5a28890d7cdeb6e697ba8c41d2bbbe7" id="r_af5a28890d7cdeb6e697ba8c41d2bbbe7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_basic_types_8h.html#a7f319bfc2492a2136964194204e7a8cf">VOID</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#af5a28890d7cdeb6e697ba8c41d2bbbe7">BreakpointRemoveAllBreakpoints</a> ()</td></tr>
<tr class="memdesc:af5a28890d7cdeb6e697ba8c41d2bbbe7"><td class="mdescLeft"> </td><td class="mdescRight">Remove all the breakpoints if possible. <br /></td></tr>
<tr class="separator:af5a28890d7cdeb6e697ba8c41d2bbbe7"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a5901425c05d238beb8eef3b70bfb65b5" id="r_a5901425c05d238beb8eef3b70bfb65b5"><td class="memItemLeft" align="right" valign="top"><a class="el" href="hyperkd_2header_2debugger_2core_2_state_8h.html#afc83bebf92c71a6a4203755970b9cf2c">PDEBUGGEE_BP_DESCRIPTOR</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#a5901425c05d238beb8eef3b70bfb65b5">BreakpointGetEntryByBreakpointId</a> (<a class="el" href="_basic_types_8h.html#aae17ebb9ef7279d026817fb22f8aebe9">UINT64</a> BreakpointId)</td></tr>
<tr class="memdesc:a5901425c05d238beb8eef3b70bfb65b5"><td class="mdescLeft"> </td><td class="mdescRight">Find entry of breakpoint descriptor from list of breakpoints by breakpoint id. <br /></td></tr>
<tr class="separator:a5901425c05d238beb8eef3b70bfb65b5"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae7d28c7c329ec9621af580e43f13b412" id="r_ae7d28c7c329ec9621af580e43f13b412"><td class="memItemLeft" align="right" valign="top"><a class="el" href="hyperkd_2header_2debugger_2core_2_state_8h.html#afc83bebf92c71a6a4203755970b9cf2c">PDEBUGGEE_BP_DESCRIPTOR</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#ae7d28c7c329ec9621af580e43f13b412">BreakpointGetEntryByAddress</a> (<a class="el" href="_basic_types_8h.html#aae17ebb9ef7279d026817fb22f8aebe9">UINT64</a> <a class="el" href="_hyper_dbg_script_imports_8h.html#a3f7c5b71d899e923be0a80d4ac7902fe">Address</a>)</td></tr>
<tr class="memdesc:ae7d28c7c329ec9621af580e43f13b412"><td class="mdescLeft"> </td><td class="mdescRight">Find entry of breakpoint descriptor from list of breakpoints by address. <br /></td></tr>
<tr class="separator:ae7d28c7c329ec9621af580e43f13b412"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a295701da4a28b591937893cfbb3dcd75" id="r_a295701da4a28b591937893cfbb3dcd75"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#a295701da4a28b591937893cfbb3dcd75">BreakpointAddNew</a> (<a class="el" href="_request_structures_8h.html#a58c97daf5894ba79ab884e8b85515ad3">PDEBUGGEE_BP_PACKET</a> BpDescriptorArg)</td></tr>
<tr class="memdesc:a295701da4a28b591937893cfbb3dcd75"><td class="mdescLeft"> </td><td class="mdescRight">Add new breakpoints. <br /></td></tr>
<tr class="separator:a295701da4a28b591937893cfbb3dcd75"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a5dc92791e7148a75a6bf701966797b9d" id="r_a5dc92791e7148a75a6bf701966797b9d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_basic_types_8h.html#a7f319bfc2492a2136964194204e7a8cf">VOID</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#a5dc92791e7148a75a6bf701966797b9d">BreakpointListAllBreakpoint</a> ()</td></tr>
<tr class="memdesc:a5dc92791e7148a75a6bf701966797b9d"><td class="mdescLeft"> </td><td class="mdescRight">List all breakpoints. <br /></td></tr>
<tr class="separator:a5dc92791e7148a75a6bf701966797b9d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:acfb2587c2b1380011576fb0f243c4148" id="r_acfb2587c2b1380011576fb0f243c4148"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#acfb2587c2b1380011576fb0f243c4148">BreakpointListOrModify</a> (<a class="el" href="_request_structures_8h.html#ae0b77106e76131900a06635311dd3c2e">PDEBUGGEE_BP_LIST_OR_MODIFY_PACKET</a> ListOrModifyBreakpoints)</td></tr>
<tr class="memdesc:acfb2587c2b1380011576fb0f243c4148"><td class="mdescLeft"> </td><td class="mdescRight">List of modify breakpoints. <br /></td></tr>
<tr class="separator:acfb2587c2b1380011576fb0f243c4148"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Routines for breakpoint commands. </p>
<dl class="section author"><dt>Author</dt><dd>Sina Karvandi (<a href="#" onclick="location.href='mai'+'lto:'+'sin'+'a@'+'hyp'+'er'+'dbg'+'.o'+'rg'; return false;">sina@<span class="obfuscator">.nosp@m.</span>hype<span class="obfuscator">.nosp@m.</span>rdbg.<span class="obfuscator">.nosp@m.</span>org</a>)</dd></dl>
<dl class="section version"><dt>Version</dt><dd>0.1 </dd></dl>
<dl class="section date"><dt>Date</dt><dd>2021-03-12</dd></dl>
<dl class="section copyright"><dt>Copyright</dt><dd>This project is released under the GNU Public License v3. </dd></dl>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a295701da4a28b591937893cfbb3dcd75" name="a295701da4a28b591937893cfbb3dcd75"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a295701da4a28b591937893cfbb3dcd75">◆ </a></span>BreakpointAddNew()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> BreakpointAddNew </td>
<td>(</td>
<td class="paramtype"><a class="el" href="_request_structures_8h.html#a58c97daf5894ba79ab884e8b85515ad3">PDEBUGGEE_BP_PACKET</a></td> <td class="paramname"><span class="paramname"><em>BpDescriptorArg</em></span></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Add new breakpoints. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">BpDescriptor</td><td></td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>BOOLEAN </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 894</span>{</div>
<div class="line"><span class="lineno"> 895</span> <a class="code hl_struct" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html">PDEBUGGEE_BP_DESCRIPTOR</a> BreakpointDescriptor = <a class="code hl_function" href="namespacetest-case-generator.html#a9a4eff80432bb93d2796381610dd86c3">NULL</a>;</div>
<div class="line"><span class="lineno"> 896</span> <a class="code hl_struct" href="struct___c_r3___t_y_p_e.html">CR3_TYPE</a> GuestCr3 = {0};</div>
<div class="line"><span class="lineno"> 897</span> <a class="code hl_typedef" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> IsAddress32Bit = <a class="code hl_define" href="_basic_types_8h.html#aa93f0eb578d23995850d61f7d61c55c1">FALSE</a>;</div>
<div class="line"><span class="lineno"> 898</span> </div>
<div class="line"><span class="lineno"> 899</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 900</span> <span class="comment">// Find the current process cr3</span></div>
<div class="line"><span class="lineno"> 901</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 902</span> GuestCr3.<a class="code hl_variable" href="struct___c_r3___t_y_p_e.html#a04eb96cc99b0458be739bcc9c640e08b">Flags</a> = <a class="code hl_function" href="_layout_8c.html#af74e610cf3ad5dd8c972f536f2809429">LayoutGetCurrentProcessCr3</a>().<a class="code hl_variable" href="struct___c_r3___t_y_p_e.html#a04eb96cc99b0458be739bcc9c640e08b">Flags</a>;</div>
<div class="line"><span class="lineno"> 903</span> </div>
<div class="line"><span class="lineno"> 904</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 905</span> <span class="comment">// *** Validate arguments ***</span></div>
<div class="line"><span class="lineno"> 906</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 907</span> </div>
<div class="line"><span class="lineno"> 908</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 909</span> <span class="comment">// Check if address is safe (only one byte for 0xcc)</span></div>
<div class="line"><span class="lineno"> 910</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 911</span> <span class="keywordflow">if</span> (!<a class="code hl_function" href="_address_check_8c.html#aec71cec56c29db61a23b2997ee8e2059">CheckAccessValidityAndSafety</a>(BpDescriptorArg-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#aa58a4dcb7c01e3412eac7dd3b428f309">Address</a>, <span class="keyword">sizeof</span>(<a class="code hl_typedef" href="_basic_types_8h.html#a4ae1dab0fb4b072a66584546209e7d58">BYTE</a>)))</div>
<div class="line"><span class="lineno"> 912</span> {</div>
<div class="line"><span class="lineno"> 913</span> BpDescriptorArg-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#a31f51c86477913031d2e01f69341620f">Result</a> = <a class="code hl_define" href="_error_codes_8h.html#a68e4d375f85d62fc6169b228d0cb346a">DEBUGGER_ERROR_EDIT_MEMORY_STATUS_INVALID_ADDRESS_BASED_ON_CURRENT_PROCESS</a>;</div>
<div class="line"><span class="lineno"> 914</span> <span class="keywordflow">return</span> <a class="code hl_define" href="_basic_types_8h.html#aa93f0eb578d23995850d61f7d61c55c1">FALSE</a>;</div>
<div class="line"><span class="lineno"> 915</span> }</div>
<div class="line"><span class="lineno"> 916</span> </div>
<div class="line"><span class="lineno"> 917</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 918</span> <span class="comment">// Check if the core number is not invalid</span></div>
<div class="line"><span class="lineno"> 919</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 920</span> <span class="keywordflow">if</span> (BpDescriptorArg-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#a7285098a69927e556cbc61864a1d7e62">Core</a> != <a class="code hl_define" href="_constants_8h.html#aa145d6235b4996c241ae08d13de243a0">DEBUGGEE_BP_APPLY_TO_ALL_CORES</a> &&</div>
<div class="line"><span class="lineno"> 921</span> !<a class="code hl_function" href="hyperkd_2code_2common_2_common_8c.html#aa5308cc9607ad03a4a7ade3bf8c323ac">CommonValidateCoreNumber</a>(BpDescriptorArg-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#a7285098a69927e556cbc61864a1d7e62">Core</a>))</div>
<div class="line"><span class="lineno"> 922</span> {</div>
<div class="line"><span class="lineno"> 923</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 924</span> <span class="comment">// Core is invalid (Set the error)</span></div>
<div class="line"><span class="lineno"> 925</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 926</span> BpDescriptorArg-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#a31f51c86477913031d2e01f69341620f">Result</a> = <a class="code hl_define" href="_error_codes_8h.html#a5a5ccba7c7cceb94d66f297978047611">DEBUGGER_ERROR_INVALID_CORE_ID</a>;</div>
<div class="line"><span class="lineno"> 927</span> <span class="keywordflow">return</span> <a class="code hl_define" href="_basic_types_8h.html#aa93f0eb578d23995850d61f7d61c55c1">FALSE</a>;</div>
<div class="line"><span class="lineno"> 928</span> }</div>
<div class="line"><span class="lineno"> 929</span> </div>
<div class="line"><span class="lineno"> 930</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 931</span> <span class="comment">// Check if breakpoint already exists on list or not</span></div>
<div class="line"><span class="lineno"> 932</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 933</span> <span class="keywordflow">if</span> (<a class="code hl_function" href="#ae7d28c7c329ec9621af580e43f13b412">BreakpointGetEntryByAddress</a>(BpDescriptorArg-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#aa58a4dcb7c01e3412eac7dd3b428f309">Address</a>) != NULL)</div>
<div class="line"><span class="lineno"> 934</span> {</div>
<div class="line"><span class="lineno"> 935</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 936</span> <span class="comment">// Address is already on the list (Set the error)</span></div>
<div class="line"><span class="lineno"> 937</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 938</span> BpDescriptorArg-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#a31f51c86477913031d2e01f69341620f">Result</a> = <a class="code hl_define" href="_error_codes_8h.html#a3b5b126406066bc4844a91c1d07de9ac">DEBUGGER_ERROR_BREAKPOINT_ALREADY_EXISTS_ON_THE_ADDRESS</a>;</div>
<div class="line"><span class="lineno"> 939</span> <span class="keywordflow">return</span> <a class="code hl_define" href="_basic_types_8h.html#aa93f0eb578d23995850d61f7d61c55c1">FALSE</a>;</div>
<div class="line"><span class="lineno"> 940</span> }</div>
<div class="line"><span class="lineno"> 941</span> </div>
<div class="line"><span class="lineno"> 942</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 943</span> <span class="comment">// We won't check for process id and thread id, if these arguments are invalid</span></div>
<div class="line"><span class="lineno"> 944</span> <span class="comment">// then the HyperDbg simply ignores the breakpoints but it makes the computer slow</span></div>
<div class="line"><span class="lineno"> 945</span> <span class="comment">// it just won't be triggered</span></div>
<div class="line"><span class="lineno"> 946</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 947</span> </div>
<div class="line"><span class="lineno"> 948</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 949</span> <span class="comment">// When we reach here means that the arguments are valid and address is</span></div>
<div class="line"><span class="lineno"> 950</span> <span class="comment">// safe to access (put 0xcc)</span></div>
<div class="line"><span class="lineno"> 951</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 952</span> </div>
<div class="line"><span class="lineno"> 953</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 954</span> <span class="comment">// Get the pre-allocated buffer</span></div>
<div class="line"><span class="lineno"> 955</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 956</span> BreakpointDescriptor = (<a class="code hl_struct" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html">DEBUGGEE_BP_DESCRIPTOR</a> *)<a class="code hl_function" href="_pool_manager_8c.html#a065841edb44331344b1a71a2ea397923">PoolManagerRequestPool</a>(<a class="code hl_enumvalue" href="_data_types_8h.html#ad130f0bae4db97169873223d0aad9a63ab8948b7a3ee40226d0f76b7fccf90b9a">BREAKPOINT_DEFINITION_STRUCTURE</a>, <a class="code hl_define" href="_basic_types_8h.html#aa8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>, <span class="keyword">sizeof</span>(<a class="code hl_struct" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html">DEBUGGEE_BP_DESCRIPTOR</a>));</div>
<div class="line"><span class="lineno"> 957</span> </div>
<div class="line"><span class="lineno"> 958</span> <span class="keywordflow">if</span> (BreakpointDescriptor == NULL)</div>
<div class="line"><span class="lineno"> 959</span> {</div>
<div class="line"><span class="lineno"> 960</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 961</span> <span class="comment">// No pool ! Probably the user set more than MAXIMUM_BREAKPOINTS_WITHOUT_CONTINUE</span></div>
<div class="line"><span class="lineno"> 962</span> <span class="comment">// pools without IOCTL (continue)</span></div>
<div class="line"><span class="lineno"> 963</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 964</span> BpDescriptorArg-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#a31f51c86477913031d2e01f69341620f">Result</a> = <a class="code hl_define" href="_error_codes_8h.html#a29e9c99a3400fc71880be5e623e7baaf">DEBUGGER_ERROR_MAXIMUM_BREAKPOINT_WITHOUT_CONTINUE</a>;</div>
<div class="line"><span class="lineno"> 965</span> <span class="keywordflow">return</span> <a class="code hl_define" href="_basic_types_8h.html#aa93f0eb578d23995850d61f7d61c55c1">FALSE</a>;</div>
<div class="line"><span class="lineno"> 966</span> }</div>
<div class="line"><span class="lineno"> 967</span> </div>
<div class="line"><span class="lineno"> 968</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 969</span> <span class="comment">// Copy details of breakpoint to the descriptor structure</span></div>
<div class="line"><span class="lineno"> 970</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 971</span> <a class="code hl_variable" href="hyperkd_2header_2globals_2_global_8h.html#ad09616266c993d19a27d9f414073c0a7">g_MaximumBreakpointId</a>++;</div>
<div class="line"><span class="lineno"> 972</span> BreakpointDescriptor-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#a0600a3a7a748f669bef44b0eb920fd4f">BreakpointId</a> = <a class="code hl_variable" href="hyperkd_2header_2globals_2_global_8h.html#ad09616266c993d19a27d9f414073c0a7">g_MaximumBreakpointId</a>;</div>
<div class="line"><span class="lineno"> 973</span> BreakpointDescriptor-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#a6ee164edb59fd20f9e69048564dd435a">Address</a> = BpDescriptorArg-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#aa58a4dcb7c01e3412eac7dd3b428f309">Address</a>;</div>
<div class="line"><span class="lineno"> 974</span> BreakpointDescriptor-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#ab5f824b8c4d255545d038d3e57231e76">PhysAddress</a> = <a class="code hl_function" href="_conversion_8c.html#ace32f507228d4b1b3b8e53f82ac09402">VirtualAddressToPhysicalAddressByProcessCr3</a>((PVOID)BpDescriptorArg-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#aa58a4dcb7c01e3412eac7dd3b428f309">Address</a>,</div>
<div class="line"><span class="lineno"> 975</span> GuestCr3);</div>
<div class="line"><span class="lineno"> 976</span> BreakpointDescriptor-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#aff66a054304ff0b558bd5e5688cb8e04">Core</a> = BpDescriptorArg-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#a7285098a69927e556cbc61864a1d7e62">Core</a>;</div>
<div class="line"><span class="lineno"> 977</span> BreakpointDescriptor-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#ad46a87a0665b8d99405fec5650ae1eb1">Pid</a> = BpDescriptorArg-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#aae09270daf430ca348d56079a35ed1b8">Pid</a>;</div>
<div class="line"><span class="lineno"> 978</span> BreakpointDescriptor-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#ad787a3220aa8e2b76f31c570f33fd071">Tid</a> = BpDescriptorArg-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#a13aeaf024d8bea5bd40692b08a8ed3ee">Tid</a>;</div>
<div class="line"><span class="lineno"> 979</span> BreakpointDescriptor-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#a1e808c059fbd554f0899ae6b5f2d350e">RemoveAfterHit</a> = BpDescriptorArg-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#a69d6b93ae09e735b05232e69700e0e2f">RemoveAfterHit</a>;</div>
<div class="line"><span class="lineno"> 980</span> BreakpointDescriptor-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#a4fff2e041a08cfbb872eb2ce2838ac17">CheckForCallbacks</a> = BpDescriptorArg-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#a8e09c5b964a09cafcf316b8aea8879fb">CheckForCallbacks</a>;</div>
<div class="line"><span class="lineno"> 981</span> </div>
<div class="line"><span class="lineno"> 982</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 983</span> <span class="comment">// Check whether address is 32-bit or 64-bit</span></div>
<div class="line"><span class="lineno"> 984</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 985</span> <span class="keywordflow">if</span> (BpDescriptorArg-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#aa58a4dcb7c01e3412eac7dd3b428f309">Address</a> & 0xff00000000000000)</div>
<div class="line"><span class="lineno"> 986</span> {</div>
<div class="line"><span class="lineno"> 987</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 988</span> <span class="comment">// This is a kernel-base address and as the kernel is 64-bit, we assume it's a 64-bit address</span></div>
<div class="line"><span class="lineno"> 989</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 990</span> IsAddress32Bit = <a class="code hl_define" href="_basic_types_8h.html#aa93f0eb578d23995850d61f7d61c55c1">FALSE</a>;</div>
<div class="line"><span class="lineno"> 991</span> }</div>
<div class="line"><span class="lineno"> 992</span> <span class="keywordflow">else</span></div>
<div class="line"><span class="lineno"> 993</span> {</div>
<div class="line"><span class="lineno"> 994</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 995</span> <span class="comment">// The address is not a kernel address, thus, we check whether the debuggee is running on user-mode</span></div>
<div class="line"><span class="lineno"> 996</span> <span class="comment">// or not</span></div>
<div class="line"><span class="lineno"> 997</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 998</span> IsAddress32Bit = <a class="code hl_function" href="_kd_8c.html#a814437795a9e923d352b848630625a56">KdIsGuestOnUsermode32Bit</a>();</div>
<div class="line"><span class="lineno"> 999</span> }</div>
<div class="line"><span class="lineno"> 1000</span> </div>
<div class="line"><span class="lineno"> 1001</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 1002</span> <span class="comment">// Use length disassembler engine to get the instruction length</span></div>
<div class="line"><span class="lineno"> 1003</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 1004</span> BreakpointDescriptor-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#a603517c66479592e240eeacb29379803">InstructionLength</a> = (<a class="code hl_typedef" href="_basic_types_8h.html#a09f1a1fb2293e33483cc8d44aefb1eb1">UINT16</a>)<a class="code hl_function" href="_disassembler_8c.html#a387718dcee35d796938ad5f9b9fb1820">DisassemblerLengthDisassembleEngineInVmxRootOnTargetProcess</a>(</div>
<div class="line"><span class="lineno"> 1005</span> (PVOID)BpDescriptorArg-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#aa58a4dcb7c01e3412eac7dd3b428f309">Address</a>,</div>
<div class="line"><span class="lineno"> 1006</span> IsAddress32Bit);</div>
<div class="line"><span class="lineno"> 1007</span> </div>
<div class="line"><span class="lineno"> 1008</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 1009</span> <span class="comment">// Breakpoints are enabled by default</span></div>
<div class="line"><span class="lineno"> 1010</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 1011</span> BreakpointDescriptor-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#aac7e43f351a7b2c5d45e6b058be77036">Enabled</a> = <a class="code hl_define" href="_basic_types_8h.html#aa8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;</div>
<div class="line"><span class="lineno"> 1012</span> </div>
<div class="line"><span class="lineno"> 1013</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 1014</span> <span class="comment">// Now we should add the breakpoint to the list of breakpoints (LIST_ENTRY)</span></div>
<div class="line"><span class="lineno"> 1015</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 1016</span> <a class="code hl_function" href="_windows_8h.html#ad311db6648e5e4e2860aab6164cdb6c1">InsertHeadList</a>(&<a class="code hl_variable" href="hyperkd_2header_2globals_2_global_8h.html#abca944290c6a683f0821a9096472f7d4">g_BreakpointsListHead</a>, &(BreakpointDescriptor-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#a963ede4fbe9776b1b18b53b4e2dff062">BreakpointsList</a>));</div>
<div class="line"><span class="lineno"> 1017</span> </div>
<div class="line"><span class="lineno"> 1018</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 1019</span> <span class="comment">// Apply the breakpoint</span></div>
<div class="line"><span class="lineno"> 1020</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 1021</span> <a class="code hl_function" href="#adbfa823a7d6541668573fc9467ee4355">BreakpointWrite</a>(BreakpointDescriptor);</div>
<div class="line"><span class="lineno"> 1022</span> </div>
<div class="line"><span class="lineno"> 1023</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 1024</span> <span class="comment">// Show that operation was successful</span></div>
<div class="line"><span class="lineno"> 1025</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 1026</span> BpDescriptorArg-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#a31f51c86477913031d2e01f69341620f">Result</a> = <a class="code hl_define" href="_error_codes_8h.html#aed656c58434eecb2d7e8c10e93aecff4">DEBUGGER_OPERATION_WAS_SUCCESSFUL</a>;</div>
<div class="line"><span class="lineno"> 1027</span> </div>
<div class="line"><span class="lineno"> 1028</span> <span class="keywordflow">return</span> <a class="code hl_define" href="_basic_types_8h.html#aa8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;</div>
<div class="line"><span class="lineno"> 1029</span>}</div>
<div class="ttc" id="a_address_check_8c_html_aec71cec56c29db61a23b2997ee8e2059"><div class="ttname"><a href="_address_check_8c.html#aec71cec56c29db61a23b2997ee8e2059">CheckAccessValidityAndSafety</a></div><div class="ttdeci">BOOLEAN CheckAccessValidityAndSafety(UINT64 TargetAddress, UINT32 Size)</div><div class="ttdoc">Check the safety to access the memory.</div><div class="ttdef"><b>Definition</b> AddressCheck.c:156</div></div>
<div class="ttc" id="a_basic_types_8h_html_a09f1a1fb2293e33483cc8d44aefb1eb1"><div class="ttname"><a href="_basic_types_8h.html#a09f1a1fb2293e33483cc8d44aefb1eb1">UINT16</a></div><div class="ttdeci">unsigned short UINT16</div><div class="ttdef"><b>Definition</b> BasicTypes.h:47</div></div>
<div class="ttc" id="a_basic_types_8h_html_a1cb18096b299d23458d3c7b85fd86555"><div class="ttname"><a href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a></div><div class="ttdeci">UCHAR BOOLEAN</div><div class="ttdef"><b>Definition</b> BasicTypes.h:39</div></div>
<div class="ttc" id="a_basic_types_8h_html_a4ae1dab0fb4b072a66584546209e7d58"><div class="ttname"><a href="_basic_types_8h.html#a4ae1dab0fb4b072a66584546209e7d58">BYTE</a></div><div class="ttdeci">unsigned char BYTE</div><div class="ttdef"><b>Definition</b> BasicTypes.h:24</div></div>
<div class="ttc" id="a_basic_types_8h_html_aa8cecfc5c5c054d2875c03e77b7be15d"><div class="ttname"><a href="_basic_types_8h.html#aa8cecfc5c5c054d2875c03e77b7be15d">TRUE</a></div><div class="ttdeci">#define TRUE</div><div class="ttdef"><b>Definition</b> BasicTypes.h:55</div></div>
<div class="ttc" id="a_basic_types_8h_html_aa93f0eb578d23995850d61f7d61c55c1"><div class="ttname"><a href="_basic_types_8h.html#aa93f0eb578d23995850d61f7d61c55c1">FALSE</a></div><div class="ttdeci">#define FALSE</div><div class="ttdef"><b>Definition</b> BasicTypes.h:54</div></div>
<div class="ttc" id="a_breakpoint_commands_8c_html_adbfa823a7d6541668573fc9467ee4355"><div class="ttname"><a href="#adbfa823a7d6541668573fc9467ee4355">BreakpointWrite</a></div><div class="ttdeci">BOOLEAN BreakpointWrite(PDEBUGGEE_BP_DESCRIPTOR BreakpointDescriptor)</div><div class="ttdoc">writes the 0xcc and applies the breakpoint @detail this function won't remove the descriptor from the...</div><div class="ttdef"><b>Definition</b> BreakpointCommands.c:762</div></div>
<div class="ttc" id="a_breakpoint_commands_8c_html_ae7d28c7c329ec9621af580e43f13b412"><div class="ttname"><a href="#ae7d28c7c329ec9621af580e43f13b412">BreakpointGetEntryByAddress</a></div><div class="ttdeci">PDEBUGGEE_BP_DESCRIPTOR BreakpointGetEntryByAddress(UINT64 Address)</div><div class="ttdoc">Find entry of breakpoint descriptor from list of breakpoints by address.</div><div class="ttdef"><b>Definition</b> BreakpointCommands.c:863</div></div>
<div class="ttc" id="a_constants_8h_html_aa145d6235b4996c241ae08d13de243a0"><div class="ttname"><a href="_constants_8h.html#aa145d6235b4996c241ae08d13de243a0">DEBUGGEE_BP_APPLY_TO_ALL_CORES</a></div><div class="ttdeci">#define DEBUGGEE_BP_APPLY_TO_ALL_CORES</div><div class="ttdoc">The constant to apply to all cores for bp command.</div><div class="ttdef"><b>Definition</b> Constants.h:647</div></div>
<div class="ttc" id="a_conversion_8c_html_ace32f507228d4b1b3b8e53f82ac09402"><div class="ttname"><a href="_conversion_8c.html#ace32f507228d4b1b3b8e53f82ac09402">VirtualAddressToPhysicalAddressByProcessCr3</a></div><div class="ttdeci">_Use_decl_annotations_ UINT64 VirtualAddressToPhysicalAddressByProcessCr3(PVOID VirtualAddress, CR3_TYPE TargetCr3)</div><div class="ttdoc">Converts Virtual Address to Physical Address based on a specific process's kernel cr3.</div><div class="ttdef"><b>Definition</b> Conversion.c:215</div></div>
<div class="ttc" id="a_data_types_8h_html_ad130f0bae4db97169873223d0aad9a63ab8948b7a3ee40226d0f76b7fccf90b9a"><div class="ttname"><a href="_data_types_8h.html#ad130f0bae4db97169873223d0aad9a63ab8948b7a3ee40226d0f76b7fccf90b9a">BREAKPOINT_DEFINITION_STRUCTURE</a></div><div class="ttdeci">@ BREAKPOINT_DEFINITION_STRUCTURE</div><div class="ttdef"><b>Definition</b> DataTypes.h:45</div></div>
<div class="ttc" id="a_disassembler_8c_html_a387718dcee35d796938ad5f9b9fb1820"><div class="ttname"><a href="_disassembler_8c.html#a387718dcee35d796938ad5f9b9fb1820">DisassemblerLengthDisassembleEngineInVmxRootOnTargetProcess</a></div><div class="ttdeci">UINT32 DisassemblerLengthDisassembleEngineInVmxRootOnTargetProcess(PVOID Address, BOOLEAN Is32Bit)</div><div class="ttdoc">Disassembler length disassembler engine.</div><div class="ttdef"><b>Definition</b> Disassembler.c:297</div></div>
<div class="ttc" id="a_error_codes_8h_html_a29e9c99a3400fc71880be5e623e7baaf"><div class="ttname"><a href="_error_codes_8h.html#a29e9c99a3400fc71880be5e623e7baaf">DEBUGGER_ERROR_MAXIMUM_BREAKPOINT_WITHOUT_CONTINUE</a></div><div class="ttdeci">#define DEBUGGER_ERROR_MAXIMUM_BREAKPOINT_WITHOUT_CONTINUE</div><div class="ttdoc">error, maximum pools were used without continuing debuggee</div><div class="ttdef"><b>Definition</b> ErrorCodes.h:184</div></div>
<div class="ttc" id="a_error_codes_8h_html_a3b5b126406066bc4844a91c1d07de9ac"><div class="ttname"><a href="_error_codes_8h.html#a3b5b126406066bc4844a91c1d07de9ac">DEBUGGER_ERROR_BREAKPOINT_ALREADY_EXISTS_ON_THE_ADDRESS</a></div><div class="ttdeci">#define DEBUGGER_ERROR_BREAKPOINT_ALREADY_EXISTS_ON_THE_ADDRESS</div><div class="ttdoc">error, breakpoint already exists on the target address</div><div class="ttdef"><b>Definition</b> ErrorCodes.h:190</div></div>
<div class="ttc" id="a_error_codes_8h_html_a5a5ccba7c7cceb94d66f297978047611"><div class="ttname"><a href="_error_codes_8h.html#a5a5ccba7c7cceb94d66f297978047611">DEBUGGER_ERROR_INVALID_CORE_ID</a></div><div class="ttdeci">#define DEBUGGER_ERROR_INVALID_CORE_ID</div><div class="ttdoc">error, the core id is invalid</div><div class="ttdef"><b>Definition</b> ErrorCodes.h:69</div></div>
<div class="ttc" id="a_error_codes_8h_html_a68e4d375f85d62fc6169b228d0cb346a"><div class="ttname"><a href="_error_codes_8h.html#a68e4d375f85d62fc6169b228d0cb346a">DEBUGGER_ERROR_EDIT_MEMORY_STATUS_INVALID_ADDRESS_BASED_ON_CURRENT_PROCESS</a></div><div class="ttdeci">#define DEBUGGER_ERROR_EDIT_MEMORY_STATUS_INVALID_ADDRESS_BASED_ON_CURRENT_PROCESS</div><div class="ttdoc">error, an invalid address is specified based on current cr3 in !e* or e* commands</div><div class="ttdef"><b>Definition</b> ErrorCodes.h:106</div></div>
<div class="ttc" id="a_error_codes_8h_html_aed656c58434eecb2d7e8c10e93aecff4"><div class="ttname"><a href="_error_codes_8h.html#aed656c58434eecb2d7e8c10e93aecff4">DEBUGGER_OPERATION_WAS_SUCCESSFUL</a></div><div class="ttdeci">#define DEBUGGER_OPERATION_WAS_SUCCESSFUL</div><div class="ttdoc">General value to indicate that the operation or request was successful.</div><div class="ttdef"><b>Definition</b> ErrorCodes.h:23</div></div>
<div class="ttc" id="a_kd_8c_html_a814437795a9e923d352b848630625a56"><div class="ttname"><a href="_kd_8c.html#a814437795a9e923d352b848630625a56">KdIsGuestOnUsermode32Bit</a></div><div class="ttdeci">BOOLEAN KdIsGuestOnUsermode32Bit()</div><div class="ttdoc">determines if the guest was in 32-bit user-mode or 64-bit (long mode)</div><div class="ttdef"><b>Definition</b> Kd.c:3107</div></div>
<div class="ttc" id="a_layout_8c_html_af74e610cf3ad5dd8c972f536f2809429"><div class="ttname"><a href="_layout_8c.html#af74e610cf3ad5dd8c972f536f2809429">LayoutGetCurrentProcessCr3</a></div><div class="ttdeci">CR3_TYPE LayoutGetCurrentProcessCr3()</div><div class="ttdoc">Get cr3 of the target running process.</div><div class="ttdef"><b>Definition</b> Layout.c:55</div></div>
<div class="ttc" id="a_pool_manager_8c_html_a065841edb44331344b1a71a2ea397923"><div class="ttname"><a href="_pool_manager_8c.html#a065841edb44331344b1a71a2ea397923">PoolManagerRequestPool</a></div><div class="ttdeci">UINT64 PoolManagerRequestPool(POOL_ALLOCATION_INTENTION Intention, BOOLEAN RequestNewPool, UINT32 Size)</div><div class="ttdoc">This function should be called from vmx-root in order to get a pool from the list.</div><div class="ttdef"><b>Definition</b> PoolManager.c:212</div></div>
<div class="ttc" id="a_windows_8h_html_ad311db6648e5e4e2860aab6164cdb6c1"><div class="ttname"><a href="_windows_8h.html#ad311db6648e5e4e2860aab6164cdb6c1">InsertHeadList</a></div><div class="ttdeci">FORCEINLINE VOID InsertHeadList(_Inout_ PLIST_ENTRY ListHead, _Inout_ PLIST_ENTRY Entry)</div><div class="ttdef"><b>Definition</b> Windows.h:115</div></div>
<div class="ttc" id="ahyperkd_2code_2common_2_common_8c_html_aa5308cc9607ad03a4a7ade3bf8c323ac"><div class="ttname"><a href="hyperkd_2code_2common_2_common_8c.html#aa5308cc9607ad03a4a7ade3bf8c323ac">CommonValidateCoreNumber</a></div><div class="ttdeci">_Use_decl_annotations_ BOOLEAN CommonValidateCoreNumber(UINT32 CoreNumber)</div><div class="ttdoc">Validate core number.</div><div class="ttdef"><b>Definition</b> Common.c:256</div></div>
<div class="ttc" id="ahyperkd_2header_2globals_2_global_8h_html_abca944290c6a683f0821a9096472f7d4"><div class="ttname"><a href="hyperkd_2header_2globals_2_global_8h.html#abca944290c6a683f0821a9096472f7d4">g_BreakpointsListHead</a></div><div class="ttdeci">LIST_ENTRY g_BreakpointsListHead</div><div class="ttdoc">List header of breakpoints for debugger-mode.</div><div class="ttdef"><b>Definition</b> Global.h:91</div></div>
<div class="ttc" id="ahyperkd_2header_2globals_2_global_8h_html_ad09616266c993d19a27d9f414073c0a7"><div class="ttname"><a href="hyperkd_2header_2globals_2_global_8h.html#ad09616266c993d19a27d9f414073c0a7">g_MaximumBreakpointId</a></div><div class="ttdeci">UINT64 g_MaximumBreakpointId</div><div class="ttdoc">Seed for setting id of breakpoints.</div><div class="ttdef"><b>Definition</b> Global.h:97</div></div>
<div class="ttc" id="anamespacetest-case-generator_html_a9a4eff80432bb93d2796381610dd86c3"><div class="ttname"><a href="namespacetest-case-generator.html#a9a4eff80432bb93d2796381610dd86c3">test-case-generator.NULL</a></div><div class="ttdeci">NULL()</div><div class="ttdef"><b>Definition</b> test-case-generator.py:530</div></div>
<div class="ttc" id="astruct___c_r3___t_y_p_e_html"><div class="ttname"><a href="struct___c_r3___t_y_p_e.html">_CR3_TYPE</a></div><div class="ttdoc">CR3 Structure.</div><div class="ttdef"><b>Definition</b> BasicTypes.h:130</div></div>
<div class="ttc" id="astruct___c_r3___t_y_p_e_html_a04eb96cc99b0458be739bcc9c640e08b"><div class="ttname"><a href="struct___c_r3___t_y_p_e.html#a04eb96cc99b0458be739bcc9c640e08b">_CR3_TYPE::Flags</a></div><div class="ttdeci">UINT64 Flags</div><div class="ttdef"><b>Definition</b> BasicTypes.h:133</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r_html"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html">_DEBUGGEE_BP_DESCRIPTOR</a></div><div class="ttdoc">The structure of storing breakpoints.</div><div class="ttdef"><b>Definition</b> State.h:72</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r_html_a0600a3a7a748f669bef44b0eb920fd4f"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#a0600a3a7a748f669bef44b0eb920fd4f">_DEBUGGEE_BP_DESCRIPTOR::BreakpointId</a></div><div class="ttdeci">UINT64 BreakpointId</div><div class="ttdef"><b>Definition</b> State.h:73</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r_html_a1e808c059fbd554f0899ae6b5f2d350e"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#a1e808c059fbd554f0899ae6b5f2d350e">_DEBUGGEE_BP_DESCRIPTOR::RemoveAfterHit</a></div><div class="ttdeci">BOOLEAN RemoveAfterHit</div><div class="ttdef"><b>Definition</b> State.h:85</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r_html_a4fff2e041a08cfbb872eb2ce2838ac17"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#a4fff2e041a08cfbb872eb2ce2838ac17">_DEBUGGEE_BP_DESCRIPTOR::CheckForCallbacks</a></div><div class="ttdeci">BOOLEAN CheckForCallbacks</div><div class="ttdef"><b>Definition</b> State.h:86</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r_html_a603517c66479592e240eeacb29379803"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#a603517c66479592e240eeacb29379803">_DEBUGGEE_BP_DESCRIPTOR::InstructionLength</a></div><div class="ttdeci">UINT16 InstructionLength</div><div class="ttdef"><b>Definition</b> State.h:81</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r_html_a6ee164edb59fd20f9e69048564dd435a"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#a6ee164edb59fd20f9e69048564dd435a">_DEBUGGEE_BP_DESCRIPTOR::Address</a></div><div class="ttdeci">UINT64 Address</div><div class="ttdef"><b>Definition</b> State.h:76</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r_html_a963ede4fbe9776b1b18b53b4e2dff062"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#a963ede4fbe9776b1b18b53b4e2dff062">_DEBUGGEE_BP_DESCRIPTOR::BreakpointsList</a></div><div class="ttdeci">LIST_ENTRY BreakpointsList</div><div class="ttdef"><b>Definition</b> State.h:74</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r_html_aac7e43f351a7b2c5d45e6b058be77036"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#aac7e43f351a7b2c5d45e6b058be77036">_DEBUGGEE_BP_DESCRIPTOR::Enabled</a></div><div class="ttdeci">BOOLEAN Enabled</div><div class="ttdef"><b>Definition</b> State.h:75</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r_html_ab5f824b8c4d255545d038d3e57231e76"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#ab5f824b8c4d255545d038d3e57231e76">_DEBUGGEE_BP_DESCRIPTOR::PhysAddress</a></div><div class="ttdeci">UINT64 PhysAddress</div><div class="ttdef"><b>Definition</b> State.h:77</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r_html_ad46a87a0665b8d99405fec5650ae1eb1"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#ad46a87a0665b8d99405fec5650ae1eb1">_DEBUGGEE_BP_DESCRIPTOR::Pid</a></div><div class="ttdeci">UINT32 Pid</div><div class="ttdef"><b>Definition</b> State.h:78</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r_html_ad787a3220aa8e2b76f31c570f33fd071"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#ad787a3220aa8e2b76f31c570f33fd071">_DEBUGGEE_BP_DESCRIPTOR::Tid</a></div><div class="ttdeci">UINT32 Tid</div><div class="ttdef"><b>Definition</b> State.h:79</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r_html_aff66a054304ff0b558bd5e5688cb8e04"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#aff66a054304ff0b558bd5e5688cb8e04">_DEBUGGEE_BP_DESCRIPTOR::Core</a></div><div class="ttdeci">UINT32 Core</div><div class="ttdef"><b>Definition</b> State.h:80</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t_html_a13aeaf024d8bea5bd40692b08a8ed3ee"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#a13aeaf024d8bea5bd40692b08a8ed3ee">_DEBUGGEE_BP_PACKET::Tid</a></div><div class="ttdeci">UINT32 Tid</div><div class="ttdef"><b>Definition</b> RequestStructures.h:1063</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t_html_a31f51c86477913031d2e01f69341620f"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#a31f51c86477913031d2e01f69341620f">_DEBUGGEE_BP_PACKET::Result</a></div><div class="ttdeci">UINT32 Result</div><div class="ttdef"><b>Definition</b> RequestStructures.h:1067</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t_html_a69d6b93ae09e735b05232e69700e0e2f"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#a69d6b93ae09e735b05232e69700e0e2f">_DEBUGGEE_BP_PACKET::RemoveAfterHit</a></div><div class="ttdeci">BOOLEAN RemoveAfterHit</div><div class="ttdef"><b>Definition</b> RequestStructures.h:1065</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t_html_a7285098a69927e556cbc61864a1d7e62"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#a7285098a69927e556cbc61864a1d7e62">_DEBUGGEE_BP_PACKET::Core</a></div><div class="ttdeci">UINT32 Core</div><div class="ttdef"><b>Definition</b> RequestStructures.h:1064</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t_html_a8e09c5b964a09cafcf316b8aea8879fb"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#a8e09c5b964a09cafcf316b8aea8879fb">_DEBUGGEE_BP_PACKET::CheckForCallbacks</a></div><div class="ttdeci">BOOLEAN CheckForCallbacks</div><div class="ttdef"><b>Definition</b> RequestStructures.h:1066</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t_html_aa58a4dcb7c01e3412eac7dd3b428f309"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#aa58a4dcb7c01e3412eac7dd3b428f309">_DEBUGGEE_BP_PACKET::Address</a></div><div class="ttdeci">UINT64 Address</div><div class="ttdef"><b>Definition</b> RequestStructures.h:1061</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t_html_aae09270daf430ca348d56079a35ed1b8"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_e___b_p___p_a_c_k_e_t.html#aae09270daf430ca348d56079a35ed1b8">_DEBUGGEE_BP_PACKET::Pid</a></div><div class="ttdeci">UINT32 Pid</div><div class="ttdef"><b>Definition</b> RequestStructures.h:1062</div></div>
</div><!-- fragment -->
</div>
</div>
<a id="a6de84d2bb5c24bf8c4edcbad8e9dc055" name="a6de84d2bb5c24bf8c4edcbad8e9dc055"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6de84d2bb5c24bf8c4edcbad8e9dc055">◆ </a></span>BreakpointCheckAndHandleDebugBreakpoint()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> BreakpointCheckAndHandleDebugBreakpoint </td>
<td>(</td>
<td class="paramtype"><a class="el" href="_basic_types_8h.html#ae1e6edbbc26d6fbc71a90190d0266018">UINT32</a></td> <td class="paramname"><span class="paramname"><em>CoreId</em></span></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Check and handle debug breakpoint exceptions. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">CoreId</td><td></td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>BOOLEAN </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 239</span>{</div>
<div class="line"><span class="lineno"> 240</span> <a class="code hl_typedef" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> TrapSetByDebugger;</div>
<div class="line"><span class="lineno"> 241</span> <a class="code hl_struct" href="struct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e.html">PROCESSOR_DEBUGGING_STATE</a> * DbgState = &<a class="code hl_variable" href="hyperkd_2header_2globals_2_global_8h.html#a349ee1adc363d2e4323a35a68fae5646">g_DbgState</a>[CoreId];</div>
<div class="line"><span class="lineno"> 242</span> <a class="code hl_typedef" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> HandledByDebuggerRoutines = <a class="code hl_define" href="_basic_types_8h.html#aa8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;</div>
<div class="line"><span class="lineno"> 243</span> </div>
<div class="line"><span class="lineno"> 244</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 245</span> <span class="comment">// *** Check whether anything should be changed with trap-flags</span></div>
<div class="line"><span class="lineno"> 246</span> <span class="comment">// and also it indicates whether the debugger itself set this trap</span></div>
<div class="line"><span class="lineno"> 247</span> <span class="comment">// flag or it's not supposed to be set by the debugger ***</span></div>
<div class="line"><span class="lineno"> 248</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 249</span> <span class="keywordflow">if</span> (<a class="code hl_function" href="#a70160ffe7c755f58fbe996b53a0405da">BreakpointCheckAndPerformActionsOnTrapFlags</a>(<a class="code hl_define" href="_meta_macros_8h.html#ad790279846c85a5a453f2e7a4e02abad">HANDLE_TO_UINT32</a>(PsGetCurrentProcessId()),</div>
<div class="line"><span class="lineno"> 250</span> <a class="code hl_define" href="_meta_macros_8h.html#ad790279846c85a5a453f2e7a4e02abad">HANDLE_TO_UINT32</a>(PsGetCurrentThreadId()),</div>
<div class="line"><span class="lineno"> 251</span> &TrapSetByDebugger))</div>
<div class="line"><span class="lineno"> 252</span> {</div>
<div class="line"><span class="lineno"> 253</span> <span class="keywordflow">if</span> (DbgState-><a class="code hl_variable" href="struct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e.html#a8f17ce3238c1b7fcd0e8a53040cba548">ThreadOrProcessTracingDetails</a>.<a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___p_r_o_c_e_s_s___o_r___t_h_r_e_a_d___t_r_a_c_i_n_g___d_e_t_a_i_l_s.html#a828cb9812e870d901c9397930c02a451">DebugRegisterInterceptionState</a>)</div>
<div class="line"><span class="lineno"> 254</span> {</div>
<div class="line"><span class="lineno"> 255</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 256</span> <span class="comment">// This check was to show whether it is because of thread change detection or not</span></div>
<div class="line"><span class="lineno"> 257</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 258</span> </div>
<div class="line"><span class="lineno"> 259</span> <span class="comment">// This way of handling has a problem, if the user set to change</span></div>
<div class="line"><span class="lineno"> 260</span> <span class="comment">// the thread and instead of using 'g', it pressed the 'p' to</span></div>
<div class="line"><span class="lineno"> 261</span> <span class="comment">// set or a trap happens somewhere then will be ignored</span></div>
<div class="line"><span class="lineno"> 262</span> <span class="comment">// it because we don't know the origin of this debug breakpoint</span></div>
<div class="line"><span class="lineno"> 263</span> <span class="comment">// and it only happens on '.thread2' command, the correct way</span></div>
<div class="line"><span class="lineno"> 264</span> <span class="comment">// to handle it is to find the exact hw debug register that caused</span></div>
<div class="line"><span class="lineno"> 265</span> <span class="comment">// this vm-exit, but it's a really rare case, so we left it without</span></div>
<div class="line"><span class="lineno"> 266</span> <span class="comment">// handling this case</span></div>
<div class="line"><span class="lineno"> 267</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 268</span> <a class="code hl_function" href="_thread_8c.html#a2d1b8ef9edfc052394e1b64cf6daf3d3">ThreadHandleThreadChange</a>(DbgState);</div>
<div class="line"><span class="lineno"> 269</span> }</div>
<div class="line"><span class="lineno"> 270</span> <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="hyperkd_2header_2globals_2_global_8h.html#ae304ded1a8cbb4e772d97aec7510c9d2">g_UserDebuggerState</a> == <a class="code hl_define" href="_basic_types_8h.html#aa8cecfc5c5c054d2875c03e77b7be15d">TRUE</a> &&</div>
<div class="line"><span class="lineno"> 271</span> (<a class="code hl_variable" href="hyperkd_2header_2globals_2_global_8h.html#ae4b7e6d3d73fbc5e36dab0e432cfda0e">g_IsWaitingForUserModeProcessEntryToBeCalled</a> || <a class="code hl_variable" href="hyperkd_2header_2globals_2_global_8h.html#a0b03446aa090036e1c29277857de9596">g_IsWaitingForReturnAndRunFromPageFault</a>))</div>
<div class="line"><span class="lineno"> 272</span> {</div>
<div class="line"><span class="lineno"> 273</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 274</span> <span class="comment">// Handle for user-mode attaching mechanism</span></div>
<div class="line"><span class="lineno"> 275</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 276</span> <a class="code hl_function" href="_attaching_8c.html#adadde19c6465b57b781fff52e7f8db85">AttachingHandleEntrypointInterception</a>(DbgState);</div>
<div class="line"><span class="lineno"> 277</span> }</div>
<div class="line"><span class="lineno"> 278</span> <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="hyperkd_2header_2globals_2_global_8h.html#ae4b5afa957e3e26377135b91b60eda4e">g_KernelDebuggerState</a> == <a class="code hl_define" href="_basic_types_8h.html#aa8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>)</div>
<div class="line"><span class="lineno"> 279</span> {</div>
<div class="line"><span class="lineno"> 280</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 281</span> <span class="comment">// Here we added the handler for the kernel because we want</span></div>
<div class="line"><span class="lineno"> 282</span> <span class="comment">// stepping routines to work, even if the debugger masks the</span></div>
<div class="line"><span class="lineno"> 283</span> <span class="comment">// traps by using 'test trap off', so stepping still works</span></div>
<div class="line"><span class="lineno"> 284</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 285</span> </div>
<div class="line"><span class="lineno"> 286</span> </div>
<div class="line"><span class="lineno"> 287</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 288</span> <span class="comment">// Handle debug events (breakpoint, traps, hardware debug register when kernel</span></div>
<div class="line"><span class="lineno"> 289</span> <span class="comment">// debugger is attached)</span></div>
<div class="line"><span class="lineno"> 290</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 291</span> <a class="code hl_function" href="_kd_8c.html#af7edea2d3f08ab8587b3048031d3cddd">KdHandleDebugEventsWhenKernelDebuggerIsAttached</a>(DbgState, TrapSetByDebugger);</div>
<div class="line"><span class="lineno"> 292</span> }</div>
<div class="line"><span class="lineno"> 293</span> <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code hl_function" href="_ud_8c.html#a5ebe34618715108270c71344983e4af3">UdCheckAndHandleBreakpointsAndDebugBreaks</a>(DbgState,</div>
<div class="line"><span class="lineno"> 294</span> <a class="code hl_enumvalue" href="_connection_8h.html#a6e2be89205e735ebae644cf4850ac21ba369b24d73385054023d8aba1a5d3c8b5">DEBUGGEE_PAUSING_REASON_DEBUGGEE_GENERAL_DEBUG_BREAK</a>,</div>
<div class="line"><span class="lineno"> 295</span> NULL))</div>
<div class="line"><span class="lineno"> 296</span> {</div>
<div class="line"><span class="lineno"> 297</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 298</span> <span class="comment">// if the above function returns true, no need for further action</span></div>
<div class="line"><span class="lineno"> 299</span> <span class="comment">// it's handled in the user debugger</span></div>
<div class="line"><span class="lineno"> 300</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 301</span> }</div>
<div class="line"><span class="lineno"> 302</span> <span class="keywordflow">else</span></div>
<div class="line"><span class="lineno"> 303</span> {</div>
<div class="line"><span class="lineno"> 304</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 305</span> <span class="comment">// Here it means that the trap is supposed to be handled by</span></div>
<div class="line"><span class="lineno"> 306</span> <span class="comment">// HyperDbg but, we couldn't find any routines that gonna</span></div>
<div class="line"><span class="lineno"> 307</span> <span class="comment">// handle it (it's probably an error)</span></div>
<div class="line"><span class="lineno"> 308</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 309</span> HandledByDebuggerRoutines = <a class="code hl_define" href="_basic_types_8h.html#aa93f0eb578d23995850d61f7d61c55c1">FALSE</a>;</div>
<div class="line"><span class="lineno"> 310</span> <a class="code hl_define" href="_hyper_dbg_hyper_log_intrinsics_8h.html#a459b19922fecfbb9438dd56b66930d16">LogError</a>(<span class="stringliteral">"Err, trap is supposed to be handled by the debugger, but none of routines handled it"</span>);</div>
<div class="line"><span class="lineno"> 311</span> }</div>
<div class="line"><span class="lineno"> 312</span> }</div>
<div class="line"><span class="lineno"> 313</span> <span class="keywordflow">else</span></div>
<div class="line"><span class="lineno"> 314</span> {</div>
<div class="line"><span class="lineno"> 315</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 316</span> <span class="comment">// *** it's not supposed to be handled by the debugger routines, the guest</span></div>
<div class="line"><span class="lineno"> 317</span> <span class="comment">// or the target debuggee throws a debug break (#DB) ***</span></div>
<div class="line"><span class="lineno"> 318</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 319</span> </div>
<div class="line"><span class="lineno"> 320</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 321</span> <span class="comment">// It means that it's not handled by the debugger routines</span></div>
<div class="line"><span class="lineno"> 322</span> <span class="comment">// By default HyperDbg intercepts all #DBs and break the debugger if</span></div>
<div class="line"><span class="lineno"> 323</span> <span class="comment">// it's attached to the debugger, otherwise injects to the guest VM</span></div>
<div class="line"><span class="lineno"> 324</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 325</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="hyperkd_2header_2globals_2_global_8h.html#a2d64c12c84c91be0812df1e4b4c74b58">g_InterceptDebugBreaks</a>)</div>
<div class="line"><span class="lineno"> 326</span> {</div>
<div class="line"><span class="lineno"> 327</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 328</span> <span class="comment">// The user explicitly told the debugger not to intercept any</span></div>
<div class="line"><span class="lineno"> 329</span> <span class="comment">// traps (e.g., by using 'test trap off')</span></div>
<div class="line"><span class="lineno"> 330</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 331</span> HandledByDebuggerRoutines = <a class="code hl_define" href="_basic_types_8h.html#aa93f0eb578d23995850d61f7d61c55c1">FALSE</a>;</div>
<div class="line"><span class="lineno"> 332</span> }</div>
<div class="line"><span class="lineno"> 333</span> <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="hyperkd_2header_2globals_2_global_8h.html#ae4b5afa957e3e26377135b91b60eda4e">g_KernelDebuggerState</a> == <a class="code hl_define" href="_basic_types_8h.html#aa8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>)</div>
<div class="line"><span class="lineno"> 334</span> {</div>
<div class="line"><span class="lineno"> 335</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 336</span> <span class="comment">// Handle debug events (breakpoint, traps, hardware debug register when kernel</span></div>
<div class="line"><span class="lineno"> 337</span> <span class="comment">// debugger is attached)</span></div>
<div class="line"><span class="lineno"> 338</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 339</span> <a class="code hl_function" href="_kd_8c.html#af7edea2d3f08ab8587b3048031d3cddd">KdHandleDebugEventsWhenKernelDebuggerIsAttached</a>(DbgState, TrapSetByDebugger);</div>
<div class="line"><span class="lineno"> 340</span> }</div>
<div class="line"><span class="lineno"> 341</span> <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code hl_function" href="_ud_8c.html#a5ebe34618715108270c71344983e4af3">UdCheckAndHandleBreakpointsAndDebugBreaks</a>(DbgState,</div>
<div class="line"><span class="lineno"> 342</span> <a class="code hl_enumvalue" href="_connection_8h.html#a6e2be89205e735ebae644cf4850ac21ba369b24d73385054023d8aba1a5d3c8b5">DEBUGGEE_PAUSING_REASON_DEBUGGEE_GENERAL_DEBUG_BREAK</a>,</div>
<div class="line"><span class="lineno"> 343</span> NULL))</div>
<div class="line"><span class="lineno"> 344</span> {</div>
<div class="line"><span class="lineno"> 345</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 346</span> <span class="comment">// if the above function returns true, no need for further action</span></div>
<div class="line"><span class="lineno"> 347</span> <span class="comment">// it's handled in the user debugger</span></div>
<div class="line"><span class="lineno"> 348</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 349</span> }</div>
<div class="line"><span class="lineno"> 350</span> <span class="keywordflow">else</span></div>
<div class="line"><span class="lineno"> 351</span> {</div>
<div class="line"><span class="lineno"> 352</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 353</span> <span class="comment">// Inject to back to the guest as it's not either handled by the kernel debugger</span></div>
<div class="line"><span class="lineno"> 354</span> <span class="comment">// routines or the user debugger</span></div>
<div class="line"><span class="lineno"> 355</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 356</span> HandledByDebuggerRoutines = <a class="code hl_define" href="_basic_types_8h.html#aa93f0eb578d23995850d61f7d61c55c1">FALSE</a>;</div>
<div class="line"><span class="lineno"> 357</span> }</div>
<div class="line"><span class="lineno"> 358</span> }</div>
<div class="line"><span class="lineno"> 359</span> </div>
<div class="line"><span class="lineno"> 360</span> <span class="keywordflow">return</span> HandledByDebuggerRoutines;</div>
<div class="line"><span class="lineno"> 361</span>}</div>
<div class="ttc" id="a_attaching_8c_html_adadde19c6465b57b781fff52e7f8db85"><div class="ttname"><a href="_attaching_8c.html#adadde19c6465b57b781fff52e7f8db85">AttachingHandleEntrypointInterception</a></div><div class="ttdeci">VOID AttachingHandleEntrypointInterception(PROCESSOR_DEBUGGING_STATE *DbgState)</div><div class="ttdoc">Handle the interception of finding the entrypoint on attaching to user-mode process.</div><div class="ttdef"><b>Definition</b> Attaching.c:436</div></div>
<div class="ttc" id="a_breakpoint_commands_8c_html_a70160ffe7c755f58fbe996b53a0405da"><div class="ttname"><a href="#a70160ffe7c755f58fbe996b53a0405da">BreakpointCheckAndPerformActionsOnTrapFlags</a></div><div class="ttdeci">BOOLEAN BreakpointCheckAndPerformActionsOnTrapFlags(UINT32 ProcessId, UINT32 ThreadId, BOOLEAN *TrapSetByDebugger)</div><div class="ttdoc">Check and perform actions on RFLAGS.TF.</div><div class="ttdef"><b>Definition</b> BreakpointCommands.c:23</div></div>
<div class="ttc" id="a_connection_8h_html_a6e2be89205e735ebae644cf4850ac21ba369b24d73385054023d8aba1a5d3c8b5"><div class="ttname"><a href="_connection_8h.html#a6e2be89205e735ebae644cf4850ac21ba369b24d73385054023d8aba1a5d3c8b5">DEBUGGEE_PAUSING_REASON_DEBUGGEE_GENERAL_DEBUG_BREAK</a></div><div class="ttdeci">@ DEBUGGEE_PAUSING_REASON_DEBUGGEE_GENERAL_DEBUG_BREAK</div><div class="ttdef"><b>Definition</b> Connection.h:41</div></div>
<div class="ttc" id="a_hyper_dbg_hyper_log_intrinsics_8h_html_a459b19922fecfbb9438dd56b66930d16"><div class="ttname"><a href="_hyper_dbg_hyper_log_intrinsics_8h.html#a459b19922fecfbb9438dd56b66930d16">LogError</a></div><div class="ttdeci">#define LogError(format,...)</div><div class="ttdoc">Log in the case of error.</div><div class="ttdef"><b>Definition</b> HyperDbgHyperLogIntrinsics.h:113</div></div>
<div class="ttc" id="a_kd_8c_html_af7edea2d3f08ab8587b3048031d3cddd"><div class="ttname"><a href="_kd_8c.html#af7edea2d3f08ab8587b3048031d3cddd">KdHandleDebugEventsWhenKernelDebuggerIsAttached</a></div><div class="ttdeci">VOID KdHandleDebugEventsWhenKernelDebuggerIsAttached(PROCESSOR_DEBUGGING_STATE *DbgState, BOOLEAN TrapSetByDebugger)</div><div class="ttdoc">Handles debug events when kernel-debugger is attached.</div><div class="ttdef"><b>Definition</b> Kd.c:426</div></div>
<div class="ttc" id="a_meta_macros_8h_html_ad790279846c85a5a453f2e7a4e02abad"><div class="ttname"><a href="_meta_macros_8h.html#ad790279846c85a5a453f2e7a4e02abad">HANDLE_TO_UINT32</a></div><div class="ttdeci">#define HANDLE_TO_UINT32(_var)</div><div class="ttdef"><b>Definition</b> MetaMacros.h:39</div></div>
<div class="ttc" id="a_thread_8c_html_a2d1b8ef9edfc052394e1b64cf6daf3d3"><div class="ttname"><a href="_thread_8c.html#a2d1b8ef9edfc052394e1b64cf6daf3d3">ThreadHandleThreadChange</a></div><div class="ttdeci">BOOLEAN ThreadHandleThreadChange(PROCESSOR_DEBUGGING_STATE *DbgState)</div><div class="ttdoc">handle thread changes</div><div class="ttdef"><b>Definition</b> Thread.c:22</div></div>
<div class="ttc" id="a_ud_8c_html_a5ebe34618715108270c71344983e4af3"><div class="ttname"><a href="_ud_8c.html#a5ebe34618715108270c71344983e4af3">UdCheckAndHandleBreakpointsAndDebugBreaks</a></div><div class="ttdeci">BOOLEAN UdCheckAndHandleBreakpointsAndDebugBreaks(PROCESSOR_DEBUGGING_STATE *DbgState, DEBUGGEE_PAUSING_REASON Reason, PDEBUGGER_TRIGGERED_EVENT_DETAILS EventDetails)</div><div class="ttdoc">Handle #DBs and #BPs for kernel debugger.</div><div class="ttdef"><b>Definition</b> Ud.c:443</div></div>
<div class="ttc" id="ahyperkd_2header_2globals_2_global_8h_html_a0b03446aa090036e1c29277857de9596"><div class="ttname"><a href="hyperkd_2header_2globals_2_global_8h.html#a0b03446aa090036e1c29277857de9596">g_IsWaitingForReturnAndRunFromPageFault</a></div><div class="ttdeci">BOOLEAN g_IsWaitingForReturnAndRunFromPageFault</div><div class="ttdoc">Whether the thread attaching mechanism is waiting for a page-fault finish or not.</div><div class="ttdef"><b>Definition</b> Global.h:146</div></div>
<div class="ttc" id="ahyperkd_2header_2globals_2_global_8h_html_a2d64c12c84c91be0812df1e4b4c74b58"><div class="ttname"><a href="hyperkd_2header_2globals_2_global_8h.html#a2d64c12c84c91be0812df1e4b4c74b58">g_InterceptDebugBreaks</a></div><div class="ttdeci">BOOLEAN g_InterceptDebugBreaks</div><div class="ttdoc">shows whether the debugger should intercept breakpoints (#DB) or not</div><div class="ttdef"><b>Definition</b> Global.h:121</div></div>
<div class="ttc" id="ahyperkd_2header_2globals_2_global_8h_html_a349ee1adc363d2e4323a35a68fae5646"><div class="ttname"><a href="hyperkd_2header_2globals_2_global_8h.html#a349ee1adc363d2e4323a35a68fae5646">g_DbgState</a></div><div class="ttdeci">PROCESSOR_DEBUGGING_STATE * g_DbgState</div><div class="ttdoc">Save the state and variables related to debugging on each to logical core.</div><div class="ttdef"><b>Definition</b> Global.h:17</div></div>
<div class="ttc" id="ahyperkd_2header_2globals_2_global_8h_html_ae304ded1a8cbb4e772d97aec7510c9d2"><div class="ttname"><a href="hyperkd_2header_2globals_2_global_8h.html#ae304ded1a8cbb4e772d97aec7510c9d2">g_UserDebuggerState</a></div><div class="ttdeci">BOOLEAN g_UserDebuggerState</div><div class="ttdoc">shows whether the user debugger is enabled or disabled</div><div class="ttdef"><b>Definition</b> Global.h:109</div></div>
<div class="ttc" id="ahyperkd_2header_2globals_2_global_8h_html_ae4b5afa957e3e26377135b91b60eda4e"><div class="ttname"><a href="hyperkd_2header_2globals_2_global_8h.html#ae4b5afa957e3e26377135b91b60eda4e">g_KernelDebuggerState</a></div><div class="ttdeci">BOOLEAN g_KernelDebuggerState</div><div class="ttdoc">shows whether the kernel debugger is enabled or disabled</div><div class="ttdef"><b>Definition</b> Global.h:103</div></div>
<div class="ttc" id="ahyperkd_2header_2globals_2_global_8h_html_ae4b7e6d3d73fbc5e36dab0e432cfda0e"><div class="ttname"><a href="hyperkd_2header_2globals_2_global_8h.html#ae4b7e6d3d73fbc5e36dab0e432cfda0e">g_IsWaitingForUserModeProcessEntryToBeCalled</a></div><div class="ttdeci">BOOLEAN g_IsWaitingForUserModeProcessEntryToBeCalled</div><div class="ttdoc">Whether the thread attaching mechanism is waiting for #DB or not.</div><div class="ttdef"><b>Definition</b> Global.h:158</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_e___p_r_o_c_e_s_s___o_r___t_h_r_e_a_d___t_r_a_c_i_n_g___d_e_t_a_i_l_s_html_a828cb9812e870d901c9397930c02a451"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_e___p_r_o_c_e_s_s___o_r___t_h_r_e_a_d___t_r_a_c_i_n_g___d_e_t_a_i_l_s.html#a828cb9812e870d901c9397930c02a451">_DEBUGGEE_PROCESS_OR_THREAD_TRACING_DETAILS::DebugRegisterInterceptionState</a></div><div class="ttdeci">BOOLEAN DebugRegisterInterceptionState</div><div class="ttdef"><b>Definition</b> State.h:56</div></div>
<div class="ttc" id="astruct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e_html"><div class="ttname"><a href="struct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e.html">_PROCESSOR_DEBUGGING_STATE</a></div><div class="ttdoc">Saves the debugger state.</div><div class="ttdef"><b>Definition</b> State.h:165</div></div>
<div class="ttc" id="astruct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e_html_a8f17ce3238c1b7fcd0e8a53040cba548"><div class="ttname"><a href="struct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e.html#a8f17ce3238c1b7fcd0e8a53040cba548">_PROCESSOR_DEBUGGING_STATE::ThreadOrProcessTracingDetails</a></div><div class="ttdeci">DEBUGGEE_PROCESS_OR_THREAD_TRACING_DETAILS ThreadOrProcessTracingDetails</div><div class="ttdef"><b>Definition</b> State.h:178</div></div>
</div><!-- fragment -->
</div>
</div>
<a id="af249a8d277f3fe6fdeeb1796e537572b" name="af249a8d277f3fe6fdeeb1796e537572b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af249a8d277f3fe6fdeeb1796e537572b">◆ </a></span>BreakpointCheckAndHandleDebuggerDefinedBreakpoints()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> BreakpointCheckAndHandleDebuggerDefinedBreakpoints </td>
<td>(</td>
<td class="paramtype"><a class="el" href="hyperkd_2header_2debugger_2core_2_state_8h.html#aa35afece6adc9a29a7bf7a2e76476037">PROCESSOR_DEBUGGING_STATE</a> *</td> <td class="paramname"><span class="paramname"><em>DbgState</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="_basic_types_8h.html#aae17ebb9ef7279d026817fb22f8aebe9">UINT64</a></td> <td class="paramname"><span class="paramname"><em>GuestRip</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="_connection_8h.html#ac834b5b60f3a3213636632ea482a26a3">DEBUGGEE_PAUSING_REASON</a></td> <td class="paramname"><span class="paramname"><em>Reason</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a></td> <td class="paramname"><span class="paramname"><em>ChangeMtfState</em></span> )</td>
</tr>
</table>
</div><div class="memdoc">
<p>Check if the breakpoint vm-exit relates to 'bp' command or not. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">DbgState</td><td>The state of the debugger on the current core </td></tr>
<tr><td class="paramname">GuestRip</td><td></td></tr>
<tr><td class="paramname">Reason</td><td></td></tr>
<tr><td class="paramname">ChangeMtfState</td><td></td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>BOOLEAN </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 501</span>{</div>
<div class="line"><span class="lineno"> 502</span> <a class="code hl_struct" href="struct___c_r3___t_y_p_e.html">CR3_TYPE</a> GuestCr3 = {0};</div>
<div class="line"><span class="lineno"> 503</span> <a class="code hl_typedef" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> IsHandledByBpRoutines = <a class="code hl_define" href="_basic_types_8h.html#aa93f0eb578d23995850d61f7d61c55c1">FALSE</a>;</div>
<div class="line"><span class="lineno"> 504</span> PLIST_ENTRY TempList = 0;</div>
<div class="line"><span class="lineno"> 505</span> <a class="code hl_typedef" href="_basic_types_8h.html#aae17ebb9ef7279d026817fb22f8aebe9">UINT64</a> GuestRipPhysical = (<a class="code hl_typedef" href="_basic_types_8h.html#aae17ebb9ef7279d026817fb22f8aebe9">UINT64</a>)NULL;</div>
<div class="line"><span class="lineno"> 506</span> <a class="code hl_struct" href="struct___d_e_b_u_g_g_e_r___t_r_i_g_g_e_r_e_d___e_v_e_n_t___d_e_t_a_i_l_s.html">DEBUGGER_TRIGGERED_EVENT_DETAILS</a> TargetContext = {0};</div>
<div class="line"><span class="lineno"> 507</span> RFLAGS Rflags = {0};</div>
<div class="line"><span class="lineno"> 508</span> <a class="code hl_typedef" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> AvoidUnsetMtf = <a class="code hl_define" href="_basic_types_8h.html#aa93f0eb578d23995850d61f7d61c55c1">FALSE</a>;</div>
<div class="line"><span class="lineno"> 509</span> <a class="code hl_typedef" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> IgnoreUserHandling = <a class="code hl_define" href="_basic_types_8h.html#aa93f0eb578d23995850d61f7d61c55c1">FALSE</a>;</div>
<div class="line"><span class="lineno"> 510</span> </div>
<div class="line"><span class="lineno"> 511</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 512</span> <span class="comment">// ***** Check breakpoint for 'bp' command *****</span></div>
<div class="line"><span class="lineno"> 513</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 514</span> </div>
<div class="line"><span class="lineno"> 515</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 516</span> <span class="comment">// Find the current process cr3</span></div>
<div class="line"><span class="lineno"> 517</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 518</span> GuestCr3.<a class="code hl_variable" href="struct___c_r3___t_y_p_e.html#a04eb96cc99b0458be739bcc9c640e08b">Flags</a> = <a class="code hl_function" href="_layout_8c.html#af74e610cf3ad5dd8c972f536f2809429">LayoutGetCurrentProcessCr3</a>().<a class="code hl_variable" href="struct___c_r3___t_y_p_e.html#a04eb96cc99b0458be739bcc9c640e08b">Flags</a>;</div>
<div class="line"><span class="lineno"> 519</span> </div>
<div class="line"><span class="lineno"> 520</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 521</span> <span class="comment">// Convert breakpoint to physical address</span></div>
<div class="line"><span class="lineno"> 522</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 523</span> GuestRipPhysical = <a class="code hl_function" href="_conversion_8c.html#ace32f507228d4b1b3b8e53f82ac09402">VirtualAddressToPhysicalAddressByProcessCr3</a>((PVOID)GuestRip, GuestCr3);</div>
<div class="line"><span class="lineno"> 524</span> </div>
<div class="line"><span class="lineno"> 525</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 526</span> <span class="comment">// Iterate through the list of breakpoints</span></div>
<div class="line"><span class="lineno"> 527</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 528</span> TempList = &<a class="code hl_variable" href="hyperkd_2header_2globals_2_global_8h.html#abca944290c6a683f0821a9096472f7d4">g_BreakpointsListHead</a>;</div>
<div class="line"><span class="lineno"> 529</span> </div>
<div class="line"><span class="lineno"> 530</span> <span class="keywordflow">while</span> (&<a class="code hl_variable" href="hyperkd_2header_2globals_2_global_8h.html#abca944290c6a683f0821a9096472f7d4">g_BreakpointsListHead</a> != TempList->Flink)</div>
<div class="line"><span class="lineno"> 531</span> {</div>
<div class="line"><span class="lineno"> 532</span> TempList = TempList->Flink;</div>
<div class="line"><span class="lineno"> 533</span> <a class="code hl_struct" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html">PDEBUGGEE_BP_DESCRIPTOR</a> CurrentBreakpointDesc = CONTAINING_RECORD(TempList, <a class="code hl_struct" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html">DEBUGGEE_BP_DESCRIPTOR</a>, BreakpointsList);</div>
<div class="line"><span class="lineno"> 534</span> </div>
<div class="line"><span class="lineno"> 535</span> <span class="keywordflow">if</span> (CurrentBreakpointDesc-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#ab5f824b8c4d255545d038d3e57231e76">PhysAddress</a> == GuestRipPhysical)</div>
<div class="line"><span class="lineno"> 536</span> {</div>
<div class="line"><span class="lineno"> 537</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 538</span> <span class="comment">// It's a breakpoint by 'bp' command</span></div>
<div class="line"><span class="lineno"> 539</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 540</span> IsHandledByBpRoutines = <a class="code hl_define" href="_basic_types_8h.html#aa8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;</div>
<div class="line"><span class="lineno"> 541</span> </div>
<div class="line"><span class="lineno"> 542</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 543</span> <span class="comment">// First, we remove the breakpoint</span></div>
<div class="line"><span class="lineno"> 544</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 545</span> <a class="code hl_function" href="_memory_mapper_8c.html#a1ddcc27debd88fc732fe9b046a6b0038">MemoryMapperWriteMemorySafeByPhysicalAddress</a>(GuestRipPhysical,</div>
<div class="line"><span class="lineno"> 546</span> (<a class="code hl_typedef" href="_basic_types_8h.html#aae17ebb9ef7279d026817fb22f8aebe9">UINT64</a>)&CurrentBreakpointDesc-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#a5a31f78cc97ef4c9fdb0ab7a9a3d9bad">PreviousByte</a>,</div>
<div class="line"><span class="lineno"> 547</span> <span class="keyword">sizeof</span>(<a class="code hl_typedef" href="_basic_types_8h.html#a4ae1dab0fb4b072a66584546209e7d58">BYTE</a>));</div>
<div class="line"><span class="lineno"> 548</span> </div>
<div class="line"><span class="lineno"> 549</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 550</span> <span class="comment">// Now, halt the debuggee</span></div>
<div class="line"><span class="lineno"> 551</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 552</span> TargetContext.<a class="code hl_variable" href="struct___d_e_b_u_g_g_e_r___t_r_i_g_g_e_r_e_d___e_v_e_n_t___d_e_t_a_i_l_s.html#aed232a35a0d0d95aa4ca77dc50fc6fae">Context</a> = (PVOID)<a class="code hl_function" href="_export_8c.html#ab49740d6ce5d1c5f90828b66496dcb4c">VmFuncGetLastVmexitRip</a>(DbgState-><a class="code hl_variable" href="struct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e.html#a090832a74d330cde891a17bdd5b236e3">CoreId</a>);</div>
<div class="line"><span class="lineno"> 553</span> </div>
<div class="line"><span class="lineno"> 554</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 555</span> <span class="comment">// In breakpoints tag is breakpoint id, not event tag</span></div>
<div class="line"><span class="lineno"> 556</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 557</span> <span class="keywordflow">if</span> (Reason == <a class="code hl_enumvalue" href="_connection_8h.html#a6e2be89205e735ebae644cf4850ac21ba04b2c9d4250379b584ec3d3d2af3355c">DEBUGGEE_PAUSING_REASON_DEBUGGEE_SOFTWARE_BREAKPOINT_HIT</a>)</div>
<div class="line"><span class="lineno"> 558</span> {</div>
<div class="line"><span class="lineno"> 559</span> TargetContext.<a class="code hl_variable" href="struct___d_e_b_u_g_g_e_r___t_r_i_g_g_e_r_e_d___e_v_e_n_t___d_e_t_a_i_l_s.html#a4eed19d8d35fa2c8378db39e95dd9ef2">Tag</a> = CurrentBreakpointDesc-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#a0600a3a7a748f669bef44b0eb920fd4f">BreakpointId</a>;</div>
<div class="line"><span class="lineno"> 560</span> }</div>
<div class="line"><span class="lineno"> 561</span> </div>
<div class="line"><span class="lineno"> 562</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 563</span> <span class="comment">// Hint the debuggee about the length</span></div>
<div class="line"><span class="lineno"> 564</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 565</span> DbgState-><a class="code hl_variable" href="struct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e.html#ac0735b6e84ce3ae397f74cfd5b4eabb4">InstructionLengthHint</a> = CurrentBreakpointDesc-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#a603517c66479592e240eeacb29379803">InstructionLength</a>;</div>
<div class="line"><span class="lineno"> 566</span> </div>
<div class="line"><span class="lineno"> 567</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 568</span> <span class="comment">// Check constraints</span></div>
<div class="line"><span class="lineno"> 569</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 570</span> <span class="keywordflow">if</span> ((CurrentBreakpointDesc-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#ad46a87a0665b8d99405fec5650ae1eb1">Pid</a> == <a class="code hl_define" href="_constants_8h.html#a772442c9aa9acb6567a6d79ddc8c171b">DEBUGGEE_BP_APPLY_TO_ALL_PROCESSES</a> || CurrentBreakpointDesc-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#ad46a87a0665b8d99405fec5650ae1eb1">Pid</a> == <a class="code hl_define" href="_meta_macros_8h.html#ad790279846c85a5a453f2e7a4e02abad">HANDLE_TO_UINT32</a>(PsGetCurrentProcessId())) &&</div>
<div class="line"><span class="lineno"> 571</span> (CurrentBreakpointDesc-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#ad787a3220aa8e2b76f31c570f33fd071">Tid</a> == <a class="code hl_define" href="_constants_8h.html#a83c229c2fbc9b06f560b3b78ae873f50">DEBUGGEE_BP_APPLY_TO_ALL_THREADS</a> || CurrentBreakpointDesc-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#ad787a3220aa8e2b76f31c570f33fd071">Tid</a> == <a class="code hl_define" href="_meta_macros_8h.html#ad790279846c85a5a453f2e7a4e02abad">HANDLE_TO_UINT32</a>(PsGetCurrentThreadId())) &&</div>
<div class="line"><span class="lineno"> 572</span> (CurrentBreakpointDesc-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#aff66a054304ff0b558bd5e5688cb8e04">Core</a> == <a class="code hl_define" href="_constants_8h.html#aa145d6235b4996c241ae08d13de243a0">DEBUGGEE_BP_APPLY_TO_ALL_CORES</a> || CurrentBreakpointDesc-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#aff66a054304ff0b558bd5e5688cb8e04">Core</a> == DbgState-><a class="code hl_variable" href="struct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e.html#a090832a74d330cde891a17bdd5b236e3">CoreId</a>))</div>
<div class="line"><span class="lineno"> 573</span> {</div>
<div class="line"><span class="lineno"> 574</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 575</span> <span class="comment">// Check if breakpoint should be removed after this hit or not</span></div>
<div class="line"><span class="lineno"> 576</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 577</span> <span class="keywordflow">if</span> (CurrentBreakpointDesc-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#a1e808c059fbd554f0899ae6b5f2d350e">RemoveAfterHit</a>)</div>
<div class="line"><span class="lineno"> 578</span> {</div>
<div class="line"><span class="lineno"> 579</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 580</span> <span class="comment">// One hit, we have to remove it</span></div>
<div class="line"><span class="lineno"> 581</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 582</span> <a class="code hl_function" href="#a15e8a59a7b3e9d6c7fd68539075564c8">BreakpointClearAndDeallocateMemory</a>(CurrentBreakpointDesc);</div>
<div class="line"><span class="lineno"> 583</span> }</div>
<div class="line"><span class="lineno"> 584</span> </div>
<div class="line"><span class="lineno"> 585</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 586</span> <span class="comment">// Check if it needs to check for callbacks or not</span></div>
<div class="line"><span class="lineno"> 587</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 588</span> <span class="keywordflow">if</span> (CurrentBreakpointDesc-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#a4fff2e041a08cfbb872eb2ce2838ac17">CheckForCallbacks</a>)</div>
<div class="line"><span class="lineno"> 589</span> {</div>
<div class="line"><span class="lineno"> 590</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 591</span> <span class="comment">// check callbacks</span></div>
<div class="line"><span class="lineno"> 592</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 593</span> IgnoreUserHandling = <a class="code hl_function" href="#a6228e6bee67f388f8ef0a730c7d5626b">BreakpointTriggerCallbacks</a>(DbgState, <a class="code hl_define" href="_meta_macros_8h.html#ad790279846c85a5a453f2e7a4e02abad">HANDLE_TO_UINT32</a>(PsGetCurrentProcessId()), <a class="code hl_define" href="_meta_macros_8h.html#ad790279846c85a5a453f2e7a4e02abad">HANDLE_TO_UINT32</a>(PsGetCurrentThreadId()));</div>
<div class="line"><span class="lineno"> 594</span> }</div>
<div class="line"><span class="lineno"> 595</span> </div>
<div class="line"><span class="lineno"> 596</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 597</span> <span class="comment">// Check if we need to handle the breakpoint by user or just ignore handling it</span></div>
<div class="line"><span class="lineno"> 598</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 599</span> <span class="keywordflow">if</span> (!IgnoreUserHandling && !<a class="code hl_variable" href="hyperkd_2header_2globals_2_global_8h.html#a4d0018c727503706f39f9ad28f8ad373">g_InterceptBreakpoints</a> && !<a class="code hl_variable" href="hyperkd_2header_2globals_2_global_8h.html#a7209d2a1918f90ef7d818714bcb5fbe1">g_InterceptBreakpointsAndEventsForCommandsInRemoteComputer</a>)</div>
<div class="line"><span class="lineno"> 600</span> {</div>
<div class="line"><span class="lineno"> 601</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 602</span> <span class="comment">// *** It's not safe to access CurrentBreakpointDesc anymore as the</span></div>
<div class="line"><span class="lineno"> 603</span> <span class="comment">// breakpoint might be removed ***</span></div>
<div class="line"><span class="lineno"> 604</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 605</span> <a class="code hl_function" href="_kd_8c.html#a732bca2051e444c16d2d9a5080978981">KdHandleBreakpointAndDebugBreakpoints</a>(DbgState,</div>
<div class="line"><span class="lineno"> 606</span> Reason,</div>
<div class="line"><span class="lineno"> 607</span> &TargetContext);</div>
<div class="line"><span class="lineno"> 608</span> }</div>
<div class="line"><span class="lineno"> 609</span> }</div>
<div class="line"><span class="lineno"> 610</span> </div>
<div class="line"><span class="lineno"> 611</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 612</span> <span class="comment">// Reset hint to instruction length</span></div>
<div class="line"><span class="lineno"> 613</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 614</span> DbgState-><a class="code hl_variable" href="struct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e.html#ac0735b6e84ce3ae397f74cfd5b4eabb4">InstructionLengthHint</a> = 0;</div>
<div class="line"><span class="lineno"> 615</span> </div>
<div class="line"><span class="lineno"> 616</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 617</span> <span class="comment">// Check if we should re-apply the breakpoint after this instruction</span></div>
<div class="line"><span class="lineno"> 618</span> <span class="comment">// or not (in other words, is breakpoint still valid)</span></div>
<div class="line"><span class="lineno"> 619</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 620</span> <span class="keywordflow">if</span> (!CurrentBreakpointDesc-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#a92b8d8e3dfe78ced438c04c2fc9c8b08">AvoidReApplyBreakpoint</a>)</div>
<div class="line"><span class="lineno"> 621</span> {</div>
<div class="line"><span class="lineno"> 622</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 623</span> <span class="comment">// We should re-apply the breakpoint on next mtf</span></div>
<div class="line"><span class="lineno"> 624</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 625</span> DbgState-><a class="code hl_variable" href="struct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e.html#ac48a6f48fd26c69f2d2ad49f09acbdd4">SoftwareBreakpointState</a> = CurrentBreakpointDesc;</div>
<div class="line"><span class="lineno"> 626</span> </div>
<div class="line"><span class="lineno"> 627</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 628</span> <span class="comment">// Fire and MTF</span></div>
<div class="line"><span class="lineno"> 629</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 630</span> <a class="code hl_function" href="_export_8c.html#a85480760316ec7682996e98898d3a611">VmFuncSetMonitorTrapFlag</a>(<a class="code hl_define" href="_basic_types_8h.html#aa8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>);</div>
<div class="line"><span class="lineno"> 631</span> AvoidUnsetMtf = <a class="code hl_define" href="_basic_types_8h.html#aa8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;</div>
<div class="line"><span class="lineno"> 632</span> </div>
<div class="line"><span class="lineno"> 633</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 634</span> <span class="comment">// As we want to continue debuggee, the MTF might arrive when the</span></div>
<div class="line"><span class="lineno"> 635</span> <span class="comment">// host finish executing it's time slice; thus, a clock interrupt</span></div>
<div class="line"><span class="lineno"> 636</span> <span class="comment">// or an IPI might be arrived and the next instruction is not what</span></div>
<div class="line"><span class="lineno"> 637</span> <span class="comment">// we expect, because of that we check if the IF (Interrupt enable)</span></div>
<div class="line"><span class="lineno"> 638</span> <span class="comment">// flag of RFLAGS is enabled or not, if enabled then we remove it</span></div>
<div class="line"><span class="lineno"> 639</span> <span class="comment">// to avoid any clock-interrupt or IPI to arrive and the next</span></div>
<div class="line"><span class="lineno"> 640</span> <span class="comment">// instruction is our next instruction in the current execution</span></div>
<div class="line"><span class="lineno"> 641</span> <span class="comment">// context</span></div>
<div class="line"><span class="lineno"> 642</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 643</span> Rflags.AsUInt = <a class="code hl_function" href="_export_8c.html#a65a0cf94fa34ebb1f4150ed97fa7abc0">VmFuncGetRflags</a>();</div>
<div class="line"><span class="lineno"> 644</span> </div>
<div class="line"><span class="lineno"> 645</span> <span class="keywordflow">if</span> (Rflags.InterruptEnableFlag)</div>
<div class="line"><span class="lineno"> 646</span> {</div>
<div class="line"><span class="lineno"> 647</span> Rflags.InterruptEnableFlag = <a class="code hl_define" href="_basic_types_8h.html#aa93f0eb578d23995850d61f7d61c55c1">FALSE</a>;</div>
<div class="line"><span class="lineno"> 648</span> <a class="code hl_function" href="_export_8c.html#a1951855b2f1d299485b5d7e9d5dfa6f7">VmFuncSetRflags</a>(Rflags.AsUInt);</div>
<div class="line"><span class="lineno"> 649</span> </div>
<div class="line"><span class="lineno"> 650</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 651</span> <span class="comment">// An indicator to restore RFLAGS if to enabled state</span></div>
<div class="line"><span class="lineno"> 652</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 653</span> DbgState-><a class="code hl_variable" href="struct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e.html#ac48a6f48fd26c69f2d2ad49f09acbdd4">SoftwareBreakpointState</a>-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#a7c55438ab180ae0b5c47fe3b4266fce7">SetRflagsIFBitOnMtf</a> = <a class="code hl_define" href="_basic_types_8h.html#aa8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;</div>
<div class="line"><span class="lineno"> 654</span> }</div>
<div class="line"><span class="lineno"> 655</span> }</div>
<div class="line"><span class="lineno"> 656</span> </div>
<div class="line"><span class="lineno"> 657</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 658</span> <span class="comment">// Do not increment rip</span></div>
<div class="line"><span class="lineno"> 659</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 660</span> <a class="code hl_function" href="_export_8c.html#ad357512be8732352fac0e4a03676e458">VmFuncSuppressRipIncrement</a>(DbgState-><a class="code hl_variable" href="struct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e.html#a090832a74d330cde891a17bdd5b236e3">CoreId</a>);</div>
<div class="line"><span class="lineno"> 661</span> </div>
<div class="line"><span class="lineno"> 662</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 663</span> <span class="comment">// No need to iterate anymore</span></div>
<div class="line"><span class="lineno"> 664</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 665</span> <span class="keywordflow">break</span>;</div>
<div class="line"><span class="lineno"> 666</span> }</div>
<div class="line"><span class="lineno"> 667</span> }</div>
<div class="line"><span class="lineno"> 668</span> </div>
<div class="line"><span class="lineno"> 669</span> <span class="keywordflow">if</span> (IsHandledByBpRoutines && ChangeMtfState)</div>
<div class="line"><span class="lineno"> 670</span> {</div>
<div class="line"><span class="lineno"> 671</span> <a class="code hl_function" href="_export_8c.html#a00a52e5c83db1524b3877e7b24c235bf">VmFuncChangeMtfUnsettingState</a>(DbgState-><a class="code hl_variable" href="struct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e.html#a090832a74d330cde891a17bdd5b236e3">CoreId</a>, AvoidUnsetMtf);</div>
<div class="line"><span class="lineno"> 672</span> }</div>
<div class="line"><span class="lineno"> 673</span> </div>
<div class="line"><span class="lineno"> 674</span> <span class="keywordflow">return</span> IsHandledByBpRoutines;</div>
<div class="line"><span class="lineno"> 675</span>}</div>
<div class="ttc" id="a_basic_types_8h_html_aae17ebb9ef7279d026817fb22f8aebe9"><div class="ttname"><a href="_basic_types_8h.html#aae17ebb9ef7279d026817fb22f8aebe9">UINT64</a></div><div class="ttdeci">unsigned __int64 UINT64</div><div class="ttdef"><b>Definition</b> BasicTypes.h:21</div></div>
<div class="ttc" id="a_breakpoint_commands_8c_html_a15e8a59a7b3e9d6c7fd68539075564c8"><div class="ttname"><a href="#a15e8a59a7b3e9d6c7fd68539075564c8">BreakpointClearAndDeallocateMemory</a></div><div class="ttdeci">VOID BreakpointClearAndDeallocateMemory(PDEBUGGEE_BP_DESCRIPTOR BreakpointDesc)</div><div class="ttdoc">Clears the breakpoint and remove the entry from the breakpoint list.</div><div class="ttdef"><b>Definition</b> BreakpointCommands.c:416</div></div>
<div class="ttc" id="a_breakpoint_commands_8c_html_a6228e6bee67f388f8ef0a730c7d5626b"><div class="ttname"><a href="#a6228e6bee67f388f8ef0a730c7d5626b">BreakpointTriggerCallbacks</a></div><div class="ttdeci">BOOLEAN BreakpointTriggerCallbacks(PROCESSOR_DEBUGGING_STATE *DbgState, UINT32 ProcessId, UINT32 ThreadId)</div><div class="ttdoc">Trigger callback for breakpoint hit.</div><div class="ttdef"><b>Definition</b> BreakpointCommands.c:148</div></div>
<div class="ttc" id="a_connection_8h_html_a6e2be89205e735ebae644cf4850ac21ba04b2c9d4250379b584ec3d3d2af3355c"><div class="ttname"><a href="_connection_8h.html#a6e2be89205e735ebae644cf4850ac21ba04b2c9d4250379b584ec3d3d2af3355c">DEBUGGEE_PAUSING_REASON_DEBUGGEE_SOFTWARE_BREAKPOINT_HIT</a></div><div class="ttdeci">@ DEBUGGEE_PAUSING_REASON_DEBUGGEE_SOFTWARE_BREAKPOINT_HIT</div><div class="ttdef"><b>Definition</b> Connection.h:29</div></div>
<div class="ttc" id="a_constants_8h_html_a772442c9aa9acb6567a6d79ddc8c171b"><div class="ttname"><a href="_constants_8h.html#a772442c9aa9acb6567a6d79ddc8c171b">DEBUGGEE_BP_APPLY_TO_ALL_PROCESSES</a></div><div class="ttdeci">#define DEBUGGEE_BP_APPLY_TO_ALL_PROCESSES</div><div class="ttdoc">The constant to apply to all processes for bp command.</div><div class="ttdef"><b>Definition</b> Constants.h:653</div></div>
<div class="ttc" id="a_constants_8h_html_a83c229c2fbc9b06f560b3b78ae873f50"><div class="ttname"><a href="_constants_8h.html#a83c229c2fbc9b06f560b3b78ae873f50">DEBUGGEE_BP_APPLY_TO_ALL_THREADS</a></div><div class="ttdeci">#define DEBUGGEE_BP_APPLY_TO_ALL_THREADS</div><div class="ttdoc">The constant to apply to all threads for bp command.</div><div class="ttdef"><b>Definition</b> Constants.h:659</div></div>
<div class="ttc" id="a_export_8c_html_a00a52e5c83db1524b3877e7b24c235bf"><div class="ttname"><a href="_export_8c.html#a00a52e5c83db1524b3877e7b24c235bf">VmFuncChangeMtfUnsettingState</a></div><div class="ttdeci">VOID VmFuncChangeMtfUnsettingState(UINT32 CoreId, BOOLEAN Set)</div><div class="ttdoc">Suppress unsetting MTF.</div><div class="ttdef"><b>Definition</b> Export.c:47</div></div>
<div class="ttc" id="a_export_8c_html_a1951855b2f1d299485b5d7e9d5dfa6f7"><div class="ttname"><a href="_export_8c.html#a1951855b2f1d299485b5d7e9d5dfa6f7">VmFuncSetRflags</a></div><div class="ttdeci">VOID VmFuncSetRflags(UINT64 Rflags)</div><div class="ttdoc">Set guest's RFLAGS.</div><div class="ttdef"><b>Definition</b> Export.c:364</div></div>
<div class="ttc" id="a_export_8c_html_a65a0cf94fa34ebb1f4150ed97fa7abc0"><div class="ttname"><a href="_export_8c.html#a65a0cf94fa34ebb1f4150ed97fa7abc0">VmFuncGetRflags</a></div><div class="ttdeci">UINT64 VmFuncGetRflags()</div><div class="ttdoc">Read guest's RFLAGS.</div><div class="ttdef"><b>Definition</b> Export.c:352</div></div>
<div class="ttc" id="a_export_8c_html_a85480760316ec7682996e98898d3a611"><div class="ttname"><a href="_export_8c.html#a85480760316ec7682996e98898d3a611">VmFuncSetMonitorTrapFlag</a></div><div class="ttdeci">VOID VmFuncSetMonitorTrapFlag(BOOLEAN Set)</div><div class="ttdoc">Set the monitor trap flag.</div><div class="ttdef"><b>Definition</b> Export.c:98</div></div>
<div class="ttc" id="a_export_8c_html_ab49740d6ce5d1c5f90828b66496dcb4c"><div class="ttname"><a href="_export_8c.html#ab49740d6ce5d1c5f90828b66496dcb4c">VmFuncGetLastVmexitRip</a></div><div class="ttdeci">UINT64 VmFuncGetLastVmexitRip(UINT32 CoreId)</div><div class="ttdoc">get the last vm-exit RIP</div><div class="ttdef"><b>Definition</b> Export.c:318</div></div>
<div class="ttc" id="a_export_8c_html_ad357512be8732352fac0e4a03676e458"><div class="ttname"><a href="_export_8c.html#ad357512be8732352fac0e4a03676e458">VmFuncSuppressRipIncrement</a></div><div class="ttdeci">VOID VmFuncSuppressRipIncrement(UINT32 CoreId)</div><div class="ttdoc">Suppress the incrementation of RIP.</div><div class="ttdef"><b>Definition</b> Export.c:34</div></div>
<div class="ttc" id="a_kd_8c_html_a732bca2051e444c16d2d9a5080978981"><div class="ttname"><a href="_kd_8c.html#a732bca2051e444c16d2d9a5080978981">KdHandleBreakpointAndDebugBreakpoints</a></div><div class="ttdeci">_Use_decl_annotations_ VOID KdHandleBreakpointAndDebugBreakpoints(PROCESSOR_DEBUGGING_STATE *DbgState, DEBUGGEE_PAUSING_REASON Reason, PDEBUGGER_TRIGGERED_EVENT_DETAILS EventDetails)</div><div class="ttdoc">Handle #DBs and #BPs for kernel debugger.</div><div class="ttdef"><b>Definition</b> Kd.c:1214</div></div>
<div class="ttc" id="a_memory_mapper_8c_html_a1ddcc27debd88fc732fe9b046a6b0038"><div class="ttname"><a href="_memory_mapper_8c.html#a1ddcc27debd88fc732fe9b046a6b0038">MemoryMapperWriteMemorySafeByPhysicalAddress</a></div><div class="ttdeci">_Use_decl_annotations_ BOOLEAN MemoryMapperWriteMemorySafeByPhysicalAddress(UINT64 DestinationPa, UINT64 Source, SIZE_T SizeToWrite)</div><div class="ttdoc">Write memory safely by mapping the buffer.</div><div class="ttdef"><b>Definition</b> MemoryMapper.c:1432</div></div>
<div class="ttc" id="ahyperkd_2header_2globals_2_global_8h_html_a4d0018c727503706f39f9ad28f8ad373"><div class="ttname"><a href="hyperkd_2header_2globals_2_global_8h.html#a4d0018c727503706f39f9ad28f8ad373">g_InterceptBreakpoints</a></div><div class="ttdeci">BOOLEAN g_InterceptBreakpoints</div><div class="ttdoc">shows whether the debugger should intercept breakpoints (#BP) or not</div><div class="ttdef"><b>Definition</b> Global.h:115</div></div>
<div class="ttc" id="ahyperkd_2header_2globals_2_global_8h_html_a7209d2a1918f90ef7d818714bcb5fbe1"><div class="ttname"><a href="hyperkd_2header_2globals_2_global_8h.html#a7209d2a1918f90ef7d818714bcb5fbe1">g_InterceptBreakpointsAndEventsForCommandsInRemoteComputer</a></div><div class="ttdeci">BOOLEAN g_InterceptBreakpointsAndEventsForCommandsInRemoteComputer</div><div class="ttdoc">To avoid getting stuck from getting hit from the breakpoints while executing the commands in the remo...</div><div class="ttdef"><b>Definition</b> Global.h:166</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r_html_a5a31f78cc97ef4c9fdb0ab7a9a3d9bad"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#a5a31f78cc97ef4c9fdb0ab7a9a3d9bad">_DEBUGGEE_BP_DESCRIPTOR::PreviousByte</a></div><div class="ttdeci">BYTE PreviousByte</div><div class="ttdef"><b>Definition</b> State.h:82</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r_html_a7c55438ab180ae0b5c47fe3b4266fce7"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#a7c55438ab180ae0b5c47fe3b4266fce7">_DEBUGGEE_BP_DESCRIPTOR::SetRflagsIFBitOnMtf</a></div><div class="ttdeci">BOOLEAN SetRflagsIFBitOnMtf</div><div class="ttdef"><b>Definition</b> State.h:83</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r_html_a92b8d8e3dfe78ced438c04c2fc9c8b08"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#a92b8d8e3dfe78ced438c04c2fc9c8b08">_DEBUGGEE_BP_DESCRIPTOR::AvoidReApplyBreakpoint</a></div><div class="ttdeci">BOOLEAN AvoidReApplyBreakpoint</div><div class="ttdef"><b>Definition</b> State.h:84</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_r___t_r_i_g_g_e_r_e_d___e_v_e_n_t___d_e_t_a_i_l_s_html"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_r___t_r_i_g_g_e_r_e_d___e_v_e_n_t___d_e_t_a_i_l_s.html">_DEBUGGER_TRIGGERED_EVENT_DETAILS</a></div><div class="ttdoc">The structure of detail of a triggered event in HyperDbg.</div><div class="ttdef"><b>Definition</b> DataTypes.h:192</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_r___t_r_i_g_g_e_r_e_d___e_v_e_n_t___d_e_t_a_i_l_s_html_a4eed19d8d35fa2c8378db39e95dd9ef2"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_r___t_r_i_g_g_e_r_e_d___e_v_e_n_t___d_e_t_a_i_l_s.html#a4eed19d8d35fa2c8378db39e95dd9ef2">_DEBUGGER_TRIGGERED_EVENT_DETAILS::Tag</a></div><div class="ttdeci">UINT64 Tag</div><div class="ttdef"><b>Definition</b> DataTypes.h:193</div></div>
<div class="ttc" id="astruct___d_e_b_u_g_g_e_r___t_r_i_g_g_e_r_e_d___e_v_e_n_t___d_e_t_a_i_l_s_html_aed232a35a0d0d95aa4ca77dc50fc6fae"><div class="ttname"><a href="struct___d_e_b_u_g_g_e_r___t_r_i_g_g_e_r_e_d___e_v_e_n_t___d_e_t_a_i_l_s.html#aed232a35a0d0d95aa4ca77dc50fc6fae">_DEBUGGER_TRIGGERED_EVENT_DETAILS::Context</a></div><div class="ttdeci">PVOID Context</div><div class="ttdef"><b>Definition</b> DataTypes.h:194</div></div>
<div class="ttc" id="astruct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e_html_a090832a74d330cde891a17bdd5b236e3"><div class="ttname"><a href="struct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e.html#a090832a74d330cde891a17bdd5b236e3">_PROCESSOR_DEBUGGING_STATE::CoreId</a></div><div class="ttdeci">UINT32 CoreId</div><div class="ttdef"><b>Definition</b> State.h:169</div></div>
<div class="ttc" id="astruct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e_html_ac0735b6e84ce3ae397f74cfd5b4eabb4"><div class="ttname"><a href="struct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e.html#ac0735b6e84ce3ae397f74cfd5b4eabb4">_PROCESSOR_DEBUGGING_STATE::InstructionLengthHint</a></div><div class="ttdeci">UINT16 InstructionLengthHint</div><div class="ttdef"><b>Definition</b> State.h:182</div></div>
<div class="ttc" id="astruct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e_html_ac48a6f48fd26c69f2d2ad49f09acbdd4"><div class="ttname"><a href="struct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e.html#ac48a6f48fd26c69f2d2ad49f09acbdd4">_PROCESSOR_DEBUGGING_STATE::SoftwareBreakpointState</a></div><div class="ttdeci">PDEBUGGEE_BP_DESCRIPTOR SoftwareBreakpointState</div><div class="ttdef"><b>Definition</b> State.h:174</div></div>
</div><!-- fragment -->
</div>
</div>
<a id="ac2d64f1a4448078440fa5e05a511e3bb" name="ac2d64f1a4448078440fa5e05a511e3bb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac2d64f1a4448078440fa5e05a511e3bb">◆ </a></span>BreakpointCheckAndHandleReApplyingBreakpoint()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> BreakpointCheckAndHandleReApplyingBreakpoint </td>
<td>(</td>
<td class="paramtype"><a class="el" href="_basic_types_8h.html#ae1e6edbbc26d6fbc71a90190d0266018">UINT32</a></td> <td class="paramname"><span class="paramname"><em>CoreId</em></span></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Check and reapply breakpoint. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">CoreId</td><td></td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>BOOLEAN </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 443</span>{</div>
<div class="line"><span class="lineno"> 444</span> <a class="code hl_typedef" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> Result = <a class="code hl_define" href="_basic_types_8h.html#aa93f0eb578d23995850d61f7d61c55c1">FALSE</a>;</div>
<div class="line"><span class="lineno"> 445</span> <a class="code hl_struct" href="struct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e.html">PROCESSOR_DEBUGGING_STATE</a> * DbgState = &<a class="code hl_variable" href="hyperkd_2header_2globals_2_global_8h.html#a349ee1adc363d2e4323a35a68fae5646">g_DbgState</a>[CoreId];</div>
<div class="line"><span class="lineno"> 446</span> </div>
<div class="line"><span class="lineno"> 447</span> <span class="keywordflow">if</span> (DbgState-><a class="code hl_variable" href="struct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e.html#ac48a6f48fd26c69f2d2ad49f09acbdd4">SoftwareBreakpointState</a> != NULL)</div>
<div class="line"><span class="lineno"> 448</span> {</div>
<div class="line"><span class="lineno"> 449</span> <a class="code hl_typedef" href="_basic_types_8h.html#a4ae1dab0fb4b072a66584546209e7d58">BYTE</a> BreakpointByte = 0xcc;</div>
<div class="line"><span class="lineno"> 450</span> </div>
<div class="line"><span class="lineno"> 451</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 452</span> <span class="comment">// MTF is handled</span></div>
<div class="line"><span class="lineno"> 453</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 454</span> Result = <a class="code hl_define" href="_basic_types_8h.html#aa8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;</div>
<div class="line"><span class="lineno"> 455</span> </div>
<div class="line"><span class="lineno"> 456</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 457</span> <span class="comment">// Restore previous breakpoint byte</span></div>
<div class="line"><span class="lineno"> 458</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 459</span> <a class="code hl_function" href="_memory_mapper_8c.html#a1ddcc27debd88fc732fe9b046a6b0038">MemoryMapperWriteMemorySafeByPhysicalAddress</a>(</div>
<div class="line"><span class="lineno"> 460</span> DbgState-><a class="code hl_variable" href="struct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e.html#ac48a6f48fd26c69f2d2ad49f09acbdd4">SoftwareBreakpointState</a>-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#ab5f824b8c4d255545d038d3e57231e76">PhysAddress</a>,</div>
<div class="line"><span class="lineno"> 461</span> (<a class="code hl_typedef" href="_basic_types_8h.html#aae17ebb9ef7279d026817fb22f8aebe9">UINT64</a>)&BreakpointByte,</div>
<div class="line"><span class="lineno"> 462</span> <span class="keyword">sizeof</span>(<a class="code hl_typedef" href="_basic_types_8h.html#a4ae1dab0fb4b072a66584546209e7d58">BYTE</a>));</div>
<div class="line"><span class="lineno"> 463</span> </div>
<div class="line"><span class="lineno"> 464</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 465</span> <span class="comment">// Check if we should re-enabled IF bit of RFLAGS or not</span></div>
<div class="line"><span class="lineno"> 466</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 467</span> <span class="keywordflow">if</span> (DbgState-><a class="code hl_variable" href="struct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e.html#ac48a6f48fd26c69f2d2ad49f09acbdd4">SoftwareBreakpointState</a>-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#a7c55438ab180ae0b5c47fe3b4266fce7">SetRflagsIFBitOnMtf</a>)</div>
<div class="line"><span class="lineno"> 468</span> {</div>
<div class="line"><span class="lineno"> 469</span> RFLAGS Rflags = {0};</div>
<div class="line"><span class="lineno"> 470</span> </div>
<div class="line"><span class="lineno"> 471</span> Rflags.AsUInt = <a class="code hl_function" href="_export_8c.html#a65a0cf94fa34ebb1f4150ed97fa7abc0">VmFuncGetRflags</a>();</div>
<div class="line"><span class="lineno"> 472</span> </div>
<div class="line"><span class="lineno"> 473</span> Rflags.InterruptEnableFlag = <a class="code hl_define" href="_basic_types_8h.html#aa8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;</div>
<div class="line"><span class="lineno"> 474</span> </div>
<div class="line"><span class="lineno"> 475</span> <a class="code hl_function" href="_export_8c.html#a1951855b2f1d299485b5d7e9d5dfa6f7">VmFuncSetRflags</a>(Rflags.AsUInt);</div>
<div class="line"><span class="lineno"> 476</span> </div>
<div class="line"><span class="lineno"> 477</span> DbgState-><a class="code hl_variable" href="struct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e.html#ac48a6f48fd26c69f2d2ad49f09acbdd4">SoftwareBreakpointState</a>-><a class="code hl_variable" href="struct___d_e_b_u_g_g_e_e___b_p___d_e_s_c_r_i_p_t_o_r.html#a7c55438ab180ae0b5c47fe3b4266fce7">SetRflagsIFBitOnMtf</a> = <a class="code hl_define" href="_basic_types_8h.html#aa93f0eb578d23995850d61f7d61c55c1">FALSE</a>;</div>
<div class="line"><span class="lineno"> 478</span> }</div>
<div class="line"><span class="lineno"> 479</span> </div>
<div class="line"><span class="lineno"> 480</span> DbgState-><a class="code hl_variable" href="struct___p_r_o_c_e_s_s_o_r___d_e_b_u_g_g_i_n_g___s_t_a_t_e.html#ac48a6f48fd26c69f2d2ad49f09acbdd4">SoftwareBreakpointState</a> = <a class="code hl_function" href="namespacetest-case-generator.html#a9a4eff80432bb93d2796381610dd86c3">NULL</a>;</div>
<div class="line"><span class="lineno"> 481</span> }</div>
<div class="line"><span class="lineno"> 482</span> </div>
<div class="line"><span class="lineno"> 483</span> <span class="keywordflow">return</span> Result;</div>
<div class="line"><span class="lineno"> 484</span>}</div>
</div><!-- fragment -->
</div>
</div>
<a id="a70160ffe7c755f58fbe996b53a0405da" name="a70160ffe7c755f58fbe996b53a0405da"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a70160ffe7c755f58fbe996b53a0405da">◆ </a></span>BreakpointCheckAndPerformActionsOnTrapFlags()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> BreakpointCheckAndPerformActionsOnTrapFlags </td>
<td>(</td>
<td class="paramtype"><a class="el" href="_basic_types_8h.html#ae1e6edbbc26d6fbc71a90190d0266018">UINT32</a></td> <td class="paramname"><span class="paramname"><em>ProcessId</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="_basic_types_8h.html#ae1e6edbbc26d6fbc71a90190d0266018">UINT32</a></td> <td class="paramname"><span class="paramname"><em>ThreadId</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> *</td> <td class="paramname"><span class="paramname"><em>TrapSetByDebugger</em></span> )</td>
</tr>
</table>
</div><div class="memdoc">
<p>Check and perform actions on RFLAGS.TF. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">ProcessId</td><td></td></tr>
<tr><td class="paramname">ThreadId</td><td></td></tr>
<tr><td class="paramname">TrapSetByDebugger</td><td></td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>BOOLEAN Shows whether the #DB should be handled by the debugger or re-injected </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 24</span>{</div>
<div class="line"><span class="lineno"> 25</span> <a class="code hl_typedef" href="_basic_types_8h.html#ae1e6edbbc26d6fbc71a90190d0266018">UINT32</a> Index;</div>
<div class="line"><span class="lineno"> 26</span> <a class="code hl_struct" href="struct___d_e_b_u_g_g_e_r___p_r_o_c_e_s_s___t_h_r_e_a_d___i_n_f_o_r_m_a_t_i_o_n.html">DEBUGGER_PROCESS_THREAD_INFORMATION</a> ProcThrdInfo = {0};</div>
<div class="line"><span class="lineno"> 27</span> <a class="code hl_typedef" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> Result;</div>
<div class="line"><span class="lineno"> 28</span> <a class="code hl_typedef" href="_basic_types_8h.html#a1cb18096b299d23458d3c7b85fd86555">BOOLEAN</a> ResultToReturn;</div>
<div class="line"><span class="lineno"> 29</span> RFLAGS Rflags = {0};</div>
<div class="line"><span class="lineno"> 30</span> </div>
<div class="line"><span class="lineno"> 31</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 32</span> <span class="comment">// Read the RFLAGS</span></div>
<div class="line"><span class="lineno"> 33</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 34</span> Rflags.AsUInt = <a class="code hl_function" href="_export_8c.html#a65a0cf94fa34ebb1f4150ed97fa7abc0">VmFuncGetRflags</a>();</div>
<div class="line"><span class="lineno"> 35</span> </div>
<div class="line"><span class="lineno"> 36</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 37</span> <span class="comment">// Form the process id and thread id into a 64-bit value</span></div>
<div class="line"><span class="lineno"> 38</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 39</span> ProcThrdInfo.<a class="code hl_variable" href="struct___d_e_b_u_g_g_e_r___p_r_o_c_e_s_s___t_h_r_e_a_d___i_n_f_o_r_m_a_t_i_o_n.html#af204c100a8fe3c62bb095c356fc6560b">Fields</a>.<a class="code hl_variable" href="struct___d_e_b_u_g_g_e_r___p_r_o_c_e_s_s___t_h_r_e_a_d___i_n_f_o_r_m_a_t_i_o_n.html#a7f016873acb7cd98d43b0943c277729e">ProcessId</a> = ProcessId;</div>
<div class="line"><span class="lineno"> 40</span> ProcThrdInfo.<a class="code hl_variable" href="struct___d_e_b_u_g_g_e_r___p_r_o_c_e_s_s___t_h_r_e_a_d___i_n_f_o_r_m_a_t_i_o_n.html#af204c100a8fe3c62bb095c356fc6560b">Fields</a>.<a class="code hl_variable" href="struct___d_e_b_u_g_g_e_r___p_r_o_c_e_s_s___t_h_r_e_a_d___i_n_f_o_r_m_a_t_i_o_n.html#afc1bf1fdb6a11e56da28d9c360cfd15c">ThreadId</a> = ThreadId;</div>
<div class="line"><span class="lineno"> 41</span> </div>
<div class="line"><span class="lineno"> 42</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 43</span> <span class="comment">// Make sure, nobody is in the middle of modifying the list</span></div>
<div class="line"><span class="lineno"> 44</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 45</span> <a class="code hl_function" href="_spinlock_8c.html#a08984f739349991eab67c45376a990bc">SpinlockLock</a>(&<a class="code hl_variable" href="_breakpoint_commands_8h.html#ae50db4cdf98f46b292c83cb1b92178c7">BreakpointCommandTrapListLock</a>);</div>
<div class="line"><span class="lineno"> 46</span> </div>
<div class="line"><span class="lineno"> 47</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 48</span> <span class="comment">// *** Search the list of processes/threads for the current process's trap flag state ***</span></div>
<div class="line"><span class="lineno"> 49</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 50</span> Result = <a class="code hl_function" href="_binary_search_8c.html#ac1532f925279158a47a45e688224fb72">BinarySearchPerformSearchItem</a>((<a class="code hl_typedef" href="_basic_types_8h.html#aae17ebb9ef7279d026817fb22f8aebe9">UINT64</a> *)&<a class="code hl_variable" href="hyperkd_2header_2globals_2_global_8h.html#a08664e62cf0b438d0a6e22f8a3b0bcf3">g_TrapFlagState</a>.<a class="code hl_variable" href="struct___d_e_b_u_g_g_e_r___t_r_a_p___f_l_a_g___s_t_a_t_e.html#a86158ec2d43b4f49e48fefcfa10836f5">ThreadInformation</a>[0],</div>
<div class="line"><span class="lineno"> 51</span> <a class="code hl_variable" href="hyperkd_2header_2globals_2_global_8h.html#a08664e62cf0b438d0a6e22f8a3b0bcf3">g_TrapFlagState</a>.<a class="code hl_variable" href="struct___d_e_b_u_g_g_e_r___t_r_a_p___f_l_a_g___s_t_a_t_e.html#aadcf8838b899a02f40f9745c0f32f6f4">NumberOfItems</a>,</div>
<div class="line"><span class="lineno"> 52</span> &Index,</div>
<div class="line"><span class="lineno"> 53</span> ProcThrdInfo.<a class="code hl_variable" href="struct___d_e_b_u_g_g_e_r___p_r_o_c_e_s_s___t_h_r_e_a_d___i_n_f_o_r_m_a_t_i_o_n.html#a36c7fc28abe9c34904e9c023988cf112">asUInt</a>);</div>
<div class="line"><span class="lineno"> 54</span> </div>
<div class="line"><span class="lineno"> 55</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 56</span> <span class="comment">// Indicate whether the trap flag is set by the debugger or not</span></div>
<div class="line"><span class="lineno"> 57</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 58</span> *TrapSetByDebugger = Result;</div>
<div class="line"><span class="lineno"> 59</span> </div>
<div class="line"><span class="lineno"> 60</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 61</span> <span class="comment">// We check the trap flag after the results because we might set the trap flag</span></div>
<div class="line"><span class="lineno"> 62</span> <span class="comment">// for the thread but the thread might run 'popfq' removing our trap flag</span></div>
<div class="line"><span class="lineno"> 63</span> <span class="comment">// so, we both check whether thread is expected to have trap flag, if not</span></div>
<div class="line"><span class="lineno"> 64</span> <span class="comment">// we check whether the trap flag is available or not</span></div>
<div class="line"><span class="lineno"> 65</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 66</span> <span class="keywordflow">if</span> (!Result && !Rflags.TrapFlag)</div>
<div class="line"><span class="lineno"> 67</span> {</div>
<div class="line"><span class="lineno"> 68</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 69</span> <span class="comment">// It's not related to a TRAP FLAG, and we didn't previously set trap flag for this thread</span></div>
<div class="line"><span class="lineno"> 70</span> <span class="comment">// So, probably other events like setting hardware debug breakpoints caused this #DB</span></div>
<div class="line"><span class="lineno"> 71</span> <span class="comment">// which means that it should be handled by the debugger</span></div>
<div class="line"><span class="lineno"> 72</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 73</span> ResultToReturn = <a class="code hl_define" href="_basic_types_8h.html#aa8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;</div>
<div class="line"><span class="lineno"> 74</span> <span class="keywordflow">goto</span> Return;</div>
<div class="line"><span class="lineno"> 75</span> }</div>
<div class="line"><span class="lineno"> 76</span> <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!Result && Rflags.TrapFlag)</div>
<div class="line"><span class="lineno"> 77</span> {</div>
<div class="line"><span class="lineno"> 78</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 79</span> <span class="comment">// As it's not set by the debugger (not found in our list), it means the program or</span></div>
<div class="line"><span class="lineno"> 80</span> <span class="comment">// a debugger already set the trap flag, we'll return FALSE</span></div>
<div class="line"><span class="lineno"> 81</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 82</span> <span class="comment">// LogInfo("Caution: The process (pid:%x, tid:%x, name:%s) is utilizing a trap flag, "</span></div>
<div class="line"><span class="lineno"> 83</span> <span class="comment">// "which was not previously adjusted by HyperDbg. This occurrence could indicate "</span></div>
<div class="line"><span class="lineno"> 84</span> <span class="comment">// "the employment of an anti-debugging technique by the process or the involvement "</span></div>
<div class="line"><span class="lineno"> 85</span> <span class="comment">// "of another debugger. By default, HyperDbg automatically manages these #DB events "</span></div>
<div class="line"><span class="lineno"> 86</span> <span class="comment">// "and halt the debugger; however, if you wish to redirect them to the debugger, "</span></div>
<div class="line"><span class="lineno"> 87</span> <span class="comment">// "you can utilize 'test trap off'. Alternatively, you can use the transparent-mode "</span></div>
<div class="line"><span class="lineno"> 88</span> <span class="comment">// "to mitigate these situations",</span></div>
<div class="line"><span class="lineno"> 89</span> <span class="comment">// PsGetCurrentProcessId(),</span></div>
<div class="line"><span class="lineno"> 90</span> <span class="comment">// PsGetCurrentThreadId(),</span></div>
<div class="line"><span class="lineno"> 91</span> <span class="comment">// CommonGetProcessNameFromProcessControlBlock(PsGetCurrentProcess()));</span></div>
<div class="line"><span class="lineno"> 92</span> </div>
<div class="line"><span class="lineno"> 93</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 94</span> <span class="comment">// Returning false means that it should be re-injected into the debuggee</span></div>
<div class="line"><span class="lineno"> 95</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 96</span> ResultToReturn = <a class="code hl_define" href="_basic_types_8h.html#aa93f0eb578d23995850d61f7d61c55c1">FALSE</a>;</div>
<div class="line"><span class="lineno"> 97</span> <span class="keywordflow">goto</span> Return;</div>
<div class="line"><span class="lineno"> 98</span> }</div>
<div class="line"><span class="lineno"> 99</span> <span class="keywordflow">else</span></div>
<div class="line"><span class="lineno"> 100</span> {</div>
<div class="line"><span class="lineno"> 101</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 102</span> <span class="comment">// *** being here means the thread is found in the list of threads that we set TRAP FLAG on it ***</span></div>
<div class="line"><span class="lineno"> 103</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 104</span> </div>
<div class="line"><span class="lineno"> 105</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 106</span> <span class="comment">// Uset or set the TRAP flag</span></div>
<div class="line"><span class="lineno"> 107</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 108</span> <a class="code hl_function" href="_export_8c.html#a8f68fa306b093e98466bd4f16cd16035">VmFuncSetRflagTrapFlag</a>(<a class="code hl_define" href="_basic_types_8h.html#aa93f0eb578d23995850d61f7d61c55c1">FALSE</a>);</div>
<div class="line"><span class="lineno"> 109</span> </div>
<div class="line"><span class="lineno"> 110</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 111</span> <span class="comment">// Remove the thread/process from the list</span></div>
<div class="line"><span class="lineno"> 112</span> <span class="comment">// We're sure the Result is TRUE</span></div>
<div class="line"><span class="lineno"> 113</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 114</span> <a class="code hl_function" href="_insertion_sort_8c.html#a7132f7eebd8c326f710aa5ac6273d2d6">InsertionSortDeleteItem</a>((<a class="code hl_typedef" href="_basic_types_8h.html#aae17ebb9ef7279d026817fb22f8aebe9">UINT64</a> *)&<a class="code hl_variable" href="hyperkd_2header_2globals_2_global_8h.html#a08664e62cf0b438d0a6e22f8a3b0bcf3">g_TrapFlagState</a>.<a class="code hl_variable" href="struct___d_e_b_u_g_g_e_r___t_r_a_p___f_l_a_g___s_t_a_t_e.html#a86158ec2d43b4f49e48fefcfa10836f5">ThreadInformation</a>[0],</div>
<div class="line"><span class="lineno"> 115</span> &<a class="code hl_variable" href="hyperkd_2header_2globals_2_global_8h.html#a08664e62cf0b438d0a6e22f8a3b0bcf3">g_TrapFlagState</a>.<a class="code hl_variable" href="struct___d_e_b_u_g_g_e_r___t_r_a_p___f_l_a_g___s_t_a_t_e.html#aadcf8838b899a02f40f9745c0f32f6f4">NumberOfItems</a>,</div>
<div class="line"><span class="lineno"> 116</span> Index);</div>
<div class="line"><span class="lineno"> 117</span> </div>
<div class="line"><span class="lineno"> 118</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 119</span> <span class="comment">// Handled #DB by debugger</span></div>
<div class="line"><span class="lineno"> 120</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 121</span> ResultToReturn = <a class="code hl_define" href="_basic_types_8h.html#aa8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;</div>
<div class="line"><span class="lineno"> 122</span> <span class="keywordflow">goto</span> Return;</div>
<div class="line"><span class="lineno"> 123</span> }</div>
<div class="line"><span class="lineno"> 124</span> </div>
<div class="line"><span class="lineno"> 125</span>Return:</div>
<div class="line"><span class="lineno"> 126</span> </div>
<div class="line"><span class="lineno"> 127</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 128</span> <span class="comment">// Unlock the list modification lock</span></div>
<div class="line"><span class="lineno"> 129</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 130</span> <a class="code hl_function" href="_spinlock_8c.html#a529db917026601c47af458af0154bfa1">SpinlockUnlock</a>(&<a class="code hl_variable" href="_breakpoint_commands_8h.html#ae50db4cdf98f46b292c83cb1b92178c7">BreakpointCommandTrapListLock</a>);</div>
<div class="line"><span class="lineno"> 131</span> </div>
<div class="line"><span class="lineno"> 132</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 133</span> <span class="comment">// By default, #DBs are managed by HyperDbg</span></div>
<div class="line"><span class="lineno"> 134</span> <span class="comment">//</span></div>
<div class="line"><span class="lineno"> 135</span> <span class="keywordflow">return</span> ResultToReturn;</div>
<div class="line"><span class="lineno"> 136</span>}</div>
<div class="ttc" id="a_basic_types_8h_html_ae1e6edbbc26d6fbc71a90190d0266018"><div class="ttname"><a href="_basic_types_8h.html#ae1e6edbbc26d6fbc71a90190d0266018">UINT32</a></div><div class="ttdeci">unsigned int UINT32</div><div class="ttdef"><b>Definition</b> BasicTypes.h:48</div></div>
<div class="ttc" id="a_binary_search_8c_html_ac1532f925279158a47a45e688224fb72"><div class="ttname"><a href="_binary_search_8c.html#ac1532f925279158a47a45e688224fb72">BinarySearchPerformSearchItem</a></div><div class="ttdeci">BOOLEAN BinarySearchPerformSearchItem(UINT64 ArrayPtr[], UINT32 NumberOfItems, UINT32 *ResultIndex, UINT64 Key)</div><div class="ttdoc">A utility function to perform the binary search.</div><div class="ttdef"><b>Definition</b> BinarySearch.c:46</div></div>