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>&gt;&gt;&gt;=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">&lt;<a href=3D"mailto:[email protected]" target=3D"_blank=
">[email protected]</a>&gt;</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 &lt;<a href=3D"mailto:[email protected]">mysecretrob=
otfactory@gmail.<wbr>com</a>&gt; wrote:<br>
<br>
&gt; Oh this is my entire work in progress, I pull those out to figure out =
the<br>
&gt; windows API line by line, so I do have a .py containing only those, as=
 seen<br>
&gt; here:<br>
&gt;<br>
&gt; import ctypes<br>
&gt;<br>
&gt; kernel32 =3D ctypes.WinDLL(&#39;kernel32&#39;, use_last_error=3DTrue)<=
br>
&gt;<br>
&gt; PROCESS_QUERY_INFORMATION =3D 0x0400<br>
&gt; PROCESS_VM_READ =3D 0x0010<br>
&gt;<br>
&gt; ph =3D kernel32.OpenProcess(PROCESS_<wbr>QUERY_INFORMATION|PROCESS_VM_=
<wbr>READ,False,<br>
&gt; 20224)<br>
&gt; print(ph)<br>
&gt;<br>
&gt;<br>
&gt; On Fri, Dec 9, 2016 at 3:26 PM, Rob Gaddi &lt;<a href=3D"mailto:rgaddi=
@highlandtechnology.com">[email protected]</a><wbr>&gt;<br>
&gt; wrote:<br>
&gt;<br>
&gt; &gt; That&#39;s not it, Python is perfectly happy with 0x0400 as a lit=
eral.<br>
&gt; &gt;<br>
&gt; &gt; Michael, is the code you&#39;ve provided below all copied and pas=
ted from your<br>
&gt; &gt; actual code, or did you retype any of it?=C2=A0 Is it all in fact=
 at the<br>
&gt; &gt; 0-indent level and in the same file?=C2=A0 Likewise is that error=
 report copied<br>
&gt; &gt; and pasted, or are you just paraphrasing?<br>
&gt; &gt;<br>
&gt; &gt; On Fri, 9 Dec 2016 15:33:12 -0700<br>
&gt; &gt; &quot;David A. Van Arnem&quot; &lt;<a href=3D"mailto:dvanarnem@cm=
lab.biz">[email protected]</a>&gt; wrote:<br>
&gt; &gt;<br>
&gt; &gt; &gt; Hi Michael,<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; I believe Python doesn&#39;t accept a hex representation lik=
e &quot;0x0400&quot;.=C2=A0 In<br>
&gt; &gt; &gt; situations where I&#39;ve needed a hex value like that, I&#3=
9;ve used something<br>
&gt; &gt; &gt; like:<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; PROCESS_QUERY_INFORMATION =3D int(&quot;400&quot;, 16)<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; This creates an integer from the string &quot;400&quot; in b=
ase 16 (hex).<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; David<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; On 12/09/2016 03:25 PM, Michael C wrote:<br>
&gt; &gt; &gt; &gt; Hi all:<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 I am trying to write my own =
memory scanner, but I have<br>
&gt; &gt; encountered a<br>
&gt; &gt; &gt; &gt; few problem. Apparently, directly specifying &quot;<br>
&gt; &gt; &gt; &gt; PROCESS_QUERY_INFORMATION|<wbr>PROCESS_VM_READ&quot; is=
 not ok, since the<br>
&gt; &gt; interpreter<br>
&gt; &gt; &gt; &gt; returns &quot;NameError: name &#39;PROCESS_QUERY_INFORM=
ATION&#39; is not defined&quot;<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; so I should do what I did here, to define it for myself=
 first? is this<br>
&gt; &gt; &gt; &gt; correct?<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Thanks<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Code:<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; import ctypes<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; kernel32 =3D ctypes.WinDLL(&#39;kernel32&#39;, use_last=
_error=3DTrue)<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; PROCESS_QUERY_INFORMATION =3D 0x0400<br>
&gt; &gt; &gt; &gt; PROCESS_VM_READ =3D 0x0010<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; ph =3D kernel32.OpenProcess(PROCESS_<wbr>QUERY_INFORMAT=
ION|PROCESS_VM_<br>
&gt; &gt; READ,False,<br>
&gt; &gt; &gt; &gt; 20224)<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; print(ph)<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; ------------------------------<wbr>--------------------=
----------<br>
&gt; &gt; ------------------<br>
&gt; &gt; &gt; &gt; Developer Access Program for Intel Xeon Phi Processors<=
br>
&gt; &gt; &gt; &gt; Access to Intel Xeon Phi processor-based developer plat=
forms.<br>
&gt; &gt; &gt; &gt; With one year of Intel Parallel Studio XE.<br>
&gt; &gt; &gt; &gt; Training and support from Colfax.<br>
&gt; &gt; &gt; &gt; Order your platform today.<a href=3D"http://sdm.link/xe=
onphi" rel=3D"noreferrer" target=3D"_blank">http://sdm.link/xeonphi</a><br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; ______________________________<wbr>_________________<br=
>
&gt; &gt; &gt; &gt; ctypes-users mailing list<br>
&gt; &gt; &gt; &gt; <a href=3D"mailto:[email protected]">c=
types-users@lists.<wbr>sourceforge.net</a><br>
&gt; &gt; &gt; &gt; <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>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; --<br>
&gt; &gt; Rob Gaddi, Highland Technology<br>
&gt; &gt; 18 Otis St.<br>
&gt; &gt; San Francisco, CA 94103<br>
&gt; &gt; <a href=3D"tel:415-551-1700" value=3D"+14155511700">415-551-1700<=
/a><br>
&gt; &gt;<br>
&gt; &gt; ------------------------------<wbr>------------------------------=
<br>
&gt; &gt; ------------------<br>
&gt; &gt; Developer Access Program for Intel Xeon Phi Processors<br>
&gt; &gt; Access to Intel Xeon Phi processor-based developer platforms.<br>
&gt; &gt; With one year of Intel Parallel Studio XE.<br>
&gt; &gt; Training and support from Colfax.<br>
&gt; &gt; Order your platform today.<a href=3D"http://sdm.link/xeonphi" rel=
=3D"noreferrer" target=3D"_blank">http://sdm.link/xeonphi</a><br>
&gt; &gt; ______________________________<wbr>_________________<br>
&gt; &gt; ctypes-users mailing list<br>
&gt; &gt; <a href=3D"mailto:[email protected]">ctypes-user=
s@lists.<wbr>sourceforge.net</a><br>
&gt; &gt; <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>
&gt; &gt;<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==--