-
Notifications
You must be signed in to change notification settings - Fork 1
/
hidi2c.sys.c
6851 lines (6584 loc) · 263 KB
/
hidi2c.sys.c
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
/* This file was generated by the Hex-Rays decompiler.
Copyright (c) 2007-2020 Hex-Rays <[email protected]>
Detected compiler: Visual C++
*/
#include <windows.h>
#include <defs.h>
#include <stdarg.h>
//-------------------------------------------------------------------------
// Function declarations
TLG_STATUS __stdcall TlgWrite(TraceLoggingHProvider hProvider, const void *pEventMetadata, LPCGUID pActivityId, LPCGUID pRelatedActivityId, UINT32 cData, EVENT_DATA_DESCRIPTOR *pData);
void __fastcall TraceLoggingWDFDevice(int a1, struct _DRIVER_OBJECT *a2, __int64 a3, const GUID *a4);
void __fastcall TraceLoggingDeviceDriver(int a1, struct WDFDEVICE__ *a2, __int64 a3, const GUID *a4);
void __stdcall McGenControlCallbackV2(LPCGUID SourceId, ULONG ControlCode, UCHAR Level, ULONGLONG MatchAnyKeyword, ULONGLONG MatchAllKeyword, PEVENT_FILTER_DESCRIPTOR FilterData, PVOID CallbackContext);
ULONG __stdcall McGenEventRegister(LPCGUID ProviderId, PETWENABLECALLBACK EnableCallback, PVOID CallbackContext, PREGHANDLE RegHandle);
ULONG __stdcall McGenEventUnregister(PREGHANDLE RegHandle);
__int64 __fastcall WPP_RECORDER_SF_(__int64 a1, unsigned __int8 a2, unsigned int a3, unsigned __int16 a4, __int64 a5);
__int64 WPP_RECORDER_SF_d(__int64 a1, unsigned __int8 a2, unsigned int a3, unsigned __int16 a4, __int64 a5, ...);
__int64 WPP_RECORDER_SF_q(__int64 a1, __int64 a2, unsigned int a3, unsigned __int16 a4, __int64 a5, ...);
__int64 WPP_RECORDER_SF_qd(__int64 a1, unsigned __int8 a2, unsigned int a3, unsigned __int16 a4, __int64 a5, ...);
__int64 __fastcall WppClassicProviderCallback(__int64 a1, unsigned __int8 a2, __int64 *a3, __int64 a4);
void TlgDefineProvider_annotation__Tlgg_TraceLoggingProviderProv();
__int64 RtlStringCbPrintfW(wchar_t *Dest, unsigned __int64, const unsigned __int16 *, ...); // idb
void __fastcall TraceLoggingPNPFailure(const struct _TlgProvider_t *a1, __int64 a2, __int64 a3, const GUID *a4);
ULONG __stdcall McGenEventWrite(PMCGEN_TRACE_CONTEXT Context, PCEVENT_DESCRIPTOR Descriptor, LPCGUID ActivityId, ULONG EventDataCount, EVENT_DATA_DESCRIPTOR *EventData);
ULONG McTemplateK0pq(struct _MCGEN_TRACE_CONTEXT *a1, const EVENT_DESCRIPTOR *a2, __int64 a3, ...);
__int64 __fastcall OnPrepareHardware(struct WDFDEVICE__ *a1, struct WDFCMRESLIST__ *a2, struct WDFCMRESLIST__ *a3);
__int64 __fastcall OnD0Entry(struct WDFDEVICE__ *a1, enum _WDF_POWER_DEVICE_STATE a2);
__int64 __fastcall OnPostInterruptsEnabled(struct WDFDEVICE__ *, enum _WDF_POWER_DEVICE_STATE); // idb
__int64 __fastcall OnReleaseHardware(struct WDFDEVICE__ *, struct WDFCMRESLIST__ *); // idb
__int64 __fastcall OnSelfManagedIoSuspend(struct WDFDEVICE__ *); // idb
__int64 WPP_RECORDER_SF_qq(__int64 a1, __int64 a2, __int64 a3, unsigned __int16 a4, int a5, ...);
__int64 WPP_RECORDER_SF_qqd(__int64 a1, unsigned __int8 a2, unsigned int a3, unsigned __int16 a4, __int64 a5, ...);
__int64 __fastcall WPP_RECORDER_SF_sqq(__int64 a1, __int64 a2, __int64 a3, __int64 a4, int a5, const char *a6);
void __fastcall OnInternalDeviceIoControl(struct WDFQUEUE__ *a1, struct WDFREQUEST__ *a2, __int64 a3, __int64 a4, unsigned int a5);
void __fastcall OnIoStop(struct WDFQUEUE__ *a1, struct WDFREQUEST__ *a2, char a3);
char *__fastcall _DbgInternalIoctlString(unsigned int); // idb
__int64 RtlUnicodeStringPrintf(struct _UNICODE_STRING *a1, const unsigned __int16 *a2, ...);
void __fastcall TraceLoggingBusDevice(int a1, struct WDFDEVICE__ *a2, __int64 a3, const GUID *a4);
ULONG McTemplateK0pp(__int64 a1, const EVENT_DESCRIPTOR *a2, const GUID *a3, ...);
__int64 WPP_RECORDER_SF_LLd(__int64 a1, __int64 a2, unsigned int a3, unsigned __int16 a4, __int64 a5, ...);
__int64 WPP_RECORDER_SF_Ld(__int64 a1, __int64 a2, unsigned int a3, unsigned __int16 a4, __int64 a5, ...);
__int64 __fastcall WPP_RECORDER_SF_Zd(__int64 a1, unsigned __int8 a2, __int64 a3, unsigned __int16 a4, __int64 a5, const wchar_t *a6);
__int64 WPP_RECORDER_SF_i(__int64 a1, __int64 a2, __int64 a3, __int64 a4, int a5, ...);
__int64 WPP_RECORDER_SF_qLd(__int64 a1, __int64 a2, __int64 a3, unsigned __int16 a4, int a5, ...);
__int64 WPP_RECORDER_SF_qLqLd(__int64 a1, __int64 a2, __int64 a3, unsigned __int16 a4, int a5, ...);
__int64 __fastcall SpbInitialize(struct _DEVICE_CONTEXT *, struct WDFCMRESLIST__ *, struct WDFCMRESLIST__ *); // idb
__int64 __fastcall SpbWrite(struct WDFIOTARGET__ *a1, __int64 a2, unsigned __int8 *a3, unsigned int a4, unsigned int a5);
__int64 __fastcall SpbWritelessRead(struct WDFIOTARGET__ *, struct WDFREQUEST__ *, unsigned __int8 *, unsigned int, struct _GUID *); // idb
__int64 __fastcall SpbRead(struct WDFIOTARGET__ *a1, __int64 a2, unsigned __int8 *a3, unsigned int a4, unsigned int a5, unsigned int a6);
__int64 __fastcall SpbWriteWrite(struct WDFIOTARGET__ *a1, __int16 a2, unsigned __int8 *a3, unsigned __int16 a4, unsigned __int16 a5, unsigned __int8 *a6, unsigned __int16 a7);
__int64 __fastcall SpbWriteRead(struct WDFIOTARGET__ *a1, __int16 a2, unsigned __int8 *a3, unsigned __int16 a4, unsigned __int16 a5, unsigned __int8 *a6, unsigned __int16 a7);
__int64 __fastcall _SpbSequence(struct WDFIOTARGET__ *a1, void *a2, __int64 a3, unsigned int *a4, unsigned int a5);
void __fastcall TraceLoggingACPI(int a1, struct WDFDEVICE__ *a2, __int64 a3, const GUID *a4);
__int64 WPP_RECORDER_SF_D(__int64 a1, __int64 a2, unsigned int a3, unsigned __int16 a4, __int64 a5, ...);
__int64 WPP_RECORDER_SF_cd(__int64 a1, __int64 a2, __int64 a3, unsigned __int16 a4, int a5, ...);
void __fastcall TraceLoggingHID(int a1, struct WDFDEVICE__ *a2, __int64 a3, const GUID *a4);
ULONG McTemplateK0phq(struct _MCGEN_TRACE_CONTEXT *a1, const EVENT_DESCRIPTOR *a2, __int64 a3, ...);
__int64 WPP_RECORDER_SF_DD(__int64 a1, __int64 a2, __int64 a3, __int64 a4, int a5, ...);
__int64 WPP_RECORDER_SF_DDd(__int64 a1, __int64 a2, __int64 a3, unsigned __int16 a4, int a5, ...);
__int64 WPP_RECORDER_SF_Dd(__int64 a1, unsigned __int8 a2, unsigned int a3, unsigned __int16 a4, __int64 a5, ...);
__int64 __fastcall HidInitialize(struct _DEVICE_CONTEXT *, enum _WDF_POWER_DEVICE_STATE); // idb
__int64 __fastcall HidDestroy(struct _DEVICE_CONTEXT *, enum _WDF_POWER_DEVICE_STATE); // idb
__int64 __fastcall HidGetDeviceDescriptor(struct _DEVICE_CONTEXT *, struct WDFREQUEST__ *); // idb
__int64 __fastcall HidGetReportDescriptor(struct _DEVICE_CONTEXT *, struct WDFREQUEST__ *); // idb
__int64 __fastcall HidGetDeviceAttributes(struct _DEVICE_CONTEXT *, struct WDFREQUEST__ *); // idb
__int64 __fastcall HidGetString(struct _DEVICE_CONTEXT *, struct WDFREQUEST__ *); // idb
__int64 __fastcall HidReadReport(struct _DEVICE_CONTEXT *, struct WDFREQUEST__ *, unsigned __int8 *); // idb
__int64 __fastcall HidWriteReport(struct _DEVICE_CONTEXT *, struct WDFREQUEST__ *); // idb
__int64 __fastcall HidGetReport(__int64 a1, __int64 a2, int a3);
__int64 __fastcall HidSetReport(__int64 a1, __int64 a2, int a3);
__int64 __fastcall HidSendIdleNotification(struct _DEVICE_CONTEXT *, struct WDFREQUEST__ *, unsigned __int8 *); // idb
__int64 __fastcall _HidGetHidDescriptor(struct _DEVICE_CONTEXT *); // idb
void __fastcall HidEvtResetTimerFired(struct WDFTIMER__ *); // idb
__int64 __fastcall HidReset(struct _DEVICE_CONTEXT *); // idb
__int64 __fastcall _HidPower(__int64 a1, __int16 a2);
void __fastcall TraceLoggingInterrupt(int a1, struct WDFDEVICE__ *a2, __int64 a3, const GUID *a4);
ULONG __fastcall McTemplateK0(struct _MCGEN_TRACE_CONTEXT *a1, __int64 a2, const GUID *a3);
ULONG McTemplateK0p(struct _MCGEN_TRACE_CONTEXT *a1, const EVENT_DESCRIPTOR *a2, const GUID *a3, ...);
unsigned __int8 __fastcall OnInterruptIsr(struct WDFINTERRUPT__ *a1);
void __fastcall OnInterruptDpc(struct WDFINTERRUPT__ *, void *); // idb
LPGUID __fastcall _LogGetActivityId(LPGUID ActivityId, struct WDFREQUEST__ *a2);
void __fastcall TraceLoggingPowerDevice(int a1, struct WDFDEVICE__ *a2, __int64 a3, const GUID *a4);
void __fastcall PowerIdleIrpWorkitem(struct WDFWORKITEM__ *); // idb
void __fastcall PowerIdleIrpCompletion(struct _DEVICE_CONTEXT *); // idb
__int64 __fastcall WPP_RECORDER_SF_ZL(__int64 a1, __int64 a2, __int64 a3, unsigned __int16 a4, int a5, const wchar_t *a6);
void FxStubDriverUnloadCommon(void); // idb
void FxStubDriverUnload();
NTSTATUS __stdcall FxDriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath);
NTSTATUS __fastcall FxDriverEntryWorker(_DRIVER_OBJECT *DriverObject, PUNICODE_STRING RegistryPath);
__int64 __fastcall FxStubBindClasses(struct _WDF_BIND_INFO *); // idb
__int64 __fastcall _GSHandlerCheckCommon(__int64 a1, __int64 a2);
void *__cdecl memmove(void *, const void *Src, size_t Size);
void *__cdecl memset(void *, int Val, size_t Size);
// __int64 __fastcall WdfVersionBind(_QWORD, _QWORD, _QWORD, _QWORD); weak
// __int64 __fastcall WdfVersionUnbind(_QWORD, _QWORD, _QWORD); weak
// __int64 __fastcall WdfVersionBindClass(_QWORD, _QWORD); weak
// __int64 __fastcall WdfVersionUnbindClass(_QWORD, _QWORD, _QWORD); weak
// __int64 __fastcall WppAutoLogTrace(_QWORD, _QWORD, _QWORD, _QWORD, _DWORD, _QWORD); weak
// __int64 __fastcall imp_WppRecorderReplay(_QWORD, _QWORD, _QWORD, _QWORD); weak
// __int64 __fastcall WppAutoLogStart(_QWORD, _QWORD, _QWORD); weak
// __int64 __fastcall WppAutoLogStop(_QWORD, _QWORD); weak
// PVOID __stdcall ExAllocatePoolWithTag(POOL_TYPE PoolType, SIZE_T NumberOfBytes, ULONG Tag);
// void __stdcall ExFreePoolWithTag(PVOID P, ULONG Tag);
// __int64 __fastcall IoSetActivityIdIrp(_QWORD, _QWORD); weak
// NTSTATUS __stdcall RtlFindMessage(PVOID BaseAddress, ULONG Type, ULONG Language, ULONG MessageId, PMESSAGE_RESOURCE_ENTRY *MessageResourceEntry);
// __int64 __fastcall IoGetActivityIdIrp(_QWORD, _QWORD); weak
// NTSTATUS __stdcall EtwActivityIdControl(ULONG ControlCode, LPGUID ActivityId);
// NTSTATUS __stdcall EtwUnregister(REGHANDLE RegHandle);
// NTSTATUS __stdcall IoSetDevicePropertyData(PDEVICE_OBJECT Pdo, const DEVPROPKEY *PropertyKey, LCID Lcid, ULONG Flags, DEVPROPTYPE Type, ULONG Size, PVOID Data);
// int __cdecl _vsnwprintf(wchar_t *Dest, size_t Count, const wchar_t *Format, va_list Args);
// NTSTATUS __stdcall IoWMIRegistrationControl(PDEVICE_OBJECT DeviceObject, ULONG Action);
// PVOID __stdcall MmGetSystemRoutineAddress(PUNICODE_STRING SystemRoutineName);
// NTSTATUS __stdcall EtwRegister(LPCGUID ProviderId, PETWENABLECALLBACK EnableCallback, PVOID CallbackContext, PREGHANDLE RegHandle);
// void __stdcall RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PCUNICODE_STRING SourceString);
// NTSTATUS __stdcall EtwWriteTransfer(REGHANDLE RegHandle, PCEVENT_DESCRIPTOR EventDescriptor, LPCGUID ActivityId, LPCGUID RelatedActivityId, ULONG UserDataCount, PEVENT_DATA_DESCRIPTOR UserData);
// void __stdcall RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString);
// errno_t __cdecl memcpy_s(void *, rsize_t DstSize, const void *Src, rsize_t MaxCount);
// NTSTATUS __stdcall EtwSetInformation(REGHANDLE RegHandle, EVENT_INFO_CLASS InformationClass, PVOID EventInformation, ULONG InformationLength);
void __stdcall TlgEnableCallback(LPCGUID pSourceId, ULONG callbackType, UCHAR level, ULONGLONG keywordAny, ULONGLONG keywordAll, PEVENT_FILTER_DESCRIPTOR pFilterData, PVOID pCallbackContext);
PVOID WppLoadTracingSupport();
__int64 __fastcall WppTraceCallback(unsigned __int8 a1, __int64 a2, unsigned int a3, unsigned int *a4, __int64 a5, unsigned int *a6);
void __fastcall WppInitKm(__int64 a1, __int64 a2);
void __fastcall WppCleanupKm(__int64 a1);
__int64 __fastcall OnDeviceAdd(__int64 a1, __int64 a2);
void __fastcall OnDriverUnload(ULONGLONG *a1);
__int64 __fastcall OnD0Exit(__int64 a1, enum _WDF_POWER_DEVICE_STATE a2);
void __fastcall DeviceReportPnpProblem(__int64 a1, __int64 a2, __int64 a3, const GUID *a4);
__int64 __fastcall AcpiInitialize(__int64 *a1, __int64 a2);
__int64 __fastcall AcpiGetDeviceMethod(__int64 a1, __int64 a2);
__int64 __fastcall AcpiDsmSupported(struct WDFDEVICE__ **a1, __int64 a2, char *a3);
__int64 __fastcall AcpiPrepareInputParametersForDsm(_DWORD *a1, __int64 a2, int a3);
NTSTATUS __stdcall DriverEntry(_DRIVER_OBJECT *DriverObject, PUNICODE_STRING RegistryPath);
// void __cdecl _security_init_cookie();
//-------------------------------------------------------------------------
// Data declarations
const EVENT_DESCRIPTOR EVENT_HIDI2C_IO_INTERRUPT_RECEIVED = { 1010u, 1u, 16u, 4u, 1u, 2u, 9223372036854775808ui64 }; // idb
EVENT_DESCRIPTOR EVENT_HIDI2C_ENUMERATION_SPB_FAILURE = { 1001u, 1u, 16u, 2u, 0u, 1u, 9223372036854775808ui64 }; // idb
const DEVPROPKEY DEVPKEY_Device_DriverProblemDesc =
{
{
1410045054u,
35648u,
17852u,
{ 168u, 162u, 106u, 11u, 137u, 76u, 189u, 162u }
},
11u
};
EVENT_DESCRIPTOR EVENT_HIDI2C_COMMAND_POWER = { 1021u, 1u, 16u, 4u, 0u, 3u, 9223372036854775808ui64 }; // idb
EVENT_DESCRIPTOR EVENT_HIDI2C_IO_COMPLETE = { 1014u, 1u, 16u, 4u, 2u, 2u, 9223372036854775808ui64 }; // idb
_UNKNOWN WPP_ea388f3d0afe39bad432b1506e0dfc21_Traceguids; // weak
_UNKNOWN ACPI_DSM_GUID_HIDI2C; // weak
EVENT_DESCRIPTOR EVENT_HIDI2C_COMMAND_RESET = { 1020u, 1u, 16u, 4u, 0u, 3u, 9223372036854775808ui64 }; // idb
const GUID HIDI2C_EVENT_PROVIDER = { 2568982502u, 9373u, 17622u, { 185u, 61u, 90u, 48u, 96u, 193u, 222u, 219u } }; // idb
_UNKNOWN WPP_ThisDir_CTLGUID_HidI2CTraceGuid; // weak
EVENT_DESCRIPTOR EVENT_HIDI2C_IO_SPBREAD_DISPATCH = { 1011u, 1u, 16u, 4u, 10u, 2u, 9223372036854775808ui64 }; // idb
EVENT_DESCRIPTOR EVENT_HIDI2C_ENUMERATION_HID_FAILURE = { 1003u, 1u, 16u, 2u, 0u, 1u, 9223372036854775808ui64 }; // idb
EVENT_DESCRIPTOR EVENT_HIDI2C_ENUMERATION_OK = { 1000u, 1u, 16u, 4u, 0u, 1u, 9223372036854775808ui64 }; // idb
EVENT_DESCRIPTOR EVENT_HIDI2C_IO_SPBREAD_COMPLETE = { 1012u, 1u, 16u, 4u, 11u, 2u, 9223372036854775808ui64 }; // idb
EVENT_DESCRIPTOR EVENT_HIDI2C_ENUMERATION_ACPI_FAILURE = { 1002u, 1u, 16u, 2u, 0u, 1u, 9223372036854775808ui64 }; // idb
EVENT_DESCRIPTOR EVENT_HIDI2C_IO_FORWARD_TO_COMPLETIONQUEUE = { 1013u, 1u, 16u, 4u, 12u, 2u, 9223372036854775808ui64 }; // idb
_UNKNOWN WPP_3ddab8cc3e813e123c06a7e2c1802a48_Traceguids; // weak
_UNKNOWN WPP_e41706a9c2f4318f0fc3c113099c0cfa_Traceguids; // weak
_UNKNOWN WPP_9075389c7a5f3b6a15013edc3674f153_Traceguids; // weak
_UNKNOWN WPP_bbb5d3a40b7a34b6a2ec846befa6302c_Traceguids; // weak
_UNKNOWN WPP_c7bf351957b43414ee78ffacc48fa063_Traceguids; // weak
_UNKNOWN WPP_3de35891b74b33b741300fa81a68062f_Traceguids; // weak
_UNKNOWN WPP_5ffd1a9dc269374eb0715b7afb3f035a_Traceguids; // weak
_UNKNOWN WPP_726ae28c65f835e1f9147df5104045df_Traceguids; // weak
_UNKNOWN unk_1C00096F9; // weak
_UNKNOWN unk_1C0009726; // weak
_UNKNOWN unk_1C0009756; // weak
_UNKNOWN unk_1C0009781; // weak
_UNKNOWN unk_1C00097A8; // weak
_UNKNOWN unk_1C00097D0; // weak
_UNKNOWN unk_1C00097F7; // weak
_UNKNOWN unk_1C0009824; // weak
void *off_1C000B018 = &WDF_DEVICE_CONTEXT_TYPE_INFO; // weak
int dword_1C000B028 = 0; // weak
PVOID EventInformation = &unk_1C000985D; // idb
__int64 qword_1C000B038 = 0i64; // weak
__int64 qword_1C000B040 = 0i64; // weak
REGHANDLE RegHandle = 0ui64; // idb
__int128 xmmword_1C000B050 = 0i64; // weak
ULONGLONG HIDI2C_EVENT_PROVIDER_Context = 0ui64; // idb
__int64 qword_1C000B068 = 0i64; // weak
void *off_1C000B0C0 = &WDF_WORKITEM_CONTEXT_TYPE_INFO; // weak
PDEVICE_OBJECT WPP_GLOBAL_Control = &WPP_GLOBAL_Control; // idb
void *off_1C000B0F0 = &WDF_REQUEST_CONTEXT_TYPE_INFO; // weak
void *WPP_RECORDER_INITIALIZED = &WPP_RECORDER_INITIALIZED; // weak
_UNKNOWN WdfBindInfo; // weak
_UNKNOWN __KMDF_CLASS_BIND_START; // weak
_QWORD __KMDF_CLASS_BIND_END = 0i64; // idb
void *off_1C000B168 = &__KMDF_CLASS_BIND_START; // weak
_UNKNOWN __KMDF_TYPE_INIT_START; // weak
char __KMDF_TYPE_INIT_END[64] =
{
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0',
'\0'
}; // idb
__int64 pfnEtwRegisterClassicProvider = 0i64; // weak
__int64 (__fastcall *pfnWppTraceMessage)(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD) = NULL; // weak
__int64 (__fastcall *pfnWppGetVersion)(_QWORD, _QWORD, _QWORD, _QWORD) = NULL; // weak
int WPPTraceSuite = 0; // weak
char Microsoft_Windows_SPB_HIDI2CEnableBits; // weak
__int64 (__fastcall *pfnWppQueryTraceInformation)(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD); // weak
struct _DEVICE_OBJECT WPP_MAIN_CB; // idb
__int64 (*qword_1C000B498)(void); // weak
//----- (00000001C0001008) ----------------------------------------------------
TLG_STATUS __stdcall TlgWrite(TraceLoggingHProvider hProvider, const void *pEventMetadata, LPCGUID pActivityId, LPCGUID pRelatedActivityId, UINT32 cData, EVENT_DATA_DESCRIPTOR *pData)
{
EVENT_DESCRIPTOR EventDescriptor; // [rsp+30h] [rbp-18h] BYREF
*(_DWORD *)&EventDescriptor.Id = *(unsigned __int8 *)pEventMetadata << 24;
*(_DWORD *)&EventDescriptor.Level = *(unsigned __int16 *)((char *)pEventMetadata + 1);
EventDescriptor.Keyword = *(_QWORD *)((char *)pEventMetadata + 3);
pData->Ptr = (ULONGLONG)EventInformation;
pData->Size = *(unsigned __int16 *)EventInformation;
pData[1].Ptr = (ULONGLONG)pEventMetadata + 11;
pData->Reserved = 2;
pData[1].Size = *(unsigned __int16 *)((char *)pEventMetadata + 11);
pData[1].Reserved = 1;
return EtwWriteTransfer(RegHandle, &EventDescriptor, 0i64, 0i64, cData, pData);
}
//----- (00000001C00010B0) ----------------------------------------------------
void __fastcall TraceLoggingWDFDevice(int a1, struct _DRIVER_OBJECT *a2, __int64 a3, const GUID *a4)
{
struct _DRIVER_OBJECT *v4; // [rsp+30h] [rbp-68h] BYREF
EVENT_DATA_DESCRIPTOR v5; // [rsp+40h] [rbp-58h] BYREF
struct _DRIVER_OBJECT **v6; // [rsp+60h] [rbp-38h]
int v7; // [rsp+68h] [rbp-30h]
int v8; // [rsp+6Ch] [rbp-2Ch]
int *v9; // [rsp+70h] [rbp-28h]
int v10; // [rsp+78h] [rbp-20h]
int v11; // [rsp+7Ch] [rbp-1Ch]
int v12; // [rsp+A0h] [rbp+8h] BYREF
v12 = a1;
if ( (unsigned int)dword_1C000B028 > 5
&& (qword_1C000B038 & 0x200000000000i64) != 0
&& (qword_1C000B040 & 0x200000000000i64) == qword_1C000B040 )
{
v4 = a2;
v6 = &v4;
v8 = 0;
v7 = 8;
v9 = &v12;
v11 = 0;
v10 = 4;
TlgWrite((TraceLoggingHProvider)4, &unk_1C00096F9, (LPCGUID)0x200000000000i64, a4, 4u, &v5);
}
}
// 1C000B028: using guessed type int dword_1C000B028;
// 1C000B038: using guessed type __int64 qword_1C000B038;
// 1C000B040: using guessed type __int64 qword_1C000B040;
//----- (00000001C0001164) ----------------------------------------------------
void __fastcall TraceLoggingDeviceDriver(int a1, struct WDFDEVICE__ *a2, __int64 a3, const GUID *a4)
{
struct WDFDEVICE__ *v4; // [rsp+30h] [rbp-68h] BYREF
EVENT_DATA_DESCRIPTOR v5; // [rsp+40h] [rbp-58h] BYREF
struct WDFDEVICE__ **v6; // [rsp+60h] [rbp-38h]
int v7; // [rsp+68h] [rbp-30h]
int v8; // [rsp+6Ch] [rbp-2Ch]
int *v9; // [rsp+70h] [rbp-28h]
int v10; // [rsp+78h] [rbp-20h]
int v11; // [rsp+7Ch] [rbp-1Ch]
int v12; // [rsp+A0h] [rbp+8h] BYREF
v12 = a1;
if ( (unsigned int)dword_1C000B028 > 5
&& (qword_1C000B038 & 0x200000000000i64) != 0
&& (qword_1C000B040 & 0x200000000000i64) == qword_1C000B040 )
{
v4 = a2;
v6 = &v4;
v8 = 0;
v7 = 8;
v9 = &v12;
v11 = 0;
v10 = 4;
TlgWrite((TraceLoggingHProvider)4, &unk_1C0009726, (LPCGUID)0x200000000000i64, a4, 4u, &v5);
}
}
// 1C000B028: using guessed type int dword_1C000B028;
// 1C000B038: using guessed type __int64 qword_1C000B038;
// 1C000B040: using guessed type __int64 qword_1C000B040;
//----- (00000001C0001220) ----------------------------------------------------
void __stdcall McGenControlCallbackV2(LPCGUID SourceId, ULONG ControlCode, UCHAR Level, ULONGLONG MatchAnyKeyword, ULONGLONG MatchAllKeyword, PEVENT_FILTER_DESCRIPTOR FilterData, PVOID CallbackContext)
{
unsigned int v7; // er8
unsigned __int8 v8; // cl
__int64 v9; // rdx
bool v10; // r11
int v11; // edx
int *v12; // rcx
int v13; // eax
int v14; // edx
unsigned __int16 v15; // ax
if ( CallbackContext )
{
if ( ControlCode )
{
if ( ControlCode == 1 )
{
*((_BYTE *)CallbackContext + 40) = Level;
v7 = 0;
*((_QWORD *)CallbackContext + 3) = MatchAllKeyword;
*((_QWORD *)CallbackContext + 2) = MatchAnyKeyword;
for ( *((_DWORD *)CallbackContext + 9) = 1; v7 < *((unsigned __int16 *)CallbackContext + 21); ++v7 )//
{
v8 = *((_BYTE *)CallbackContext + 40);
v10 = 0;
if ( *(_BYTE *)(v7 + *((_QWORD *)CallbackContext + 8)) <= v8 || !v8 )
{
v9 = *(_QWORD *)(*((_QWORD *)CallbackContext + 7) + 8i64 * v7);
if ( !v9
|| (v9 & *((_QWORD *)CallbackContext + 2)) != 0
&& (v9 & *((_QWORD *)CallbackContext + 3)) == *((_QWORD *)CallbackContext + 3) )
{
v10 = 1;
}
}
v11 = 1 << (v7 & 0x1F);
v12 = (int *)(*((_QWORD *)CallbackContext + 6) + 4 * ((unsigned __int64)v7 >> 5));
v13 = *v12;
if ( v10 )
v14 = v13 | v11;
else
v14 = v13 & ~v11;
*v12 = v14;
}
}
}
else
{
v15 = *((_WORD *)CallbackContext + 21);
*((_DWORD *)CallbackContext + 9) = 0;
*((_BYTE *)CallbackContext + 40) = 0;
*((_QWORD *)CallbackContext + 2) = 0i64;
*((_QWORD *)CallbackContext + 3) = 0i64;
if ( v15 )
memset(*((void **)CallbackContext + 6), 0, 4i64 * ((v15 - 1) / 32 + 1));
}
}
}
//----- (00000001C000132C) ----------------------------------------------------
ULONG __stdcall McGenEventRegister(LPCGUID ProviderId, PETWENABLECALLBACK EnableCallback, PVOID CallbackContext, PREGHANDLE RegHandle)
{
ULONG result; // eax
result = 0;
if ( !HIDI2C_EVENT_PROVIDER_Context )
result = EtwRegister(
&HIDI2C_EVENT_PROVIDER,
McGenControlCallbackV2,
&HIDI2C_EVENT_PROVIDER_Context,
&HIDI2C_EVENT_PROVIDER_Context);
return result;
}
//----- (00000001C000136C) ----------------------------------------------------
ULONG __stdcall McGenEventUnregister(PREGHANDLE RegHandle)
{
ULONG result; // eax
if ( !HIDI2C_EVENT_PROVIDER_Context )
return 0;
result = EtwUnregister(HIDI2C_EVENT_PROVIDER_Context);
HIDI2C_EVENT_PROVIDER_Context = 0i64;
return result;
}
//----- (00000001C00013A0) ----------------------------------------------------
__int64 __fastcall WPP_RECORDER_SF_(__int64 a1, unsigned __int8 a2, unsigned int a3, unsigned __int16 a4, __int64 a5)
{
unsigned __int64 v8; // rdi
int v10; // eax
int v12; // [rsp+20h] [rbp-28h]
v8 = (unsigned __int64)a3 >> 16;
v10 = *((_DWORD *)&WPP_GLOBAL_Control->Timer + 20 * v8 + (((a3 - 1) >> 5) & 0x7FF) + 1);
if ( _bittest(&v10, ((_BYTE)a3 - 1) & 0x1F) && *((_BYTE *)&WPP_GLOBAL_Control->Timer + 80 * v8 + 1) >= a2 )
pfnWppTraceMessage(*((_QWORD *)&WPP_GLOBAL_Control->AttachedDevice + 10 * v8), 43i64, a5, a4, 0i64);
LOWORD(v12) = a4;
return WppAutoLogTrace(a1, a2, a3, a5, v12, 0i64);
}
// 1C0001448: variable 'v12' is possibly undefined
// 1C000B1C8: using guessed type __int64 (__fastcall *pfnWppTraceMessage)(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 1C000D028: using guessed type __int64 __fastcall WppAutoLogTrace(_QWORD, _QWORD, _QWORD, _QWORD, _DWORD, _QWORD);
//----- (00000001C0001474) ----------------------------------------------------
__int64 WPP_RECORDER_SF_d(__int64 a1, unsigned __int8 a2, unsigned int a3, unsigned __int16 a4, __int64 a5, ...)
{
unsigned __int64 v8; // rdi
int v10; // eax
int v12; // [rsp+20h] [rbp-38h]
va_list va; // [rsp+88h] [rbp+30h] BYREF
va_start(va, a5);
v8 = (unsigned __int64)a3 >> 16;
v10 = *((_DWORD *)&WPP_GLOBAL_Control->Timer + 20 * v8 + (((a3 - 1) >> 5) & 0x7FF) + 1);
if ( _bittest(&v10, ((_BYTE)a3 - 1) & 0x1F) && *((_BYTE *)&WPP_GLOBAL_Control->Timer + 80 * v8 + 1) >= a2 )
pfnWppTraceMessage(*((_QWORD *)&WPP_GLOBAL_Control->AttachedDevice + 10 * v8), 43i64, a5, a4, va);
LOWORD(v12) = a4;
return WppAutoLogTrace(a1, a2, a3, a5, v12, va);
}
// 1C000154B: variable 'v12' is possibly undefined
// 1C000B1C8: using guessed type __int64 (__fastcall *pfnWppTraceMessage)(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 1C000D028: using guessed type __int64 __fastcall WppAutoLogTrace(_QWORD, _QWORD, _QWORD, _QWORD, _DWORD, _QWORD);
//----- (00000001C0001578) ----------------------------------------------------
__int64 WPP_RECORDER_SF_q(__int64 a1, __int64 a2, unsigned int a3, unsigned __int16 a4, __int64 a5, ...)
{
unsigned __int64 v8; // rbx
int v9; // eax
int v11; // [rsp+20h] [rbp-28h]
va_list va; // [rsp+78h] [rbp+30h] BYREF
va_start(va, a5);
v8 = (unsigned __int64)a3 >> 16;
v9 = *((_DWORD *)&WPP_GLOBAL_Control->Timer + 20 * v8 + (((a3 - 1) >> 5) & 0x7FF) + 1);
if ( _bittest(&v9, (a3 - 1) & 0x1F) && *((_BYTE *)&WPP_GLOBAL_Control->Timer + 80 * v8 + 1) >= 4u )
pfnWppTraceMessage(*((_QWORD *)&WPP_GLOBAL_Control->AttachedDevice + 10 * v8), 43i64, a5, a4, va);
LOWORD(v11) = a4;
return WppAutoLogTrace(a1, 4i64, a3, a5, v11, va);
}
// 1C0001644: variable 'v11' is possibly undefined
// 1C000B1C8: using guessed type __int64 (__fastcall *pfnWppTraceMessage)(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 1C000D028: using guessed type __int64 __fastcall WppAutoLogTrace(_QWORD, _QWORD, _QWORD, _QWORD, _DWORD, _QWORD);
//----- (00000001C000166C) ----------------------------------------------------
__int64 WPP_RECORDER_SF_qd(__int64 a1, unsigned __int8 a2, unsigned int a3, unsigned __int16 a4, __int64 a5, ...)
{
unsigned __int64 v8; // rdi
int v10; // eax
int v12; // [rsp+20h] [rbp-48h]
va_list va; // [rsp+98h] [rbp+30h] BYREF
va_start(va, a5);
v8 = (unsigned __int64)a3 >> 16;
v10 = *((_DWORD *)&WPP_GLOBAL_Control->Timer + 20 * v8 + (((a3 - 1) >> 5) & 0x7FF) + 1);
if ( _bittest(&v10, ((_BYTE)a3 - 1) & 0x1F) && *((_BYTE *)&WPP_GLOBAL_Control->Timer + 80 * v8 + 1) >= a2 )
pfnWppTraceMessage(*((_QWORD *)&WPP_GLOBAL_Control->AttachedDevice + 10 * v8), 43i64, a5, a4, va);
LOWORD(v12) = a4;
return WppAutoLogTrace(a1, a2, a3, a5, v12, va);
}
// 1C000176F: variable 'v12' is possibly undefined
// 1C000B1C8: using guessed type __int64 (__fastcall *pfnWppTraceMessage)(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 1C000D028: using guessed type __int64 __fastcall WppAutoLogTrace(_QWORD, _QWORD, _QWORD, _QWORD, _DWORD, _QWORD);
//----- (00000001C00017A0) ----------------------------------------------------
__int64 __fastcall WppClassicProviderCallback(__int64 a1, unsigned __int8 a2, __int64 *a3, __int64 a4)
{
__int64 result; // rax
__int64 v5; // rdx
if ( a2 <= 1u )
{
result = 0i64;
if ( a2 )
{
*(_DWORD *)(a4 + 44) = *((_DWORD *)a3 + 1);
*(_BYTE *)(a4 + 41) = *((_BYTE *)a3 + 2);
v5 = *a3;
*(_QWORD *)(a4 + 24) = *a3;
LOBYTE(a4) = *((_BYTE *)a3 + 2);
result = imp_WppRecorderReplay(WPP_GLOBAL_Control, v5, *((unsigned int *)a3 + 1), a4);
}
else
{
*(_BYTE *)(a4 + 41) = 0;
*(_DWORD *)(a4 + 44) = 0;
*(_QWORD *)(a4 + 24) = 0i64;
}
}
return result;
}
// 1C000D030: using guessed type __int64 __fastcall imp_WppRecorderReplay(_QWORD, _QWORD, _QWORD, _QWORD);
//----- (00000001C00017FC) ----------------------------------------------------
void TlgDefineProvider_annotation__Tlgg_TraceLoggingProviderProv()
{
;
}
//----- (00000001C0001808) ----------------------------------------------------
__int64 RtlStringCbPrintfW(wchar_t *Dest, unsigned __int64 a2, const unsigned __int16 *a3, ...)
{
unsigned __int64 v3; // rdx
int v5; // esi
unsigned __int64 v6; // rbx
int v7; // eax
va_list Args; // [rsp+68h] [rbp+20h] BYREF
va_start(Args, a3);
v3 = a2 >> 1;
v5 = 0;
if ( v3 - 1 > 0x7FFFFFFE )
v5 = -1073741811;////STATUS_INVALID_PARAMETER ((NTSTATUS)0xC000000DL)
if ( v5 < 0 )
{
if ( v3 )
*Dest = 0;
}
else
{
v6 = v3 - 1;
v5 = 0;
v7 = _vsnwprintf(Dest, v3 - 1, a3, Args);
if ( v7 < 0 || v7 > v6 )
{
Dest[v6] = 0;
v5 = -2147483643;
}
else if ( v7 == v6 )
{
Dest[v6] = 0;
}
}
return (unsigned int)v5;
}
//----- (00000001C0001890) ----------------------------------------------------
void __fastcall TraceLoggingPNPFailure(const struct _TlgProvider_t *a1, __int64 a2, __int64 a3, const GUID *a4)
{
int v4; // [rsp+30h] [rbp-48h] BYREF
EVENT_DATA_DESCRIPTOR v5; // [rsp+38h] [rbp-40h] BYREF
int *v6; // [rsp+58h] [rbp-20h]
int v7; // [rsp+60h] [rbp-18h]
int v8; // [rsp+64h] [rbp-14h]
if ( (unsigned int)dword_1C000B028 > 5
&& (qword_1C000B038 & 0x200000000000i64) != 0
&& (qword_1C000B040 & 0x200000000000i64) == qword_1C000B040 )
{
v4 = (int)a1;
v6 = &v4;
v8 = 0;
v7 = 4;
TlgWrite(a1, &unk_1C0009756, (LPCGUID)0x200000000000i64, a4, 3u, &v5);
}
}
// 1C000B028: using guessed type int dword_1C000B028;
// 1C000B038: using guessed type __int64 qword_1C000B038;
// 1C000B040: using guessed type __int64 qword_1C000B040;
//----- (00000001C0001924) ----------------------------------------------------
ULONG __stdcall McGenEventWrite(PMCGEN_TRACE_CONTEXT Context, PCEVENT_DESCRIPTOR Descriptor, LPCGUID ActivityId, ULONG EventDataCount, EVENT_DATA_DESCRIPTOR *EventData)
{
unsigned __int16 *v5; // r10
ULONG v6; // eax
ULONG v8; // er9
v5 = (unsigned __int16 *)qword_1C000B068;
v6 = 0;
if ( qword_1C000B068 )
{
EventData->Ptr = qword_1C000B068;
v6 = 2;
v8 = *v5;
}
else
{
EventData->Ptr = 0i64;
v8 = 0;
}
EventData->Size = v8;
EventData->Reserved = v6;
return EtwWriteTransfer(HIDI2C_EVENT_PROVIDER_Context, Descriptor, ActivityId, 0i64, EventDataCount, EventData);
}
// 1C000B068: using guessed type __int64 qword_1C000B068;
//----- (00000001C0001984) ----------------------------------------------------
ULONG McTemplateK0pq(struct _MCGEN_TRACE_CONTEXT *a1, const EVENT_DESCRIPTOR *a2, __int64 a3, ...)
{
EVENT_DATA_DESCRIPTOR v4; // [rsp+30h] [rbp-48h] BYREF
va_list v5; // [rsp+40h] [rbp-38h]
int v6; // [rsp+48h] [rbp-30h]
int v7; // [rsp+4Ch] [rbp-2Ch]
va_list v8; // [rsp+50h] [rbp-28h]
int v9; // [rsp+58h] [rbp-20h]
int v10; // [rsp+5Ch] [rbp-1Ch]
__int64 v11; // [rsp+98h] [rbp+20h] BYREF
va_list va; // [rsp+98h] [rbp+20h]
va_list va1; // [rsp+A0h] [rbp+28h] BYREF
va_start(va1, a3);
va_start(va, a3);
v11 = va_arg(va1, _QWORD);
va_copy(v5, va);
v7 = 0;
v6 = 8;
va_copy(v8, va1);
v10 = 0;
v9 = 4;
return McGenEventWrite(a1, a2, 0i64, 3u, &v4);
}
//----- (00000001C0001A00) ----------------------------------------------------
__int64 __fastcall OnPrepareHardware(struct WDFDEVICE__ *a1, struct WDFCMRESLIST__ *a2, struct WDFCMRESLIST__ *a3) //FxDevice_a1,FxResourcesRaw_a2,FxResourcesTranslated_a3
{
struct _DEVICE_CONTEXT *v6; // rdi
__int64 v7; // rdx
int v8; // ebx
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED && LOWORD(WPP_GLOBAL_Control->DeviceType) )
WPP_RECORDER_SF_(
(__int64)WPP_GLOBAL_Control->DeviceExtension,
5u,
1u,
0xAu,
(__int64)&WPP_3ddab8cc3e813e123c06a7e2c1802a48_Traceguids);
v6 = (struct _DEVICE_CONTEXT *)(*((__int64 (__fastcall **)(PVOID, struct WDFDEVICE__ *, void *))WPP_MAIN_CB.Queue.Wcb.DeviceRoutine
+ 202))(
WPP_MAIN_CB.Queue.Wcb.DeviceContext,
a1,
off_1C000B018);//DEVICE_CONTEXT_v6=GetDeviceContext(FxDevice_a1);
v8 = SpbInitialize(v6, a2, a3); //ntstatus_v8=SpbInitialize(DEVICE_CONTEXT_v6, FxResourcesRaw_a2, FxResourcesTranslated_a3);
if ( v8 >= 0 )
v8 = AcpiInitialize((__int64 *)v6, v7); //ntstatus_v8=AcpiInitialize((__int64 *)DEVICE_CONTEXT_v6, writedata_v7); //writedata_v7经检查后续的多次路径调用到达终点没有使用,所以本函数级后续调用函数都不需要该参数
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED && LOWORD(WPP_GLOBAL_Control->DeviceType) )
WPP_RECORDER_SF_(
(__int64)WPP_GLOBAL_Control->DeviceExtension,
5u,
1u,
0xBu,
(__int64)&WPP_3ddab8cc3e813e123c06a7e2c1802a48_Traceguids);
return (unsigned int)v8;//return ntstatus_v8
}
// 1C0001A9D: variable 'v7' is possibly undefined
// 1C000B018: using guessed type void *off_1C000B018;
// 1C000B100: using guessed type void *WPP_RECORDER_INITIALIZED;
//----- (00000001C0001B00) ----------------------------------------------------
__int64 __fastcall OnD0Entry(struct WDFDEVICE__ *a1, enum _WDF_POWER_DEVICE_STATE a2)// WDFDEVICE Device_a1, WDF_POWER_DEVICE_STATE PreviousState_a2 )
{
struct _DEVICE_CONTEXT *v4; // rsi
int v5; // ebx
struct _MCGEN_TRACE_CONTEXT *v6; // rcx
__int64 v7; // r8
__int64 v9; // [rsp+20h] [rbp-38h]
__int32 v10; // [rsp+30h] [rbp-28h]
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED && LOWORD(WPP_GLOBAL_Control->DeviceType) )
WPP_RECORDER_SF_(
(__int64)WPP_GLOBAL_Control->DeviceExtension,
5u,
1u,
0xCu,
(__int64)&WPP_3ddab8cc3e813e123c06a7e2c1802a48_Traceguids);
v4 = (struct _DEVICE_CONTEXT *)(*((__int64 (__fastcall **)(PVOID, struct WDFDEVICE__ *, void *))WPP_MAIN_CB.Queue.Wcb.DeviceRoutine
+ 202))(
WPP_MAIN_CB.Queue.Wcb.DeviceContext,
a1,
off_1C000B018);//pDeviceContext_v4 = GetDeviceContext(Device_a1);
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED )
{
v10 = a2 - 1;//state_v10 = PreviousState_a2-1;
WPP_RECORDER_SF_qd(
(__int64)WPP_GLOBAL_Control->DeviceExtension,
4u,
1u,
0xDu,
(__int64)&WPP_3ddab8cc3e813e123c06a7e2c1802a48_Traceguids,
a1,
v10);
}
v5 = HidInitialize(v4, a2);//status_v5 = HidInitialize(pDeviceContext_v4 ,PreviousState_a2
if ( v5 >= 0 )
{
PowerIdleIrpCompletion(v4);//pDeviceContext_v4
if ( (Microsoft_Windows_SPB_HIDI2CEnableBits & 1) != 0 )//
{
LODWORD(v9) = v5;
McTemplateK0pq(v6, &EVENT_HIDI2C_ENUMERATION_OK, v7, a1, v9);
}
}
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED && LOWORD(WPP_GLOBAL_Control->DeviceType) )
WPP_RECORDER_SF_(
(__int64)WPP_GLOBAL_Control->DeviceExtension,
5u,
1u,
0xEu,
(__int64)&WPP_3ddab8cc3e813e123c06a7e2c1802a48_Traceguids);
return (unsigned int)v5;
}
// 1C0001BEA: variable 'v6' is possibly undefined
// 1C0001BEA: variable 'v7' is possibly undefined
// 1C0001BEA: variable 'v9' is possibly undefined
// 1C000B018: using guessed type void *off_1C000B018;
// 1C000B100: using guessed type void *WPP_RECORDER_INITIALIZED;
// 1C000B200: using guessed type char Microsoft_Windows_SPB_HIDI2CEnableBits;
//----- (00000001C0001C50) ----------------------------------------------------
__int64 __fastcall OnPostInterruptsEnabled(struct WDFDEVICE__ *a1, enum _WDF_POWER_DEVICE_STATE a2)//Device_a1, PreviousState_a2
{
unsigned int v4; // ebx
struct _DEVICE_CONTEXT *v5; // rax
int v6; // eax
__int64 v7; // r8
const GUID *v8; // r9
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED && LOWORD(WPP_GLOBAL_Control->DeviceType) )
WPP_RECORDER_SF_(
(__int64)WPP_GLOBAL_Control->DeviceExtension,
5u,
1u,
0xFu,
(__int64)&WPP_3ddab8cc3e813e123c06a7e2c1802a48_Traceguids);
v4 = 0;
v5 = (struct _DEVICE_CONTEXT *)(*((__int64 (__fastcall **)(PVOID, struct WDFDEVICE__ *, void *))WPP_MAIN_CB.Queue.Wcb.DeviceRoutine
+ 202))(
WPP_MAIN_CB.Queue.Wcb.DeviceContext,
a1,
off_1C000B018);//pDeviceContext_v5 = GetDeviceContext(Device_a1);
if ( a2 == WdfPowerDeviceD3Final )
{
v6 = HidReset(v5);//pDeviceContext_v5
v4 = v6;
if ( v6 < 0 )
{
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED )
WPP_RECORDER_SF_d(
(__int64)WPP_GLOBAL_Control->DeviceExtension,
2u,
6u,
0x10u,
(__int64)&WPP_3ddab8cc3e813e123c06a7e2c1802a48_Traceguids,
v6);
DeviceReportPnpProblem((__int64)a1, 3221291012i64, v7, v8);//Device_a1 , 0xC0010004
}
}
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED && LOWORD(WPP_GLOBAL_Control->DeviceType) )
WPP_RECORDER_SF_(
(__int64)WPP_GLOBAL_Control->DeviceExtension,
5u,
1u,
0x11u,
(__int64)&WPP_3ddab8cc3e813e123c06a7e2c1802a48_Traceguids);
return v4;
}
// 1C0001D18: variable 'v7' is possibly undefined
// 1C0001D18: variable 'v8' is possibly undefined
// 1C000B018: using guessed type void *off_1C000B018;
// 1C000B100: using guessed type void *WPP_RECORDER_INITIALIZED;
//----- (00000001C0001D70) ----------------------------------------------------
__int64 __fastcall OnReleaseHardware(struct WDFDEVICE__ *a1, struct WDFCMRESLIST__ *a2)
{
__int64 v3; // rbx
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED && LOWORD(WPP_GLOBAL_Control->DeviceType) )
WPP_RECORDER_SF_(
(__int64)WPP_GLOBAL_Control->DeviceExtension,
5u,
1u,
0x15u,
(__int64)&WPP_3ddab8cc3e813e123c06a7e2c1802a48_Traceguids);
v3 = (*((__int64 (__fastcall **)(PVOID, struct WDFDEVICE__ *, void *))WPP_MAIN_CB.Queue.Wcb.DeviceRoutine + 202))(
WPP_MAIN_CB.Queue.Wcb.DeviceContext,
a1,
off_1C000B018);//pDeviceContext_v3 = GetDeviceContext(Device_a1);
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED && LOWORD(WPP_GLOBAL_Control->DeviceType) )
WPP_RECORDER_SF_(
(__int64)WPP_GLOBAL_Control->DeviceExtension,
5u,
3u,
0x16u,
(__int64)&WPP_9075389c7a5f3b6a15013edc3674f153_Traceguids);
if ( *(_QWORD *)(v3 + 88) )//pDeviceContext->SpbRequest
(*((void (__fastcall **)(PVOID))WPP_MAIN_CB.Queue.Wcb.DeviceRoutine + 208))(WPP_MAIN_CB.Queue.Wcb.DeviceContext);//WdfObjectDelete(pDeviceContext->SpbRequest);
if ( *(_QWORD *)(v3 + 72) )//pDeviceContext->SpbIoTarget
(*((void (__fastcall **)(PVOID))WPP_MAIN_CB.Queue.Wcb.DeviceRoutine + 208))(WPP_MAIN_CB.Queue.Wcb.DeviceContext);//WdfObjectDelete(pDeviceContext->SpbIoTarget);
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED )
{
WPP_RECORDER_SF_(
(__int64)WPP_GLOBAL_Control->DeviceExtension,
4u,
3u,
0x17u,
(__int64)&WPP_9075389c7a5f3b6a15013edc3674f153_Traceguids);
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED )
{
if ( LOWORD(WPP_GLOBAL_Control->DeviceType) )
WPP_RECORDER_SF_(
(__int64)WPP_GLOBAL_Control->DeviceExtension,
5u,
3u,
0x18u,
(__int64)&WPP_9075389c7a5f3b6a15013edc3674f153_Traceguids);
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED && LOWORD(WPP_GLOBAL_Control->DeviceType) )
WPP_RECORDER_SF_(
(__int64)WPP_GLOBAL_Control->DeviceExtension,
5u,
1u,
0x16u,
(__int64)&WPP_3ddab8cc3e813e123c06a7e2c1802a48_Traceguids);
}
}
return 0i64;
}
// 1C000B018: using guessed type void *off_1C000B018;
// 1C000B100: using guessed type void *WPP_RECORDER_INITIALIZED;
//----- (00000001C0001F30) ----------------------------------------------------
__int64 __fastcall OnSelfManagedIoSuspend(struct WDFDEVICE__ *a1)
{
__int64 v1; // rdx
__int64 v2; // r8
v1 = *(_QWORD *)((*((__int64 (__fastcall **)(PVOID, struct WDFDEVICE__ *, void *))WPP_MAIN_CB.Queue.Wcb.DeviceRoutine
+ 202))(
WPP_MAIN_CB.Queue.Wcb.DeviceContext,
a1,
off_1C000B018)//pDeviceContext =GetDeviceContext(device_a1);
+ 168);////pDeviceContext->timerHandle;??
if ( v1 )
{
LOBYTE(v2) = 1;//=TRUE
(*((void (__fastcall **)(PVOID, __int64, __int64))WPP_MAIN_CB.Queue.Wcb.DeviceRoutine + 320))(
WPP_MAIN_CB.Queue.Wcb.DeviceContext,//WdfTimerStop(pDeviceContext->timerHandle, TRUE);
v1,
v2);
}
return 0i64;
}
// 1C0001F7D: variable 'v2' is possibly undefined
// 1C000B018: using guessed type void *off_1C000B018;
//----- (00000001C0001F90) ----------------------------------------------------
__int64 WPP_RECORDER_SF_qq(__int64 a1, __int64 a2, __int64 a3, unsigned __int16 a4, int a5, ...)
{
int v8; // [rsp+20h] [rbp-38h]
va_list va; // [rsp+88h] [rbp+30h] BYREF
va_start(va, a5);
if ( (HIDWORD(WPP_GLOBAL_Control->Timer) & 0x10) != 0 && BYTE1(WPP_GLOBAL_Control->Timer) >= 4u )
pfnWppTraceMessage(
WPP_GLOBAL_Control->AttachedDevice,
43i64,
&WPP_e41706a9c2f4318f0fc3c113099c0cfa_Traceguids,
a4,
va);
LOWORD(v8) = a4;
return WppAutoLogTrace(a1, 4i64, 5i64, &WPP_e41706a9c2f4318f0fc3c113099c0cfa_Traceguids, v8, va);
}
// 1C000203E: variable 'v8' is possibly undefined
// 1C000B1C8: using guessed type __int64 (__fastcall *pfnWppTraceMessage)(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 1C000D028: using guessed type __int64 __fastcall WppAutoLogTrace(_QWORD, _QWORD, _QWORD, _QWORD, _DWORD, _QWORD);
//----- (00000001C0002060) ----------------------------------------------------
__int64 WPP_RECORDER_SF_qqd(__int64 a1, unsigned __int8 a2, unsigned int a3, unsigned __int16 a4, __int64 a5, ...)
{
unsigned __int64 v8; // rdi
int v10; // eax
int v12; // [rsp+20h] [rbp-58h]
va_list va; // [rsp+A8h] [rbp+30h] BYREF
va_start(va, a5);
v8 = (unsigned __int64)a3 >> 16;
v10 = *((_DWORD *)&WPP_GLOBAL_Control->Timer + 20 * v8 + (((a3 - 1) >> 5) & 0x7FF) + 1);
if ( _bittest(&v10, ((_BYTE)a3 - 1) & 0x1F) && *((_BYTE *)&WPP_GLOBAL_Control->Timer + 80 * v8 + 1) >= a2 )
pfnWppTraceMessage(*((_QWORD *)&WPP_GLOBAL_Control->AttachedDevice + 10 * v8), 43i64, a5, a4, va);
LOWORD(v12) = a4;
return WppAutoLogTrace(a1, a2, a3, a5, v12, va);
}
// 1C0002187: variable 'v12' is possibly undefined
// 1C000B1C8: using guessed type __int64 (__fastcall *pfnWppTraceMessage)(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 1C000D028: using guessed type __int64 __fastcall WppAutoLogTrace(_QWORD, _QWORD, _QWORD, _QWORD, _DWORD, _QWORD);
//----- (00000001C00021B4) ----------------------------------------------------
__int64 __fastcall WPP_RECORDER_SF_sqq(__int64 a1, __int64 a2, __int64 a3, __int64 a4, int a5, const char *a6)
{
const char *v6; // rsi
__int64 v7; // rbx
__int64 v9; // rdx
const char *v10; // rcx
int v12; // [rsp+20h] [rbp-58h]
v6 = "NULL";
v7 = -1i64;
if ( (HIDWORD(WPP_GLOBAL_Control->Timer) & 0x10) != 0 && BYTE1(WPP_GLOBAL_Control->Timer) >= 4u )
{
if ( a6 )
{
v9 = -1i64;
do
++v9;
while ( a6[v9] );
}
v10 = "NULL";
if ( a6 )
v10 = a6;
pfnWppTraceMessage(
WPP_GLOBAL_Control->AttachedDevice,
43i64,
&WPP_e41706a9c2f4318f0fc3c113099c0cfa_Traceguids,
10i64,
v10);
}
if ( a6 )
{
do
++v7;
while ( a6[v7] );
}
if ( a6 )
v6 = a6;
LOWORD(v12) = 10;
return WppAutoLogTrace(a1, 4i64, 5i64, &WPP_e41706a9c2f4318f0fc3c113099c0cfa_Traceguids, v12, v6);
}
// 1C00022F3: variable 'v12' is possibly undefined
// 1C000B1C8: using guessed type __int64 (__fastcall *pfnWppTraceMessage)(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 1C000D028: using guessed type __int64 __fastcall WppAutoLogTrace(_QWORD, _QWORD, _QWORD, _QWORD, _DWORD, _QWORD);
//----- (00000001C0002320) ----------------------------------------------------
void __fastcall OnInternalDeviceIoControl(struct WDFQUEUE__ *a1, struct WDFREQUEST__ *a2, __int64 a3, __int64 a4, unsigned int a5)
//Queue_a1, Request_a2, OutputBufferLength_a3 ,InputBufferLength_a4 ,IoControlCode_a5
{
__int64 v6; // rax
__int64 v7; // rsi
unsigned int v8; // ebx