Re: [Tutor] using while loop for read process memory
Michael C <[email protected]> Sun, 8 Oct 2017 12:47:14 -0700
| Newsgroups | gmane.comp.python.ctypes,gmane.comp.python.tutor |
|---|---|
| Message-ID | <CANyKM1g4LzR5jBFH3_+0JSUe3La=MOZo+Kp99xhEgskUngncrQ@mail.gmail.com> |
--===============6448066180851893614== Content-Type: multipart/alternative; boundary="001a1141b7b8484278055b0e57b8" --001a1141b7b8484278055b0e57b8 Content-Type: text/plain; charset="UTF-8" I'll explain better when I get on a pc. On Oct 8, 2017 12:18 PM, "Michael C" <[email protected]> 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 > > On Oct 8, 2017 12:16 PM, "Mats Wichmann" <[email protected]> wrote: > >> 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? colors don't come through mailers that use text-based >> settings. This is an example of what your mail looks like to many of us: >> >> https://mail-archive.com/[email protected]/msg77570.html >> >> please explain in words. >> > --001a1141b7b8484278055b0e57b8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"auto">I'll explain better when I get on a pc.</div><div cla= ss=3D"gmail_extra"><br><div class=3D"gmail_quote">On Oct 8, 2017 12:18 PM, = "Michael C" <<a href=3D"mailto:[email protected]"= >[email protected]</a>> wrote:<br type=3D"attribution"><blo= ckquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #c= cc solid;padding-left:1ex"><div dir=3D"auto">This is the red part=C2=A0<div= dir=3D"auto"><div style=3D"font-family:sans-serif;font-size:13.696px" dir= =3D"auto"><font color=3D"#ff0000">=C2=A0 index =3D current_address</font></= div><div style=3D"font-family:sans-serif;font-size:13.696px" dir=3D"auto"><= font color=3D"#ff0000">=C2=A0 =C2=A0 =C2=A0 =C2=A0 end =3D current_address = + mbi.RegionSize</font></div><div style=3D"font-family:sans-serif;font-size= :13.696px" dir=3D"auto"><br></div><div style=3D"font-family:sans-serif;font= -size:13.696px" dir=3D"auto"><font color=3D"#ff0000">=C2=A0 =C2=A0 =C2=A0 = =C2=A0 while index < end:</font></div><div style=3D"font-family:sans-ser= if;font-size:13.696px" dir=3D"auto"><font color=3D"#ff0000">=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 if ReadProcessMemory(Process, index, ctypes.byr= ef(buffer), \</font></div><div style=3D"font-family:sans-serif;font-size:13= .696px" dir=3D"auto"><font color=3D"#ff0000">=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0ctypes.sizeof(buffer), ctypes.byref(nread)):</font></div><= div style=3D"font-family:sans-serif;font-size:13.696px" dir=3D"auto"><font = color=3D"#ff0000">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #= # value comparison to be implemented.</font></div><div style=3D"font-family= :sans-serif;font-size:13.696px" dir=3D"auto"><font color=3D"#ff0000">=C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pass=C2=A0 =C2=A0</font><= /div><div style=3D"font-family:sans-serif;font-size:13.696px" dir=3D"auto">= <font color=3D"#ff0000">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else:</fo= nt></div><div style=3D"font-family:sans-serif;font-size:13.696px" dir=3D"au= to"><font color=3D"#ff0000">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 raise ctypes.WinError(ctypes.get_las<wbr>t_error()= )</font></div><div style=3D"font-family:sans-serif;font-size:13.696px" dir= =3D"auto"><font color=3D"#ff0000"><br></font></div><div style=3D"font-famil= y:sans-serif;font-size:13.696px" dir=3D"auto"><font color=3D"#ff0000">=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 index +=3D 1</font></div></div></div= ><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Oct 8, 2017 1= 2:16 PM, "Mats Wichmann" <<a href=3D"mailto:[email protected]" = target=3D"_blank">[email protected]</a>> wrote:<br type=3D"attribution"><= blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px= #ccc solid;padding-left:1ex">On 10/08/2017 11:20 AM, Michael C wrote:<br> > Hi all:<br> <br> > Now, I know the problem is not with VirtualQueryEx, because if I comme= nt out<br> > the red part and just run VirtualQueryEx, it would actually skim throu= gh<br> > all regions<br> > without a single error.<br> ><br> > The red part is the problem.<br> <br> what red part?=C2=A0 colors don't come through mailers that use text-ba= sed<br> settings.=C2=A0 This is an example of what your mail looks like to many of = us:<br> <br> <a href=3D"https://mail-archive.com/[email protected]/msg77570.html" rel=3D"= noreferrer" target=3D"_blank">https://mail-archive.com/tutor<wbr>@python.or= g/msg77570.html</a><br> <br> please explain in words.<br> </blockquote></div></div> </blockquote></div></div> --001a1141b7b8484278055b0e57b8-- --===============6448066180851893614== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot --===============6448066180851893614== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ctypes-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ctypes-users --===============6448066180851893614==--