Memory Reader/Writer

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Ok, Semaphore und POSH sind nicht die Sachen die ich meinte.

    Nur damit es vielleicht nochmal deutlich wird: Ich meine wirklichen den Speicher eines Programmes, der Ausgelesen werden soll.

    Und hier das C++ Beispiel, die Namen der Funktionen sagen über ihre Funktion aus denke ich mal.

    Quellcode

    1. #include <iostream.h>
    2. #include <windows.h>
    3. #include <conio.h>
    4. using namespace std;
    5. int memValFromTitle(char* title, void* address){
    6. int timeout = 3000;
    7. int time = 0;
    8. // find window
    9. HWND wnd = NULL;
    10. while(wnd == NULL){
    11. wnd = FindWindow(NULL, title);
    12. Sleep(100);
    13. time = time + 100;
    14. if(time >= timeout)
    15. break;
    16. }
    17. if(wnd == NULL)
    18. return 0;
    19. // get pid
    20. DWORD pid = NULL;
    21. GetWindowThreadProcessId(wnd, &pid);
    22. if(pid == NULL)
    23. return 0;
    24. // open handler
    25. HANDLE proc = NULL;
    26. proc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
    27. if(proc == NULL)
    28. return 0;
    29. // get value
    30. int value = 0;
    31. DWORD buffer;
    32. ReadProcessMemory(proc, address, &value, sizeof(value), &buffer);
    33. // close the handle
    34. CloseHandle(proc);
    35. // return valze
    36. return value;
    37. }
    38. int memValFromPid(DWORD pid, void* address){
    39. // open handler
    40. HANDLE proc;
    41. proc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
    42. if(proc == NULL)
    43. return 0;
    44. // get value
    45. int value = 0;
    46. DWORD buffer;
    47. ReadProcessMemory(proc, address, &value, sizeof(value), &buffer);
    48. // close the handle
    49. CloseHandle(proc);
    50. // return valze
    51. return value;
    52. }
    53. int memValFromHandle(HANDLE proc, void* address){
    54. // get value
    55. int value = 0;
    56. DWORD buffer;
    57. ReadProcessMemory(proc, address, &value, sizeof(value), &buffer);
    58. // return value
    59. return value;
    60. }
    61. int main(){
    62. int memVal = memValFromTitle("Dev-C++ 4.9.9.2", (void*)0x30195);
    63. cout << memVal;
    64. getch();
    65. }
    Alles anzeigen

    Irgendwie übernimmt er nicht alle Tabs im Syntax Highlightning ...