-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathTsFltMgr.cpp
3988 lines (3654 loc) · 125 KB
/
TsFltMgr.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
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
#include "stdafx.h"
#include "TsFltMgr.h"
extern "C"
{
NTSTATUS NTAPI ZwQuerySystemInformation(ULONG SystemInfoClass,PVOID SystemInfoBuffer,ULONG SystemInfoBufferSize,PULONG BytesReturned OPTIONAL);
void __sidt(void*);
void __cdecl _disable(void);
void __cdecl _enable(void);
}
TsFlt_FUNCTION_LIST g_ZwCreateKey_25B4C[] =
{
{ 0x0,0x0,L"ZwCreateKey",&xx_ZwCreateKey_12580,{0x3ff,0x23,0x29,0x2b,0x40,0x40,0x40,0x46,0x46,0x15b,0x15f,0x15f,0x15e,0x15e,0x15e,0x162,0x163,0x163,0x0} }
};
TsFlt_FUNCTION_LIST g_FunctionArray_25B4C[] =
{
{ 0x0,0x0,L"ZwTerminateProcess",&xx_ZwTerminateProcess_12810,{0x3ff,0xe0,0x101,0x10a,0x152,0x14e,0x14e,0x172,0x172,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24} },
{ 0x1,0x0,L"ZwSetInformationFile",&xx_ZwSetInformationFile_12960,{0x3ff,0xc2,0xe0,0xe9,0x131,0x12d,0x12d,0x149,0x149,0x4e,0x4f,0x4f,0x4e,0x4e,0x4e,0x51,0x52,0x52} },
/*{ 0x2,0x0,L"ZwWriteFile",xx_ZwWriteFile_12BD0,{0x3ff,0xed,0x112,0x11c,0x167,0x163,0x163,0x18c,0x18c,0x4,0x5,0x5,0x5,0x5,0x5,0x6,0x7,0x7} },
{ 0x3,0x0,L"ZwSetValueKey",xx_ZwSetValueKey_12EA0,{0x3ff,0xd7,0xf7,0x100,0x148,0x144,0x144,0x166,0x166,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x32,0x32} },
{ 0x4,0x0,L"ZwWriteVirtualMemory",xx_ZwWriteVirtualMemory_13120,{0x3ff,0xf0,0x115,0x11f,0x16a,0x166,0x166,0x18f,0x18f,0x1,0x2,0x2,0x2,0x2,0x2,0x3,0x4,0x4} },
{ 0x5,0x0,L"ZwCreateFile",xx_ZwCreateFile_13390,{0x3ff,0x20,0x25,0x27,0x3c,0x3c,0x3c,0x42,0x42,0x15f,0x164,0x164,0x163,0x163,0x163,0x168,0x169,0x169} },
{ 0x6,0x0,L"ZwOpenProcess",xx_ZwOpenProcess_13690,{0x3ff,0x6a,0x7a,0x80,0xc2,0xc2,0xc2,0xbe,0xbe,0xdc,0xde,0xde,0xdd,0xdd,0xdd,0xe0,0xe1,0xe1} },
{ 0x7,0x0,L"ZwDeleteKey",xx_ZwDeleteKey_138E0,{0x3ff,0x35,0x3f,0x42,0x7b,0x7b,0x7b,0x67,0x67,0x136,0x13a,0x13a,0x139,0x139,0x139,0x13d,0x13e,0x13e} },
{ 0x8,0x0,L"ZwDeleteValueKey",xx_ZwDeleteValueKey_13AF0,{0x3ff,0x37,0x41,0x44,0x7e,0x7e,0x7e,0x6a,0x6a,0x133,0x137,0x137,0x136,0x136,0x136,0x13a,0x13b,0x13b} },
{ 0x9,0x0,L"ZwRequestWaitReplyPort",xx_ZwRequestWaitReplyPort_13D20,{0x3ff,0xb0,0xc8,0xd0,0x113,0x114,0x114,0x12b,0x12b,0x6c,0x6e,0x6e,0x6d,0x6d,0x6d,0x70,0x71,0x71} },
{ 0xa,0x0,L"ZwQueryValueKey",xx_ZwQueryValueKey_13F60,{0x3ff,0x9b,0xb1,0xb9,0xfc,0xfc,0xfc,0x10a,0x10a,0x8f,0x91,0x91,0x90,0x90,0x90,0x93,0x94,0x94} },
{ 0xb,0x0,L"ZwEnumerateValueKey",xx_ZwEnumerateValueKey_141E0,{0x3ff,0x3d,0x49,0x4d,0x88,0x88,0x88,0x77,0x77,0x124,0x128,0x128,0x127,0x127,0x127,0x12b,0x12c,0x12c} },
{ 0xc,0x0,L"ZwCreateThread",xx_ZwCreateThread_14460,{0x3ff,0x2e,0x35,0x37,0x4e,0x4e,0x4e,0x57,0x57,0x14a,0x14e,0x14e,0x14d,0x14d,0x14d,0x151,0x152,0x152} },
{ 0xd,0x0,L"ZwDuplicateObject",xx_ZwDuplicateObject_14710,{0x3ff,0x3a,0x44,0x47,0x81,0x81,0x81,0x6f,0x6f,0x12c,0x130,0x130,0x12f,0x12f,0x12f,0x133,0x134,0x134} },
{ 0xe,0x0,L"ZwLoadDriver",xx_ZwLoadDriver_149B0,{0x3ff,0x55,0x61,0x65,0xa5,0xa5,0xa5,0x9b,0x9b,0xff,0x101,0x101,0x100,0x100,0x100,0x103,0x104,0x104} },
{ 0xf,0x0,L"ZwDeviceIoControlFile",xx_ZwDeviceIoControlFile_14BC0,{0x3ff,0x38,0x42,0x45,0x7f,0x7f,0x7f,0x6b,0x6b,0x130,0x134,0x134,0x133,0x133,0x133,0x137,0x138,0x138} },
{ 0x10,0x0,L"ZwAlpcSendWaitReceivePort",xx_ZwAlpcSendWaitReceivePort_14EA0,{0x3ff,0x3ff,0x3ff,0x3ff,0x26,0x26,0x26,0x27,0x27,0x17d,0x182,0x182,0x181,0x181,0x181,0x186,0x187,0x187} },
{ 0x11,0x0,L"ZwSetSystemInformation",xx_ZwSetSystemInformation_15150,{0x3ff,0xd0,0xf0,0xf9,0x141,0x13d,0x13d,0x15e,0x15e,0x38,0x38,0x38,0x38,0x38,0x38,0x39,0x3a,0x3a} },
{ 0x12,0x0,L"ZwDeleteFile",xx_ZwDeleteFile_15390,{0x3ff,0x34,0x3e,0x41,0x7a,0x7a,0x7a,0x66,0x66,0x137,0x13b,0x13b,0x13a,0x13a,0x13a,0x13e,0x13f,0x13f} },
{ 0x13,0x0,L"ZwOpenSection",xx_ZwOpenSection_155A0,{0x3ff,0x6c,0x7d,0x83,0xc5,0xc5,0xc5,0xc2,0xc2,0xd8,0xda,0xda,0xd9,0xd9,0xd9,0xdc,0xdd,0xdd} },
{ 0x14,0x0,L"ZwCreateSection",xx_ZwCreateSection_157E0,{0x3ff,0x2b,0x32,0x34,0x4b,0x4b,0x4b,0x54,0x54,0x14d,0x151,0x151,0x150,0x150,0x150,0x154,0x155,0x155} },
{ 0x15,0x0,L"ZwSuspendThread",xx_ZwSuspendThread_15A80,{0x3ff,0xdd,0xfe,0x107,0x14f,0x14b,0x14b,0x16f,0x16f,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x27} },
{ 0x16,0x0,L"ZwTerminateThread",xx_ZwTerminateThread_15CB0,{0x3ff,0xe1,0x102,0x10b,0x153,0x14f,0x14f,0x173,0x173,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23} },
{ 0x17,0x0,L"ZwSystemDebugControl",xx_ZwSystemDebugControl_15E00,{0x3ff,0xde,0xff,0x108,0x150,0x14c,0x14c,0x170,0x170,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26} },
{ 0x18,0x0,L"ZwProtectVirtualMemory",xx_ZwProtectVirtualMemory_16080,{0x3ff,0x3ff,0x89,0x8f,0xd2,0xd2,0xd2,0xd7,0xd7,0xc2,0xc4,0xc4,0xc3,0xc3,0xc3,0xc6,0xc7,0xc7} },
{ 0x26,0x0,L"ZwCreateSymbolicLinkObject",xx_ZwCreateSymbolicLinkObject_162F0,{0x3ff,0x2d,0x34,0x36,0x4d,0x4d,0x4d,0x56,0x56,0x14b,0x14f,0x14f,0x14e,0x14e,0x14e,0x152,0x153,0x153} },
{ 0x27,0x0,L"ZwSetContextThread",xx_ZwSetContextThread_16540,{0x3ff,0x3ff,0xd5,0xdd,0x125,0x121,0x121,0x13c,0x13c,0x5b,0x5c,0x5c,0x5b,0x5b,0x5b,0x5e,0x5f,0x5f} },
{ 0x28,0x0,L"ZwRenameKey",xx_ZwRenameKey_16770,{0x3ff,0x3ff,0xc0,0xc8,0x10b,0x10b,0x10b,0x122,0x122,0x75,0x77,0x77,0x76,0x76,0x76,0x79,0x7a,0x7a} },
{ 0x29,0x0,L"ZwOpenThread",xx_ZwOpenThread_16E20,{0x3ff,0x6f,0x80,0x86,0xc9,0xc9,0xc9,0xc6,0xc6,0xd6,0xd6,0xd6,0xd5,0xd5,0xd5,0xd8,0xd9,0xd9} },
{ 0x2a,0x0,L"ZwGetNextThread",xx_ZwGetNextThread_17070,{0x3ff,0x3ff,0x3ff,0x3ff,0x174,0x170,0x170,0x8c,0x8c,0x10f,0x10f,0x10f,0x10e,0x10e,0x10e,0x111,0x112,0x112} },
{ 0x2b,0x0,L"ZwCreateThreadEx",xx_ZwCreateThreadEx_172F0,{0x3ff,0x3ff,0x3ff,0x3ff,0x184,0x17e,0x17e,0x58,0x58,0x14d,0x14d,0x14d,0x14c,0x14c,0x14c,0x150,0x151,0x151} },
{ 0x2c,0x0,L"ZwRestoreKey",xx_ZwRestoreKey_169A0,{0x3ff,0x3ff,0xcc,0xd4,0x117,0x118,0x118,0x12e,0x12e,0x69,0x6b,0x6b,0x6a,0x6a,0x6a,0x6d,0x6e,0x6e} },
{ 0x37,0x0,L"ZwReplaceKey",xx_ZwReplaceKey_16BE0,{0x3ff,0x3ff,0xc1,0xc9,0x10c,0x10c,0x10c,0x124,0x124,0x73,0x75,0x75,0x74,0x74,0x74,0x77,0x78,0x78} },
{ 0x38,0x0,L"ZwGetNextProcess",xx_ZwGetNextProcess_175F0,{0x3ff,0x3ff,0x3ff,0x3ff,0x173,0x16f,0x16f,0x8b,0x8b,0x10e,0x110,0x110,0x10f,0x10f,0x10f,0x112,0x113,0x113} },
{ 0x2d,0x0,L"ZwUnmapViewOfSection",xx_ZwUnmapViewOfSection_17860,{0x3ff,0xe7,0x10b,0x115,0x160,0x15c,0x15c,0x181,0x181,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14} },
{ 0x2e,0x0,L"ZwAssignProcessToJobObject",xx_ZwAssignProcessToJobObject_17A90,{0x3ff,0x12,0x13,0x15,0x2a,0x2a,0x2a,0x2b,0x2b,0x179,0x17e,0x17e,0x17d,0x17d,0x17d,0x182,0x183,0x183} },
{ 0x2f,0x0,L"ZwAllocateVirtualMemory",xx_ZwAllocateVirtualMemory_17CC0,{0x3ff,0x10,0x11,0x12,0x12,0x12,0x12,0x13,0x13,0x193,0x197,0x197,0x196,0x196,0x196,0x19b,0x19c,0x19c} },
{ 0x39,0x0,L"ZwFreeVirtualMemory",xx_ZwFreeVirtualMemory_17F40,{0x3ff,0x47,0x53,0x57,0x93,0x93,0x93,0x83,0x83,0x116,0x119,0x119,0x118,0x118,0x118,0x11c,0x11d,0x11d} },
{ 0x3a,0x1,L"NtUserFindWindowEx",xx_NtUserFindWindowEx_186A0,{0x3ff,0x170,0x17a,0x179,0x187,0x187,0x187,0x18c,0x18c,0x1c7,0x1c9,0x1ca,0x1cb,0x1cc,0x1cb,0x1cc,0x1ce,0x1d2} },
{ 0x19,0x1,L"NtUserBuildHwndList",xx_NtUserBuildHwndList_18910,{0x3ff,0x12e,0x138,0x137,0x142,0x142,0x142,0x143,0x143,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x1a,0x1,L"NtUserQueryWindow",xx_NtUserQueryWindow_18BB0,{0x3ff,0x1d2,0x1e3,0x1e1,0x1f8,0x1f8,0x1f8,0x203,0x203,0x1de,0x1e0,0x1e1,0x1e2,0x1e3,0x1e2,0x1e3,0x1e5,0x1e9} },
{ 0x1b,0x1,L"NtUserGetForegroundWindow",xx_NtUserGetForegroundWindow_18DE0,{0x3ff,0x189,0x194,0x193,0x1a2,0x1a2,0x1a2,0x1a7,0x1a7,0x1aa,0x1ac,0x1ad,0x1ae,0x1ae,0x1ad,0x1ae,0x1af,0x1b3} },
{ 0x1c,0x1,L"NtUserWindowFromPoint",xx_NtUserWindowFromPoint_18FD0,{0x3ff,0x238,0x250,0x24c,0x269,0x269,0x269,0x275,0x275,0x280,0x283,0x286,0x288,0x28a,0x289,0x28c,0x292,0x298} },
{ 0x1d,0x1,L"NtUserSetParent",xx_NtUserSetParent_19200,{0x3ff,0x1fe,0x211,0x20e,0x226,0x226,0x226,0x230,0x230,0x246,0x249,0x24b,0x24d,0x24f,0x24e,0x251,0x253,0x259} },
{ 0x1e,0x1,L"NtUserSetWindowLong",xx_NtUserSetWindowLong_19430,{0x3ff,0x20d,0x220,0x21c,0x236,0x236,0x236,0x242,0x242,0x230,0x232,0x234,0x236,0x237,0x236,0x239,0x23b,0x23f} },
{ 0x1f,0x1,L"NtUserMoveWindow",xx_NtUserMoveWindow_19680,{0x3ff,0x1c1,0x1d1,0x1d0,0x1e4,0x1e4,0x1e4,0x1ef,0x1ef,0x1f3,0x1f5,0x1f6,0x1f7,0x1f8,0x1f7,0x1f9,0x1fb,0x1ff} },
{ 0x20,0x1,L"NtUserSetWindowPos",xx_NtUserSetWindowPos_19900,{0x3ff,0x20f,0x222,0x21e,0x238,0x238,0x238,0x244,0x244,0x22e,0x230,0x232,0x234,0x235,0x234,0x237,0x239,0x23d} },
{ 0x21,0x1,L"NtUserSetWindowPlacement",xx_NtUserSetWindowPlacement_19BA0,{0x3ff,0x20e,0x221,0x21d,0x237,0x237,0x237,0x243,0x243,0x22f,0x231,0x233,0x235,0x236,0x235,0x238,0x23a,0x23e} },
{ 0x22,0x1,L"NtUserShowWindow",xx_NtUserShowWindow_19DD0,{0x3ff,0x218,0x22b,0x227,0x243,0x243,0x243,0x24f,0x24f,0x223,0x225,0x227,0x229,0x22a,0x229,0x22c,0x22e,0x232} },
{ 0x23,0x1,L"NtUserShowWindowAsync",xx_NtUserShowWindowAsync_1A000,{0x3ff,0x219,0x22c,0x228,0x244,0x244,0x244,0x250,0x250,0x222,0x224,0x226,0x228,0x229,0x228,0x22b,0x22d,0x231} },
{ 0x24,0x1,L"NtUserSendInput",xx_NtUserSendInput_1A230,{0x3ff,0x1e1,0x1f6,0x1f4,0x20d,0x20d,0x20d,0x218,0x218,0x25e,0x261,0x263,0x265,0x267,0x266,0x269,0x26b,0x271} },
{ 0x25,0x1,L"NtUserSetWinEventHook",xx_NtUserSetWinEventHook_1A680,{0x3ff,0x215,0x228,0x224,0x240,0x240,0x240,0x24c,0x24c,0x226,0x228,0x22a,0x22c,0x22d,0x22c,0x22f,0x231,0x235} },
{ 0x31,0x1,L"NtUserClipCursor",xx_NtUserClipCursor_1A470,{0x3ff,0x0,0x14a,0x149,0x157,0x157,0x157,0x15c,0x15c,0x14d,0x14e,0x14f,0x14f,0x14f,0x14f,0x151,0x152,0x156} },
{ 0x30,0x1,L"NtUserSetWindowsHookEx",xx_NtUserSetWindowsHookEx_1A930,{0x3ff,0x212,0x225,0x221,0x23d,0x23d,0x23d,0x249,0x249,0x229,0x22b,0x22d,0x22f,0x230,0x22f,0x232,0x234,0x238} },
{ 0x32,0x0,L"ZwMakeTemporaryObject",xx_ZwMakeTemporaryObject_18190,{0x3ff,0x3ff,0x69,0x6e,0xae,0xae,0xae,0xa4,0xa4,0xf6,0xf8,0xf8,0xf7,0xf7,0xf7,0xfa,0xfb,0xfb} },
{ 0x3b,0x0,L"ZwCreateUserProcess",xx_ZwCreateUserProcess_183A0,{0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x17f,0x17f,0x5d,0x5d,0x142,0x146,0x146,0x145,0x145,0x145,0x149,0x14a,0x14a} },
{ 0x3c,0x1,L"NtUserMessageCall",xx_NtUserMessageCall_1ABB0,{0x3ff,0x1bc,0x1cc,0x1cb,0x1df,0x1df,0x1df,0x1ea,0x1ea,0x1f8,0x1fa,0x1fb,0x1fc,0x1fd,0x1fc,0x1fe,0x200,0x204} },
{ 0x3d,0x1,L"NtUserPostMessage",xx_NtUserPostMessage_1AE50,{0x3ff,0x1cb,0x1db,0x1da,0x1f1,0x1f1,0x1f1,0x1fc,0x1fc,0x1e6,0x1e8,0x1e9,0x1ea,0x1eb,0x1ea,0x1ec,0x1ee,0x1f2} },
{ 0x3e,0x1,L"NtUserPostThreadMessage",xx_NtUserPostThreadMessage_1B0A0,{0x3ff,0x1cc,0x1dc,0x1db,0x1f2,0x1f2,0x1f2,0x1fd,0x1fd,0x1e5,0x1e7,0x1e8,0x1e9,0x1ea,0x1e9,0x1eb,0x1ed,0x1f1} },
{ 0x3f,0x1,L"NtUserBuildHwndList_WIN8",xx_NtUserBuildHwndList_WIN8_1B2F0,{0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x166,0x167,0x168,0x168,0x168,0x168,0x16a,0x16b,0x16f} },
{ 0x40,0x0,L"ZwFsControlFile",xx_ZwFsControlFile_1B5A0,{0x3ff,0x3ff,0x54,0x3ff,0x96,0x96,0x96,0x86,0x86,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x41,0x1,L"NtUserSetImeInfoEx",xx_NtUserSetImeInfoEx_1B880,{0x3ff,0x3ff,0x205,0x3ff,0x3ff,0x3ff,0x3ff,0x226,0x226,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x258,0x25b,0x25d,0x263} },
{ 0x42,0x0,L"ZwCreateProcessEx",xx_ZwCreateProcessEx_1BA90,{0x3ff,0x3ff,0x30,0x32,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x48,0x1,L"NtUserGetRawInputData",xx_NtUserGetRawInputData_1BD60,{0x3ff,0x3ff,0x1ac,0x3ff,0x3ff,0x3ff,0x3ff,0x1c0,0x1c0,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x43,0x1,L"NtUserGetRawInputBuffer",xx_NtUserGetRawInputBuffer_1BFD0,{0x3ff,0x3ff,0x1ab,0x3ff,0x3ff,0x3ff,0x3ff,0x1bf,0x1bf,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x44,0x1,L"NtUserGetAsyncKeyState",xx_NtUserGetAsyncKeyState_1C210,{0x3ff,0x3ff,0x17f,0x3ff,0x3ff,0x3ff,0x3ff,0x192,0x192,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x45,0x1,L"NtUserGetKeyState",xx_NtUserGetKeyState_1C420,{0x3ff,0x3ff,0x1a0,0x3ff,0x3ff,0x3ff,0x3ff,0x1b4,0x1b4,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x46,0x1,L"NtUserGetKeyboardState",xx_NtUserGetKeyboardState_1C630,{0x3ff,0x3ff,0x19e,0x3ff,0x3ff,0x3ff,0x3ff,0x1b2,0x1b2,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x47,0x0,L"ZwQueueApcThread",xx_ZwQueueApcThread_1C840,{0x3ff,0x3ff,0xb4,0x3ff,0x3ff,0x3ff,0x3ff,0x10d,0x10d,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x8b,0x8e,0x8f,0x8f} },
{ 0x4a,0x0,L"ZwSetSecurityObject",xx_ZwSetSecurityObject_1CAB0,{0x3ff,0x3ff,0xed,0x3ff,0x3ff,0x3ff,0x3ff,0x15b,0x15b,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3b,0x3c,0x3d,0x3d} },
{ 0x4b,0x0,L"ZwOpenFile",xx_ZwOpenFile_1CCF0,{0x3ff,0x3ff,0x74,0x3ff,0x3ff,0x3ff,0x3ff,0xb3,0xb3,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0xe8,0xeb,0xec,0xec} },
{ 0x4c,0x0,L"ZwQueueApcThreadEx",xx_ZwQueueApcThreadEx_1CF70,{0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x10e,0x10e,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x8a,0x8d,0x8e,0x8e} },
{ 0x4d,0x0,L"ZwCreateMutant",xx_ZwCreateMutant_1D1F0,{0x3ff,0x3ff,0x2b,0x2d,0x43,0x43,0x43,0x4a,0x4a,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x15a,0x15e,0x15f,0x15f} },
{ 0x4e,0x0,L"ZwQuerySystemInformation",xx_ZwQuerySystemInformation_1D440,{0x3ff,0x3ff,0xad,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x4f,0x0,L"ZwQueryIntervalProfile",xx_ZwQueryIntervalProfile_1D690,{0x3ff,0x3ff,0x9e,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x50,0x0,L"ZwSetInformationProcess",xx_ZwSetInformationProcess_1D8C0,{0x3ff,0x3ff,0xe4,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x51,0x1,L"NtGdiAddFontMemResourceEx",xx_NtGdiAddFontMemResourceEx_1DB10,{0x3ff,0x3ff,0x4,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x52,0x0,L"ZwReplyWaitReceivePortEx",xx_ZwReplyWaitReceivePortEx_1DD80,{0x3ff,0x3ff,0xc4,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x53,0x3,L"KeUserModeCallback",xx_KeUserModeCallback_1DFF0,{0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x33,0x0,L"ZwOpenKey",xx_ZwOpenKey_1E260,{0x3ff,0x3ff,0x77,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x54,0x0,L"ZwMapViewOfSection",xx_ZwMapViewOfSection_1E4A0,{0x3ff,0x3ff,0x6c,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x55,0x0,L"ZwSetIntervalProfile",xx_ZwSetIntervalProfile_1E780,{0x3ff,0x3ff,0xe7,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x56,0x1,L"NtGdiAddFontResourceW",xx_NtGdiAddFontResourceW_1E9B0,{0x3ff,0x3ff,0x2,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x57,0x1,L"NtGdiAddRemoteFontToDC",xx_NtGdiAddRemoteFontToDC_1EC30,{0x3ff,0x3ff,0x3,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x58,0x0,L"ZwQueryInformationProcess",xx_ZwQueryInformationProcess_1EE80,{0x3ff,0x3ff,0x9a,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x59,0x0,L"ZwQueryInformationThread",xx_ZwQueryInformationThread_1F0F0,{0x3ff,0x3ff,0x9b,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x5a,0x0,L"ZwCreateProfile",xx_ZwCreateProfile_1F360,{0x3ff,0x3ff,0x31,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x5b,0x0,L"ZwVdmControl",xx_ZwVdmControl_1F630,{0x3ff,0x3ff,0x10c,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x5c,0x0,L"ZwCreateProcess",xx_ZwCreateProcess_1F860,{0x3ff,0x3ff,0x2f,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x5d,0x1,L"NtGdiAddEmbFontToDC",xx_NtGdiAddEmbFontToDC_1FB10,{0x3ff,0x3ff,0xd6,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x5e,0x0,L"NtDebugActiveProcess",xx_NtDebugActiveProcess_1FD40,{0x3ff,0x3ff,0x39,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x5f,0x0,L"NtAlpcCreatePort",xx_NtAlpcCreatePort_1FF70,{0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x17,0x17,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x191,0x196,0x197,0x197} },
{ 0x60,0x0,L"NtCreatePort",xx_NtCreatePort_201B0,{0x3ff,0x3ff,0x2e,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff} },
{ 0x61,0x2,NULL,{0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0} },
{ 0x62,0x0,NULL,{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0} }
*/
};
NTSTATUS TsFltMgrDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
NTSTATUS TsFltMgrDefaultHandler(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
NTSTATUS TsFltMgrShutdownControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp);
NTSTATUS xx_DeviceExtension_11D50(int IoctlCode_a1, PULONG pFuncAddress_a2);
void DriverReinitializationRoutine(struct _DRIVER_OBJECT *DriverObject, PVOID Context, ULONG Count);
UINT xx_Init_10630();
PVOID xx_GetProAddress_11630(int a1, ULONG_PTR pBase_a2, char *strFuncName_a3);
BOOLEAN xx_GetSysModuleInfo_10720(char *pNeedModuleName_a1, void *pSysModuleInfo_a2);
#ifdef __cplusplus
extern "C" NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath);
#endif
NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
{
PTsFlt_DEVICE_EXTENSION pDeviceExtension;
UNICODE_STRING DeviceName,Win32Device;
PDEVICE_OBJECT DeviceObject = NULL;
NTSTATUS status;
ULONG i;
RtlInitUnicodeString(&DeviceName,L"\\Device\\TsFltMgr");
status = IoCreateDevice(DriverObject,
0x18,
&DeviceName,
0x8000,
0,
TRUE,
&DeviceObject);
if (!NT_SUCCESS(status))
return status;
if (!DeviceObject)
return STATUS_UNEXPECTED_IO_ERROR;
IoRegisterShutdownNotification(DeviceObject);
pDeviceExtension = (PTsFlt_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
if ( pDeviceExtension )
{
pDeviceExtension->Type = 'TSFL';
pDeviceExtension->FunctionPoint = xx_DeviceExtension_11D50;
}
RtlInitUnicodeString(&Win32Device,L"\\DosDevices\\TsFltMgr");
status = IoCreateSymbolicLink(&Win32Device, &DeviceName);
if (!NT_SUCCESS(status))
{
ExDeleteNPagedLookasideList(&g_Lookaside);
if ( DeviceObject )
IoDeleteDevice(DeviceObject);
return status;
}
DriverObject->MajorFunction[IRP_MJ_CREATE] = TsFltMgrDefaultHandler;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = TsFltMgrDefaultHandler;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = TsFltMgrDeviceControl;
DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = TsFltMgrShutdownControl;
IoRegisterBootDriverReinitialization(DriverObject, DriverReinitializationRoutine, 0);
ExInitializeNPagedLookasideList(&g_Lookaside, 0, 0, 0, sizeof(NPAGED_LOOKASIDE_LIST)/*0xCCu*/, 'SRVP', 0);
xx_Init_10630();
return STATUS_SUCCESS;
}
NTSTATUS TsFltMgrDefaultHandler(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
{
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_SUCCESS;
}
NTSTATUS TsFltMgrDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
{
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Irp->IoStatus.Status;
}
NTSTATUS TsFltMgrShutdownControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
{
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Irp->IoStatus.Status;
}
int __stdcall xx_SetDwordGolbal_11BD0(BOOLEAN a1)
{
int result; // eax@1
result = a1;
g_FilterFlag_dword_281D4 = a1;
return result;
}
unsigned int __stdcall xx_GetFunInfoIndexFromList_11BE0(ULONG index_a1, char a2)
{
PTsFlt_FILTER pTsFltFilter; // eax@1
if ( index_a1 < arraysize(g_FuncFilterInfo_dword_281F0) )
{
pTsFltFilter = g_FuncFilterInfo_dword_281F0[index_a1];
if ( pTsFltFilter )
{
pTsFltFilter->OtherModuleFuncReserve = a2;
}
}
return index_a1;
}
BOOLEAN xx_StartTimer_21250(ULONG index_a1, int pInfo_a2)
{
PTsFlt_MODULE_INTERFACE pTsFltModuleInterface_v3;
BOOLEAN isSuccess = FALSE;
PKTIMER pKtimer_v4;
LARGE_INTEGER Time = {0};
Time.QuadPart = 1000000;
if ( pInfo_a2 && index_a1 < TS_MAX_OTHER_MODULE_FUNC )
{
pTsFltModuleInterface_v3 = (PTsFlt_MODULE_INTERFACE)(pInfo_a2 + 8);
pKtimer_v4 = pTsFltModuleInterface_v3[index_a1].Timer;
KeInitializeTimer(pKtimer_v4);
while ( pTsFltModuleInterface_v3->Reserve2 )
{
KeSetTimer(pKtimer_v4, Time, 0);
KeWaitForSingleObject(pKtimer_v4, Executive, 0, 0, 0);
}
isSuccess = KeCancelTimer(pKtimer_v4);
}
return isSuccess;
}
NTSTATUS __fastcall xx_StartTimerByFuncInfoList_212B0(unsigned int index_a1, PVOID pFunction_a2)
{
NTSTATUS result;
PTsFlt_FILTER pFunInfo_v3;
ULONG index_v4;
PTsFlt_MODULE_INTERFACE pTsFltModuleInterface_v5;
PCHAR v6;
result = STATUS_UNSUCCESSFUL;
if ( pFunction_a2 )
{
if ( index_a1 < arraysize(g_FuncFilterInfo_dword_281F0) )
{
pFunInfo_v3 = g_FuncFilterInfo_dword_281F0[index_a1];
if ( pFunInfo_v3 )
{
if ( pFunInfo_v3->IsHook == TRUE )
{
index_v4 = 0;
pTsFltModuleInterface_v5 = (PTsFlt_MODULE_INTERFACE)(PCHAR)&pFunInfo_v3->ModuleInterface[0];
while ( !pTsFltModuleInterface_v5 || pTsFltModuleInterface_v5->FuncAddress != pFunction_a2 )
{
++index_v4;
pTsFltModuleInterface_v5 = (PTsFlt_MODULE_INTERFACE)((PCHAR)pTsFltModuleInterface_v5 + sizeof(TsFlt_MODULE_INTERFACE));
if ( index_v4 >= TS_MAX_OTHER_MODULE_FUNC )
{
return result;
}
}
v6 = (PCHAR)&pFunInfo_v3->OtherModuleFuncReserve;
pTsFltModuleInterface_v5->Count = 0;
InterlockedIncrement((volatile LONG *)(&pTsFltModuleInterface_v5->Count));
xx_StartTimer_21250(index_v4, (int)v6);
InterlockedExchange((volatile LONG *)(&pTsFltModuleInterface_v5->FuncAddress), 0);
InterlockedDecrement((volatile LONG *)(&pFunInfo_v3->OtherModuleFuncCount));
xx_StartTimer_21250(index_v4, (int)v6);
InterlockedDecrement((volatile LONG *)(&pTsFltModuleInterface_v5->Count));
result = STATUS_SUCCESS;
}
}
}
}
return result;
}
NTSTATUS __stdcall xx_StartTimerByFuncInfoList_11CA0(unsigned int a1, PVOID a2)
{
return xx_StartTimerByFuncInfoList_212B0(a1, a2);
}
NTSTATUS __stdcall xx_GetGlobalFlag_11CD0(PULONG a1, PULONG a2, PULONG a3, PULONG a4)
{
if ( g_SystemVersion_dword_281E8 && !g_SsdtType_dword_281DC && g_Flag_dword_281EC == -1 )
{
if ( a1 )
*(DWORD *)a1 = 0;
if ( a2 )
*(DWORD *)a2 = g_HookKiSystemFastCallFlag_dword_281E4;
if ( a3 )
*(DWORD *)a3 = g_SystemVersion_dword_281E8;
if ( a4 )
*(DWORD *)a4 = g_Flag_dword_281EC;
}
return STATUS_UNSUCCESSFUL;
}
ULONG xx_GetFuncInfoList_11D40()
{
return (ULONG)g_FuncFilterInfo_dword_281F0;
}
PVOID __stdcall xx_SetOtherModuleFunctionIntoNotifyInfo_11C10(PTsFlt_NOTIFY_INFO pTsFltNotifyInfo_a1, PVOID pFunc_a2, PVOID pFunc_a3)
{
if ( pTsFltNotifyInfo_a1 )
{
pTsFltNotifyInfo_a1->OtherModuleFuncFlag[pTsFltNotifyInfo_a1->OtherModuleFuncIndex] = (ULONG)pFunc_a3;
pTsFltNotifyInfo_a1->OtherModuleFunc[pTsFltNotifyInfo_a1->OtherModuleFuncIndex] = (ULONG)pFunc_a2;
++pTsFltNotifyInfo_a1->Count;
}
return pTsFltNotifyInfo_a1;
}
//这里精妙之处
NTSTATUS xx_CallNotifyInfoFunction_11C40(PULONG pParameter_a1, PVOID pParameter_a2, PTsFlt_NOTIFY_INFO pTsFltNotifyInfo_a3)
{
int ParameterNumber_v4 = 0;
ULONG Parameter_v5 = 0;
NTSTATUS result = STATUS_UNSUCCESSFUL;
if ( pTsFltNotifyInfo_a3 && pTsFltNotifyInfo_a3->ProxyFunction )
{
ParameterNumber_v4 = pTsFltNotifyInfo_a3->ParameterNumber;
if ( ParameterNumber_v4 )
{
ParameterNumber_v4 = ParameterNumber_v4 - 1;
do
{
Parameter_v5 = pTsFltNotifyInfo_a3->Parameter[ParameterNumber_v4];
*pParameter_a1 = Parameter_v5;
--ParameterNumber_v4;
__asm push Parameter_v5
}
while ( ParameterNumber_v4 >= 0 );
Parameter_v5 = (ULONG)pTsFltNotifyInfo_a3->ProxyFunction;
__asm mov eax,Parameter_v5
__asm call eax
__asm mov result,eax
}
}
else
{
result = STATUS_INVALID_PARAMETER;
}
return result;
}
NTSTATUS xx_SetOtherModuleFunctionIntoFilterInfoEx_21360(PVOID pFunc_a1, ULONG index_a2, PULONG pRet_a3, ULONG Type_a4, ULONG indexOfArray_a5)
{
NTSTATUS result;
PTsFlt_FILTER pTsFltFilter_v6;
ULONG count_v7;
result = STATUS_UNSUCCESSFUL;
if ( pFunc_a1 )
{
if ( index_a2 < arraysize(g_FuncFilterInfo_dword_281F0) && indexOfArray_a5 < TS_MAX_OTHER_MODULE_FUNC )
{
pTsFltFilter_v6 = g_FuncFilterInfo_dword_281F0[index_a2];
if ( pTsFltFilter_v6 )
{
if ( pTsFltFilter_v6->IsHook == TRUE )
{
if (pTsFltFilter_v6->ModuleInterface[indexOfArray_a5].FuncAddress)//if ( *(DWORD *)((indexOfArray_a5 << 6) + pTsFltFilter_v6 + 0x130) )
{
for (count_v7 = 0; pTsFltFilter_v6->ModuleInterface[count_v7].FuncAddress; count_v7++)
{
if ( count_v7 >= TS_MAX_OTHER_MODULE_FUNC )
return result;
}
pTsFltFilter_v6->ModuleInterface[count_v7].Type = Type_a4; //*(DWORD *)((count_v7 << 6) + pTsFltFilter_v6 + 0xF8) = Type_a4;
InterlockedExchange((PLONG)&pTsFltFilter_v6->ModuleInterface[count_v7].FuncAddress, (LONG)pFunc_a1);//InterlockedExchange((volatile LONG *)((count_v7 << 6) + pTsFltFilter_v6 + 0x130), pFunc_a1);
InterlockedIncrement((PLONG)&pTsFltFilter_v6->OtherModuleFuncCount);
result = 0;
if ( pRet_a3 )
{
*pRet_a3 = count_v7;
}
}
else
{
pTsFltFilter_v6->ModuleInterface[indexOfArray_a5].Type = Type_a4;//*(DWORD *)((indexOfArray_a5 << 6) + pTsFltFilter_v6 + 0xF8) = Type_a4;
InterlockedExchange((PLONG)&pTsFltFilter_v6->ModuleInterface[indexOfArray_a5].FuncAddress, (LONG)pFunc_a1);//InterlockedExchange((volatile LONG *)((indexOfArray_a5 << 6) + pTsFltFilter_v6 + 0x130), pFunc_a1);
InterlockedIncrement((PLONG)&pTsFltFilter_v6->OtherModuleFuncCount);//InterlockedIncrement((volatile LONG *)(pTsFltFilter_v6 + 0xF4));
result = 0;
if ( pRet_a3 )
{
*pRet_a3 = indexOfArray_a5;
}
}
}
}
}
}
return result;
}
NTSTATUS __stdcall xx_SetOtherModuleFunctionIntoFilterInfo_11CB0(ULONG Index_a1, PVOID pFunc_a2, ULONG Type_a3, ULONG indexOfArray_a4, PULONG pRet_a5)
{
return xx_SetOtherModuleFunctionIntoFilterInfoEx_21360(pFunc_a2, Index_a1, pRet_a5, Type_a3, indexOfArray_a4);
}
NTSTATUS xx_DeviceExtension_11D50(int IoctlCode_a1, PULONG pFuncAddress_a2)
{
NTSTATUS result = 0;
if ( pFuncAddress_a2 )
{
result = 0;
switch ( IoctlCode_a1 )
{
case 0:
*(DWORD *)pFuncAddress_a2 = (DWORD)xx_SetDwordGolbal_11BD0;
break;
case 1:
*(DWORD *)pFuncAddress_a2 = (DWORD)xx_GetFunInfoIndexFromList_11BE0;
break;
case 2:
*(DWORD *)pFuncAddress_a2 = (DWORD)xx_SetOtherModuleFunctionIntoNotifyInfo_11C10;
break;
case 3:
*(DWORD *)pFuncAddress_a2 = (DWORD)xx_CallNotifyInfoFunction_11C40;
break;
case 4:
*(DWORD *)pFuncAddress_a2 = (DWORD)xx_SetOtherModuleFunctionIntoFilterInfo_11CB0;
break;
case 5:
*(DWORD *)pFuncAddress_a2 = (DWORD)xx_StartTimerByFuncInfoList_11CA0;
break;
case 6:
*(DWORD *)pFuncAddress_a2 = (DWORD)xx_GetGlobalFlag_11CD0;
break;
case 7:
*(DWORD *)pFuncAddress_a2 = (DWORD)xx_GetFuncInfoList_11D40;
break;
default:
*(DWORD *)pFuncAddress_a2 = 0;
result = STATUS_UNSUCCESSFUL;
}
}
else
{
result = STATUS_UNSUCCESSFUL;
}
return result;
}
PCHAR xx_GetProcessName_111E0(PEPROCESS pEprocess_a1)
{
PVOID PsGetProcessImageFileName_v1;
PCHAR result;
UNICODE_STRING DestinationString;
if ( !g_BuildNumber )
{
PsGetVersion(0, 0, &g_BuildNumber, 0);
}
PsGetProcessImageFileName_v1 = g_PsGetProcessImageFileName_dword_28178;
if ( g_PsGetProcessImageFileName_dword_28178 || g_BuildNumber != 2195)
{
RtlInitUnicodeString(&DestinationString, L"PsGetProcessImageFileName");
PsGetProcessImageFileName_v1 = MmGetSystemRoutineAddress(&DestinationString);
g_PsGetProcessImageFileName_dword_28178 = (PVOID)PsGetProcessImageFileName_v1;
if (g_PsGetProcessImageFileName_dword_28178)
{
result = ((PCHAR (__stdcall *)(PEPROCESS))PsGetProcessImageFileName_v1)(pEprocess_a1);
}
}
else
{
result = (PCHAR)"OS_2000";
}
return result;
}
NTSTATUS xx_QueryValueKey_10E70(PCWSTR RegSourceString, PCWSTR ValueSourceStringa, void *pData_a3, int pDataLen_a4, int pRet_a5)
{
PVOID pBuffer_v5 = 0;
NTSTATUS status_v6;
PVOID pBuffer_v7;
NTSTATUS result;
HANDLE KeyHandle = NULL;
ULONG ResultLength = 0;
LSA_UNICODE_STRING DestinationString;
LSA_UNICODE_STRING ValueName;
OBJECT_ATTRIBUTES ObjectAttributes = {0};
if ( RegSourceString && ValueSourceStringa )
{
RtlInitUnicodeString(&DestinationString, RegSourceString);
InitializeObjectAttributes(&ObjectAttributes,&DestinationString, 576, 0, 0)
status_v6 = ZwOpenKey(&KeyHandle, (ACCESS_MASK)0x00020019, &ObjectAttributes);
if ( status_v6 >= 0 )
{
pBuffer_v5 = ExAllocatePoolWithTag(NonPagedPool, 0x218u, ' kdD');
if ( pBuffer_v5 )
{
memset(pBuffer_v5, 0, 0x218u);
RtlInitUnicodeString(&ValueName, ValueSourceStringa);
status_v6 = ZwQueryValueKey(
KeyHandle,
&ValueName,
KeyValuePartialInformation,
pBuffer_v5,
0x218u,
&ResultLength);
if ( status_v6 >= 0 )
{
if ( pRet_a5 )
*(DWORD *)pRet_a5 = *((DWORD *)pBuffer_v5 + 1);
if ( pData_a3 )
{
if ( (unsigned int)pDataLen_a4 < *((DWORD *)pBuffer_v5 + 2) )
memcpy(pData_a3, (char *)pBuffer_v5 + 12, pDataLen_a4);
else
memcpy(pData_a3, (char *)pBuffer_v5 + 12, *((DWORD *)pBuffer_v5 + 2));
}
}
}
}
if ( KeyHandle )
ZwClose(KeyHandle);
if ( pBuffer_v5 )
ExFreePool(pBuffer_v5);
result = status_v6;
}
else
{
result = STATUS_INVALID_PARAMETER;
}
return result;
}
NTSTATUS __stdcall xx_OpenKeyTsFltMgr_10D80(PHANDLE pHandle)
{
NTSTATUS status_v1 = STATUS_UNSUCCESSFUL;
HANDLE Handle = NULL;
HANDLE KeyHandle = NULL;
UNICODE_STRING DestinationString = {0};
UNICODE_STRING DestinationString_v6 = {0};
OBJECT_ATTRIBUTES ObjectAttributes = {0};
OBJECT_ATTRIBUTES ObjectAttributes_v8 = {0};
RtlInitUnicodeString(&DestinationString, L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Services\\TsFltMgr");
InitializeObjectAttributes(&ObjectAttributes, &DestinationString, 512, 0, 0);
status_v1 = ZwOpenKey(&KeyHandle, 0xF003Fu, &ObjectAttributes);
if ( NT_SUCCESS(status_v1) )
{
RtlInitUnicodeString(&DestinationString_v6, L"TsFltInfo");
InitializeObjectAttributes(&ObjectAttributes_v8, &DestinationString_v6, 512, KeyHandle, 0);
status_v1 = ZwCreateKey(&Handle, 0xF003Fu, &ObjectAttributes_v8, 0, 0, 0, 0);
if ( NT_SUCCESS(status_v1))
{
if ( pHandle )
{
*(HANDLE *)pHandle = Handle;
}
else
{
ZwClose(Handle);
}
}
}
if ( KeyHandle )
{
ZwClose(KeyHandle);
}
return status_v1;
}
NTSTATUS xx_InitializeResourceLite_223F0()
{
NTSTATUS result;
PTsFlt_PERESOURCE pTemp = NULL;
if ( g_pInitResourceLiteInfo_dword_2A398 )
{
result = STATUS_SUCCESS;
}
else
{
pTemp = (PTsFlt_PERESOURCE)ExAllocatePoolWithTag(NonPagedPool, sizeof(TsFlt_PERESOURCE)/*0x240u*/, 'KPOT');
g_pInitResourceLiteInfo_dword_2A398 = pTemp;
if ( pTemp )
{
memset(pTemp, 0, sizeof(TsFlt_PERESOURCE)/*0x240u*/);
result = ExInitializeResourceLite((PERESOURCE)&pTemp->Eresouce);
g_pInitResourceLiteInfo_dword_2A398->Status = result;
g_IsExInitializeResourceLiteSuccess_byte_2A39C = TRUE;
}
else
{
result = STATUS_UNSUCCESSFUL;
}
}
return result;
}
PVOID xx_GetFunctionClassPoint_22FF0()
{
PVOID result; // eax@1
PVOID pBuffer_v1; // esi@2
result = 0;
if ( g_IsExInitializeResourceLiteSuccess_byte_2A39C )
{
result = ExAllocatePoolWithTag(NonPagedPool, 0x48u, 'KPOT');
pBuffer_v1 = result;
if ( result )
{
/*memset(result, 0, 0x48u);
*((DWORD *)pBuffer_v1 + 0) = xx_CreateMsgPort_22CF0;
*((DWORD *)pBuffer_v1 + 1) = sub_22E50;
*((DWORD *)pBuffer_v1 + 2) = sub_22F20;
*((DWORD *)pBuffer_v1 + 3) = sub_22F80;
*((DWORD *)pBuffer_v1 + 4) = sub_22960;
*((DWORD *)pBuffer_v1 + 5) = sub_228F0;
*((DWORD *)pBuffer_v1 + 6) = sub_226D0;
*((DWORD *)pBuffer_v1 + 7) = xx_InsertIntoList_22800;
*((DWORD *)pBuffer_v1 + 8) = xx_GetResourceSharedLiteInfo_22460;
*((DWORD *)pBuffer_v1 + 9) = xx_InterlockedDecrement_224F0;*/
result = pBuffer_v1;
}
}
return result;
}
NTSTATUS xx_ZwWriteFile_220B0(PTsFlt_WRITE_FILE_BUFFER pWriteFileBufferInfo_a1, HANDLE FileHandle)
{
ULONG Len_v2; // ST18_4@1
void *pBuffer_v3; // ST14_4@1
LARGE_INTEGER ByteOffset = {0}; // [sp+0h] [bp-14h]@1
IO_STATUS_BLOCK IoStatusBlock; // [sp+8h] [bp-Ch]@1
Len_v2 = pWriteFileBufferInfo_a1->Length;
pBuffer_v3 = pWriteFileBufferInfo_a1->pBuffer;
return ZwWriteFile(FileHandle, 0, 0, 0, &IoStatusBlock, pBuffer_v3, Len_v2, &ByteOffset, 0);
}
int xx_WriteFile_220F0(int a1, int a2, int a3)
{
PVOID pFuncClassPoint_v3; // esi@1
NTSTATUS result; // eax@1
pFuncClassPoint_v3 = xx_GetFunctionClassPoint_22FF0();
result = STATUS_UNSUCCESSFUL;
if ( a1 && pFuncClassPoint_v3 && a3 )
{
result = (*(NTSTATUS (__stdcall **)(char *, int, NTSTATUS (__stdcall *)(int, HANDLE), int))pFuncClassPoint_v3)(
(char *)pFuncClassPoint_v3 + 0x40,
a1,
(NTSTATUS (__stdcall *)(int,HANDLE))xx_ZwWriteFile_220B0,
a2);
if ( result >= 0 )
{
result = (*(int (__stdcall **)(DWORD, DWORD, char *))((int (__stdcall **)(DWORD, DWORD, DWORD))pFuncClassPoint_v3
+ 8))(
*((DWORD *)pFuncClassPoint_v3 + 0x10),
*((DWORD *)pFuncClassPoint_v3 + 17),
(char *)pFuncClassPoint_v3 + 40);
*(PVOID *)a3 = pFuncClassPoint_v3;
}
}
return result;
}
NTSTATUS xx_CreateFile_22030(PUNICODE_STRING pFileName_a1, PHANDLE pFileHandle_a2)
{
NTSTATUS result; // eax@3
HANDLE FileHandle; // [sp+4h] [bp-28h]@1
IO_STATUS_BLOCK IoStatusBlock; // [sp+8h] [bp-24h]@3
OBJECT_ATTRIBUTES ObjectAttributes; // [sp+10h] [bp-1Ch]@3
FileHandle = 0;
if ( pFileName_a1 && pFileHandle_a2 )
{
*(HANDLE *)pFileHandle_a2 = NULL;
InitializeObjectAttributes(&ObjectAttributes, pFileName_a1, 576, 0, 0);
result = ZwCreateFile(&FileHandle, 4u, &ObjectAttributes, &IoStatusBlock, 0, 0x80u, 3u, 5u, 0, 0, 0);
if ( result >= 0 )
{
*(HANDLE *)pFileHandle_a2 = FileHandle;
}
}
else
{
result = 0xC000000D;
}
return result;
}
unsigned int xx_WriteLog_22140(const WCHAR *pwstrFileName_a1)
{
const WCHAR *wstrFileName_v1; // esi@1
PTsFlt_PNPAGED_LOOKASIDE_LIST pBuffer_v2; // eax@2
NTSTATUS status_v5 = STATUS_UNSUCCESSFUL; // eax@4
HANDLE handle_v6 = NULL; // esi@4
int v9; // [sp+14h] [bp-Ch]@1
LSA_UNICODE_STRING DestinationString; // [sp+18h] [bp-8h]@4
wstrFileName_v1 = pwstrFileName_a1;
v9 = 0;
if ( !pwstrFileName_a1 )
return STATUS_INVALID_PARAMETER;
pBuffer_v2 = (PTsFlt_PNPAGED_LOOKASIDE_LIST)ExAllocatePoolWithTag(NonPagedPool, 0x68u, 'KLog');
if ( pBuffer_v2 )
{
memset(pBuffer_v2, 0, 0x68u);
RtlInitUnicodeString(&DestinationString, wstrFileName_v1);
status_v5 = xx_CreateFile_22030(&DestinationString, &handle_v6);
if ( status_v5 >= 0 )
{
status_v5 = xx_WriteFile_220F0((int)&DestinationString, (int)handle_v6, (int)&v9);
if ( status_v5 >= 0 )
{
ExInitializeNPagedLookasideList((PNPAGED_LOOKASIDE_LIST)(pBuffer_v2 + 24), 0, 0, 0, 0x200u, 'KLOG', 0);
*(DWORD *)(pBuffer_v2 + 4) = v9;
*(DWORD *)pBuffer_v2 = (DWORD)handle_v6;
g_pTsFltPnpagedLoolasideList_28180 = pBuffer_v2;
return status_v5;
}
}
if ( handle_v6 )
ZwClose(handle_v6);
if ( status_v5 >= 0 )
return status_v5;
}
else
{
status_v5 = STATUS_NO_MEMORY;
}
if ( pBuffer_v2 )
ExFreePoolWithTag((PVOID)pBuffer_v2, 'Klog');
return status_v5;
}
void xx_WriteTsDbgLog_112A0(char a1, PVOID P)
{
int nRet = 4;
char strBuf_v3[260];
memset(strBuf_v3, 0, sizeof(strBuf_v3) - 1);
if ( (xx_QueryValueKey_10E70(
L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Services\\TsFltMgr",
L"TsDbgLog",
&strBuf_v3,
sizeof(strBuf_v3),
(int)&nRet) & 0x80000000) == 0
&& nRet == 1
&& xx_InitializeResourceLite_223F0() >= 0 )
{
xx_WriteLog_22140((const WCHAR *)&strBuf_v3);
//xx_DbgPrint_22270(g_pTsFltPnpagedLoolasideList_28180, (int)"TS TsFltMgr DbgHelper", a1);
}
if (P)
{
ExFreePool(P);
}
}
void DriverReinitializationRoutine(struct _DRIVER_OBJECT *DriverObject, PVOID Context, ULONG Count)
{
PWORK_QUEUE_ITEM pWorkQueueItem = NULL; // eax@2
if ( !g_pTsFltPnpagedLoolasideList_28180)
{
pWorkQueueItem = (PWORK_QUEUE_ITEM)ExAllocatePoolWithTag(NonPagedPool, sizeof(WORK_QUEUE_ITEM), 'TSFL');
if ( pWorkQueueItem )
{
ExInitializeWorkItem(pWorkQueueItem, (PWORKER_THREAD_ROUTINE)xx_WriteTsDbgLog_112A0, pWorkQueueItem);
ExQueueWorkItem((PWORK_QUEUE_ITEM)pWorkQueueItem, (WORK_QUEUE_TYPE)0);
}
}
}
NTSTATUS xx_wGetStrLen_233A4(PWCHAR wstrDes_a1, int nDesMaxLen_a2, int* pRealLen_a3)
{
int wDesLen_v3;
NTSTATUS result;
PWCHAR wstr_v5;
wstr_v5 = wstrDes_a1;
wDesLen_v3 = nDesMaxLen_a2;
result = STATUS_SUCCESS;
if ( !nDesMaxLen_a2 )
{
return STATUS_INVALID_PARAMETER;
}
while (*wstr_v5 && wDesLen_v3--)
{
wstr_v5++;
}
if ( wDesLen_v3 && pRealLen_a3 )
{
*(int *)pRealLen_a3 = nDesMaxLen_a2 - wDesLen_v3;
}
else
{
result = STATUS_INVALID_PARAMETER;
}
return result;
}
NTSTATUS __stdcall xx_StrCpy_232DC(PUCHAR pret_a1, int len_a2, PUCHAR pName_a3)
{
NTSTATUS result; // eax@1
PUCHAR pRetBuffer_v4; // edx@3
PUCHAR pInputBuffer_v5; // esi@3
result = 0;
if ( len_a2 )
{
pRetBuffer_v4 = pret_a1;
pInputBuffer_v5 = pName_a3;
while ( *pInputBuffer_v5 && len_a2--)
{
*pRetBuffer_v4++ = *pInputBuffer_v5++;
}
if ( !len_a2 )
{
--pRetBuffer_v4;
result = 0x80000005;
}
*pRetBuffer_v4 = 0;
}
else
{
result = 0xC000000D;
}
return result;
}
NTSTATUS __stdcall xx_StrCpy_233DA(PUCHAR str_a1, int len_a2, PUCHAR pName_a3)
{
NTSTATUS result; // eax@2
if ( len_a2 <= 0x7FFFFFFF )
result = xx_StrCpy_232DC(str_a1, len_a2, pName_a3);
else
result = 0xC000000D;
return result;
}
NTSTATUS xx_wStrCat_23318(PWCHAR wstrDes_a1, int nDesMaxLen_a2, PWCHAR wstrSrc_a3)
{
NTSTATUS result; // eax@1
PWCHAR wstrDes_v4; // edx@3
PWCHAR wstrSrc_v5; // esi@3
result = STATUS_SUCCESS;
if ( nDesMaxLen_a2 )
{
wstrDes_v4 = wstrDes_a1;
wstrSrc_v5 = wstrSrc_a3;
while ( *wstrSrc_v5 && nDesMaxLen_a2--)
{
*wstrDes_v4++ = *wstrSrc_v5++;
}
//假如空间不够
if ( !nDesMaxLen_a2 )
{
wstrDes_v4--;
result = 0x80000005;
}
*wstrDes_v4 = 0;
}
else
{
result = STATUS_INVALID_PARAMETER;
}
return result;
}
int xx_wStrCmp_2347F(PWCHAR wstrDes_a1, PWCHAR wstrSrc_a2)
{
WCHAR *wstrDes_v2; // edx@1
WCHAR *wstrSrc_v3; // esi@1
WCHAR wDes_v5; // cx@3
WCHAR wSrc_v6; // ax@5
wstrDes_v2 = wstrDes_a1;
wstrSrc_v3 = wstrSrc_a2;
do
{
wDes_v5 = *wstrDes_v2 + 32;
if ( *wstrDes_v2 < 0x41u || *wstrDes_v2 > 0x5Au)
{
wDes_v5 = *wstrDes_v2;
}
wSrc_v6 = *wstrSrc_v3 + 32;
if ( *wstrSrc_v3 < 0x41u || *wstrSrc_v3 > 0x5Au )
{
wSrc_v6 = *wstrSrc_v3;
}
++wstrDes_v2;
++wstrSrc_v3;
}
while ( wDes_v5 && wDes_v5 == wSrc_v6 );
return wDes_v5 - wSrc_v6;
}
NTSTATUS xx_MyWStrCat_23436(PWCHAR wstrDes_a1, int wDesMaxLen_a2, PWCHAR wstrSrc_a3)
{
int Len_v3; // esi@1
unsigned int result; // eax@1
Len_v3 = wDesMaxLen_a2;
result = xx_wGetStrLen_233A4(wstrDes_a1, wDesMaxLen_a2, &wDesMaxLen_a2);
if ( (result & 0x80000000) == 0 )
{
result = xx_wStrCat_23318(&wstrDes_a1[wDesMaxLen_a2], Len_v3 - wDesMaxLen_a2, wstrSrc_a3);
}
return result;
}
NTSTATUS xx_MyWStrCat_23468(PWCHAR wstrDes_a1, unsigned int nDesMaxLen_a2, PWCHAR wstrSrc_a3)
{
NTSTATUS result = STATUS_INVALID_PARAMETER;
if ( nDesMaxLen_a2 <= 0x7FFFFFFF )
{
result = xx_MyWStrCat_23436(wstrDes_a1, nDesMaxLen_a2, wstrSrc_a3);
}
return result;
}
BOOLEAN xx_InitTsFltMgrRegistry_10540()
{
BOOLEAN isSuccess_v0 = FALSE;
ULONG Data = 0;
HANDLE KeyHandle = NULL;
UNICODE_STRING DestinationString;
WCHAR SourceString[260] = {0};
memcpy(&SourceString,
L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Services\\TsFltMgr",
wcslen(L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Services\\TsFltMgr")*sizeof(WCHAR));
xx_MyWStrCat_23468(SourceString, sizeof(SourceString), L"\\");
xx_MyWStrCat_23468(SourceString, sizeof(SourceString), L"TsFltInfo");
if ( (xx_QueryValueKey_10E70(SourceString, L"IsBsod", &Data, sizeof(Data), 0) & 0x80000000) == STATUS_SUCCESS )
{
if ( Data )
{
isSuccess_v0 = TRUE;
if ( xx_OpenKeyTsFltMgr_10D80(&KeyHandle) >= 0 )
{
RtlInitUnicodeString(&DestinationString, L"IsBsod");
Data = 1;
ZwSetValueKey(KeyHandle, &DestinationString, 0, 4u, &Data, 4u);
ZwClose(KeyHandle);
}
}