Showing archive results for 2004

Aug 27, 2004
Post comments count0
Post likes count2

Importance of alignment even on x86 machines

Raymond Chen

Sometimes unaligned memory access will hang the machine. Some video cards do not let you access all the video memory at one go. Instead, you are given a window into which you can select which subset of video memory ("bank") you want to see. For example, the EGA video card had 256K of memory, split into four 64K banks. If you wanted to access memo...

History
Aug 26, 2004
Post comments count0
Post likes count1

Why do some structures end with an array of size 1?

Raymond Chen

Some Windows structures are variable-sized, beginning with a fixed header, followed by a variable-sized array. When these structures are declared, they often declare an array of size 1 where the variable-sized array should be. For example: typedef struct _TOKEN_GROUPS { DWORD GroupCount; SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY]; } TOKEN...

Code
Aug 25, 2004
Post comments count0
Post likes count0

Why can’t you treat a FILETIME as an __int64?

Raymond Chen

The FILETIME structure represents a 64-bit value in two parts: typedef struct _FILETIME { DWORD dwLowDateTime; DWORD dwHighDateTime; } FILETIME, *PFILETIME; You may be tempted to take the entire FILETIME structure and access it directly as if it were an __int64. After all, its memory layout exactly matches that of a 64-bit (little-endian)...

CodeTime
Aug 24, 2004
Post comments count0
Post likes count1

Beware of non-null-terminated registry strings

Raymond Chen

Even though a value is stored in the registry as REG_SZ, this doesn't mean that the value actually ends with a proper null terminator. At the bottom, the registry is just a hierarchically-organized name/value database. And you can lie and get away with it. Lots of people lie about their registry data. You'll find lots of things that should be...

Code
Aug 23, 2004
Post comments count0
Post likes count0

The kooky STRRET structure

Raymond Chen

It was designed when computers were a lot slower.

History
Aug 23, 2004
Post comments count0
Post likes count0

Finished competing in your event? Let the games begin!

Raymond Chen

Ten thousand human beings in peak physical condition. All in one dormitory complex. With 130,000 free condoms. Let the games begin! And you have to tip your hat (tam?) to The Scotsman for finding an athlete named "Randy Jones" for this article.

Non-Computer
Aug 22, 2004
Post comments count0
Post likes count0

Summary of the recent spate of /3GB articles

Raymond Chen

A table of contents now that the whole thing is over. I hope. I'm not sure how successful this series has been, though, for it appears that even people who have read the articles continue to confuse virtual address space with physical address space. (Or maybe this person is merely mocking a faulty argument? I can't tell for sure.)

Other
Aug 20, 2004
Post comments count0
Post likes count0

Writing your own menu-like window

Raymond Chen

Hereby incorporating by reference the "FakeMenu" sample in the Platform SDK. It's in the winui\shell\fakemenu directory. For those who don't have the Platform SDK, what are you doing writing Win32 programs without the Platform SDK? Download it if it didn't come with your development tools. If for some reason you don't want the Platform SDK yet ...

Code
Aug 20, 2004
Post comments count0
Post likes count0

The curious interaction between PAE and NX

Raymond Chen

Carmen Crincoli covered the interaction between PAE and NX on his own blog, so I'll merely incorporate his remarks by reference. (And notice again the concession to backwards compatibility. Without the backwards compatibility work, XP SP2 would have shipped with NX support and an asterisk, "* and those of you who have device drivers that a...

Other
Aug 19, 2004
Post comments count0
Post likes count0

Myth: In order to use AWE, you must enable PAE

Raymond Chen

Address Windowing Extensions (AWE) does not require PAE. I don't know why some people claim that it does, since it is so easy to demonstrate otherwise. Take a program that uses AWE. If you don't have one handy, you can use the one that comes in MSDN as a sample program that demonstrates how to use AWE. Grant yourself "Lock Pages in Memory" privi...

Other