Re: [Tutor] using while loop for read process memory

2017-10-13 Thread Michael C
Sorry Alan, Steve, everyone Can you take a look of this please? Here is my question about the memory: So I have a base address of a chunk of memory from it's size, from VirtualQueryEx (if you dont use windows, it's ok, it's not about how u get these values, because I think the base concept is

Re: [Tutor] using while loop for read process memory

2017-10-13 Thread Alan Gauld via Tutor
On 13/10/17 02:58, Michael C wrote: >         end = current_address + mbi.RegionSize - 7 > > then it doesn't complain anymore. I think it's because I ran this in a > while loop with start += 1 > so in the last 7 bytes, I'd be reading past the end of this memory chunk. > > Is this right? Yes,

Re: [Tutor] using while loop for read process memory

2017-10-13 Thread Michael C
in fact, when I am using this: end = start + mbi.RegionSize I was getting error from the ReadProcessMemory function, and I couldn't figure it out why. Until I did this: end = current_address + mbi.RegionSize - 7 then it doesn't complain anymore. I think it's because I ran this

Re: [Tutor] using while loop for read process memory

2017-10-13 Thread Michael C
Here is my question about the memory: So I have a base address of a chunk of memory from it's size, from VirtualQueryEx (if you dont use windows, it's ok, it's not about how u get these values, because I think the base concept is the same) start = mbi.BaseAddress finish = mbi.RegionSize So at

Re: [Tutor] using while loop for read process memory

2017-10-09 Thread Michael C
thank for replying, but I am toast, so I'll reply tomorrow, thanks! On Sun, Oct 8, 2017 at 4:46 PM, Alan Gauld via Tutor wrote: > On 08/10/17 20:18, Michael C wrote: > > This is the red part > > index = current_address > > end = current_address + mbi.RegionSize > > >

Re: [Tutor] using while loop for read process memory

2017-10-08 Thread Steven D'Aprano
I have no idea about ctypes or Windows, but it seems to me that you are creating a rod for your own back by using a while loop here. Why use a primitive, low-level looping construct when Python gives you much better tools? My *guess* is that somewhere you are miscalcuating when to stop, and

Re: [Tutor] using while loop for read process memory

2017-10-08 Thread Alan Gauld via Tutor
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), \ >                                  

Re: [Tutor] using while loop for read process memory

2017-10-08 Thread Michael C
I'll explain better when I get on a pc. On Oct 8, 2017 12:18 PM, "Michael C" wrote: > This is the red part > index = current_address > end = current_address + mbi.RegionSize > > while index < end: > if ReadProcessMemory(Process,

Re: [Tutor] using while loop for read process memory

2017-10-08 Thread Michael C
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

Re: [Tutor] using while loop for read process memory

2017-10-08 Thread Mats Wichmann
On 10/08/2017 11:20 AM, Michael C wrote: > Hi all: > Now, I know the problem is not with VirtualQueryEx, because if I comment out > the red part and just run VirtualQueryEx, it would actually skim through > all regions > without a single error. > > The red part is the problem. what red part?

[Tutor] using while loop for read process memory

2017-10-08 Thread Michael C
Hi all: I have the following code, and somehow I must have fed the read process Memory incorrectly. what the code does is to check a region of memory to see whether or not it can be scanned. mbi.Protect == PAGE_READWRITE and mbi.State == MEM_COMMIT If this is true,then it proceeds to scan the