Results 1 to 1 of 1
  1. #1
    Dragonion's Avatar
    Join Date
    Sep 2008
    Posts
    1
    Reputation
    10
    Thanks
    0

    Write/ReadProcessMemory errors

    Edit: I managed to solve the writing. It seems like the error was the casting of the value with (LPCVOID), instead I changed the value to a const int and pointed to it.
    [php]
    const int EngineUpgrade_Value = 0x6;
    WriteProcessMemory(ProcessHandle,(void*)EngineUpgr ade_Addr,&EngineUpgrade_Value,EngineUpgrade_Size,& EngineUpgrade_Sent);[/php]

    The read still doesn't work, and not only that, it also stops the writing from working. I'll try to figure that one as well.




    I tried to hack an old game called Jets'n'Guns for practice (I'm really really new to hacking, just started looking at forums and stuff two days ago), and I got two errors.

    For the Read, I got error 5: Access is denied.
    And for writing error 299: Only part of a ReadProcessMemory or WriteProcessMemory request was completed.

    When I did it with Cheat Engine it worked just fine, but then again, I have no idea how Cheat Engine works.
    Here is my code
    [php]
    #include <Windows.h>
    #include <iostream>
    using namespace std;

    #define EngineUpgrade_Addr 0x03894F44

    #define EngineUpgrade_Value 6

    const SIZE_T EngineUpgrade_Size = sizeof(EngineUpgrade_Value);

    SIZE_T EngineUpgrade_Sent = 0;

    bool JetsnGuns()
    {
    HWND WindowHandle;
    DWORD ProcessId;
    HANDLE ProcessHandle;

    if(!(WindowHandle = FindWindow(NULL,"Jets'n'Guns ver. 1.212 gold")))
    cout<<"Jets'n'Guns couldn't be accessed (Did you start the game?)."<<endl;

    while(!WindowHandle)
    {
    Sleep(200);
    WindowHandle = FindWindow(NULL,"Jets'n'Guns ver. 1.212 gold");
    }
    GetWindowThreadProcessId(WindowHandle,&ProcessId);
    ProcessHandle = OpenProcess(PROCESS_VM_WRITE | PROCESS_VM_OPERATION,FALSE,ProcessId);

    cout<<"Jets'n'Guns located. Starting to hack now."<<endl;

    // this part tries to read from the address
    LPVOID upgradelevel;
    SIZE_T bytesgot;
    if(!ReadProcessMemory(ProcessHandle ,(void*)EngineUpgrade_Addr ,&upgradelevel ,4 ,&bytesgot))
    printf("Getting upgrade info... n");
    printf("Level: %i",upgradelevel);
    printf("nBytes got: %i",bytesgot);

    printf("nError: %i",GetLastError());

    // this part tries to write to the address
    while(1)
    {
    WriteProcessMemory(ProcessHandle ,(void*)EngineUpgrade_Addr ,(LPCVOID)EngineUpgrade_Value ,EngineUpgrade_Size ,&EngineUpgrade_Sent);
    Sleep(100);
    printf("nError: %i",GetLastError());
    }

    return true;
    }
    [/php]

    I will also be very glad if someone will point me to some DMA hacking tutorials, because the only one I found was this and I really didn't get what I'm supposed to do in C++.

    Thanks in advance.
    Last edited by Dragonion; 09-23-2008 at 01:01 PM.

Similar Threads

  1. Help with AlterIW mod loading write error
    By jeffadkins51 in forum Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    Replies: 3
    Last Post: 11-07-2010, 04:21 AM
  2. compile error :/ from [Writing your own C++ Trainer]
    By FantaBrause in forum C++/C Programming
    Replies: 7
    Last Post: 07-06-2009, 11:09 PM
  3. Hellbreath Int Error?
    By RebornAce in forum General
    Replies: 10
    Last Post: 03-06-2009, 09:04 PM
  4. Actually writing hacks.
    By shercipher in forum Programming
    Replies: 22
    Last Post: 03-20-2006, 04:31 AM

Tags for this Thread