[Tutor] How do I scan memory for singles, doubles and so on?

Mats Wichmann mats at wichmann.us
Mon Oct 9 11:29:33 EDT 2017


On 10/07/2017 09:18 PM, Michael C wrote:
> I am following some examples online such as this one:
> https://social.msdn.microsoft.com/Forums/vstudio/en-US/ce0cc398-2b96-4688-b8a4-b5f4c9ebc064/memory-searcher-with-virtualqueryex-and-readprocessmemory?forum=vclanguage
> 
> 
> i think I got most of it right, so this following part is what I would like
> you to look at:
> 
> DWORD read = 0;
> LPVOID buffer = 0
> 
> (ReadProcessMemory(hackProcess, (void*)start, &buffer, sizeof(int), &read)
> 
> 
> So, what's the Python equivalent statements for sizeof(int) ?

There isn't one, directly, since python types are dynamic (and once
Python knows something is an int it can morph into a bigint later).

But probably for your purposes, this would give what you want:

Python 3.6.2 (default, Sep 22 2017, 08:28:09)
[GCC 7.2.1 20170915 (Red Hat 7.2.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> ctypes.sizeof(ctypes.c_int)
4
>>> ctypes.sizeof(ctypes.c_long)
8
>>> ctypes.sizeof(ctypes.c_float)
4
>>> ctypes.sizeof(ctypes.c_double)
8
>>>




More information about the Tutor mailing list