Code:
#include <iostream>
#include <windows.h>
#include <string>
#include <tlhelp32.h>
#include <tchar.h>
using namespace std;
// FindWindow();
// GetWindowsThreadProcessId();
// OpenProcess();
// WriteProcessMemory();
// CloseHandle();
DWORD dwGetModuleBaseAddress(DWORD dwProcessIdentifier, TCHAR *lpszModuleName)
{
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, dwProcessIdentifier);
DWORD dwModuleBaseAddress = 0;
if(hSnapshot != INVALID_HANDLE_VALUE)
{
MODULEENTRY32 ModuleEntry32 = {0};
ModuleEntry32.dwSize = sizeof(MODULEENTRY32);
if(Module32First(hSnapshot, &ModuleEntry32))
{
do
{
if(_tcscmp(ModuleEntry32.szModule, lpszModuleName) == 0)
{
dwModuleBaseAddress = (DWORD)ModuleEntry32.modBaseAddr;
break;
}
}
while(Module32Next(hSnapshot, &ModuleEntry32));
}
CloseHandle(hSnapshot);
}
return dwModuleBaseAddress;
}
int main()
{
SetConsoleTitleA("Nickname Changer");
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY | COMMON_LVB_UNDERSCORE);
HWND hWnd = FindWindow(0, _T("Alliance of Valiant Arms"));
if(hWnd == 0)
{
cerr << "Unable to find the window" << endl;
}
else{
clog << "Found Window" << endl;
DWORD PId;
DWORD processID = GetWindowThreadProcessId(hWnd, &PId);
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, PId);
if (!hProcess){
cerr << "Unable to Open Process" << endl;
}
else{
clog << "Opened Process" << endl;
wchar_t newvalue[19];
DWORD Pointer = 0x00000000;
DWORD Pointed;
DWORD Pointed1;
DWORD Pointed2;
DWORD baseAddr = dwGetModuleBaseAddress(PId, _T("AVA.exe"));
DWORD Offset = 0x00;
DWORD Offset2 = 0x00;
wchar_t newval[19];
ReadProcessMemory(hProcess, (LPCVOID)(Pointer+baseAddr), &Pointed, sizeof(wchar_t), NULL);
ReadProcessMemory(hProcess, (LPCVOID)(Pointed+Offset), &Pointed1, sizeof(wchar_t), NULL);
ReadProcessMemory(hProcess, (LPCVOID)(Pointed1+Offset2), &Pointed2, sizeof(wchar_t), NULL);
ReadProcessMemory(hProcess, (LPCVOID)Pointed2, &newval, sizeof(wchar_t), NULL);
cout << "Your current nickname is: " << newval << endl;;
cout << "Enter the new nickname: ";
wcin >> newvalue;
int isSuccessful = WriteProcessMemory(hProcess, (LPVOID)Pointed2, &newvalue , (DWORD)sizeof(newvalue), NULL);
if(isSuccessful > 0){
clog << "Process Memory Written" << endl;
}else{
cerr << "Cannot write process memory." << endl;
}
}
}
char cls;
cout << "Wanna change the Nickname again? (y) or (n)" << endl;
cin >> cls;
while(cls){
switch(cls){
case 'y':
system("CLS");
return main();
break;
case 'n':
return 0;
break;
case 'Y':
system("CLS");
return main();
break;
case 'N':
return 0;
default:
return 0;
break;
}
}
system("PAUSE");
return main();
}
I tried to search for AVA.exe Base Address cause in CE the pointer is "AVA.exe"+00000000 as an example with offsets 00 and 00 .