forked from swwwolf/wdbgark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
systemcb.cpp
691 lines (565 loc) · 25 KB
/
systemcb.cpp
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
/*
* WinDBG Anti-RootKit extension
* Copyright © 2013-2014 Vyacheslav Rusakoff
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* This work is licensed under the terms of the GNU GPL, version 3. See
* the COPYING file in the top-level directory.
*/
// TODO(swwwolf): DbgkLkmdRegisterCallback (WINDOWS 7+), ObRegisterCallbacks, CrashdmpCallTable,
// KdRegisterPowerHandler, IoRegisterIoTracking
/*
"!systemcb /type type_name"
Type names are:
image
process
thread
registry
bugcheck
bugcheckreason
bugcheckaddpages
powersetting
callbackdir
shutdown
shutdownlast
drvreinit
bootdrvreinit
fschange
nmi
logonsessionroutine
prioritycallback
pnp
lego
debugprint
alpcplog
empcb
ioperf
dbgklkmd
Default: all of them
*/
/*
typedef struct _EX_CALLBACK_ROUTINE_BLOCK {
EX_RUNDOWN_REF RundownProtect;
PEX_CALLBACK_FUNCTION Function;
PVOID Context;
} EX_CALLBACK_ROUTINE_BLOCK, *PEX_CALLBACK_ROUTINE_BLOCK;
typedef struct _EX_CALLBACK {
EX_FAST_REF RoutineBlock;
} EX_CALLBACK, *PEX_CALLBACK;
*/
/*
BUGCHECK & BUGCHECKREASON:
typedef struct _KBUGCHECK_CALLBACK_RECORD {
LIST_ENTRY Entry;
PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine;
__field_bcount_opt(Length) PVOID Buffer;
ULONG Length;
PUCHAR Component;
ULONG_PTR Checksum;
UCHAR State;
} KBUGCHECK_CALLBACK_RECORD, *PKBUGCHECK_CALLBACK_RECORD;
typedef struct _KBUGCHECK_REASON_CALLBACK_RECORD {
LIST_ENTRY Entry;
PKBUGCHECK_REASON_CALLBACK_ROUTINE CallbackRoutine;
PUCHAR Component;
ULONG_PTR Checksum;
KBUGCHECK_CALLBACK_REASON Reason;
UCHAR State;
} KBUGCHECK_REASON_CALLBACK_RECORD, *PKBUGCHECK_REASON_CALLBACK_RECORD;
*/
/*
CALLBACKDIR:
typedef struct _CALLBACK_OBJECT {
ULONG Signature;
KSPIN_LOCK Lock;
LIST_ENTRY RegisteredCallbacks;
BOOLEAN AllowMultipleCallbacks;
UCHAR reserved[3];
} CALLBACK_OBJECT , *PCALLBACK_OBJECT;
//
// Executive callback registration structure definition.
//
typedef struct _CALLBACK_REGISTRATION {
LIST_ENTRY Link;
PCALLBACK_OBJECT CallbackObject;
PCALLBACK_FUNCTION CallbackFunction;
PVOID CallbackContext;
ULONG Busy;
BOOLEAN UnregisterWaiting;
} CALLBACK_REGISTRATION , *PCALLBACK_REGISTRATION;
*/
/*
SHUTDOWN & SHUTDOWNLAST:
typedef struct _SHUTDOWN_PACKET {
LIST_ENTRY ListEntry;
PDEVICE_OBJECT DeviceObject;
} SHUTDOWN_PACKET, *PSHUTDOWN_PACKET;
*/
/*
FSCHANGE:
typedef struct _NOTIFICATION_PACKET {
LIST_ENTRY ListEntry;
PDRIVER_OBJECT DriverObject;
PDRIVER_FS_NOTIFICATION NotificationRoutine;
} NOTIFICATION_PACKET, *PNOTIFICATION_PACKET;
*/
/*
LOGONSESSIONROUTINES:
typedef struct _SEP_LOGON_SESSION_TERMINATED_NOTIFICATION {
struct _SEP_LOGON_SESSION_TERMINATED_NOTIFICATION *Next;
PSE_LOGON_SESSION_TERMINATED_ROUTINE CallbackRoutine;
} SEP_LOGON_SESSION_TERMINATED_NOTIFICATION, *PSEP_LOGON_SESSION_TERMINATED_NOTIFICATION;
*/
/*
PNP:
x86 offset to routine is 0x14
x64 offset to routine is 0x20
XP/W2K3:
//
IopProfileNotifyList
//
//
InsertTailList(&deviceNode->TargetDeviceNotify, (PLIST_ENTRY)entry);
//
//
#define NOTIFY_DEVICE_CLASS_HASH_BUCKETS 13
LIST_ENTRY IopDeviceClassNotifyList[NOTIFY_DEVICE_CLASS_HASH_BUCKETS];
InsertTailList( (PLIST_ENTRY) &(IopDeviceClassNotifyList[ IopHashGuid(&(entry->ClassGuid)) ]), (PLIST_ENTRY) entry);
//
VISTA+:
IopProfileNotifyList and IopDeviceClassNotifyList were replaced by PnpProfileNotifyList and PnpDeviceClassNotifyList
*/
#include <map>
#include <string>
#include <utility>
#include <memory>
#include "wdbgark.hpp"
#include "analyze.hpp"
EXT_COMMAND(wa_systemcb,
"Output kernel-mode registered callback(s)",
"{type;s;o;type,Callback type name:\n"\
"image, process, thread, registry, bugcheck, bugcheckreason, bugcheckaddpages, powersetting, callbackdir, "\
"shutdown, shutdownlast, drvreinit, bootdrvreinit, fschange, nmi, logonsessionroutine, prioritycallback, "\
"pnp, lego, debugprint, alpcplog, empcb, ioperf, dbgklkmd}") {
std::string type;
walkresType output_list;
RequireKernelMode();
if ( !Init() )
throw ExtStatusException(S_OK, "global init failed");
if ( HasArg("type") ) // callback type was provided
type.assign(GetArgStr("type"));
out << "Displaying OS registered callback(s) " << type << endlout;
std::unique_ptr<WDbgArkAnalyze> display(new WDbgArkAnalyze(WDbgArkAnalyze::AnalyzeTypeCallback));
display->PrintFooter();
try {
if ( type.empty() ) {
for ( callbacksInfo::const_iterator citer = system_cb_commands.cbegin();
citer != system_cb_commands.cend();
++citer ) {
CallCorrespondingWalkListRoutine(citer, output_list);
}
} else {
callbacksInfo::const_iterator citer = system_cb_commands.find(type);
if ( citer != system_cb_commands.end() )
CallCorrespondingWalkListRoutine(citer, output_list);
else
err << __FUNCTION__ << ": invalid type was specified" << endlerr;
}
std::string prev_list_head;
for ( const OutputWalkInfo &walk_info : output_list ) {
if ( prev_list_head != walk_info.list_head_name ) {
out << "[+] " << walk_info.list_head_name;
if ( walk_info.list_head_offset )
out << ": " << std::hex << std::showbase << walk_info.list_head_offset;
out << endlout;
display->PrintHeader();
}
display->AnalyzeAddressAsRoutine(walk_info.routine_address, walk_info.type, walk_info.info);
display->PrintFooter();
prev_list_head = walk_info.list_head_name;
}
display->PrintFooter();
output_list.clear();
}
catch( const ExtInterruptException& ) {
throw;
}
}
void WDbgArk::CallCorrespondingWalkListRoutine(const callbacksInfo::const_iterator &citer,
walkresType &output_list) {
if ( citer->first == "registry" ) {
if ( m_minor_build == WXP_VER || m_minor_build == W2K3_VER ) {
WalkExCallbackList(citer->second.list_count_name,
0ULL,
0,
citer->second.list_head_name,
0ULL,
m_PtrSize,
citer->first,
output_list);
} else {
WalkAnyListWithOffsetToRoutine("nt!CallbackListHead",
0ULL,
0,
true,
citer->second.offset_to_routine,
citer->first,
"",
output_list);
}
} else if ( citer->first == "image" || citer->first == "process" || citer->first == "thread" ) {
WalkExCallbackList(citer->second.list_count_name,
0ULL,
0,
citer->second.list_head_name,
0ULL,
m_PtrSize,
citer->first,
output_list);
} else if ( citer->first == "bugcheck" || citer->first == "bugcheckreason" ||
(citer->first == "bugcheckaddpages" && m_minor_build >= VISTA_SP1_VER) ) {
WalkAnyListWithOffsetToRoutine(citer->second.list_head_name,
0ULL,
0,
true,
citer->second.offset_to_routine,
citer->first,
"",
output_list);
} else if ( citer->first == "powersetting" && m_minor_build > W2K3_VER ) {
WalkAnyListWithOffsetToRoutine(citer->second.list_head_name,
0ULL,
0,
true,
citer->second.offset_to_routine,
citer->first,
"",
output_list);
} else if ( citer->first == "callbackdir" ) {
WalkCallbackDirectory(citer->first, output_list);
} else if ( citer->first == "shutdown" || citer->first == "shutdownlast" ) {
WalkShutdownList(citer->second.list_head_name, citer->first, output_list);
} else if ( citer->first == "drvreinit" || citer->first == "bootdrvreinit" ) {
WalkAnyListWithOffsetToRoutine(citer->second.list_head_name,
0ULL,
0,
true,
citer->second.offset_to_routine,
citer->first,
"",
output_list);
} else if ( citer->first == "fschange" ) {
WalkAnyListWithOffsetToRoutine(citer->second.list_head_name,
0ULL,
0,
true,
citer->second.offset_to_routine,
citer->first,
"",
output_list);
} else if ( citer->first == "nmi" && m_minor_build > WXP_VER ) {
WalkAnyListWithOffsetToRoutine(citer->second.list_head_name,
0ULL,
0,
false,
citer->second.offset_to_routine,
citer->first,
"",
output_list);
} else if ( citer->first == "logonsessionroutine" ) {
WalkAnyListWithOffsetToRoutine(citer->second.list_head_name,
0ULL,
0,
false,
citer->second.offset_to_routine,
citer->first,
"",
output_list);
} else if ( citer->first == "prioritycallback" && m_minor_build >= W7RTM_VER ) {
WalkExCallbackList(citer->second.list_count_name,
0ULL,
0,
citer->second.list_head_name,
0ULL,
m_PtrSize,
citer->first,
output_list);
} else if ( citer->first == "pnp" ) {
WalkPnpLists(citer->first, output_list);
} else if ( citer->first == "lego" ) {
AddSymbolPointer(citer->second.list_head_name, citer->first, "", output_list);
} else if ( citer->first == "debugprint" && m_minor_build >= VISTA_RTM_VER ) {
if ( m_minor_build == VISTA_RTM_VER ) {
AddSymbolPointer("nt!RtlpDebugPrintCallback", citer->first, "", output_list);
} else {
WalkAnyListWithOffsetToRoutine(citer->second.list_head_name,
0ULL,
0,
true,
citer->second.offset_to_routine,
citer->first,
"",
output_list);
}
} else if ( citer->first == "alpcplog" && m_minor_build >= VISTA_RTM_VER ) {
WalkAnyListWithOffsetToRoutine(citer->second.list_head_name,
0ULL,
0,
true,
citer->second.offset_to_routine,
citer->first,
"",
output_list);
} else if ( citer->first == "empcb" && m_minor_build >= VISTA_RTM_VER ) {
WalkAnyListWithOffsetToRoutine(citer->second.list_head_name,
0ULL,
GetEmpCallbackItemLinkOffset(),
true,
citer->second.offset_to_routine,
citer->first,
"",
output_list);
} else if ( citer->first == "ioperf" && m_minor_build >= W8RTM_VER ) {
WalkAnyListWithOffsetToRoutine(citer->second.list_head_name,
0ULL,
0,
true,
citer->second.offset_to_routine,
citer->first,
"",
output_list);
} else if ( citer->first == "dbgklkmd" && m_minor_build >= W7RTM_VER ) {
WalkExCallbackList("",
0ULL,
GetDbgkLkmdCallbackCount(),
citer->second.list_head_name,
0ULL,
GetDbgkLkmdCallbackArrayDistance(),
"dbgklkmd",
output_list);
}
}
void WDbgArk::WalkExCallbackList(const std::string &list_count_name,
const unsigned __int64 offset_list_count,
const unsigned __int32 count,
const std::string &list_head_name,
const unsigned __int64 offset_list_head,
const unsigned __int32 array_distance,
const std::string &type,
walkresType &output_list) {
unsigned __int64 offset = offset_list_count;
unsigned __int32 rcount = count;
ExtRemoteData routine_count;
try {
if ( !rcount && !offset && !GetSymbolOffset(list_count_name.c_str(), true, &offset) ) {
err << __FUNCTION__ << ": failed to get " << list_count_name << endlerr;
return;
}
if ( !rcount )
routine_count.Set(offset, static_cast<unsigned __int32>(sizeof(unsigned __int32)));
offset = offset_list_head;
if ( !offset && !GetSymbolOffset(list_head_name.c_str(), true, &offset) ) {
err << __FUNCTION__ << ": failed to get " << list_head_name << endlerr;
return;
}
const unsigned __int64 list_head_offset_out = offset;
if ( !rcount )
rcount = routine_count.GetUlong();
for ( unsigned __int32 i = 0; i < rcount; i++ ) {
ExtRemoteData notify_routine_list(offset + i * array_distance, m_PtrSize);
const unsigned __int64 ex_callback_fast_ref = notify_routine_list.GetPtr();
if ( ex_callback_fast_ref ) {
ExtRemoteData routine_block(
m_obj_helper->ExFastRefGetObject(ex_callback_fast_ref) + GetTypeSize("nt!_EX_RUNDOWN_REF"),
m_PtrSize);
const unsigned __int64 notify_routine = routine_block.GetPtr();
if ( notify_routine ) {
OutputWalkInfo info;
info.routine_address = notify_routine;
info.type = type;
info.info = "";
info.list_head_name = list_head_name;
info.object_offset = 0ULL;
info.list_head_offset = list_head_offset_out;
output_list.push_back(info);
}
}
}
}
catch ( const ExtRemoteException &Ex ) {
err << __FUNCTION__ << ": " << Ex.GetMessage() << endlerr;
}
}
//
// http://redplait.blogspot.ru/2010/08/cmregistercallbackex-on-vista.html
//
unsigned __int32 WDbgArk::GetCmCallbackItemFunctionOffset() const {
if ( !m_is_cur_machine64 )
return 0x1C;
if ( m_minor_build >= VISTA_RTM_VER && m_minor_build < W7RTM_VER )
return 0x30;
else if ( m_minor_build >= W7RTM_VER )
return 0x28;
return 0;
}
//
// http://redplait.blogspot.ru/2012/10/poregisterpowersettingcallback-callbacks.html
//
unsigned __int32 WDbgArk::GetPowerCallbackItemFunctionOffset() const {
if ( !m_is_cur_machine64 )
return 0x28;
return 0x40;
}
unsigned __int32 WDbgArk::GetPnpCallbackItemFunctionOffset() const {
if ( !m_is_cur_machine64 )
return 0x14;
return 0x20;
}
//
// http://redplait.blogspot.ru/2012/09/emproviderregisterempproviderregister.html
//
unsigned __int32 WDbgArk::GetEmpCallbackItemLinkOffset() const {
if ( !m_is_cur_machine64 )
return 0x1C;
return 0x28;
}
void WDbgArk::WalkCallbackDirectory(const std::string &type, walkresType &output_list) {
WalkCallbackContext context;
context.type = type;
context.output_list_pointer = &output_list;
WalkDirectoryObject(m_obj_helper->FindObjectByName("Callback", 0ULL),
reinterpret_cast<void*>(&context),
DirectoryObjectCallback);
}
HRESULT WDbgArk::DirectoryObjectCallback(WDbgArk* wdbg_ark_class, const ExtRemoteTyped &object, void* context) {
WalkCallbackContext* cb_context = reinterpret_cast<WalkCallbackContext*>(context);
std::string type = cb_context->type;
std::string list_head_name = "\\Callback\\";
std::pair<HRESULT, std::string> result = wdbg_ark_class->m_obj_helper->GetObjectName(object);
if ( !SUCCEEDED(result.first) ) {
std::stringstream tmpwarn;
tmpwarn << __FUNCTION__ << ": failed to get object name" << endlwarn;
} else {
list_head_name.append(result.second);
}
// Signature + Lock
const unsigned __int64 offset_list_head = object.m_Offset + g_Ext->m_PtrSize + g_Ext->m_PtrSize;
// Link + CallbackObject
const unsigned __int32 offset_to_routine = GetTypeSize("nt!_LIST_ENTRY") + g_Ext->m_PtrSize;
wdbg_ark_class->WalkAnyListWithOffsetToRoutine(list_head_name,
offset_list_head,
0,
true,
offset_to_routine,
type,
"",
*cb_context->output_list_pointer);
return S_OK;
}
void WDbgArk::WalkShutdownList(const std::string &list_head_name, const std::string &type, walkresType &output_list) {
WalkCallbackContext context;
context.type = type;
context.list_head_name = list_head_name;
context.output_list_pointer = &output_list;
if ( !GetSymbolOffset( list_head_name.c_str(), true, &context.list_head_offset ) )
warn << __FUNCTION__ << ": GetSymbolOffset failed with " << list_head_name << endlwarn;
WalkAnyListWithOffsetToObjectPointer(list_head_name,
0ULL,
true,
GetTypeSize("nt!_LIST_ENTRY"),
reinterpret_cast<void*>(&context),
ShutdownListCallback);
}
HRESULT WDbgArk::ShutdownListCallback(WDbgArk* wdbg_ark_class, ExtRemoteData &object_pointer, void* context) {
WalkCallbackContext* cb_context = reinterpret_cast<WalkCallbackContext*>(context);
std::string type = cb_context->type;
try {
ExtRemoteTyped device_object("nt!_DEVICE_OBJECT", object_pointer.GetPtr(), false, NULL, NULL);
ExtRemoteTyped driver_object_ptr = device_object.Field("DriverObject");
ExtRemoteTyped driver_object = *driver_object_ptr;
ExtRemoteTyped major_functions = driver_object.Field("MajorFunction");
std::stringstream info;
info << "<exec cmd=\"!devobj " << std::hex << std::showbase << object_pointer.GetPtr();
info << "\">!devobj" << "</exec>" << " ";
info << "<exec cmd=\"!devstack " << std::hex << std::showbase << object_pointer.GetPtr();
info << "\">!devstack" << "</exec>" << " ";
info << "<exec cmd=\"!drvobj " << std::hex << std::showbase << driver_object.m_Offset;
info << " 7" << "\">!drvobj" << "</exec>";
const unsigned __int64 routine_address = major_functions[static_cast<ULONG>(IRP_MJ_SHUTDOWN)].GetPtr();
OutputWalkInfo winfo;
winfo.routine_address = routine_address;
winfo.type = type;
winfo.info = info.str();
winfo.list_head_name = cb_context->list_head_name;
winfo.object_offset = 0ULL;
winfo.list_head_offset = cb_context->list_head_offset;
cb_context->output_list_pointer->push_back(winfo);
}
catch ( const ExtRemoteException &Ex ) {
std::stringstream tmperr;
tmperr << __FUNCTION__ << ": " << Ex.GetMessage() << endlerr;
return Ex.GetStatus();
}
return S_OK;
}
// IopProfileNotifyList and IopDeviceClassNotifyList were replaced
// by PnpProfileNotifyList and PnpDeviceClassNotifyList in Vista+
void WDbgArk::WalkPnpLists(const std::string &type, walkresType &output_list) {
std::string list_head_name;
unsigned __int64 offset = 0;
const unsigned __int32 offset_to_routine = GetPnpCallbackItemFunctionOffset();
if ( m_minor_build == WXP_VER || m_minor_build == W2K3_VER )
list_head_name = "nt!IopProfileNotifyList";
else
list_head_name = "nt!PnpProfileNotifyList";
WalkAnyListWithOffsetToRoutine(list_head_name, 0ULL, 0, true, offset_to_routine, type, "", output_list);
if ( m_minor_build == WXP_VER || m_minor_build == W2K3_VER )
list_head_name = "nt!IopDeviceClassNotifyList";
else
list_head_name = "nt!PnpDeviceClassNotifyList";
if ( !GetSymbolOffset(list_head_name.c_str(), true, &offset) ) {
err << __FUNCTION__ << ": failed to get " << list_head_name << endlerr;
} else {
for ( int i = 0; i < NOTIFY_DEVICE_CLASS_HASH_BUCKETS; i++ ) {
WalkAnyListWithOffsetToRoutine(list_head_name,
offset + i * GetTypeSize("nt!_LIST_ENTRY"),
0,
true,
offset_to_routine,
type,
"",
output_list);
}
}
WalkCallbackContext context;
context.type = type;
context.list_head_name = "nt!IopRootDeviceNode";
context.output_list_pointer = &output_list;
WalkDeviceNode(0ULL, reinterpret_cast<void*>(&context), DeviceNodeCallback);
}
HRESULT WDbgArk::DeviceNodeCallback(WDbgArk* wdbg_ark_class, ExtRemoteTyped &device_node, void* context) {
WalkCallbackContext* cb_context = reinterpret_cast<WalkCallbackContext*>(context);
std::stringstream info;
info << std::setw(37) << "<exec cmd=\"!devnode " << std::hex << std::showbase << device_node.m_Offset;
info << "\">!devnode" << "</exec>";
wdbg_ark_class->WalkAnyListWithOffsetToRoutine(cb_context->list_head_name,
device_node.Field("TargetDeviceNotify").m_Offset,
0,
true,
wdbg_ark_class->GetPnpCallbackItemFunctionOffset(),
cb_context->type,
info.str(),
*cb_context->output_list_pointer);
return S_OK;
}