C++ ReadProcessMemory problem menu

Shout-Out

User Tag List

Results 1 to 13 of 13
  1. #1
    0_00_0's Avatar Member
    Reputation
    1
    Join Date
    Jun 2007
    Posts
    39
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    C++ ReadProcessMemory problem

    So I tried to read the static memory address for player X address in C++ and it didnt work. I have cheat engine open with the same memory address being viewed with the correct X location.

    The current output is just 2. always 2. Im running vista and there is always problems with my permissions. I thought OpenProcess as ACCESS_ALL and running as administrator would do the trick but I guess not.

    heres my code
    Code:
    #include <cstdlib>
    #include <iostream>
    #include <Windows.h>
    
    //memory addresses
    DWORD PLAYER_X = 0x012E1B7C;
    
    int main(int argc, char *argv[])
    {
        long x;
        unsigned long pID;
        
        HWND hWnd = FindWindow(NULL, "World of Warcraft");
        GetWindowThreadProcessId(hWnd, &pID); 
        HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pID); 
        
        ReadProcessMemory(hProcess, (LPVOID) PLAYER_X, &x, sizeof(x), NULL); 
        
        std::cout<< x << "\n";
        
        system("PAUSE");
        return EXIT_SUCCESS;
    }

    C++ ReadProcessMemory problem
  2. #2
    Apoc's Avatar Angry Penguin
    Reputation
    1388
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PLAYER_X is a float. Not a long.

  3. #3
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow... I'm amazed you were able to fit so many mistakes and poor programming practices in such a small snippet of code.

  4. #4
    0_00_0's Avatar Member
    Reputation
    1
    Join Date
    Jun 2007
    Posts
    39
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Cypher View Post
    Wow... I'm amazed you were able to fit so many mistakes and poor programming practices in such a small snippet of code.
    ok dick licking ****** that really helped. Sorry there arent any comments or anything, jesus. The problem is with setting privileges, actually. No matter how much your little comment helped, your still a goddamn loser who insults programmers on an online forum. ePeen++4u?

    So many mistakes? First of all there are only slight problems with the code, and I only have to add token privileges before I read the memory. Im trying to read one ****ing value not develop a bot here. And no, x can be of type DWORD

  5. #5
    Phygar's Avatar ( ͡° ͜ʖ ͡°)
    Reputation
    444
    Join Date
    Nov 2007
    Posts
    1,591
    Thanks G/R
    7/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, first off X is a float, not a long, and second, look here for SetPrivilege():

    Enabling and Disabling Privileges in C++ (Windows)

  6. #6
    0_00_0's Avatar Member
    Reputation
    1
    Join Date
    Jun 2007
    Posts
    39
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Phygar View Post
    Yes, first off X is a float, not a long, and second, look here for SetPrivilege():

    Enabling and Disabling Privileges in C++ (Windows)
    Yeah, thats exactly what I have to do. Thats what you get for using vista. Thank you for the first productive comment

  7. #7
    Shynd's Avatar Contributor
    Reputation
    97
    Join Date
    May 2008
    Posts
    393
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What are you, twelve? Dick-licking ****** is the insult one gets for pointing out that you're a shit programmer and don't know what you're doing? Whomever said anyone has to be helpful on these forums, anyway? We help or flame on our own time, under our own set of rules, and are not obligated to do either, so **** off. I'm surprised ANYONE helped you.

  8. #8
    0_00_0's Avatar Member
    Reputation
    1
    Join Date
    Jun 2007
    Posts
    39
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Shynd View Post
    What are you, twelve? Dick-licking ****** is the insult one gets for pointing out that you're a shit programmer and don't know what you're doing? Whomever said anyone has to be helpful on these forums, anyway? We help or flame on our own time, under our own set of rules, and are not obligated to do either, so **** off. I'm surprised ANYONE helped you.
    Yeah Im twelve years old... But actually Ive been programming for 7 years and Im in my first year of university. Im sorry they dont teach me wow hacking lol.

    That code segment was something I threw together last night at 5 in the morning while really high. Its now working no thanks to these dumbass comments.

    Heres all the code needed. some privledges.
    Code:
    //Thanks to lurc for help with this function
    BOOL SetDebugPrivileges()
    {
       BOOL               bRET = FALSE;
       TOKEN_PRIVILEGES   tp;
       HANDLE             hToken;
    
       if (LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &tp.Privileges[0].Luid))
       {
          if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken))
          {
             if (hToken != INVALID_HANDLE_VALUE)
             {
                tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
                tp.PrivilegeCount = 1;
                if (AdjustTokenPrivileges(hToken, FALSE, &tp, 0, 0, 0))
                   bRET = TRUE;
                CloseHandle(hToken);
             }
          }
       }
       return bRET;
    }

  9. #9
    Shynd's Avatar Contributor
    Reputation
    97
    Join Date
    May 2008
    Posts
    393
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, because programming while you're high not only excuses your shitty programming tendencies, it also makes you REALLY COOL.

  10. #10
    Apoc's Avatar Angry Penguin
    Reputation
    1388
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by 0_00_0 View Post
    Yeah Im twelve years old... But actually Ive been programming for 7 years and Im in my first year of university. Im sorry they dont teach me wow hacking lol.

    That code segment was something I threw together last night at 5 in the morning while really high. Its now working no thanks to these dumbass comments.

    Heres all the code needed. some privledges.
    Code:
    //Thanks to lurc for help with this function
    BOOL SetDebugPrivileges()
    {
       BOOL               bRET = FALSE;
       TOKEN_PRIVILEGES   tp;
       HANDLE             hToken;
    
       if (LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &tp.Privileges[0].Luid))
       {
          if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken))
          {
             if (hToken != INVALID_HANDLE_VALUE)
             {
                tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
                tp.PrivilegeCount = 1;
                if (AdjustTokenPrivileges(hToken, FALSE, &tp, 0, 0, 0))
                   bRET = TRUE;
                CloseHandle(hToken);
             }
          }
       }
       return bRET;
    }
    Programming since you were 5 eh? And you're in a post-highschool school?

    YOO IS SO KEWL! I WAN BE LIKE CHU!

  11. #11
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by 0_00_0 View Post
    ok dick licking ****** that really helped. Sorry there arent any comments or anything, jesus. The problem is with setting privileges, actually. No matter how much your little comment helped, your still a goddamn loser who insults programmers on an online forum. ePeen++4u?

    So many mistakes? First of all there are only slight problems with the code, and I only have to add token privileges before I read the memory. Im trying to read one ****ing value not develop a bot here. And no, x can be of type DWORD
    I love stupid people, they're so amusing.

    First off, you call me a "dick licking ******" then say I'm a "loser" because I "[insult] programmers on an online forum"? Please direct yourself to a dictionary and look up the word "hypocrite".

    Secondly, the coordinate system always has been and always will be based on floating point numbers, specifically, single precision floating point numbers (i.e. 'floats'). Reading off the value as a 'long' is retarded, you'll get garbage every single time.

    Next on the list. If you've really been programming for 7 years it doesn't show, Universities where you live must have really low standards, either that or you're going to one of those "pay to get in" colleges/universities. Then again, the most likely scenario is just that you're lying because you think that saying that makes you look less stupid, when infact it makes you look MORE stupid because of how poor your programming ability is.

    P.S. For bonus points Google why 'std::endl' is a good idea and 'system("PAUSE")' is a bad idea.

  12. #12
    kynox's Avatar Member
    Reputation
    830
    Join Date
    Dec 2006
    Posts
    888
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I threw together last night at 5 in the morning while really high
    You're so cool, can i be like you? No. Wait. I take that back, i'd rather be successful.

    But actually Ive been programming for 7 years and Im in my first year of university.
    Yeah.. i'd give up while you were behind.. seriously behind.

  13. #13
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by kynox View Post
    You're so cool, can i be like you? No. Wait. I take that back, i'd rather be successful.



    Yeah.. i'd give up while you were behind.. seriously behind.
    I start uni next year, can I be cool too?

Similar Threads

  1. Problem with ReadProcessMemory : access denied
    By Fayat in forum Programming
    Replies: 2
    Last Post: 10-22-2008, 06:29 PM
  2. realm list problem
    By robtuner in forum World of Warcraft General
    Replies: 2
    Last Post: 07-21-2006, 09:08 AM
  3. I have problem with BHW 3.0
    By sunrize1 in forum World of Warcraft General
    Replies: 1
    Last Post: 07-17-2006, 08:49 AM
  4. wow emu problem
    By bezike in forum World of Warcraft General
    Replies: 0
    Last Post: 07-09-2006, 04:45 PM
  5. Site problems
    By Shanaar in forum Community Chat
    Replies: 10
    Last Post: 05-14-2006, 01:15 AM
All times are GMT -5. The time now is 06:46 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search