Re: [Tutor] ctypes wintypes

2017-10-07 Thread Michael C
I think I pieced together what you have been helping me with, but this still raise a error I have been loosely following this guide: https://www.codeproject.com/articles/716227/csharp-how-to-scan-a-process-memory >code start. import ctypes from ctypes.wintypes import WORD, DWORD, LPVOID

Re: [Tutor] ctypes wintypes

2017-10-07 Thread Michael C
For this read process memory, if I am trying compose a LPCVOID lpBaseAddress, am I not making a variable that equals to mbi.BaseAddress, and then making a pointer pointing to it? start_address = mbi.BaseAddress LPCVOID = ctypes.byref(start_address) ? But I get this start =

Re: [Tutor] ctypes wintypes

2017-10-07 Thread Michael C
like this? buffer = ctypes.byref(ctypes.create_string_buffer(4)) On Fri, Oct 6, 2017 at 1:55 PM, eryk sun wrote: > On Fri, Oct 6, 2017 at 9:12 PM, Michael C > wrote: > > > > How do I create a buffer, or rather, is a buffer just a variable? >

Re: [Tutor] ctypes wintypes

2017-10-07 Thread Michael C
This is my updated version, it still doesn't work :( base = mbi.BaseAddress buffer = ctypes.c_int32() buffer_pointer = ctypes.byref(buffer) ReadProcessMemory = Kernel32.ReadProcessMemory if ReadProcessMemory(Process, base, buffer_pointer, mbi.RegionSize, None): print('buffer is:

Re: [Tutor] ctypes wintypes

2017-10-06 Thread eryk sun
On Fri, Oct 6, 2017 at 11:05 PM, Michael C wrote: > For this read process memory, if I am trying compose a LPCVOID > lpBaseAddress, am I not making a variable that equals to mbi.BaseAddress, > and then making a pointer pointing to it? > > start_address =

Re: [Tutor] ctypes wintypes

2017-10-06 Thread eryk sun
On Fri, Oct 6, 2017 at 10:26 PM, Michael C wrote: > > base = mbi.BaseAddress > buffer = ctypes.c_int32() > buffer_pointer = ctypes.byref(buffer) > ReadProcessMemory = Kernel32.ReadProcessMemory > > if ReadProcessMemory(Process, base, buffer_pointer, mbi.RegionSize,

Re: [Tutor] ctypes wintypes

2017-10-06 Thread eryk sun
On Fri, Oct 6, 2017 at 10:06 PM, Michael C wrote: > like this? > > buffer = ctypes.byref(ctypes.create_string_buffer(4)) No, the buffer is the array created by create_string_buffer, which you pass byref(). In the following example I create a `test` buffer that

Re: [Tutor] ctypes wintypes

2017-10-06 Thread eryk sun
On Fri, Oct 6, 2017 at 9:12 PM, Michael C wrote: > > How do I create a buffer, or rather, is a buffer just a variable? A buffer is a block of memory for an I/O operation. For example, if you need to read a 4-byte (32-bit) integer at an address in another process,

Re: [Tutor] ctypes wintypes

2017-10-06 Thread Michael C
Hi all: How do I create a buffer, or rather, is a buffer just a variable? How do I create a pointer to it? This code ran fine (thanks to you, Eryk, I now know about how to work VirtualQueryEx work) until when I ran the read process memory part. I think I am not feeding the function properly.

Re: [Tutor] ctypes wintypes

2017-10-06 Thread Michael C
Hi Eryk Sun: I started out with what you gave me: >code starts class SYSTEM_INFO(ctypes.Structure): """https://msdn.microsoft.com/en-us/library/ms724958""; class _U(ctypes.Union): class _S(ctypes.Structure): _fields_ = (('wProcessorArchitecture', WORD),

Re: [Tutor] ctypes wintypes

2017-10-06 Thread Michael C
Sorry but I dont understand this line: mbi = MEMORY_BASIC_INFORMATION() This creates a instance of the class? Also, I thought with VirtualQueryEx, what you need for it is a handle, which I acquire from this Process = Kernel32.OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ, False, PID)

Re: [Tutor] ctypes wintypes

2017-10-06 Thread eryk sun
On Fri, Oct 6, 2017 at 7:43 PM, Michael C wrote: > Sorry but I dont understand this line: > > mbi = MEMORY_BASIC_INFORMATION() > > This creates a instance of the class? Yes, and this allocates sizeof(MEMORY_BASIC_INFORMATION) bytes at addressof(mbi), which you

Re: [Tutor] ctypes wintypes

2017-10-06 Thread eryk sun
On Fri, Oct 6, 2017 at 7:26 PM, Michael C wrote: > > I started out with what you gave me: > [...] > > I am trying to acquire "lpMinimumApplicationAddress" and > "lpMaximumApplicationAddress" from system_info, so I did this, > >>code > Kernel32 =

Re: [Tutor] ctypes wintypes

2017-10-05 Thread Michael C
First of all, thanks for the reply. How do I see the values of each field? This doesn't work. print(PMEMORY_BASIC_INFORMATION.Protect) thanks! On Thu, Oct 5, 2017 at 11:34 AM, eryk sun wrote: > On Tue, Oct 3, 2017 at 10:30 PM, Michael C >

Re: [Tutor] ctypes wintypes

2017-10-05 Thread Michael C
Sorry about asking these super obvious little things, I am actually a 1st student, but I acing my programming 101 at the moment lol On Thu, Oct 5, 2017 at 12:27 PM, Michael C wrote: > First of all, thanks for the reply. > > > How do I see the values of each

Re: [Tutor] ctypes wintypes

2017-10-05 Thread eryk sun
On Thu, Oct 5, 2017 at 8:27 PM, Michael C wrote: > > How do I see the values of each field? This doesn't work. > > print(PMEMORY_BASIC_INFORMATION.Protect) Create an instance of MEMORY_BASIC_INFORMATION and pass a pointer to it via byref(). For example, the

Re: [Tutor] ctypes wintypes

2017-10-05 Thread eryk sun
On Tue, Oct 3, 2017 at 10:30 PM, Michael C wrote: > > I am trying to create SYSTEM_INFO structure and MEMORY_BASIC_INFORMATION > structure First, avoid relying on constants, enumerations, and structures published on MSDN. It's not always right. Get the SDK and

Re: [Tutor] ctypes wintypes

2017-10-04 Thread Albert-Jan Roskam
utor Subject: [Tutor] ctypes wintypes Hi all: I am trying to create SYSTEM_INFO structure and MEMORY_BASIC_INFORMATION structure I think there are modules for this purpose? Is it the ctypes.wintypes? if so, please point me to a documentation for it. Thanks! _

Re: [Tutor] ctypes wintypes

2017-10-04 Thread Alan Gauld via Tutor
On 04/10/17 04:12, Michael C wrote: > Is there a module that does this for me? > If it exists, how do I find it? Google is your friend. What you need to remember is that modules only get created if someone else has the same need as you. And usually if its a repeated need since it takes time and

Re: [Tutor] ctypes wintypes

2017-10-04 Thread Michael C
Is there a module that does this for me? If it exists, how do I find it? thanks On Tue, Oct 3, 2017 at 5:04 PM, Michael C wrote: > i see i see. > > On Tue, Oct 3, 2017 at 4:50 PM, Alan Gauld via Tutor > wrote: > >> On 03/10/17 22:30, Michael C

Re: [Tutor] ctypes wintypes

2017-10-03 Thread Michael C
i see i see. On Tue, Oct 3, 2017 at 4:50 PM, Alan Gauld via Tutor wrote: > On 03/10/17 22:30, Michael C wrote: > > > I am trying to create SYSTEM_INFO structure and MEMORY_BASIC_INFORMATION > > structure > > > > I think there are modules for this purpose? Is it the

Re: [Tutor] ctypes wintypes

2017-10-03 Thread Alan Gauld via Tutor
On 03/10/17 22:30, Michael C wrote: > I am trying to create SYSTEM_INFO structure and MEMORY_BASIC_INFORMATION > structure > > I think there are modules for this purpose? Is it the ctypes.wintypes? wintypes does define many of the standard Win32 API types but sadly neither of the two you

[Tutor] ctypes wintypes

2017-10-03 Thread Michael C
Hi all: I am trying to create SYSTEM_INFO structure and MEMORY_BASIC_INFORMATION structure I think there are modules for this purpose? Is it the ctypes.wintypes? if so, please point me to a documentation for it. Thanks! ___ Tutor maillist -