[c++] problem with reading memory menu

User Tag List

Results 1 to 4 of 4
  1. #1
    Lucani's Avatar Member
    Reputation
    1
    Join Date
    May 2008
    Posts
    15
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [c++] problem with reading memory

    Hello!

    I want know why my program don't get right values.

    Here is my code:
    Code:
    void __fastcall TForm1::Button1Click(TObject *Sender)
    {
    	HWND hWnd;
    	DWORD processId;
    	HANDLE hProcess;
    	hWnd = FindWindow(0, "World of Warcraft");
    	if (hWnd)
        {
            GetWindowThreadProcessId(hWnd, &processId);
    	    hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, 0x680);
    	    char name[30];
    	    ReadProcessMemory(hProcess, (LPVOID)(0x763BB8), &name, 30, 0);
    
            Form1->ECharName->Text=name;
        }
        else
        {
            Form1->ECharName->Text="WoW not runned";
        }
    }
    I see right value in Cheat Engine, but when i try get it in my program I get something like that "Dß_", I also tried use many processId whitch i found in Cheat engine process and window list but it doesnt work,

    Could someone help me in this small problem ?

    [c++] problem with reading memory
  2. #2
    macintox's Avatar Member
    Reputation
    30
    Join Date
    Aug 2007
    Posts
    113
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    are you sure what you are looking for is stored in 30 sizeof(char) ? if your trying to seek a float or int make a temp float or int var, and size 4 for exemple

  3. #3
    Lucani's Avatar Member
    Reputation
    1
    Join Date
    May 2008
    Posts
    15
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm sure thats right address and type, of course in my source was little mistake, it should be:
    Code:
    hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, processId);
    But it still doesn't work, I downloaded Delphi source, reading memory is very similar - I use same address and type and in Delphi I got right values, but in this downloaded source there are many lines which I don't understand

    in my code , to get wow process id, i only use this:

    Code:
    hWnd = FindWindow(0, "World of Warcraft");
    GetWindowThreadProcessId(hWnd, &processId);
    the problem is also with reading another things from wow memory,

    could someone gimme mini example code how to do it in right way?

  4. #4
    Xarg0's Avatar Member
    Reputation
    61
    Join Date
    Jan 2008
    Posts
    389
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, your ReadProccessMemory call is wrong, a char array with 30 members isn't 30 bytes long, it's 4*30 bytes long, since a char is like a int a 4byte sized variable type (chars are integer), I'd recommend you to youse the sizeof() function instead of a fixed byte value:
    MemoryReadProcess(hProcess, (LPVOID) Adress, &name, sizeof(name[30]),0);
    that should do the trick.

    Edit: wupps forgott that your name var is a cahr array, sizeof(name) would've returned 4 bytes ^^, since the name of char array is it's entry point adress :-)
    Last edited by Xarg0; 05-08-2008 at 03:49 AM.
    I hacked 127.0.0.1

Similar Threads

  1. [AutoIt] Help with reading memory
    By naiki94 in forum Programming
    Replies: 2
    Last Post: 02-26-2014, 06:11 PM
  2. [help] small problem with my memory scanner
    By anon145236 in forum WoW Memory Editing
    Replies: 11
    Last Post: 11-28-2011, 07:24 PM
  3. [C#]Need help with some memory reading
    By jazerix in forum Programming
    Replies: 1
    Last Post: 10-29-2010, 09:49 AM
  4. [Autoit] Problem with Memory reading for looting *resolved*
    By spudstar99 in forum WoW Memory Editing
    Replies: 4
    Last Post: 05-15-2009, 10:26 PM
All times are GMT -5. The time now is 05:47 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search