Thread: Several Questions, main one is about protected memory

  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    2

    Question Several Questions, main one is about protected memory

    Here are some of my questions:

    1. How do you get around protected memory? As in, access another program's memory. Like how a trainer for a game would. I know how to set a pointer to that address, but the OS keeps it from being able to read and write to it without crashing my program.

    2.(relates to #1) I have the offsets for the values in a game's dll. Now, how would I find the memory address of the dll. I got the offsets from a memory reading program, but I would like to be able to access this with my own program.

    3. How would you go about reading pixels from the screen? Mainly, a DirectX program.

    4. How can you send out button presses, as if you were using a controller, through DirectInput? Is it done in a similar way as sending messages out to windows?


    Sorry if I asked any stupid questions, I just started learning C programming about a month ago. I think I got the basics down, and I'm working on learning Windows API now. # 3 and 4, I don't know much about. And I searched...I don't think these questions were asked before...at least questions #1 and 2 anyway.

  2. #2
    ---
    Join Date
    May 2004
    Posts
    1,379
    Yeah these questions aren't asked often because it is against the forum rules. Sorry but you won't get any help on writing a trainer here .

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    2
    ...not really a trainer...that was more of an example. I'm trying to make a program...like an AI, that you can play against in the game. Only way I can think of it being able to know what's going on is to read the memory from the game. It would be like the second player.

    Sorry if this still isn't suitable for the forms.

  4. #4
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    >> 1. How do you get around protected memory? As in, access another program's memory. Like how a trainer for a game would. I know how to set a pointer to that address, but the OS keeps it from being able to read and write to it without crashing my program. <<

    Each process has a seperate address space. You can read and write from another process' memory using the ReadProcessMemory and WriteProcessMemory functions. Examples are available on the board and on the web.

    >> 2.(relates to #1) I have the offsets for the values in a game's dll. Now, how would I find the memory address of the dll. I got the offsets from a memory reading program, but I would like to be able to access this with my own program. <<

    You can use the EnumProcessModules function or CreateToolhelp32Snapshot with TH32CS_SNAPMODULE. Note that the HMODULE or HINSTANCE of a DLL is its base address. Many DLL/EXE combinations will use constant base addresses so you may be able to skip this step. A tool such as Dependency Walker will tell you the preferred and actual base addresses of the DLLs loaded into a process.

    >> 3. How would you go about reading pixels from the screen? Mainly, a DirectX program. <<

    Try this search.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory handling functions (newbie questions)
    By PaulBlay in forum C Programming
    Replies: 6
    Last Post: 03-10-2009, 06:37 AM
  2. Memory allocation/reallocation
    By magda3227 in forum C Programming
    Replies: 10
    Last Post: 07-04-2008, 03:27 PM
  3. Memory leaks problem in C -- Help please
    By Amely in forum C Programming
    Replies: 14
    Last Post: 05-21-2008, 11:16 AM
  4. Manipulating the Windows Clipboard
    By Johno in forum Windows Programming
    Replies: 2
    Last Post: 10-01-2002, 09:37 AM
  5. Memory handler
    By Dr. Bebop in forum C Programming
    Replies: 7
    Last Post: 09-15-2002, 04:14 PM