Re: How come this is different?
Michael C <[email protected]> Fri, 9 Dec 2016 16:08:47 -0800
| Newsgroups | gmane.comp.python.ctypes |
|---|---|
| Message-ID | <CANyKM1h6YPwgD5mwcq-rM===PkWiKmpKWz0+NNEvvtjU-_YBaA@mail.gmail.com> |
--===============8084017656299051545== Content-Type: multipart/alternative; boundary=94eb2c1188b8b865ae054342ac3d --94eb2c1188b8b865ae054342ac3d Content-Type: text/plain; charset=UTF-8 RESTART: C:\Users\AwesomeMe\Desktop\my prorgamming project\python\i am working on\temp code park.py 760 >>> On Fri, Dec 9, 2016 at 4:07 PM, Rob Gaddi <[email protected]> wrote: > And when you run that .py file, the entire error message with traceback > is...? > > On Fri, 9 Dec 2016 16:03:36 -0800 > Michael C <[email protected]> wrote: > > > Oh this is my entire work in progress, I pull those out to figure out the > > windows API line by line, so I do have a .py containing only those, as > seen > > here: > > > > import ctypes > > > > kernel32 = ctypes.WinDLL('kernel32', use_last_error=True) > > > > PROCESS_QUERY_INFORMATION = 0x0400 > > PROCESS_VM_READ = 0x0010 > > > > ph = kernel32.OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_ > READ,False, > > 20224) > > print(ph) > > > > > > On Fri, Dec 9, 2016 at 3:26 PM, Rob Gaddi <[email protected] > > > > wrote: > > > > > That's not it, Python is perfectly happy with 0x0400 as a literal. > > > > > > Michael, is the code you've provided below all copied and pasted from > your > > > actual code, or did you retype any of it? Is it all in fact at the > > > 0-indent level and in the same file? Likewise is that error report > copied > > > and pasted, or are you just paraphrasing? > > > > > > On Fri, 9 Dec 2016 15:33:12 -0700 > > > "David A. Van Arnem" <[email protected]> wrote: > > > > > > > Hi Michael, > > > > > > > > I believe Python doesn't accept a hex representation like "0x0400". > In > > > > situations where I've needed a hex value like that, I've used > something > > > > like: > > > > > > > > PROCESS_QUERY_INFORMATION = int("400", 16) > > > > > > > > This creates an integer from the string "400" in base 16 (hex). > > > > > > > > David > > > > > > > > On 12/09/2016 03:25 PM, Michael C wrote: > > > > > Hi all: > > > > > > > > > > I am trying to write my own memory scanner, but I have > > > encountered a > > > > > few problem. Apparently, directly specifying " > > > > > PROCESS_QUERY_INFORMATION|PROCESS_VM_READ" is not ok, since the > > > interpreter > > > > > returns "NameError: name 'PROCESS_QUERY_INFORMATION' is not > defined" > > > > > > > > > > so I should do what I did here, to define it for myself first? is > this > > > > > correct? > > > > > > > > > > Thanks > > > > > > > > > > Code: > > > > > > > > > > import ctypes > > > > > > > > > > kernel32 = ctypes.WinDLL('kernel32', use_last_error=True) > > > > > > > > > > PROCESS_QUERY_INFORMATION = 0x0400 > > > > > PROCESS_VM_READ = 0x0010 > > > > > > > > > > ph = kernel32.OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_ > > > READ,False, > > > > > 20224) > > > > > > > > > > print(ph) > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------ > > > ------------------ > > > > > Developer Access Program for Intel Xeon Phi Processors > > > > > Access to Intel Xeon Phi processor-based developer platforms. > > > > > With one year of Intel Parallel Studio XE. > > > > > Training and support from Colfax. > > > > > Order your platform today.http://sdm.link/xeonphi > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > ctypes-users mailing list > > > > > [email protected] > > > > > https://lists.sourceforge.net/lists/listinfo/ctypes-users > > > > > > > > > > > > > > > > > > -- > > > Rob Gaddi, Highland Technology > > > 18 Otis St. > > > San Francisco, CA 94103 > > > 415-551-1700 > > > > > > ------------------------------------------------------------ > > > ------------------ > > > Developer Access Program for Intel Xeon Phi Processors > > > Access to Intel Xeon Phi processor-based developer platforms. > > > With one year of Intel Parallel Studio XE. > > > Training and support from Colfax. > > > Order your platform today.http://sdm.link/xeonphi > > > _______________________________________________ > > > ctypes-users mailing list > > > [email protected] > > > https://lists.sourceforge.net/lists/listinfo/ctypes-users > > > > > > -- > Rob Gaddi, Highland Technology > 18 Otis St. > San Francisco, CA 94103 > 415-551-1700 > > ------------------------------------------------------------ > ------------------ > Developer Access Program for Intel Xeon Phi Processors > Access to Intel Xeon Phi processor-based developer platforms. > With one year of Intel Parallel Studio XE. > Training and support from Colfax. > Order your platform today.http://sdm.link/xeonphi > _______________________________________________ > ctypes-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/ctypes-users > --94eb2c1188b8b865ae054342ac3d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div>=C2=A0RESTART: C:\Users\AwesomeMe\Desktop\my prorgamm= ing project\python\i am working on\temp code park.py=C2=A0</div><div>760</d= iv><div>>>>=C2=A0</div></div><div class=3D"gmail_extra"><br><div c= lass=3D"gmail_quote">On Fri, Dec 9, 2016 at 4:07 PM, Rob Gaddi <span dir=3D= "ltr"><<a href=3D"mailto:[email protected]" target=3D"_blank= ">[email protected]</a>></span> wrote:<br><blockquote class= =3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd= ing-left:1ex">And when you run that .py file, the entire error message with= traceback is...?<br> <div class=3D"HOEnZb"><div class=3D"h5"><br> On Fri, 9 Dec 2016 16:03:36 -0800<br> Michael C <<a href=3D"mailto:[email protected]">mysecretrob= otfactory@gmail.<wbr>com</a>> wrote:<br> <br> > Oh this is my entire work in progress, I pull those out to figure out = the<br> > windows API line by line, so I do have a .py containing only those, as= seen<br> > here:<br> ><br> > import ctypes<br> ><br> > kernel32 =3D ctypes.WinDLL('kernel32', use_last_error=3DTrue)<= br> ><br> > PROCESS_QUERY_INFORMATION =3D 0x0400<br> > PROCESS_VM_READ =3D 0x0010<br> ><br> > ph =3D kernel32.OpenProcess(PROCESS_<wbr>QUERY_INFORMATION|PROCESS_VM_= <wbr>READ,False,<br> > 20224)<br> > print(ph)<br> ><br> ><br> > On Fri, Dec 9, 2016 at 3:26 PM, Rob Gaddi <<a href=3D"mailto:rgaddi= @highlandtechnology.com">[email protected]</a><wbr>><br> > wrote:<br> ><br> > > That's not it, Python is perfectly happy with 0x0400 as a lit= eral.<br> > ><br> > > Michael, is the code you've provided below all copied and pas= ted from your<br> > > actual code, or did you retype any of it?=C2=A0 Is it all in fact= at the<br> > > 0-indent level and in the same file?=C2=A0 Likewise is that error= report copied<br> > > and pasted, or are you just paraphrasing?<br> > ><br> > > On Fri, 9 Dec 2016 15:33:12 -0700<br> > > "David A. Van Arnem" <<a href=3D"mailto:dvanarnem@cm= lab.biz">[email protected]</a>> wrote:<br> > ><br> > > > Hi Michael,<br> > > ><br> > > > I believe Python doesn't accept a hex representation lik= e "0x0400".=C2=A0 In<br> > > > situations where I've needed a hex value like that, I= 9;ve used something<br> > > > like:<br> > > ><br> > > > PROCESS_QUERY_INFORMATION =3D int("400", 16)<br> > > ><br> > > > This creates an integer from the string "400" in b= ase 16 (hex).<br> > > ><br> > > > David<br> > > ><br> > > > On 12/09/2016 03:25 PM, Michael C wrote:<br> > > > > Hi all:<br> > > > ><br> > > > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 I am trying to write my own = memory scanner, but I have<br> > > encountered a<br> > > > > few problem. Apparently, directly specifying "<br> > > > > PROCESS_QUERY_INFORMATION|<wbr>PROCESS_VM_READ" is= not ok, since the<br> > > interpreter<br> > > > > returns "NameError: name 'PROCESS_QUERY_INFORM= ATION' is not defined"<br> > > > ><br> > > > > so I should do what I did here, to define it for myself= first? is this<br> > > > > correct?<br> > > > ><br> > > > > Thanks<br> > > > ><br> > > > > Code:<br> > > > ><br> > > > > import ctypes<br> > > > ><br> > > > > kernel32 =3D ctypes.WinDLL('kernel32', use_last= _error=3DTrue)<br> > > > ><br> > > > > PROCESS_QUERY_INFORMATION =3D 0x0400<br> > > > > PROCESS_VM_READ =3D 0x0010<br> > > > ><br> > > > > ph =3D kernel32.OpenProcess(PROCESS_<wbr>QUERY_INFORMAT= ION|PROCESS_VM_<br> > > READ,False,<br> > > > > 20224)<br> > > > ><br> > > > > print(ph)<br> > > > ><br> > > > ><br> > > > ><br> > > > > ------------------------------<wbr>--------------------= ----------<br> > > ------------------<br> > > > > Developer Access Program for Intel Xeon Phi Processors<= br> > > > > Access to Intel Xeon Phi processor-based developer plat= forms.<br> > > > > With one year of Intel Parallel Studio XE.<br> > > > > Training and support from Colfax.<br> > > > > Order your platform today.<a href=3D"http://sdm.link/xe= onphi" rel=3D"noreferrer" target=3D"_blank">http://sdm.link/xeonphi</a><br> > > > ><br> > > > ><br> > > > ><br> > > > > ______________________________<wbr>_________________<br= > > > > > ctypes-users mailing list<br> > > > > <a href=3D"mailto:[email protected]">c= types-users@lists.<wbr>sourceforge.net</a><br> > > > > <a href=3D"https://lists.sourceforge.net/lists/listinfo= /ctypes-users" rel=3D"noreferrer" target=3D"_blank">https://lists.sourcefor= ge.net/<wbr>lists/listinfo/ctypes-users</a><br> > > > ><br> > > ><br> > ><br> > ><br> > > --<br> > > Rob Gaddi, Highland Technology<br> > > 18 Otis St.<br> > > San Francisco, CA 94103<br> > > <a href=3D"tel:415-551-1700" value=3D"+14155511700">415-551-1700<= /a><br> > ><br> > > ------------------------------<wbr>------------------------------= <br> > > ------------------<br> > > Developer Access Program for Intel Xeon Phi Processors<br> > > Access to Intel Xeon Phi processor-based developer platforms.<br> > > With one year of Intel Parallel Studio XE.<br> > > Training and support from Colfax.<br> > > Order your platform today.<a href=3D"http://sdm.link/xeonphi" rel= =3D"noreferrer" target=3D"_blank">http://sdm.link/xeonphi</a><br> > > ______________________________<wbr>_________________<br> > > ctypes-users mailing list<br> > > <a href=3D"mailto:[email protected]">ctypes-user= s@lists.<wbr>sourceforge.net</a><br> > > <a href=3D"https://lists.sourceforge.net/lists/listinfo/ctypes-us= ers" rel=3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/<wb= r>lists/listinfo/ctypes-users</a><br> > ><br> <br> <br> --<br> Rob Gaddi, Highland Technology<br> 18 Otis St.<br> San Francisco, CA 94103<br> <a href=3D"tel:415-551-1700" value=3D"+14155511700">415-551-1700</a><br> <br> ------------------------------<wbr>------------------------------<wbr>-----= -------------<br> Developer Access Program for Intel Xeon Phi Processors<br> Access to Intel Xeon Phi processor-based developer platforms.<br> With one year of Intel Parallel Studio XE.<br> Training and support from Colfax.<br> Order your platform today.<a href=3D"http://sdm.link/xeonphi" rel=3D"norefe= rrer" target=3D"_blank">http://sdm.link/xeonphi</a><br> ______________________________<wbr>_________________<br> ctypes-users mailing list<br> <a href=3D"mailto:[email protected]">ctypes-users@lists.<w= br>sourceforge.net</a><br> <a href=3D"https://lists.sourceforge.net/lists/listinfo/ctypes-users" rel= =3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/<wbr>lists/= listinfo/ctypes-users</a><br> </div></div></blockquote></div><br></div> --94eb2c1188b8b865ae054342ac3d-- --===============8084017656299051545== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today.http://sdm.link/xeonphi --===============8084017656299051545== 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 --===============8084017656299051545==--