Re: How come this is different?
Rob Gaddi <[email protected]> Fri, 9 Dec 2016 16:07:18 -0800
| Newsgroups | gmane.comp.python.ctypes |
|---|---|
| Message-ID | <[email protected]> |
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