The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Jun 15, 2010
Post comments count 0
Post likes count 2

What does the PRE in PREfast stand for?

Raymond Chen

Commenter Jeff asks what the PRE in PREfast stands for. It's an inside joke. The Microsoft Programmer Productivity Research Center (MSPPRC) originally produced a tool called PREfix. Michael Howard put me in touch with the development team, and they explained that it was called PREfix because it helps you fix your bugs before (PRE) you even run the code. The problem with PREfix was that it required monster hardware, and even if you got the hardware up and running, the results took days to generate, and tuning the program's parameters required intricate knowledge of its inner workings. In other words, it was ...

Jun 14, 2010
Post comments count 0
Post likes count 0

Hunting for loopholes in Washington state's driving-while-phoning-or-texting law

Raymond Chen

Last week, a law went into effect in the state of Washington which makes driving while texting or using a hand-held phone a primary offense, meaning that you can be pulled over for doing it. (Previously, it was a secondary offense, which means that the officer must have some other reason for pulling you over.) One of my colleagues studied the new law when it was passed and believes he found a loophole. According to RCW 46.61.667 subsection (2)(c)(i), driving-while-phoning is legal if the driver is using the phone to report illegal activity. My colleague points out that the law does not say whom you have t...

Jun 14, 2010
Post comments count 0
Post likes count 1

Annotating function parameters and using PREfast to check them

Raymond Chen

Via the suggestion box, Sys64738 asks, whether I think is a good C/C++ programming style to add IN and OUT to function prototypes. Remember, this is my opinion. Your opinion may validly differ. I would go beyond just IN and OUT and step up to SAL annotations, which describe the semantics of function parameters in more detail than simply IN and OUT. For example, the annotation lets you specify not only that the buffer is an output parameter, but also lets you specify how big the buffer is. This added expressiveness is used by tools like PREfast and its user-mode equivalent the C/C++ Code Analysis tool. The...

Jun 11, 2010
Post comments count 0
Post likes count 0

My niece asked me what color seashell I would like her to draw

Raymond Chen

My niece was amusing herself by drawing pictures with crayon, and she asked me, "I'm going to draw a seashell for you. What color do you want?" I said, "Blue." She responded, "No."

Jun 11, 2010
Post comments count 0
Post likes count 1

How do I indicate that I want my window to follow right-to-left layout rules?

Raymond Chen

There are many ways, depending on how wide a scope you want. If there is one specific window that you want to follow right-to-left layout rules, then you pass the extended window style when you create the window. This extended style is inherited by child windows, so once you set a top-level window to have right-to-left layout, all child windows will have it, too. To block the extended style from being inherited by child windows, pass the style when you create the parent window. Sidebar: If you're calling the function, then you don't directly control the styles of the top-level window. But there's a weird ba...

Jun 10, 2010
Post comments count 0
Post likes count 1

When you set a 100% CPU program to real-time priority, you get what you asked for

Raymond Chen

Real-time priority is really dangerous. It's higher priority than nearly everything else. It's higher priority than mouse input, keyboard input, and the disk cache. If you foolishly set the priority class of a CPU-intensive program to real-time, it will suck up your entire processor, leaving no cycles for anything else. In particular, since not even input runs at real-time priority, you can't stop it via any interactive means, because the thread that manages input can't even run to process your input. Mind you, even if the input thread did run at real-time priority, that wouldn't really help you any. Sure, it...

Jun 9, 2010
Post comments count 0
Post likes count 1

When you use a term, it helps if you know what the term means

Raymond Chen

Some years ago (in a project far, far away) I received a piece of email from a member of the release management team asking me if a particular issue met the escrow reset bug bar or not, as it applied to an upcoming pre-RTM release. I asked, "What is the current escrow reset bar?" I thought this was a fair question. After all, in order to state whether or not the issue met the escrow reset criteria, I needed to know what the escrow reset criteria were. I figured they'd reply with something like "The escrow reset criteria are on this internal Web page. Please evaluate the issue against those criteria and get bac...

Jun 8, 2010
Post comments count 0
Post likes count 1

Proto-Microspeak: Bug-hugging

Raymond Chen

As they say, "piss or get off the pot."

Jun 7, 2010
Post comments count 0
Post likes count 0

Dum dee dum, just hanging around the European Conference on Computer Supported Co-op… OMG LOOK AT THOSE CUTE DUCKS!

Raymond Chen

The 10th European Conference on Computer Supported Co-operative Work was held in Limerick, Ireland, and as you'd expect there were a lot of speakers and breakout sessions and... oh my God, look at those cute ducks!