The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts

Horrifically nasty gotcha: FindResource and FindResourceEx

The old switcheroo.

2014 year-end link clearance

Another round of the semi-annual link clearance.

Even the publishing department had its own Year 2000 preparedness plan

On December 31, 1999, Microsoft Product Support Services were ready in case something horrible happened as the calendar rolled over into the new year. I'm told that Microsoft Press also had its own Year 2000 plan. They staffed their helpline continuously from Friday evening December 31, 1999 all the way through Sunday, January 2, 2000. They did this even though Microsoft Press did not normally staff its helpline ouside normal business hours, and even though all sample code in all publications come with a disclaimer that they are provided "as is" with no warranty. I do not know if they took any calls, but I sus...

How did that program manage to pin itself to my taskbar when I installed it?

Occasionally, somebody will notice that upon installing a program, it managed to pin itself to the taskbar. But just like there is no function, there is also no function, and for the same reason: Because applications would abuse it and auto-pin themselves because they are so awesome, and so that the developer could get a nice bonus. In spite of these roadblocks, some applications manage to pin themselves to the taskbar anyway, typically by programmatically driving the shortcut context menu. The developer then collects their bonus and goes out and gets drunk. There is no real way of blocking this behavior ot...

Integer signum in SSE

The signum function is defined as follows: There are a couple of ways of calculating this in SSE integers. One way is to convert the C idiom The SSE translation of this is mostly straightforward. The quirk is that the SSE comparison functions return −1 to indicate , whereas C uses +1 to represent . But this is easy to take into account: Substituting this into the original function, we get In assembly: With intrinsics: This pattern extends mutatus mutandis to , , and . Another solution is to use the signed minimum and maximum opcodes, using the formula In assembly: With intrinsi...

Debugging walkthrough: Access violation on nonsense instruction

A colleague of mine asked for help puzzling out a mysterious crash dump which arrived via Windows Error Reporting. Well that's a pretty strange instruction. Especially since it doesn't match up with the source code at all. There is no bit-toggling in the actual code. The method calls to , , and are all interface calls and therefore should be vtable calls. We are clearly in a case of a bogus return address, possibly a stack smash (and therefore cause for concern from a security standpoint). My approach was to try to figure out what was happening just before the crash. And that meant figuring out how we ...

My pants are fancy!

During the development of Windows, the User Research team tried out an early build of some proposed changes on volunteers from the general community. During one of the tests, they invited the volunteer to just play around with a particular component, to explore it the way they would at home. The usability subject scrolled around a bit, admired the visuals, selected a few things, and then had an idea to try to customize the component. He fiddled around a bit and quickly discovered the customization feaure. To celebrate his success, he proudly announced in a sing-song sort of way, "My pants are fancy!" That cl...

How can I let my child use an app that I bought from the Windows Store?

If you buy an app from the Windows Store, you can make it available to other users on the same Windows PC. This is useful if you, say, buy an app for your child to use. Here's how you do it. (This is all explained on the Windows Store blog, but I've converted it into a step-by-step and updated it for Windows 8.1.) First, sign on as yourself and install the app under your own account. Next, sign on as the child (or whatever other account you want to share the app with), and launch the Store from that second account. In the Store app, go to the top of the screen and hit Account, then My account. From the My ac...

The Softsel Hot List for the week of December 22, 1986

Look at all that stuff people bought.