The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Mar 11, 2011
Post comments count 0
Post likes count 1

Why does my TIME_ZONE_INFORMATION have the wrong DST cutover date?

Raymond Chen

Public Service Announcement: Daylight Saving Time begins in most parts of the United States this weekend. Other parts of the world may change on a different day from the United States. A customer reported that they were getting incorrect values from the function. I have a program that calls , and it looks like it's returning incorrect DST transition dates. For example, is returning March 2nd as the tzi.DaylightDate value, instead of the Expected March 14th date. The current time zone is Pacific Time. The value returned by (and ) is correct; you're just reading it wrong. As called out in the documentation...

Mar 10, 2011
Post comments count 0
Post likes count 1

How do I create a topmost window that is never covered by other topmost windows?

Raymond Chen

You can't.

Mar 9, 2011
Post comments count 0
Post likes count 1

How to rescue a broken stack trace: Recovering the EBP chain

Raymond Chen

Stack frames are threaded through EBP.

Mar 8, 2011
Post comments count 0
Post likes count 1

Microspeak: Cadence

Raymond Chen

Originally, the term cadence meant the rate at which a regular event recurs, possibly with variations, but with an overall cycle that repeats. For example, the cadence for team meetings might be "Every Monday, with a longer meeting on the last meeting of each month." Project X is on a six-month release cadence, whereas Project Y takes two to three years between releases. Q: What was the cadence of email requests you sent out to drive contributions? A: We started with an announcement in September, with two follow-up messages in the next month. In what I suspect is a case of I want to use this cool...

Mar 7, 2011
Post comments count 0
Post likes count 1

What's the difference between FreeResource and, say, DestroyAcceleratorTable

Raymond Chen

MaxMax asks a number of resource-related questions, starting with "How do you Unlock a Lock­Resource?" and culminating in "What are the differences between and , , etc.? It would be much easier to use a single function instead of a collection of five." It helps if you understand the history of resources, because the functions were designed back when resources were managed very differently from how they are today. The usage pattern is still the same: You unlock a resource by calling, um, . Although the usage pattern is the same, the mechanism under the covers is completely different. In 16-bit Windows,...

Mar 4, 2011
Post comments count 0
Post likes count 1

News flash: Companies change their product to appeal to their customers

Raymond Chen

There was some apparent uproar because there was an industry which "changed the flavoring of their product depending on which market segment they were trying to appeal to." Well duh, don't all industries do this? The reason why this even remotely qualified as news didn't appear until the last five words of the article!

Mar 4, 2011
Post comments count 0
Post likes count 1

The window manager needs a message pump in order to call you back unexpectedly

Raymond Chen

There are a bunch of different ways of asking the window manager to call you when something interesting happens. Some of them are are in response to things that you explicitly asked for right now. The enumeration functions are classic examples of this. If you call and pass a callback function, then that callback is called directly from the enumerator. On the other hand, there is a much larger class of things that are in response either to things that happen on another thread, or in response to things that happen on your thread, but not as a direct result of an immediate request. For example, if you use the fun...

Mar 3, 2011
Post comments count 0
Post likes count 1

If you're waiting for I/O to complete, it helps if you actually have an I/O to begin with

Raymond Chen

We saw earlier the importance of waiting for I/O to complete before freeing the data structures associated with that I/O. On the other hand, before you start waiting, you have to make sure that you have something to wait for. A customer reported a hang in waiting for an I/O to cancel, and the I/O team was brought in to investigate. They looked at the I/O stack and found that the I/O the customer was waiting for was no longer active. The I/O people considered a few possibilities. These possibilities are in increasing order of likelihood (and, perhaps not coincidentally, decreasing order of relevance to th...

Mar 2, 2011
Post comments count 0
Post likes count 0

Charlie Sheen v Muammar Gaddafi: Whose line is it anyway?

Raymond Chen

I got seven out of ten right.