
Originally Posted by
MW2TopTenWORLD
I actually fixed it... but now I have another problem...
Code:
#include <iostream>
#include <windows.h>
#include <string>
#include <cstdio>
using namespace std;
int main()
{
system("color 0A");
cout << "Call of Duty : Modern Warfare 2 Steam Tool - Made by MW2TopTenWORLD!\n" << endl;
cout << "Research made for Steam version of the game \"1.2.208\"\n" << endl;
cout << "Research by : MW2TopTenWORLD\n" << endl;
cout << "There will be no updates to this program! This will only be a stats tool!!\n" << endl;
LPCWSTR ProcessName222 = L"Modern Warfare 2";
HWND hwnd = FindWindow(0, ProcessName222);
if (hwnd == 0)
{
cout << "Call of Duty : Modern Warfare 2 was NOT Found!! Make sure the game is opened before opening this tool...\nThe tool will exit so you can Open the game...";
std::getchar();
}
else
{
DWORD process_ID;
GetWindowThreadProcessId(hwnd, &process_ID);
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, process_ID);
cout << "Call of Duty : Modern Warfare 2 Was FOUND!... Welcome to my tool..." << endl;
system("Pause");
int Option;
cout << "Pick what you want to mod...\nType 1 for XP\nType 2 for Score\nType 3 for Wins\nType 4 for Losses\nType 5 for Ties\nType 6 for Win Streak\nType 7 for Kills\nType 8 for Headshots\nType 9 for Assists\nType 10 for Killstreak\nType 11 for Deaths\nType 12 for Prestige\nType 13 for INSANE STATS!\n";
cout << "Type what you want : ";
cin >> Option;
cin.ignore();
if (Option > 13)
{
cout << "There is no option higher than 13.... Dumbass!" << endl;
}
else
{
if (Option == 1){
cout << "What do you want to set your XP as?" << endl;
cout << "Type what XP you want : ";
int XP;
cin >> XP;
cin.ignore();
DWORD newdatasize = sizeof(XP);
if (WriteProcessMemory(hProcess, (LPVOID)0x01B2C89C, &XP, newdatasize, NULL))
{
cout << "The XP Has been sucessfully written as : " + XP << endl;
}
else
{
cout << "An error has ocurred and the XP could not be written!!" << endl;
}
CloseHandle(hProcess);
}
}
cin.get();
}
return 0;
}
HANDLE WINAPI GetCurrentProcess(void);
DWORD WINAPI GetCurrentProcessId(void);
BOOL WINAPI WriteProcessMemory(
_In_ HANDLE hProcess,
_In_ LPVOID lpBaseAddress,
_In_ LPCVOID lpBuffer,
_In_ SIZE_T nSize,
_Out_ SIZE_T *lpNumberOfBytesWritten
);
HANDLE WINAPI OpenProcess(
_In_ DWORD dwDesiredAccess,
_In_ BOOL bInheritHandle,
_In_ DWORD dwProcessId
);
BOOL IsProcessRunning(DWORD pid)
{
HANDLE process = OpenProcess(SYNCHRONIZE, FALSE, pid);
DWORD ret = WaitForSingleObject(process, 0);
CloseHandle(process);
return ret == WAIT_TIMEOUT;
}
...I had to create LPCWSTR "variable"...
But now I have another problem.. in here "if (WriteProcessMemory(hProcess, (LPVOID)0x01B2C89C, &XP, newdatasize, NULL))
{
cout << "The XP Has been sucessfully written as : " + XP << endl;
}
else
{
cout << "An error has ocurred and the XP could not be written!!" << endl;
}"
The messages (cout´s) aren´t appearing.. the XP Changes but none a error or success message appears...
Also it was more of a distraction other than a "lack" of programming experience, because I think i am experienced enough to know that strings need quotes (irony because everyone knows that)
btw it is not an error its a "bug" when running the app the messages dont appear
btw, "That didn´t fixed it...." doesn't tell me s***.
(and you *don't* have to create the lpcwstring variable ..you could just pass in the string literal L"your_title_here")
edit: it's corrupting the stack somehow
it's something to do w/ how you define the OpenProcess() and WriteProcessMemory() functions below int main()...
I don't understand why you're re-declaring them..you're including Windows.h, which has them.
Something is un-balancing the stack, ie. your function expects parameters to be a certain size, and you call the function passing in a different size.
If they're supposed to be prototypes, why aren't they above int main() ? Commenting out the declarations for OpenProcess() and WriteProcessMemory() compiles / no bugs / shows the cout's correctly. I think it has something to do w/ the difference between the WriteProcessMemory()
nSize parameter being DWORD vs. SIZE_T? I think the compiler will automatically side/up-cast the dword parameter to a size_t, but not sure - Apparently not. (?) Oddly enough, after I got it working, I uncommented the 2 function declarations and it still works. I modified your code as little as possible to make it work w/ 'calculator'
Code:
#include <iostream>
#include <Windows.h>
#include <string>
#include <cstdio>
using namespace std;
int main()
{
system("color 0A");
LPCWSTR ProcessName222 = L"Calculator";
HWND hwnd = FindWindowW(0, ProcessName222);
if (hwnd == 0)
{
cout << "Call of Duty : Modern Warfare 2 was NOT Found!! Make sure the game is opened before opening this tool...\nThe tool will exit so you can Open the game...";
std::getchar();
}
else
{
DWORD process_ID;
GetWindowThreadProcessId(hwnd, &process_ID);
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, process_ID);
cout << ProcessName222 << " FOUND!... Welcome to my tool..." << endl;
system("Pause");
int Option;
cout << "Pick what you want to mod...\nType 1 for XP\nType 2 for Score\nType 3 for Wins\nType 4 for Losses\nType 5 for Ties\nType 6 for Win Streak\nType 7 for Kills\nType 8 for Headshots\nType 9 for Assists\nType 10 for Killstreak\nType 11 for Deaths\nType 12 for Prestige\nType 13 for INSANE STATS!\n";
cout << "Type what you want : ";
cin >> Option;
cin.ignore();
if (Option > 13)
{
cout << "There is no option higher than 13.... Dumbass!" << endl;
}
else
{
if (Option == 1){
cout << "What do you want to set your XP at?" << endl;
cout << "Type what XP you want : ";
int XP;
cin >> XP;
cin.ignore();
DWORD newdatasize = sizeof(XP);
cout <<"About to call WPM()...\n\n" << endl;
cout <<"sizeof(SIZE_T) = " << sizeof(SIZE_T) << "\n";
cout <<"sizeof(void*) = " << sizeof(void*) << "\n";
cout <<"sizeof(DWORD) = " << sizeof(DWORD) << "\n";
cout <<"sizeof(XP-int) = " << sizeof(XP) << "\n" << endl;
if (WriteProcessMemory(hProcess, (LPVOID)0x004D815C, &XP, newdatasize, NULL))
{
cout << "The XP Has been sucessfully written as : " << XP << endl;
}
else
{
cout << "An error has ocurred and the XP could not be written!!" << endl;
}
CloseHandle(hProcess);
}
}
cin.get();
}
return 0;
}
HANDLE WINAPI GetCurrentProcess(void);
DWORD WINAPI GetCurrentProcessId(void);
BOOL WINAPI WriteProcessMemory(
_In_ HANDLE hProcess,
_In_ LPVOID lpBaseAddress,
_In_ LPCVOID lpBuffer,
_In_ SIZE_T nSize,
_Out_ SIZE_T *lpNumberOfBytesWritten
);
HANDLE WINAPI OpenProcess(
_In_ DWORD dwDesiredAccess,
_In_ BOOL bInheritHandle,
_In_ DWORD dwProcessId
);
BOOL IsProcessRunning(DWORD pid)
{
HANDLE process = OpenProcess(SYNCHRONIZE, FALSE, pid);
DWORD ret = WaitForSingleObject(process, 0);
CloseHandle(process);
return ret == WAIT_TIMEOUT;
}
-I'd erase the function declarations and let Windows.h take care of it. After erasing them and re-compiling I get this
32bit/64bit
