I used some code to read the process memory using the MEMORY_BASE_INFORMATION a little while back using the information provided here. However, when I list out the regions in memory, only the pages with RW pages seem to be listed out. More importantly, none of the pages with executable permissions are listed out. How could I rectify this?
Could it have something to do with the privilege at which the process runs?
I've attached a screenshot of the process memory in Ollydbg and what is printed out using the source below :-
int main() {
HANDLE process = GetCurrentProcess();
MEMORY_BASIC_INFORMATION info;
unsigned char *p = NULL;
for ( p = NULL;
VirtualQueryEx(process, p, &info, sizeof(info)) == sizeof(info);
p += info.RegionSize )
{
if (info.State == MEM_COMMIT && (info.Type == MEM_MAPPED || info.Type == MEM_PRIVATE))
printf("%08x %08x %08x\n", info.BaseAddress, info.RegionSize, info.Protect);
}
}