The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts
What’s up with the mysterious inc bp in function prologues of 16-bit code?
A little while ago, we learned about the EBP chain. The EBP chain in 32-bit code is pretty straightforward because there is only one type of function call. But in 16-bit code there are two types of function calls, the near call and the far call. A near call pushes a 16-bit return address on the stack before branching to the function entry point, which must reside in the same code segment as the caller. The function then uses a instruction (a near return) when it wants to return to the caller, indicating that the CPU should resume execution at the specified address within the same code segment. By comparison, ...
Raymond's highly scientific predictions for the 2011 NCAA men's basketball tournament
Once again, it's time for Raymond to come up with an absurd, arbitrary criterion for filling out his NCAA bracket. This year, I look at the strength of the school's football team, on the theory that a school with a strong football team and a strong basketball team has clearly invested a lot in its athletics program. My ranking of football teams is about as scientific as my ranking of basketball teams: (As a special case, USC received its rank of 22 from two years ago, because it was forced to sit out the 2010 season as part of its punishment for "several major rules violations." Now that's what I call dedic...
Why can't Explorer decide what size a file is?
If you open Explorer and highlight a file whose size is a few kilobytes, you can find some file sizes where the Explorer Size column shows a size different from the value shown in the Details pane. What's the deal? Why can't Explorer decide what size a file is? The two displays use different algorithms. The values in the Size column are always given in kilobytes, regardless of the actual file size. File is 15 bytes? Show it in kilobytes. File is 2 gigabytes? Show it in kilobytes. The value shown in the Size column is rounded up to the nearest kilobyte. Your 15-byte file shows up as 1KB. This has been the behav...
The old DEBUG program can load COM files bigger than 64KB, but that doesn't mean they actually load as a program
Some times ago, I described why a corrupted binary sometimes results in the error "Program too big to fit in memory". Commenter Neil was under the impression that nonrelocatable programs files could be larger than 64KB and used the DEBUG command to verify this assertion. While it's true that DEBUG can load files bigger than 64KB, that doesn't mean that they will load as a program. If DEBUG decide that you didn't give it a program (the file extension is not EXE or COM),¹ then it treats the file on the command line as a data file and loads it into memory in its entirety, provided it fits in memory in its en...
Why does my TIME_ZONE_INFORMATION have the wrong DST cutover date?
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...
How do I create a topmost window that is never covered by other topmost windows?
You can't.
How to rescue a broken stack trace: Recovering the EBP chain
Stack frames are threaded through EBP.
Microspeak: Cadence
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...
What's the difference between FreeResource and, say, DestroyAcceleratorTable
MaxMax asks a number of resource-related questions, starting with "How do you Unlock a LockResource?" 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,...