Problem

SpRoXx

Member
Joined
Oct 29, 2016
Messages
23
Reaction score
1
Code:
#include <iostream>
#include <windows.h>

using namespace std;

int main()
{
	system("color 0A");
	cout << "Counter Strike Source is opened before pressing ENTER..." << endl;
	system("Pause");
	LPCWSTR Fuck = L"Counter-Strike Source";
	HWND hwnd = FindWindow(0, Fuck);
	if (hwnd == 0)
	{
		cout << "The game has not been found... please open it before opening the tool next time..." << endl;
		system("Pause");
	}
	else
	{
		DWORD process_ID;
		GetWindowThreadProcessId(hwnd, &process_ID);
		HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, process_ID);
		cout << "Counter Strike Source has been found... Enjoy the tool!" << endl;
		system("Pause");
		cout << "Type 1 for Health" << endl;
		cout << "Type : ";
		int Option;
		cin >> Option; 
		if (Option > 1)
		{
			cout << "There is no option higher than 1..." << endl;
			system("Pause");
		}
		if (Option == 1)
		{
			cout << "What do you want to set your Health as?" << endl;
			cout << "Type : ";
			int Health;
			cin >> Health;
			DWORD newdatasize = sizeof(Health);
			// 0x01B2C89C
			if (WriteProcessMemory(hProcess, (LPVOID)0x01B2C89C, &Health, newdatasize, NULL))
			{
				cout << "The Health has been written sucessfully!!" << endl;
				system("Pause");
			}
			else
			{
				cout << "There was an error writing the Health..." << endl;
				system("Pause");
			}

		}
	}
	main();
	return 0;
}

[font=Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif]https://s27.postimg.org/d005tf2wj/Untitled.png[/font]
Untitled.png



Please don't ignore this topic xd i really need ur help, It says "There was an error writing the Health..." Idk why i did all good, it's copied but usually i make like this code.
 
Joined
Feb 18, 2005
Messages
2,963
Reaction score
267
If WriteProcMemory fails, calling GetLastError and checking the error code might indicate why.
 

SpRoXx

Member
Joined
Oct 29, 2016
Messages
23
Reaction score
1
springfield said:
If WriteProcMemory fails, calling GetLastError  and checking the error code might indicate why.

It gives me a warning, "C4717 'main': recursive on all control paths, function will cause runtime stack overflow , What is that? i tried to fix the problem but ...
 
Top