The Old New Thing

Why you should never suspend a thread
Why you should never suspend a thread
It's almost as bad as terminating a thread. Instead of just answering a question, I'm going to ask you the questions and see if you can come up with the answers. Consider the following program, in (gasp) C#: When you run this program and hit Enter to suspend, the program hangs. But if you change the worker function to just "for...
If FlushInstructionCache doesn't do anything, why do you have to call it?
If FlushInstructionCache doesn't do anything, why do you have to call it?
If you look at the implementation of FlushInstructionCache on Windows 95, you'll see that it's just a return instruction. It doesn't actually do anything. So why do you have to call it? Because the act of calling it is the whole point. The control transfers implicit in calling a function suffice to flush the instruction cache on a Pentium. ...
What's with the catcow and dogoldfish?
What's with the catcow and dogoldfish?
Am I the only one who find these icons bizarro? The first time I saw them, I thought the first one was a cow and the second one was a goldfish. But apparently they're a cat and a dog. I never understood the need for these emoticons in the first place. If you need to add a smiley face to indicate that you're joking, then you need to ...
At least she represents the United States faithfully
At least she represents the United States faithfully
The MPR show Marketplace (note: MPR, not NPR) had a brief story about the reaction to China being the host of the Miss World pageant. (Last story on the page.) What I noticed was the comment at timecode 23:50 from Miss World - United States Kim Harlan. (Not to be confused with ...
Why do I have to return this goofy value for WM_DEVICECHANGE?
Why do I have to return this goofy value for WM_DEVICECHANGE?
To deny a device removal query, you must return the special value BROADCAST_QUERY_DENY, which has the curious value 0x424D5144. What's the story behind that? Well, we first tried following the pattern set by WM_QUERYENDSESSION, where returning TRUE allows the operation to proceed and returning FALSE causes the operation to fail. But when we ...
Which access rights bits belong to whom?
Which access rights bits belong to whom?
Each ACE in a security descriptor contains a 32-bit access mask. Which bits belong to whom? The access rights mask is a 32-bit value. The upper 16 bits are defined by the operating system and the lower 16 bits are defined by the object being secured. For example, consider the value 0x00060002 for the access rights mask. This breaks down as ...
Which window style bits belong to whom?
Which window style bits belong to whom?
There are 64 bits of styles in the parameters to CreateWindowEx. Which ones belong to whom? Windows defines the meanings of the high word of the dwStyle parameter and all of the bits in the dwExStyle parameter. The low 16 bits of the dwStyle parameter are defined by the implementor of the window class (by the person who calls RegisterClass...
Which message numbers belong to whom?
Which message numbers belong to whom?
Valid window messages break down into four categories. 0 .. 0x3FF (WM_USER-1): System-defined messages. The meanings of these messages are defined by the operating system and cannot be changed. Do not invent new messages here. Since the meanings are defined by Windows, the operating system understands how to parse the WPARAM and LPARAM ...