How come this is different?
Michael C <[email protected]> Fri, 9 Dec 2016 14:25:00 -0800
| Newsgroups | gmane.comp.python.ctypes |
|---|---|
| Message-ID | <CANyKM1iDUqHp1hPCfbkNv+P7D_ZQkJ_A2zHqd2vgpJwdLQ-mRw@mail.gmail.com> |
--===============2505928506287537822==
Content-Type: multipart/alternative; boundary=94eb2c05be948976430543413991
--94eb2c05be948976430543413991
Content-Type: text/plain; charset=UTF-8
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)
--94eb2c05be948976430543413991
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Hi all:<div><br></div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0I am=
trying to write my own memory scanner, but I have encountered a few proble=
m. Apparently, directly specifying "<font color=3D"#9900ff">PROCESS_QU=
ERY_INFORMATION|PROCESS_VM_READ"</font> is not ok, since the interpret=
er returns <font color=3D"#ff0000">"NameError: name 'PROCESS_QUERY=
_INFORMATION' is not defined"</font><br><div><br></div><div>so I s=
hould do what I did here, to define it for myself first? is this correct?</=
div><div><br></div><div>Thanks</div><div><br></div><div>Code:</div><div><br=
></div><div><div>import ctypes</div><div><br></div><div>kernel32 =3D ctypes=
.WinDLL('kernel32', use_last_error=3DTrue)</div><div><br></div><div=
>PROCESS_QUERY_INFORMATION =3D 0x0400</div><div>PROCESS_VM_READ =3D 0x0010<=
/div><div><br></div><div>ph =3D kernel32.OpenProcess(PROCESS_QUERY_INFORMAT=
ION|PROCESS_VM_READ,False, 20224)</div><div><br></div><div>print(ph)</div><=
/div><div><br></div></div></div>
--94eb2c05be948976430543413991--
--===============2505928506287537822==
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
--===============2505928506287537822==
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
--===============2505928506287537822==--