-
Автор темы
- #1
C++:
#include <Windows.h>
#include <iostream>
using namespace std;
int main() {
setlocale(0, "Rus");
DWORD pid = 0;
cout << "PID: ";
cin >> dec >> pid;
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
if (hProcess == NULL) {
cout << "Ошибка открытия процесса. GetLastError = " << dec << GetLastError() << endl;
system("pause");
return EXIT_FAILURE;
}
uintptr_t memoryAddress = 0x0;
cout << "Введите адресс памяти : 0x";
cin >> hex >> memoryAddress;
int intToWrite = 0;
cout << "Введите желаемое число : ";
cin >> dec >> intToWrite;
BOOL wpmReturn = WriteProcessMemory(hProcess, (LPVOID)memoryAddress, &intToWrite, sizeof(int), NULL);
if (wpmReturn == FALSE) {
cout << "Ошибка записи в память. GetLastError = " << dec << GetLastError() << endl;
system("pause");
return EXIT_FAILURE;
}
cout << "Успешно!" << endl;
cout << "Press ENTER to quit." << endl;
system("pause > nul");
return EXIT_SUCCESS;
}