-
Notifications
You must be signed in to change notification settings - Fork 1
/
hidusb.sys.c
5611 lines (5454 loc) · 177 KB
/
hidusb.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 <info@hex-rays.com>
Detected compiler: Visual C++
*/
#include <windows.h>
#include <defs.h>
#include <stdarg.h>
//-------------------------------------------------------------------------
// Function declarations
__int64 __fastcall tlgCreate1Sz_char(__int64 a1, const CHAR *a2);
bool tlgKeywordOn();
NTSTATUS __fastcall tlgWriteTransfer_EtwWriteTransfer(__int64 a1, unsigned __int8 *a2, __int64 a3, __int64 a4, ULONG UserDataCount, PEVENT_DATA_DESCRIPTOR UserData);
__int64 __fastcall HumInternalIoctl(PDEVICE_OBJECT DeviceObject, PVOID Tag); // idb
__int64 WPP_RECORDER_SF_Lqq(__int64 a1, __int64 a2, __int64 a3, __int64 a4, int a5, ...);
NTSTATUS __stdcall DriverEntry(_DRIVER_OBJECT *DriverObject, PUNICODE_STRING RegistryPath);
__int64 __fastcall HumGetDescriptorRequest(PDEVICE_OBJECT DeviceObject, __int16 a2, char a3, void **a4, __int64 a5, int a6, char a7, __int16 a8);
__int64 __fastcall HumCallUSB(PDEVICE_OBJECT DeviceObject, ULONG_PTR a2);
__int64 WPP_RECORDER_SF_qDd(__int64 a1, __int64 a2, __int64 a3, __int64 a4, int a5, ...);
__int64 __fastcall WPP_RECORDER_SF_q(_DWORD, _DWORD, _DWORD, _DWORD, __int64, char); // weak
__int64 __fastcall HumCallUsbComplete(PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Context);
NTSTATUS __fastcall HumWriteReport(__int64 a1, IRP *a2, char a3, _BYTE *a4);
NTSTATUS __fastcall HumPower(__int64 a1, IRP *a2);
__int64 __fastcall HumPowerCompletion(PDEVICE_OBJECT DeviceObject, PVOID Tag); // idb
__int64 __fastcall HumReadCompletion(__int64 a1, __int64 a2, unsigned int *a3);
__int64 __fastcall HumPnpCompletion(PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Context);
__int64 __fastcall HumWriteCompletion(__int64 a1, __int64 a2, unsigned int *a3);
__int64 __fastcall HumInitDevice(PDEVICE_OBJECT DeviceObject); // idb
__int64 __fastcall HumSetIdle(PDEVICE_OBJECT DeviceObject); // idb
__int64 __fastcall HumSelectConfiguration(PDEVICE_OBJECT DeviceObject, PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor); // idb
__int64 __fastcall HumGetDeviceDescriptor(PDEVICE_OBJECT DeviceObject, __int64 a2);
__int64 __fastcall HumGetConfigDescriptor(PDEVICE_OBJECT DeviceObject, _QWORD *a2, _DWORD *a3);
__int64 __fastcall HumParseHidInterface(__int64 a1, char *a2, unsigned int a3, char **a4);
__int64 __fastcall WPP_RECORDER_SF_(_DWORD, _DWORD, _DWORD, _DWORD, __int64); // weak
__int64 __fastcall HumAddDevice(__int64 a1, __int64 a2);
__int64 __fastcall WPP_RECORDER_SF_d(_DWORD, _DWORD, _DWORD, _DWORD, __int64, char); // weak
void __fastcall HumCompleteDeviceResetNotificationIrp(__int64 a1, int a2);
void **__fastcall HumDeviceResetNotificationIrpCancelled(__int64 a1, IRP *a2);
__int64 WPP_RECORDER_SF_qdq(__int64 a1, __int64 a2, __int64 a3, __int64 a4, int a5, ...);
_BOOL8 __fastcall WppIsEqualGuid(_DWORD *a1, _DWORD *a2);
void tlgDefineProvider_annotation__Tlgg_TraceLoggingProviderProv();
__int64 __fastcall HumIncrementPendingRequestCount(__int64 a1);
__int64 WPP_RECORDER_SF_qcc(__int64 a1, __int64 a2, __int64 a3, __int64 a4, int a5, ...);
__int64 __fastcall WPP_RECORDER_SF_dD(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, char, char); // weak
__int64 __fastcall _GSHandlerCheckCommon(__int64 a1, __int64 a2);
__int64 _cpu_features_init();
void *__cdecl memmove(void *, const void *Src, size_t Size);
void *__cdecl memset(void *, int Val, size_t Size);
__int64 __fastcall _memset_repmovs(_OWORD *a1, __int64 a2, __int64 a3);
void _memset_query();
void __fastcall _memset_spec_ermsb(char *a1, unsigned __int8 a2, unsigned __int64 a3);
void __fastcall _memset_spec_ermsb_repmovsb(_OWORD *a1, __int64 a2, __int64 a3);
_OWORD *__fastcall _memset_spec_plain(_OWORD *a1, unsigned __int8 a2, unsigned __int64 a3);
__int64 __fastcall HumCreateClose(__int64 a1, __int64 a2);
void __fastcall HumUnload(__int64 a1);
__int64 WPP_RECORDER_SF_dq(__int64 a1, unsigned __int8 a2, unsigned int a3, unsigned __int16 a4, __int64 a5, ...);
__int64 WPP_RECORDER_SF_qq(__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 __fastcall HumSetIdleWorker(PDEVICE_OBJECT DeviceObject, PVOID Context);
__int64 __fastcall WPP_RECORDER_SF_L(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, char); // weak
__int64 WPP_RECORDER_SF_qd(__int64 a1, unsigned __int8 a2, unsigned int a3, unsigned __int16 a4, __int64 a5, ...);
__int64 __fastcall GetInterruptInputPipeForDevice(__int64 a1);
LONG __fastcall HumDecrementPendingRequestCount(__int64 a1);
NTSTATUS __fastcall HumGetPortStatus(__int64 a1, _DWORD *a2);
NTSTATUS __fastcall HumGetSetReport(__int64 a1, IRP *a2, _BYTE *a3);
__int64 __fastcall HumGetSetReportCompletion(__int64 a1, __int64 a2, unsigned int *a3);
__int64 __fastcall HumQueueResetWorkItem(__int64 a1, __int64 a2);
__int64 __fastcall HumResetInterruptPipe(PDEVICE_OBJECT DeviceObject); // idb
NTSTATUS __fastcall HumResetParentPort(__int64 a1);
void __fastcall HumResetWorkItem(PDEVICE_OBJECT DeviceObject, PVOID Context);
__int64 WPP_RECORDER_SF_D(__int64 a1, unsigned __int8 a2, unsigned int a3, unsigned __int16 a4, __int64 a5, ...);
// NTSTATUS __stdcall HidRegisterMinidriver(PHID_MINIDRIVER_REGISTRATION MinidriverRegistration);
// PUSB_INTERFACE_DESCRIPTOR __stdcall USBD_ParseConfigurationDescriptorEx(PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, PVOID StartPosition, LONG InterfaceNumber, LONG AlternateSetting, LONG InterfaceClass, LONG InterfaceSubClass, LONG InterfaceProtocol);
// PURB __stdcall USBD_CreateConfigurationRequestEx(PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, PUSBD_INTERFACE_LIST_ENTRY InterfaceList);
// __int64 __fastcall WppAutoLogStart(_QWORD, _QWORD, _QWORD); weak
// __int64 __fastcall WppAutoLogTrace(_QWORD, _QWORD, _QWORD, _QWORD, _DWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// __int64 __fastcall imp_WppRecorderReplay(_QWORD, _QWORD, _QWORD, _QWORD); weak
// __int64 __fastcall WppAutoLogStop(_QWORD, _QWORD); weak
// void __stdcall IoInitializeRemoveLockEx(PIO_REMOVE_LOCK Lock, ULONG AllocateTag, ULONG MaxLockedMinutes, ULONG HighWatermark, ULONG RemlockSize);
// KIRQL __stdcall KeAcquireSpinLockRaiseToDpc(PKSPIN_LOCK SpinLock);
// void __stdcall KeReleaseSpinLock(PKSPIN_LOCK SpinLock, KIRQL NewIrql);
// void __stdcall IoReleaseRemoveLockEx(PIO_REMOVE_LOCK RemoveLock, PVOID Tag, ULONG RemlockSize);
// void __stdcall IoReleaseCancelSpinLock(KIRQL Irql);
// NTSTATUS __stdcall IoAcquireRemoveLockEx(PIO_REMOVE_LOCK RemoveLock, PVOID Tag, PCSTR File, ULONG Line, ULONG RemlockSize);
// NTSTATUS __stdcall IoSetCompletionRoutineEx(PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_COMPLETION_ROUTINE CompletionRoutine, PVOID Context, BOOLEAN InvokeOnSuccess, BOOLEAN InvokeOnError, BOOLEAN InvokeOnCancel);
// NTSTATUS __stdcall IofCallDriver(PDEVICE_OBJECT DeviceObject, PIRP Irp);
// NTSTATUS __stdcall KeWaitForSingleObject(PVOID Object, KWAIT_REASON WaitReason, KPROCESSOR_MODE WaitMode, BOOLEAN Alertable, PLARGE_INTEGER Timeout);
// void __stdcall ExFreePool(PVOID P);
// void __stdcall IoFreeWorkItem(PIO_WORKITEM IoWorkItem);
// void __stdcall KeInitializeEvent(PRKEVENT Event, EVENT_TYPE Type, BOOLEAN State);
// PIO_WORKITEM __stdcall IoAllocateWorkItem(PDEVICE_OBJECT DeviceObject);
// void __stdcall IoQueueWorkItem(PIO_WORKITEM IoWorkItem, PIO_WORKITEM_ROUTINE WorkerRoutine, WORK_QUEUE_TYPE QueueType, PVOID Context);
// void __stdcall PoStartNextPowerIrp(PIRP Irp);
// NTSTATUS __stdcall PoCallDriver(PDEVICE_OBJECT DeviceObject, PIRP Irp);
// LONG __stdcall KeResetEvent(PRKEVENT Event);
// __int64 __fastcall ExAllocatePool2(_QWORD, _QWORD, _QWORD); weak
// LONG __stdcall KeSetEvent(PRKEVENT Event, KPRIORITY Increment, BOOLEAN Wait);
// void __stdcall IoReleaseRemoveLockAndWaitEx(PIO_REMOVE_LOCK RemoveLock, PVOID Tag, ULONG RemlockSize);
// PIRP __stdcall IoBuildDeviceIoControlRequest(ULONG IoControlCode, PDEVICE_OBJECT DeviceObject, PVOID InputBuffer, ULONG InputBufferLength, PVOID OutputBuffer, ULONG OutputBufferLength, BOOLEAN InternalDeviceIoControl, PKEVENT Event, PIO_STATUS_BLOCK IoStatusBlock);
// void __stdcall IoInvalidateDeviceState(PDEVICE_OBJECT PhysicalDeviceObject);
// PVOID __stdcall MmMapLockedPagesSpecifyCache(PMDL MemoryDescriptorList, KPROCESSOR_MODE AccessMode, MEMORY_CACHING_TYPE CacheType, PVOID RequestedAddress, ULONG BugCheckOnFailure, ULONG Priority);
// BOOLEAN __stdcall IoCancelIrp(PIRP Irp);
// void __stdcall IofCompleteRequest(PIRP Irp, CCHAR PriorityBoost);
// NTSTATUS __stdcall EtwUnregister(REGHANDLE RegHandle);
// NTSTATUS __stdcall EtwWriteTransfer(REGHANDLE RegHandle, PCEVENT_DESCRIPTOR EventDescriptor, LPCGUID ActivityId, LPCGUID RelatedActivityId, ULONG UserDataCount, PEVENT_DATA_DESCRIPTOR UserData);
// void __stdcall KeInitializeSpinLock(PKSPIN_LOCK SpinLock);
// NTSTATUS __stdcall EtwRegister(LPCGUID ProviderId, PETWENABLECALLBACK EnableCallback, PVOID CallbackContext, PREGHANDLE RegHandle);
// NTSTATUS __stdcall EtwSetInformation(REGHANDLE RegHandle, EVENT_INFO_CLASS InformationClass, PVOID EventInformation, ULONG InformationLength);
// NTSTATUS __stdcall IoWMIRegistrationControl(PDEVICE_OBJECT DeviceObject, ULONG Action);
// PVOID __stdcall MmGetSystemRoutineAddress(PUNICODE_STRING SystemRoutineName);
// KIRQL KeGetCurrentIrql(void);
// void __stdcall RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString);
__int64 TraceLoggingRegisterEx_EtwRegister_EtwSetInformation();
__int64 TraceLoggingRegister_EtwRegister_EtwSetInformation();
NTSTATUS TraceLoggingUnregister_EtwUnregister();
void __fastcall tlgEnableCallback(LPCGUID SourceId, __int64 ControlCode, __int64 Level, ULONGLONG MatchAnyKeyword, ULONGLONG MatchAllKeyword, PEVENT_FILTER_DESCRIPTOR FilterData, PVOID CallbackContext);
__int64 __fastcall HumGetStringDescriptor(PDEVICE_OBJECT DeviceObject, _QWORD *a2);
__int64 __fastcall HumPnP(PDEVICE_OBJECT DeviceObject, PVOID Tag); // idb
__int64 __fastcall HumGetReportDescriptor(PDEVICE_OBJECT DeviceObject, PVOID Tag, _BYTE *a3);
__int64 __fastcall HumGetHidDescriptor(__int64 a1, __int64 a2);
__int64 __fastcall HumGetDeviceAttributes(__int64 a1, _QWORD *a2);
PVOID WppLoadTracingSupport();
void __fastcall WppInitKm(__int64 a1, __int64 a2);
void __fastcall WppCleanupKm(__int64 a1);
__int64 __fastcall WppTraceCallback(char a1, __int64 a2, unsigned int a3, unsigned int *a4, __int64 a5, unsigned int *a6);
__int64 __fastcall HumAbortPendingRequests(PDEVICE_OBJECT DeviceObject); // idb
__int64 __fastcall HumRemoveDevice(PDEVICE_OBJECT DeviceObject, PVOID Tag); // idb
__int64 __fastcall HumStopDevice(PDEVICE_OBJECT DeviceObject); // idb
NTSTATUS __fastcall HumSystemControl(__int64 a1, IRP *a2);
__int64 __fastcall HumGetMsGenreDescriptor(PDEVICE_OBJECT DeviceObject, __int64 a2);
__int64 __fastcall HumGetPhysicalDescriptor(PDEVICE_OBJECT DeviceObject, __int64 a2);
NTSTATUS __stdcall GsDriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath);
void __cdecl _security_init_cookie();
//-------------------------------------------------------------------------
// Data declarations
_UNKNOWN WPP_2854d9da723b379c5be992cbaea3dfcc_Traceguids; // weak
_UNKNOWN WPP_22f9612a74bb302c47e3c2e818dbd68b_Traceguids; // weak
const CHAR File[8] = { '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0' }; // idb
_UNKNOWN WPP_942e49b71fcd3dd08668400dfd38e524_Traceguids; // weak
_UNKNOWN WPP_ThisDir_CTLGUID_HidUsbTraceGuid; // weak
_UNKNOWN WPP_3df5017319393635ea3e191f08ba3365_Traceguids; // weak
_UNKNOWN WPP_b40a5588456f3c2c427887b931342e5d_Traceguids; // weak
int dword_1C00077B9[13] =
{
1291,
0,
704643104,
1962967040,
1886938478,
1702126437,
1767982692,
1701999980,
1400139264,
1970561396,
243794035,
1936942445,
6645601
}; // idb
int dword_1C00077EF[13] =
{
1291,
0,
721420320,
1677754368,
1667855973,
1635013477,
1845519732,
1635013492,
7566708,
1953697416,
6648929,
1936026888,
1701273971
}; // idb
int dword_1C0007826[14] =
{
1291,
0,
469762080,
1761640448,
1920222063,
1953366124,
1952543827,
-2013236363,
1685021454,
67633253,
-350844514,
1367256632,
767053097,
1951178952
}; // idb
void *WPP_RECORDER_INITIALIZED = &WPP_RECORDER_INITIALIZED; // weak
PDEVICE_OBJECT WPP_GLOBAL_Control = &WPP_GLOBAL_Control; // idb
int dword_1C0009010 = 0; // weak
PVOID EventInformation = &unk_1C000785E; // idb
__int64 qword_1C0009020 = 0i64; // weak
__int64 qword_1C0009028 = 0i64; // weak
REGHANDLE RegHandle = 0ui64; // idb
__int128 xmmword_1C0009038 = 0i64; // weak
uintptr_t _security_cookie = 47936899621426ui64;
__int64 _security_cookie_complement = -47936899621427i64; // weak
char _isa_info = '\x02'; // weak
_LARGE_INTEGER Timeout = { { 4244967296u, -1 } }; // idb
KSPIN_LOCK resetWorkItemsListSpinLock = 0ui64; // idb
_DEVICE_OBJECT WPP_MAIN_CB =
{
0,
0u,
0,
NULL,
NULL,
NULL,
NULL,
NULL,
0u,
0u,
NULL,
NULL,
0u,
'\0',
{ { { { { NULL, NULL }, 0u, 0u } }, NULL, NULL, 0u, NULL, NULL, NULL } },
0u,
{ 0, 0, { NULL, NULL }, 0ui64, { { -256i64, -72057594037927936i64 } } },
{ { 0u }, { NULL }, 0ui64, NULL, NULL, NULL, NULL, NULL },
0u,
NULL,
{ { { { 0 } }, 0, { NULL, NULL } } },
0u,
0u,
NULL,
NULL
}; // idb
//----- (00000001C0001008) ----------------------------------------------------
__int64 __fastcall tlgCreate1Sz_char(__int64 a1, const CHAR *a2)
{
__int64 v2; // rax
__int64 result; // rax
if ( a2 )
{
v2 = -1i64;
do
++v2;
while ( a2[v2] );
result = (unsigned int)(v2 + 1);
}
else
{
a2 = File;
result = 1i64;
}
*(_DWORD *)(a1 + 12) = 0;
*(_QWORD *)a1 = a2;
*(_DWORD *)(a1 + 8) = result;
return result;
}
//----- (00000001C000103C) ----------------------------------------------------
bool tlgKeywordOn()
{
return (qword_1C0009020 & 0x200000000000i64) != 0 && (qword_1C0009028 & 0x200000000000i64) == qword_1C0009028;
}
// 1C0009020: using guessed type __int64 qword_1C0009020;
// 1C0009028: using guessed type __int64 qword_1C0009028;
//----- (00000001C0001070) ----------------------------------------------------
NTSTATUS __fastcall tlgWriteTransfer_EtwWriteTransfer(__int64 a1, unsigned __int8 *a2, __int64 a3, __int64 a4, ULONG UserDataCount, PEVENT_DATA_DESCRIPTOR UserData)
{
EVENT_DESCRIPTOR EventDescriptor; // [rsp+30h] [rbp-18h] BYREF
*(_DWORD *)&EventDescriptor.Id = *a2 << 24;
*(_DWORD *)&EventDescriptor.Level = *(unsigned __int16 *)(a2 + 1);
EventDescriptor.Keyword = *(_QWORD *)(a2 + 3);
UserData->Ptr = (ULONGLONG)EventInformation;
UserData->Size = *(unsigned __int16 *)EventInformation;
UserData[1].Ptr = (ULONGLONG)(a2 + 11);
UserData->Reserved = 2;
UserData[1].Size = *(unsigned __int16 *)(a2 + 11);
UserData[1].Reserved = 1;
return EtwWriteTransfer(RegHandle, &EventDescriptor, 0i64, 0i64, UserDataCount, UserData);
}
//----- (00000001C0001120) ----------------------------------------------------
__int64 __fastcall HumInternalIoctl(PDEVICE_OBJECT DeviceObject, PVOID Tag)
{
_QWORD *v2; // rdi
char v4; // si
__int64 v5; // r13
struct _IO_REMOVE_LOCK *v6; // r12
NTSTATUS v7; // eax
__int64 v8; // rdx
__int64 v9; // r8
__int64 v10; // r9
int v11; // ebx
unsigned int v12; // edx
unsigned int v13; // er15
__int64 v14; // rcx
__int64 v15; // r8
__int64 v16; // r9
__int64 *v17; // rax
_QWORD *v18; // rax
__int64 v19; // r12
int v20; // ecx
__int64 v21; // rax
__int64 v22; // r9
unsigned int v23; // er8
__int64 v24; // rax
__int64 v25; // r13
__int64 v26; // rax
void *v27; // rbx
__int64 v28; // rax
__int64 v29; // r8
_BYTE *v30; // rax
__int64 v31; // rcx
__int64 v32; // r8
__int64 v33; // r9
int v34; // eax
__int64 v35; // rcx
__int64 v36; // r8
__int64 v37; // r9
__int64 v38; // rbx
_QWORD *v39; // rax
NTSTATUS v40; // eax
KIRQL v41; // cl
int RemlockSize; // [rsp+20h] [rbp-69h]
char v44[3]; // [rsp+41h] [rbp-48h] BYREF
int v45; // [rsp+44h] [rbp-45h] BYREF
__int64 v46; // [rsp+48h] [rbp-41h] BYREF
struct _IO_REMOVE_LOCK *v47; // [rsp+50h] [rbp-39h]
__int64 v48; // [rsp+58h] [rbp-31h]
struct _EVENT_DATA_DESCRIPTOR v49; // [rsp+60h] [rbp-29h] BYREF
__int64 *v50; // [rsp+80h] [rbp-9h]
__int64 v51; // [rsp+88h] [rbp-1h]
__int64 *v52; // [rsp+90h] [rbp+7h]
__int64 v53; // [rsp+98h] [rbp+Fh]
v2 = Tag;
v44[0] = 1;
v4 = 0;
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED && LOWORD(WPP_GLOBAL_Control->DeviceType) )
{
LOBYTE(Tag) = 5;
WPP_RECORDER_SF_(
WPP_GLOBAL_Control->DeviceExtension,
(_DWORD)Tag,
3,
10,
(__int64)&WPP_2854d9da723b379c5be992cbaea3dfcc_Traceguids);
}
v5 = *((_QWORD *)DeviceObject->DeviceExtension + 2);
v6 = (struct _IO_REMOVE_LOCK *)(v5 + 104);
v47 = (struct _IO_REMOVE_LOCK *)(v5 + 104);
v7 = IoAcquireRemoveLockEx((PIO_REMOVE_LOCK)(v5 + 104), v2, File, 1u, 0x20u);
v11 = v7;
if ( v7 < 0 )
{
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED )
{
WPP_RECORDER_SF_qd(
(__int64)WPP_GLOBAL_Control->DeviceExtension,
2u,
3u,
0xBu,
(__int64)&WPP_2854d9da723b379c5be992cbaea3dfcc_Traceguids,
v5 + 104,
v7);
*((_DWORD *)v2 + 12) = v11;
IofCompleteRequest((PIRP)v2, 0);
goto LABEL_77;
}
goto LABEL_71;
}
v13 = *(_DWORD *)(v2[23] + 24i64);
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED )
WPP_RECORDER_SF_Lqq((__int64)WPP_GLOBAL_Control->DeviceExtension, v8, v9, v10, RemlockSize);
if ( v13 > 0xB0191 )
{
switch ( v13 )
{
case 0xB0192u:
case 0xB0195u:
case 0xB01A2u:
goto LABEL_58;
case 0xB019Au:
v11 = HumGetPhysicalDescriptor(DeviceObject, (__int64)v2);
*((_DWORD *)v2 + 12) = v11;
goto LABEL_75;
case 0xB01E2u:
LABEL_39:
v34 = HumGetStringDescriptor(DeviceObject, v2);
goto LABEL_40;
case 0xB01E6u:
v34 = HumGetMsGenreDescriptor(DeviceObject, (__int64)v2);
LABEL_40:
v11 = v34;
if ( v34 >= 0 || (unsigned int)dword_1C0009010 <= 5 || !tlgKeywordOn() )
goto LABEL_70;
v45 = v11;
v50 = (__int64 *)&v45;
v51 = 4i64;
v52 = &v46;
LODWORD(v46) = v13;
v53 = 4i64;
tlgWriteTransfer_EtwWriteTransfer(v35, (unsigned __int8 *)dword_1C0007826, v36, v37, 4u, &v49);
LABEL_74:
*((_DWORD *)v2 + 12) = v11;
LABEL_75:
IofCompleteRequest((PIRP)v2, 0);
goto LABEL_76;
case 0xB0233u:
v41 = KeAcquireSpinLockRaiseToDpc((PKSPIN_LOCK)(v5 + 136));
if ( *(_QWORD *)(v5 + 144) )
{
KeReleaseSpinLock((PKSPIN_LOCK)(v5 + 136), v41);
v11 = -1073741808;
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED )
{
WPP_RECORDER_SF_qq(
(__int64)WPP_GLOBAL_Control->DeviceExtension,
4u,
1u,
0xFu,
(__int64)&WPP_2854d9da723b379c5be992cbaea3dfcc_Traceguids,
v2,
DeviceObject);
*((_DWORD *)v2 + 12) = -1073741808;
IofCompleteRequest((PIRP)v2, 0);
goto LABEL_76;
}
LABEL_70:
v4 = 1;
goto LABEL_71;
}
*(_QWORD *)(v5 + 144) = v2;
_InterlockedExchange64(v2 + 13, (__int64)HumDeviceResetNotificationIrpCancelled);
if ( *((_BYTE *)v2 + 68) && _InterlockedExchange64(v2 + 13, 0i64) )
{
*(_QWORD *)(v5 + 144) = 0i64;
KeReleaseSpinLock((PKSPIN_LOCK)(v5 + 136), v41);
v11 = -1073741536;
if ( WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED )
goto LABEL_28;
WPP_RECORDER_SF_qq(
(__int64)WPP_GLOBAL_Control->DeviceExtension,
4u,
1u,
0xEu,
(__int64)&WPP_2854d9da723b379c5be992cbaea3dfcc_Traceguids,
v2,
DeviceObject);
*((_DWORD *)v2 + 12) = -1073741536;
IofCompleteRequest((PIRP)v2, 0);
goto LABEL_76;
}
*(_BYTE *)(v2[23] + 3i64) |= 1u;
KeReleaseSpinLock((PKSPIN_LOCK)(v5 + 136), v41);
v11 = 259;
if ( WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED )
return (unsigned int)v11;
WPP_RECORDER_SF_qq(
(__int64)WPP_GLOBAL_Control->DeviceExtension,
4u,
1u,
0xDu,
(__int64)&WPP_2854d9da723b379c5be992cbaea3dfcc_Traceguids,
v2,
DeviceObject);
break;
case 0xB0263u:
LABEL_53:
v40 = HumWriteReport((__int64)DeviceObject, (IRP *)v2, v13 == 721507, v44);
goto LABEL_54;
default:
LABEL_73:
v11 = *((_DWORD *)v2 + 12);
goto LABEL_74;
}
}
else
{
if ( v13 == 721297 )
{
LABEL_58:
v40 = HumGetSetReport((__int64)DeviceObject, (IRP *)v2, v44);
LABEL_54:
v11 = v40;
if ( v40 < 0 && (unsigned int)dword_1C0009010 > 5 && tlgKeywordOn() )
{
v45 = v11;
v50 = (__int64 *)&v45;
v17 = &v46;
LODWORD(v46) = v13;
LABEL_17:
v52 = v17;
v51 = 4i64;
v53 = 4i64;
tlgWriteTransfer_EtwWriteTransfer(v14, (unsigned __int8 *)dword_1C0007826, v15, v16, 4u, &v49);
}
}
else
{
v12 = -1073741824;
switch ( v13 )
{
case 0xB0003u:
v11 = HumGetHidDescriptor((__int64)DeviceObject, (__int64)v2);
*((_DWORD *)v2 + 12) = v11;
goto LABEL_75;
case 0xB0007u:
v11 = HumGetReportDescriptor(DeviceObject, v2, v44);
if ( v11 >= 0 || (unsigned int)dword_1C0009010 <= 5 || !tlgKeywordOn() )
goto LABEL_27;
LODWORD(v46) = v11;
v50 = &v46;
v17 = (__int64 *)&v45;
v45 = v13;
goto LABEL_17;
case 0xB000Bu:
v18 = DeviceObject->DeviceExtension;
v48 = v2[23];
v19 = v18[2];
v20 = *(_DWORD *)(v48 + 8);
v21 = v2[14];
v46 = v21;
v45 = v20;
if ( !v20 || !v21 )
{
v11 = -1073741811;
goto LABEL_36;
}
v22 = *(_QWORD *)(v19 + 16);
v12 = 0;
v23 = *(_DWORD *)(v22 + 16);
if ( !v23 )
goto LABEL_24;
break;
case 0xB000Fu:
goto LABEL_53;
case 0xB0013u:
goto LABEL_39;
case 0xB001Fu:
case 0xB0023u:
v11 = 0;
*((_DWORD *)v2 + 12) = 0;
goto LABEL_75;
case 0xB0027u:
v11 = HumGetDeviceAttributes((__int64)DeviceObject, v2);
*((_DWORD *)v2 + 12) = v11;
goto LABEL_75;
case 0xB002Bu:
v38 = v2[23];
if ( *(_DWORD *)(v38 + 16) >= 0x10u )
{
IoReleaseRemoveLockEx((PIO_REMOVE_LOCK)(*((_QWORD *)DeviceObject->DeviceExtension + 2) + 104i64), v2, 0x20u);
*(_BYTE *)(v38 - 72) = *(_BYTE *)v38;
*(_DWORD *)(v38 - 56) = *(_DWORD *)(v38 + 16);
*(_QWORD *)(v38 - 40) = *(_QWORD *)(v38 + 32);
*(_DWORD *)(v38 - 48) = 2228263;
v39 = DeviceObject->DeviceExtension;
v44[0] = 0;
*(_QWORD *)(v38 - 32) = v39[1];
v11 = IofCallDriver(*((PDEVICE_OBJECT *)DeviceObject->DeviceExtension + 1), (PIRP)v2);
if ( v11 >= 0 )
goto LABEL_77;
}
else
{
v11 = -1073741789;
}
if ( (unsigned int)dword_1C0009010 <= 5 || !tlgKeywordOn() )
goto LABEL_27;
v45 = v11;
v50 = (__int64 *)&v45;
v17 = &v46;
LODWORD(v46) = v13;
goto LABEL_17;
default:
goto LABEL_73;
}
while ( 1 )
{
v24 = v22 + 24i64 * v12;
if ( *(char *)(v24 + 26) < 0 && *(_DWORD *)(v24 + 28) == 3 )
break;
if ( ++v12 >= v23 )
goto LABEL_24;
}
v25 = v24 + 24;
if ( v24 == -24 )
{
LABEL_24:
v11 = -1073741438;
goto LABEL_25;
}
v26 = ExAllocatePool2(64i64, 152i64, 1432643912i64);
v27 = (void *)v26;
if ( v26 )
{
*(_DWORD *)v26 = 589952;
*(_QWORD *)(v26 + 24) = *(_QWORD *)(v25 + 8);
*(_DWORD *)(v26 + 36) = v45;
*(_QWORD *)(v26 + 40) = v46;
*(_QWORD *)(v26 + 48) = 0i64;
*(_DWORD *)(v26 + 32) = 3;
*(_QWORD *)(v26 + 56) = 0i64;
v28 = v2[23];
*(_QWORD *)(v28 - 16) = HumReadCompletion;
*(_QWORD *)(v28 - 8) = v27;
*(_BYTE *)(v28 - 69) = -32;
v29 = v2[23];
v30 = (_BYTE *)v48;
*(_QWORD *)(v29 - 64) = v27;
*(_BYTE *)(v29 - 72) = *v30;
*(_DWORD *)(v29 - 48) = 2228227;
*(_QWORD *)(v29 - 32) = *((_QWORD *)DeviceObject->DeviceExtension + 1);
_InterlockedIncrement((volatile signed __int32 *)(v19 + 32));
if ( (unsigned int)(*(_DWORD *)v19 - 1) <= 1 )
{
v11 = IofCallDriver(*((PDEVICE_OBJECT *)DeviceObject->DeviceExtension + 1), (PIRP)v2);
v44[0] = 0;
}
else
{
HumDecrementPendingRequestCount(v19);
ExFreePool(v27);
v11 = -1073741810;
}
}
else
{
v11 = -1073741670;
}
LABEL_25:
if ( v11 >= 0 )
goto LABEL_26;
LABEL_36:
if ( (unsigned int)dword_1C0009010 > 5 && tlgKeywordOn() )
{
v45 = v31;
v50 = (__int64 *)&v45;
v51 = 4i64;
v52 = &v46;
LODWORD(v46) = v13;
v53 = 4i64;
tlgWriteTransfer_EtwWriteTransfer(v31, (unsigned __int8 *)dword_1C0007826, v32, v33, 4u, &v49);
}
LABEL_26:
v6 = v47;
}
LABEL_27:
if ( v44[0] )
{
LABEL_28:
v4 = 1;
LABEL_71:
*((_DWORD *)v2 + 12) = v11;
IofCompleteRequest((PIRP)v2, 0);
if ( v4 )
LABEL_76:
IoReleaseRemoveLockEx(v6, v2, 0x20u);
goto LABEL_77;
}
}
LABEL_77:
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED && LOWORD(WPP_GLOBAL_Control->DeviceType) )
{
LOBYTE(v12) = 5;
WPP_RECORDER_SF_(
WPP_GLOBAL_Control->DeviceExtension,
v12,
3,
16,
(__int64)&WPP_2854d9da723b379c5be992cbaea3dfcc_Traceguids);
}
return (unsigned int)v11;
}
// 1C000126A: variable 'v8' is possibly undefined
// 1C000126A: variable 'v9' is possibly undefined
// 1C000126A: variable 'v10' is possibly undefined
// 1C000126A: variable 'RemlockSize' is possibly undefined
// 1C0001330: variable 'v14' is possibly undefined
// 1C0001330: variable 'v15' is possibly undefined
// 1C0001330: variable 'v16' is possibly undefined
// 1C00014EC: variable 'v31' is possibly undefined
// 1C0001527: variable 'v32' is possibly undefined
// 1C0001527: variable 'v33' is possibly undefined
// 1C000159F: variable 'v35' is possibly undefined
// 1C000159F: variable 'v36' is possibly undefined
// 1C000159F: variable 'v37' is possibly undefined
// 1C0001988: variable 'v12' is possibly undefined
// 1C0004590: using guessed type __int64 __fastcall WPP_RECORDER_SF_(_DWORD, _DWORD, _DWORD, _DWORD, __int64);
// 1C0009000: using guessed type void *WPP_RECORDER_INITIALIZED;
// 1C0009010: using guessed type int dword_1C0009010;
// 1C000B0D8: using guessed type __int64 __fastcall ExAllocatePool2(_QWORD, _QWORD, _QWORD);
//----- (00000001C00019C0) ----------------------------------------------------
__int64 WPP_RECORDER_SF_Lqq(__int64 a1, __int64 a2, __int64 a3, __int64 a4, int a5, ...)
{
int v7; // [rsp+20h] [rbp-48h]
__int64 v8; // [rsp+98h] [rbp+30h] BYREF
va_list va; // [rsp+98h] [rbp+30h]
__int64 v10; // [rsp+A0h] [rbp+38h] BYREF
va_list va1; // [rsp+A0h] [rbp+38h]
va_list va2; // [rsp+A8h] [rbp+40h] BYREF
va_start(va2, a5);
va_start(va1, a5);
va_start(va, a5);
v8 = va_arg(va1, _QWORD);
va_copy(va2, va1);
v10 = va_arg(va2, _QWORD);
if ( (HIDWORD(WPP_GLOBAL_Control->Timer) & 4) != 0 && BYTE1(WPP_GLOBAL_Control->Timer) >= 4u )
((void (__fastcall *)(_DEVICE_OBJECT *, __int64, void *, __int64, __int64 *, __int64, __int64 *, __int64, char *, __int64, _QWORD))WPP_MAIN_CB.Dpc.DpcData)(
WPP_GLOBAL_Control->AttachedDevice,
43i64,
&WPP_2854d9da723b379c5be992cbaea3dfcc_Traceguids,
12i64,
(__int64 *)va,
4i64,
(__int64 *)va1,
8i64,
va2,
8i64,
0i64);
LOWORD(v7) = 12;
return WppAutoLogTrace(
a1,
4i64,
3i64,
&WPP_2854d9da723b379c5be992cbaea3dfcc_Traceguids,
v7,
(__int64 *)va,
4i64,
(__int64 *)va1,
8i64,
va2,
8i64,
0i64);
}
// 1C0009200: invalid function type has been ignored
// 1C0001A47: variable 'v7' is possibly undefined
// 1C000B030: using guessed type __int64 __fastcall WppAutoLogTrace(_QWORD, _QWORD, _QWORD, _QWORD, _DWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
//----- (00000001C0001A70) ----------------------------------------------------
NTSTATUS __stdcall DriverEntry(_DRIVER_OBJECT *DriverObject, PUNICODE_STRING RegistryPath)
{
int v4; // edx
NTSTATUS v5; // eax
int v6; // edx
NTSTATUS v7; // ebx
int v8; // edx
__int64 v9; // r8
__int64 v10; // r9
NTSTATUS v12; // [rsp+30h] [rbp-98h] BYREF
struct _HID_MINIDRIVER_REGISTRATION MinidriverRegistration; // [rsp+38h] [rbp-90h] BYREF
struct _EVENT_DATA_DESCRIPTOR v14; // [rsp+60h] [rbp-68h] BYREF
int *v15; // [rsp+80h] [rbp-48h]
__int64 v16; // [rsp+88h] [rbp-40h]
char v17[16]; // [rsp+90h] [rbp-38h] BYREF
*(&MinidriverRegistration.Revision + 1) = 0;
TraceLoggingRegister_EtwRegister_EtwSetInformation();
*(_QWORD *)&WPP_MAIN_CB.Type = 0i64;
WPP_MAIN_CB.DriverObject = (_DRIVER_OBJECT *)&WPP_ThisDir_CTLGUID_HidUsbTraceGuid;
WPP_MAIN_CB.NextDevice = 0i64;
WPP_MAIN_CB.CurrentIrp = 0i64;
WPP_MAIN_CB.Timer = (PIO_TIMER)1;
WPP_MAIN_CB.DeviceExtension = 0i64;
WPP_MAIN_CB.DeviceType = 0;
WppLoadTracingSupport();
WPP_MAIN_CB.CurrentIrp = 0i64;
WppInitKm((__int64)DriverObject, (__int64)RegistryPath);
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED )
{
if ( LOWORD(WPP_GLOBAL_Control->DeviceType) )
{
LOBYTE(v4) = 5;
WPP_RECORDER_SF_(
WPP_GLOBAL_Control->DeviceExtension,
v4,
1,
10,
(__int64)&WPP_942e49b71fcd3dd08668400dfd38e524_Traceguids);
}
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED )
{
LOBYTE(v4) = 4;
WPP_RECORDER_SF_q(
WPP_GLOBAL_Control->DeviceExtension,
v4,
1,
11,
(__int64)&WPP_942e49b71fcd3dd08668400dfd38e524_Traceguids,
(char)DriverObject);
}
}
DriverObject->MajorFunction[2] = (PDRIVER_DISPATCH)HumCreateClose;
DriverObject->MajorFunction[0] = (PDRIVER_DISPATCH)HumCreateClose;
DriverObject->MajorFunction[15] = (PDRIVER_DISPATCH)HumInternalIoctl;
DriverObject->MajorFunction[27] = (PDRIVER_DISPATCH)HumPnP;
DriverObject->MajorFunction[22] = (PDRIVER_DISPATCH)HumPower;
DriverObject->MajorFunction[23] = (PDRIVER_DISPATCH)HumSystemControl;
DriverObject->DriverExtension->AddDevice = (PDRIVER_ADD_DEVICE)HumAddDevice;
DriverObject->DriverUnload = (PDRIVER_UNLOAD)HumUnload;
MinidriverRegistration.Revision = 1;
MinidriverRegistration.DriverObject = DriverObject;
MinidriverRegistration.RegistryPath = RegistryPath;
MinidriverRegistration.DeviceExtensionSize = 152;
MinidriverRegistration.DevicesArePolled = 0;
v5 = HidRegisterMinidriver(&MinidriverRegistration);
v7 = v5;
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED )
{
LOBYTE(v6) = 4;
WPP_RECORDER_SF_d(
WPP_GLOBAL_Control->DeviceExtension,
v6,
1,
12,
(__int64)&WPP_942e49b71fcd3dd08668400dfd38e524_Traceguids,
v5);
}
KeInitializeSpinLock(&resetWorkItemsListSpinLock);
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED && LOWORD(WPP_GLOBAL_Control->DeviceType) )
{
LOBYTE(v8) = 5;
WPP_RECORDER_SF_(
WPP_GLOBAL_Control->DeviceExtension,
v8,
1,
13,
(__int64)&WPP_942e49b71fcd3dd08668400dfd38e524_Traceguids);
}
if ( v7 < 0 )
{
if ( (unsigned int)dword_1C0009010 > 5 && tlgKeywordOn() )
{
v12 = v7;
v15 = &v12;
v16 = 4i64;
tlgCreate1Sz_char((__int64)v17, "HIDUSB_MiniportReg");
tlgWriteTransfer_EtwWriteTransfer((__int64)&v14, (unsigned __int8 *)dword_1C00077B9, v9, v10, 4u, &v14);
}
TraceLoggingUnregister_EtwUnregister();
WppCleanupKm((__int64)DriverObject);
}
return v7;
}
// 1C0001B31: variable 'v4' is possibly undefined
// 1C0001C24: variable 'v6' is possibly undefined
// 1C0001C67: variable 'v8' is possibly undefined
// 1C0001CCC: variable 'v9' is possibly undefined
// 1C0001CCC: variable 'v10' is possibly undefined
// 1C0002470: using guessed type __int64 __fastcall WPP_RECORDER_SF_q(_DWORD, _DWORD, _DWORD, _DWORD, __int64, char);
// 1C0004590: using guessed type __int64 __fastcall WPP_RECORDER_SF_(_DWORD, _DWORD, _DWORD, _DWORD, __int64);
// 1C0004760: using guessed type __int64 __fastcall WPP_RECORDER_SF_d(_DWORD, _DWORD, _DWORD, _DWORD, __int64, char);
// 1C0009000: using guessed type void *WPP_RECORDER_INITIALIZED;
// 1C0009010: using guessed type int dword_1C0009010;
//----- (00000001C0001D10) ----------------------------------------------------
__int64 __fastcall HumGetDescriptorRequest(PDEVICE_OBJECT DeviceObject, __int16 a2, char a3, void **a4, __int64 a5, int a6, char a7, __int16 a8)
{
__int16 v10; // bp
char v12; // r15
int v13; // edx
_WORD *v14; // rdi
int v15; // ebp
__int64 v16; // rdx
int v17; // ebx
__int64 v18; // r8
__int64 v19; // r9
int v21; // [rsp+20h] [rbp-48h]
v10 = a2;
v12 = 0;
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED )
{
if ( LOWORD(WPP_GLOBAL_Control->DeviceType) )
WPP_RECORDER_SF_(
WPP_GLOBAL_Control->DeviceExtension,
5,
5,
93,
(__int64)&WPP_22f9612a74bb302c47e3c2e818dbd68b_Traceguids);
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED )
{
LOBYTE(a2) = 4;
WPP_RECORDER_SF_q(
WPP_GLOBAL_Control->DeviceExtension,
a2,
5,
94,
(__int64)&WPP_22f9612a74bb302c47e3c2e818dbd68b_Traceguids,
(char)DeviceObject);
}
}
v14 = (_WORD *)ExAllocatePool2(64i64, 136i64, 1432643912i64);
if ( v14 )
{
if ( !*a4 )
{
*a4 = (void *)ExAllocatePool2(64i64, *(unsigned int *)a5, 1432643912i64);
v12 = 1;
}
if ( !*a4 )
{
v17 = -1073741801;
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED )
{
LOBYTE(v13) = 2;
WPP_RECORDER_SF_d(
WPP_GLOBAL_Control->DeviceExtension,
v13,
5,
98,
(__int64)&WPP_22f9612a74bb302c47e3c2e818dbd68b_Traceguids,
23);
ExFreePool(v14);
goto LABEL_30;
}
goto LABEL_25;
}
if ( !v12 )
memset(*a4, 0, *(unsigned int *)a5);
v14[1] = v10;
*v14 = 136;
v15 = 0;
*((_DWORD *)v14 + 9) = *(_DWORD *)a5;
*((_QWORD *)v14 + 6) = 0i64;
*((_QWORD *)v14 + 5) = *a4;
*((_BYTE *)v14 + 130) = a7;
v14[66] = a8;
*((_BYTE *)v14 + 131) = a3;
*((_QWORD *)v14 + 7) = 0i64;
v17 = HumCallUSB(DeviceObject, (ULONG_PTR)v14);
if ( v17 < 0 )
{
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED )
{
LOBYTE(v16) = 2;
WPP_RECORDER_SF_d(
WPP_GLOBAL_Control->DeviceExtension,
v16,
5,
97,
(__int64)&WPP_22f9612a74bb302c47e3c2e818dbd68b_Traceguids,
v17);
}
}
else
{
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED )
WPP_RECORDER_SF_qDd((__int64)WPP_GLOBAL_Control->DeviceExtension, v16, v18, v19, v21);
if ( *((int *)v14 + 1) >= 0 )
{
v17 = 0;
v15 = *((_DWORD *)v14 + 9);
LABEL_24:
*(_DWORD *)a5 = v15;
LABEL_25:
ExFreePool(v14);
goto LABEL_30;
}
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED )
WPP_RECORDER_SF_dD(WPP_GLOBAL_Control->DeviceExtension, v16, v18, v19, v21, v17, *((_DWORD *)v14 + 1));
v17 = -1073741823;
}
if ( v12 )
{
ExFreePool(*a4);
*a4 = 0i64;
}
goto LABEL_24;
}
v17 = -1073741801;
if ( WPP_RECORDER_INITIALIZED == &WPP_RECORDER_INITIALIZED )
return (unsigned int)v17;
LOBYTE(v13) = 2;
WPP_RECORDER_SF_d(
WPP_GLOBAL_Control->DeviceExtension,
v13,
5,
99,
(__int64)&WPP_22f9612a74bb302c47e3c2e818dbd68b_Traceguids,
23);
LABEL_30:
if ( WPP_RECORDER_INITIALIZED != &WPP_RECORDER_INITIALIZED && LOWORD(WPP_GLOBAL_Control->DeviceType) )
WPP_RECORDER_SF_(
WPP_GLOBAL_Control->DeviceExtension,
5,
5,