[Tutor] using while loop for read process memory

Alan Gauld alan.gauld at yahoo.co.uk
Sun Oct 8 19:46:19 EDT 2017


On 08/10/17 20:18, Michael C wrote:
> This is the red part 
>   index = current_address
>         end = current_address + mbi.RegionSize
> 
>         while index < end:
>             if ReadProcessMemory(Process, index, ctypes.byref(buffer), \
>                                  ctypes.sizeof(buffer),
> ctypes.byref(nread)):
>                 ## value comparison to be implemented.
>                 pass   
>             else:
>                     raise ctypes.WinError(ctypes.get_last_error())
> 
>             index += 1

I haven't been following this closely so may be way off here,
but does this mean you are incrementing the memory address
by 1? If so you are only increasing the pointer by 1 byte
but you are, presumably, reading multiple bytes at a time
(the size of the buffer presumably).

Do you perhaps need to treat the buffer as a byte array
and use something like the struct module to decode it?
(assuming you know what you are reading...?)

But I may be way off, I'm just going on a cursory look.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list