[Tutor] Windows Memory Basics

Steven D'Aprano steve at pearwood.info
Mon Oct 16 22:20:40 EDT 2017

On Mon, Oct 16, 2017 at 01:04:40PM -0700, Michael C wrote:
> Hi all:
> I don't understand this part about the memory:
> if I used VirtualQueryEx to find out if a region of memory is ok to scan,
> and it
> says it's ok, are the values in the region arranged like this:
> short,int,double,long,char, double, short in
> as in, random?

I am not a Windows expert, but I doubt it. Memory is always an array of 
bytes. How you interpret that memory depends on what you are doing with 
it, and there's no way to tell from outside how it should be 
interpreted. (Some very clever, perhaps too clever, can even give the 
same chunk of memory two or more *valid* interpretations at the same 

This implies that unless you know that this chunk of memory has some 
special meaning to Windows, the choice of how to interpret the chunk of 
memory is up to you. If you have a block of memory in hexadecimal that 
looks like this:


then it is entirely up to you whether you interpret it as:

(1) 64 one-byte values:

    1f 78 a9 24 ...

(2) 32 two-byte values:

    1f78 a924 b6c0 ...

(3) 16 four-byte values:

    1f78a924 b6c00be4 ...

or something else. You could interpret them as ASCII bytes, Unicode code 
points, signed integers, unsigned integers, single- or double-precision 
floating point numbers, strings, or anything you like.


More information about the Tutor mailing list