#include <string>
#include <stdio.h>
#include <windows.h>
#include <iostream>
using namespace std;
BOOL WriteProcessBytes(HANDLE hProcess, DWORD destAddress, LPVOID patch, DWORD numBytes)
{
DWORD oldProtect = 0; // Old protection on page we are writing to
DWORD bytesRet = 0; // # of bytes written
BOOL status = TRUE; // Status of the function
// Change page protection so we can write executable code
if(!VirtualProtectEx(hProcess, UlongToPtr(destAddress), numBytes, PAGE_EXECUTE_READWRITE, &oldProtect))
return FALSE;
// Write out the data
if(!WriteProcessMemory(hProcess, UlongToPtr(destAddress), patch, numBytes, &bytesRet))
status = FALSE;
// Compare written bytes to the size of the patch
if(bytesRet != numBytes)
status = FALSE;
// Restore the old page protection
if(!VirtualProtectEx(hProcess, UlongToPtr(destAddress), numBytes, oldProtect, &oldProtect))
status = FALSE;
// Make sure changes are made!
if(!FlushInstructionCache(hProcess, UlongToPtr(destAddress), numBytes))
status = FALSE;
// Return the final status, note once we set page protection, we don't want to prematurely return
return status;
}
std::string GetPath()
{
char path[2048] = {0};
GetModuleFileName(0, path, sizeof(path));
for(int x = sizeof(path); x > 1; --x)
{
if(path[x] == '\\')
{
memset(path + x, 0, sizeof(path) - x);
break;
}
}
return std::string(path);
}
int main(int argc, char* argv[])
{
SetConsoleTitle("ProjectHax.com");
std::cout << "SSE v2.6 Loader - ProjectHax.com" << std::endl;
std::string ssepath = GetPath() + "\\SSE26.exe";
std::string ippath = GetPath() + "\\ip.ini";
std::wstring ippathw(ippath.length(), 0);
std::copy(ippath.begin(), ippath.end(), ippathw.begin());
wchar_t line1[] = L"The code used in this program has been stolen from SREmu!\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
wchar_t line5[] = L"ProjectHax.com\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0\0\0";
wchar_t title[] = L"SSE Cracked by WeeMan\0\0";
wchar_t projecthax[] = L"ProjectHax";
wchar_t ip[64] = {0};
GetPrivateProfileStringW(L"ProjectHax", L"IP", 0, ip, 60, ippathw.c_str());
if(wcslen(ip) == 0)
{
std::cout << "World IP: ";
wcin >> ip;
WritePrivateProfileStringW(L"ProjectHax", L"IP", ip, ippathw.c_str());
}
else if(wcslen(ip) > 11)
{
std::cout << "Sorry, the IP length must be less than 12" << std::endl;
std::cout << "Press enter to continue . . . ";
std::cin.get();
}
STARTUPINFO sInfo = {0};
PROCESS_INFORMATION pInfo = {0};
if(!CreateProcess(0, (char*)ssepath.c_str(), NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, NULL, &sInfo, &pInfo))
{
std::cout << "Failed to start SSE" << std::endl;
}
else
{
WriteProcessBytes(pInfo.hProcess, 0x40A828, line1, sizeof(line1));
WriteProcessBytes(pInfo.hProcess, 0x40AC84, line5, sizeof(line5));
WriteProcessBytes(pInfo.hProcess, 0x40B1D0, title, sizeof(title));
WriteProcessBytes(pInfo.hProcess, 0x40B1B4, projecthax, sizeof(projecthax));
BYTE NOP[12];
memset(NOP, 0x90, 12);
WriteProcessBytes(pInfo.hProcess, 0x005FEBBE, NOP, 12);
WriteProcessBytes(pInfo.hProcess, 0x40A08C, ip, 13 * 2);
ResumeThread(pInfo.hThread);
}
std::cout << "Press enter to continue . . . ";
std::cin.get();
return 0;
}
|