The Old New Thing

Accessibility is not just for people with disabilities

When the topic of accessibility comes up, most people think it's all about people with disabilities. While it's true that people with disabilities were the original target audience for accessibility, more recent developments have highlighted the value of accessible technologies to everyone. For one thing, making your program accessible means ...

Cool web site: Bill Monk

One of my friends introduced me to Bill Monk, which is like PayPal but without the money. You and your friends sign up, and then you can let the site keep track of who owe whom how much. Of course, whether this is useful to you depends on how you and your friends actually deal with money and small debts. With some of my friends, we use the...

Do not change program semantics in the debug build

What you don't want is a problem that goes away when you debug it. It is expected that a program have additional debugging code inside blocks. After all, that's why it's a debug build. But what you definitely don't want to do is have that debugging to fundamentally change the program's behavior. You can perform additional validation. You ...

The cultural anthropology of getting on a bicycle

I can tell where you grew up by watching you get on a bicycle. Well, sort of. In my limited experience, I've observed two distinct ways of getting on a bicycle. The first is what I'll call the Chinese method, since it's the dominant technique in China, Taiwan, and Japan, as far as I can tell. To get on a bicycle using the Chinese method, ...

Why can't I see all of the 4GB of RAM in my machine?

Here's a question that came from a customer: I have set my boot options to /3GB /NOPAE. Even though the server has 4GB of physical memory, we see only 3.5GB of physical memory on the server after it boots up. However, when we change the boot options to /PAE, we can observe 4GB of memory. Furthermore, when I enable only /PAE, even though the ...

Why does SetWindowsHookEx take an HINSTANCE parameter?

An anonymous commenter asked why the function takes an parameter if the first thing it's going to do is convert the instance handle into a file name. Because that's not how it worked in 16-bit Windows. In 16-bit Windows there was no such thing as hook injection. All 16-bit Windows applications ran in the same address space, so there was ...

Space scientist James Van Allen (1914–2006)

Discoverer of the Van Allen radiation belts and one of the TIME magazine men of the year for 1960 James Van Allen died yesterday. (What a coincidence. What are the odds that the person to discover the Van Allen radiation belts would also be named Van Allen?) I never met the man, but I met his granddaughter. She has an amazing facility with ...

One way people abused hooks in 16-bit Windows

We saw last time how windows hooks were implemented in 16-bit Windows. Even though the was an opaque data type that should have been treated like a handle, many programs "knew enough to be dangerous" and took advantage of the fact that the was just a pointer to the previous hook procedure. The most common way of abusing this knowledge ...

How were window hooks implemented in 16-bit Windows?

The mechanism for keeping track of window hooks was very different in 16-bit Windows. The functions involved were , and . The first two functions still exist today, but the third one has been replaced with a macro: Disclaimer: All code below is "reconstructed from memory". The spirit of the code is intact, but the precise details may be ...