   Questions About Accessing Process Memory
  I apologize in advance for bringing this up again but after having read everything I can find, I'm only slightly more confused than when I started.I'm trying to write a Hex viewer that allows me to monitor the information in other processes outside my application.  I don't care anything about writing over any memory locations, I just want to see what is there. I know there are plenty of tools out there that can do that. This is a learning experience more than anything.My application seems to work as intended except that it doesn't appear to be reading the correct address range. Although it does appear to be reading the same incorrect range every time for any given process.Before I boggle your mind with my own cryptic code, I'd like to ask a few general questions and see if answers to those questions will resolve my issues. If the answers fail to resolve the issues, I'll clean up the code before I post it.1 ... GetSystemInfo(&si) places system information into a SYSTEM_INFO structure. The size of a page is contained in si.dwPageSize. Does this number represent the number of bytes in a page, or the number of 32-bit locations in a page (hence, making the number of bytes = 4 * dwPageSize)?  or something else altogether?2 ... I've been using:  DWORD base = 0x00400000; for the base address of the process.  Should I be doing this differently? If so, can you point me to a "how to obtain the base address of a process" tutorial/example?3 ... VirtualQueryEx(hProcess, &base, &mbi, sizeof(MEMORY_BASIC_INFORMATION) places information about the process into the MEMORY_BASIC_INFORMATION structure. The following is always the same, regardless of the process I'm trying to view.mbi.BaseAddress is always 1.mbi.AllocationBase is always 1.mbi.RegionSize is always 4096.That doesn't seem to be correct to me, but is it?4 ... Does mbi.RegionSize represent the number of contiguous pages that the process is occupying?   
  1. Page size is in bytes.2. Check out GetModuleHandle.3. Check out VirtualQueryEx. 4. Check out MEMORY_BASIC_INFORMATION. RegionSize: The size of the region beginning at the base address in which all pages have identical attributes, in bytes.