The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

What appears superficially to be a line is actually just a one-dimensional mob
Dec 9, 2010
Post comments count 0
Post likes count 0

What appears superficially to be a line is actually just a one-dimensional mob

Raymond Chen
Raymond Chen

In China, queueing is honored more in the breach than in the observance. If you see a line for something, you must understand that what you are seeing is not really a line. It is a one-dimensional mob. You must be prepared to defend your position in line fiercely, because any sign of weakness will be pounced upon, and the next thing you know, five people just cut in front of you. I first became aware of this characteristic of "Chinese queueing theory" while still at the airport. When the gate agents announced that the flight to Beijing had begun boarding, a one-dimensional mob quickly formed, and I naïvely...

We've traced the call and it's coming from inside the house: Grid lines in list view report mode
Dec 9, 2010
Post comments count 0
Post likes count 0

We've traced the call and it's coming from inside the house: Grid lines in list view report mode

Raymond Chen
Raymond Chen

A customer wanted to know how to remove the grid lines from a list view control in report mode. The customer was kind enough to include the source code for the relevant part of the program and drew our attention to the line in the resource file that he believed to be the source of the problem: The customer didn't know it, but that line in the resource file was of no help at all in diagnosing the problem. Fortunately, we found the root cause in the source code provided: The grid lines are there because you explicitly asked for them! The customer accepted this answer without response. One of my colleagues ...

Kindergarten writing exercise from my niece
Dec 8, 2010
Post comments count 0
Post likes count 0

Kindergarten writing exercise from my niece

Raymond Chen
Raymond Chen

When my niece was in kindergarten, a regular classroom assignment was for students to write a few sentences about something happening in their lives. For one of the assignments, my niece wrote the following: My auntie has a baby in her tumy. If it is a boy I will call him Kevin. If it is a grl I will call her Alula. We have no idea where the name "Alula" came from. The baby turned out to be a girl, but her aunt chose a different name. My niece did not hold up her end of the bargain and call her new cousin "Alula". Update: Upon further reflection, I think the proposed boy's name was "Derik", not Kevin. Not i...

It rather involved being on the other side of this airtight hatchway: Invalid parameters from one security level crashing code at the same security level
Dec 8, 2010
Post comments count 0
Post likes count 0

It rather involved being on the other side of this airtight hatchway: Invalid parameters from one security level crashing code at the same security level

Raymond Chen
Raymond Chen

In the category of dubious security vulnerability, I submit the following (paraphrased) report: I have discovered that if you call the function (whose first parameter is supposed to be a pointer to a IUnknown), and instead of passing a valid COM object pointer, you pass a pointer to a random hunk of data, you can trigger an access violation in the function which is exploitable by putting specially-crafted data in that memory blob. An attacker can exploit the function for remote execution and compromise the system, provided an application uses the function and passes a pointer to untrusted data as the firs...

Creative naming in pursuit of subverting the no-fun zone
Dec 7, 2010
Post comments count 0
Post likes count 0

Creative naming in pursuit of subverting the no-fun zone

Raymond Chen
Raymond Chen

For a time, the Information Technology department at Microsoft cracked down on what it believed to be frivolous mailing lists. All mailing lists inside the company had to have a valid business purpose. The nascent wireless networking team found a way to circumvent this rule: They created a mailing list for discussion of non-business topics but officially said that it was for discussing Wireless Networking Interference.

TrackMouseEvent tracks mouse events in your window, but only if the events belong to your window
Dec 6, 2010
Post comments count 0
Post likes count 0

TrackMouseEvent tracks mouse events in your window, but only if the events belong to your window

Raymond Chen
Raymond Chen

Greg Williams wonders why fails to detect mouse hover events when responding to Do­Drag­Drop callbacks. "My suspicion is that monopolizes the window so that a message is never posted, so it won't end up being useful." That's basically it, for the appropriate sense of the word "monopolize." The monitors mouse events that take place in your window and notifies your window when events of interest occur. But this requires that the events actually take place in your window! The function calls so that it can carry out the task of following the mouse anywhere on the screen. Recall that mouse events nor...

ZOMG! This program is using 100% CPU!1! Think of the puppies!!11!!1!1!eleven
Dec 3, 2010
Post comments count 0
Post likes count 0

ZOMG! This program is using 100% CPU!1! Think of the puppies!!11!!1!1!eleven

Raymond Chen
Raymond Chen

Calm down.

The alignment declaration specifier is in bytes, not bits
Dec 2, 2010
Post comments count 0
Post likes count 0

The alignment declaration specifier is in bytes, not bits

Raymond Chen
Raymond Chen

Explicit object alignment is not something most people worry about when writing code, which means that when you decide to worry about it, you may be a bit rusty on how the declarations work. (After all, if it's something you worried about all the time, then you wouldn't have trouble remembering how to do it!) I was looking at some customer code, and there was a class who had a data member with an explicit alignment declaration. I pointed out that the comment didn't match the code. The comment says that the variable needs to be DWORD-aligned (which in Windows-speak means aligned on a 32-bit boundary), but th...

I will be speaking at TechEd China 2010 today
Dec 1, 2010
Post comments count 0
Post likes count 0

I will be speaking at TechEd China 2010 today

Raymond Chen
Raymond Chen

As I've mentioned a few times by now, the way to get me to show up at your event is to invite me. The easiest (i.e. cheapest) way is to hold your event in the Seattle area so that my travel expenses are effectively zero; I just use my bus pass. The folks at TechEd China 2010, on the other hand, had to fly me all the way out to Beijing, which is where I've been this week. Preparing these talks is a lot of work, because each one is different. It's not like I have a "stock presentation" that I give over and over. So even if you invite me, I may decline because I simply don't have the time to write up a new present...