The Old New Thing

2012 mid-year link clearance

Another round of the semi-annual link clearance. And, as always, the obligatory plug for my column in TechNet Magazine...
Comments are closed.0Other

How did real-mode Windows patch up return addresses to discarded code segments?

Last week, I described how real-mode Windows fixed up jumps to functions that got discarded. But what about return addresses to functions that got discarded? The naïve solution would be to allocate a special "return address recovery" function for each return address you found, but that idea comes with its own problems: You are patching ...

You still need the "safe" functions even if you check string lengths ahead of time

Commenter POKE53280,0 claims, "If one validates parameters before using string functions (which quality programmers should do), the 'safe' functions have no reason to exist." Consider the following function: What could possibly go wrong? You check the length of the string, and if it doesn't fit in the buffer, then you reject it. ...
Comments are closed.0Code

How did my hard drive turn into a TARDIS?

A customer observed that the entry for a network drive looked liked this in My Computer, well, except that there was a network drive icon instead of ASCII art. How is it possible for a 2.5GB drive to have 3.81TB free? While there have certainly been examples of Explorer showing confusing values the reason for the strange results was, at ...
Comments are closed.0Other

Thanks for reminding me what to do when the elevator is out of order

Every few years, the building maintenance people have to perform tests on the elevators to ensure they meet safety regulations. And the real estate department sends out the usual notice informing the building occupants that the elevators in the building will be taken out of service at various times during the day. They were kind enough to ...

How does Explorer determine the delay between clicking on an item and initiating an edit?

Ian Boyd wants to know why the specific value of 500ms was chosen as the edit delay in Windows Explorer. Because it's your double-click time. Since the double-click action (execute) is not an extension of the single-click action (edit), Explorer (and more generally, list view) waits for the double-click timeout before entering edit mode so...

How did real-mode Windows fix up jumps to functions that got discarded?

In a discussion of how real-mode Windows walked stacks, commenter Matt wonders about fixing jumps in the rest of the code to the discarded functions. I noted in the original article that "there are multiple parts to the solution" and that stack-walking was just one piece. Today, we'll look at another piece: Inter-segment fixups. Recall ...

When the default pushbutton is invoked, the invoke goes to the top-level dialog

One quirk of nested dialogs lies in what happens when the user presses Enter to invoke the default pushbutton: The resulting WM_COMMAND message goes to the top-level dialog, even if the default pushbutton belongs to a sub-dialog. Why doesn't it send the WM_COMMAND to the parent of the default pushbutton? I mean, the dialog manager knows the...
Comments are closed.0Code

Counting down to the last day of school, as students do it

Today is the last day of school in Seattle public school. My friend the seventh-grade teacher told me that students count down to the last day of school in a rather unusual way. Some people might count the number of calendar days until the end of school. For example, if there are 35 days between today and the last day of school, we say that ...

When embedding a dialog inside another, make sure you don't accidentally create duplicate control IDs

The WS_EX_CONTROL­PARENT extended style (known in dialog templates as DS_CONTROL) instructs the dialog manager that the dialog's children should be promoted into the dialog's parent. This is easier to explain in pictures than in text. Given the following window hierarchy: The result of the WS_EX_CONTROL­PARENT extended style being ...
Comments are closed.0Code