Finding all memory connected to a given process

Windows specific forum
sybixsus
User
User
Posts: 14
Joined: Mon Jul 21, 2003 12:28 pm
Location: UK

Finding all memory connected to a given process

Post by sybixsus »

I'm using VirtualQueryEx() to find which areas of memory are available to which processes but I'm finding I either get more blocks than I need, or not enough. I found a thread on these forums which suggested limiting the blocks to those where the mbi.lType is MEM_PRIVATE and the mbi.State is MEM_COMMIT but this discards important blocks of memory which the process is using ( yes, I'm 100% certain. )

So I tried cutting out the MEM_PRIVATE and just reading those blocks which are MEM_COMMIT, but that gives me a lot of false positives. It doesn't give me anything which causes an access violation, but it does slow things down by making me trawl through memory I don't really need to check.

Is there a better way to focus my search?