huhu, ich hab ein Problem den Process Handle von Diablo II zu bekommen.
und zwar wird dann in der Konsole bei HANDLE : 0 ausgegeben und der Speicherwert kann auch nicht ausgelesen werden.
Wenn ich das ganze jedoch bei Minesweeper mache klappt es Problemlos wieso ? :(
Code:
#include <cstdlib>
#include <iostream>
#include <windows.h>
using namespace std;
int main(int argc, char *argv[])
{
HWND Diablo = FindWindow("Diablo II", NULL);
DWORD process_ID;
DWORD thread_ID = GetWindowThreadProcessId(Diablo, &process_ID);
HANDLE process = OpenProcess(STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xFFF, FALSE, process_ID);
//SPEICHERABFRAGE//
unsigned int wert(0);
unsigned int adress(0x01CBFC3D);
ReadProcessMemory(process,
reinterpret_cast<void *> (adress),
&wert,
sizeof(wert),
NULL);
if(ReadProcessMemory(process,
reinterpret_cast<void *> (adress),
&wert,
sizeof(wert),
NULL)){
cout<<"Success";}
else{
cout<<"Fehlercode"<<endl;
cout<<GetLastError()<<endl;
}
///AUSGABE////
if (Diablo){
cout<<"\n";
cout<<"\n";
cout<<"HWND"<<endl;
cout<<Diablo<<endl;
cout<<"\n";
cout<<"HANDLE"<<endl;
cout<<process<<endl;
cout<<"\n";
cout<<"&wert"<<endl;
cout<<&wert<<endl;
cout<<"\n";
cout<<"wert"<<endl;
cout<<wert<<endl;
}
else if(!Diablo)
{
cout<<"Programm nicht aktiv"<<endl;
}
system("PAUSE");
return EXIT_SUCCESS;
}
Wenn ich das ganze jedoch bei Minesweeper mache klappt es Problemlos wieso ? :(