1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
#include <winsock2.h>
#include <iostream>
#include <sstream>
#include <tchar.h>
#include <TlHelp32.h>
bool GetPid(const TCHAR* targetProcess, DWORD* procID){
HANDLE snap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if(snap && snap != INVALID_HANDLE_VALUE){
PROCESSENTRY32 pe;
pe.dwSize = sizeof(pe);
if(Process32First(snap, &pe)){
do{
if(!_tcsicmp(pe.szExeFile, targetProcess)){
CloseHandle(snap);
*procID = pe.th32ProcessID;
return true;
}
}
while (Process32Next(snap, &pe));
}
}
return false;
}
using namespace std;
int main(int Execution, char * Variables[]){
const char * nom_application = "Notepad.exe";
HANDLE Processus = 0;
DWORD ProcessusID = 0;
GetPid(_T(nom_application), &ProcessusID);
Processus = OpenProcess(PROCESS_ALL_ACCESS, 0, ProcessusID);
int Adresse;
int Parametre;
int ParametreAdresse;
int ValeurAdresse;
Adresse = 2;
Parametre = 2;
UINT_PTR UINTCreationByteMemoire = 0x28D8FAC0000 + Adresse;
ReadProcessMemory(Processus, (LPCVOID)UINTCreationByteMemoire, &ParametreAdresse, 1, NULL);
cout << ParametreAdresse << endl;
system("pause");
return 0;
} |
Partager