- #include <iostream>
- #include <windows.h>
-
- #pragma comment(lib, "ws2_32.lib")
- using namespace std;
-
- int main()
- {
- cout<<"\nReadProcessMemory\n\n\n";
-
- STARTUPINFO StartupInfo; //Structure STARTUPINFO
- memset(&StartupInfo, 0, sizeof(StartupInfo)); //On complète StartupInfo de 0
-
- PROCESS_INFORMATION ProcessInfo; //Structure PROCESS_INFORMATION
- memset(&ProcessInfo, 0, sizeof(ProcessInfo));
-
- char memread[100];
- char *cmdline;
-
- int offset = 0x400000; //On prend un offset de départ
-
- cmdline = GetCommandLine();
- cout<<"Command Line : \n"<<cmdline<<"\n\n\n"; //Pour comprendre vous même l'utilitée de GetCommandLine()
-
- CreateProcess("programme.exe", cmdline, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &StartupInfo, &ProcessInfo); //On démarre le processus, notre programme
- cout<<"\n\nMemory Read : \n";
- while(ReadProcessMemory(ProcessInfo.hProcess, (LPVOID) offset, memread, 1, NULL)) //On lit son conten
- {
-
- printf("%d", memread[0]);
- offset ++; //On incrémente l'offset
- if(memread[0] == 0x0) //On remplace les 0 par des 1, aucune utilitée, c'est juste pour l'exemple
- {
- WriteProcessMemory(ProcessInfo.hProcess, (LPVOID) offset, "0x1", 1, NULL);
-
- }
- }
-
- CloseHandle(ProcessInfo.hProcess);
- CloseHandle(ProcessInfo.hThread);
-
- system("pause");
- return 0;
- }
#include <iostream>
#include <windows.h>
#pragma comment(lib, "ws2_32.lib")
using namespace std;
int main()
{
cout<<"\nReadProcessMemory\n\n\n";
STARTUPINFO StartupInfo; //Structure STARTUPINFO
memset(&StartupInfo, 0, sizeof(StartupInfo)); //On complète StartupInfo de 0
PROCESS_INFORMATION ProcessInfo; //Structure PROCESS_INFORMATION
memset(&ProcessInfo, 0, sizeof(ProcessInfo));
char memread[100];
char *cmdline;
int offset = 0x400000; //On prend un offset de départ
cmdline = GetCommandLine();
cout<<"Command Line : \n"<<cmdline<<"\n\n\n"; //Pour comprendre vous même l'utilitée de GetCommandLine()
CreateProcess("programme.exe", cmdline, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &StartupInfo, &ProcessInfo); //On démarre le processus, notre programme
cout<<"\n\nMemory Read : \n";
while(ReadProcessMemory(ProcessInfo.hProcess, (LPVOID) offset, memread, 1, NULL)) //On lit son conten
{
printf("%d", memread[0]);
offset ++; //On incrémente l'offset
if(memread[0] == 0x0) //On remplace les 0 par des 1, aucune utilitée, c'est juste pour l'exemple
{
WriteProcessMemory(ProcessInfo.hProcess, (LPVOID) offset, "0x1", 1, NULL);
}
}
CloseHandle(ProcessInfo.hProcess);
CloseHandle(ProcessInfo.hThread);
system("pause");
return 0;
}