The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Command line tool to manage Windows 7 Libraries, with source code
Aug 28, 2012
Post comments count 0
Post likes count 0

Command line tool to manage Windows 7 Libraries, with source code

Raymond Chen
Raymond Chen

A customer asked if there was a command-line tool for managing Windows 7 Libraries so that they could create and deploy libraries across their organization. Not only is there such a tool, it even comes with source code. The Shell Library Command Line Sample shows how to manage Windows 7 libraries programmatically via the interface. And it's actually a useful program on its own. For example, to see all the folders that are part of your Documents library, use the command Each of the commands has further sub-options. And the source code shows how to perform each of these actions programmati...

Well at least nobody's parking there any more
Aug 28, 2012
Post comments count 0
Post likes count 0

Well at least nobody's parking there any more

Raymond Chen
Raymond Chen

There is a field next to the Microsoft building I used to work in, and for a time, people parked their cars out on the field, presumably because finding a proper parking space in the garage became difficult due to overcrowding. To prevent people from parking in the field, Security placed a large log across the access to the field. The technique worked: Nobody parked in the field any more. Some months later, our building had a fire drill, and everybody dutifully filed out of the building and waited until the all-clear signal was given to return. Normally, people would wait in the field, because that is the design...

How does the taskbar decide whether to show Recent or Frequent documents on the jump list?
Aug 27, 2012
Post comments count 0
Post likes count 0

How does the taskbar decide whether to show Recent or Frequent documents on the jump list?

Raymond Chen
Raymond Chen

Some jump lists show Recent documents, and others show Frequent documents. (Images stolen from Sasha Goldshtein.) Our friend xpclient wanted to know how the taskbar decides which one to use, because it seemed random. (Ironically, xpclient is asking a question about the Window 7 client.) The default is to show Recent documents. But an application can customize its jump list, and in that case, the application can select which category to show based on the guidance in the documentation. (Or the application might choose to ignore the guidance in the documentation and show both.) Okay, but what about Expl...

Dumping a hash table with external chaining from the debugger
Aug 24, 2012
Post comments count 0
Post likes count 0

Dumping a hash table with external chaining from the debugger

Raymond Chen
Raymond Chen

I was doing some crash dump debugging, as I am often called upon to do, and one of the data structure I had to grovel through was something that operated basically like an atom table, so that's what I'll call it. Like an atom table, it manages a collection of strings. You can add a string to the table (getting a unique value back, which we will call an atom), and later you can hand it the atom and it will give you the string back. It looked something like this: (It didn't actually look like this; I've reduced it to the smallest example that still illustrates my point.) As part of my debugging, I had an atom...

Wait, you never said that I had to initialize the object before I used it!
Aug 23, 2012
Post comments count 0
Post likes count 0

Wait, you never said that I had to initialize the object before I used it!

Raymond Chen
Raymond Chen

A customer reported that they were having trouble creating slim reader/writer locks at runtime. They simplified the issue to a short program: "What is the correct way of creating an via the operator?" It wasn't long before somebody noted that nowhere in the code is the function called. "Oh, yeah, thanks for catching that. It looks like one needs to initialize SRW locks which are created via the operator. Otherwise it's not required." No, the function is always required. It's just that you got lucky in the local variable case and the initial stack garbage looks enough like an initialized SRW lock th...

The shifting sands of "Run as different user"
Aug 22, 2012
Post comments count 0
Post likes count 0

The shifting sands of "Run as different user"

Raymond Chen
Raymond Chen

A customer liaison asked the following question on behalf of his customer. When I do a shift-right-click on a shortcut to a program, I see the following: The option to run a program as another user (other than Administrator) was present in Windows XP, but it was lost in Windows Vista. It appears that we responded to those complaints by restoring the functionality in Windows 7. Is that right? The odd thing is that my customer has the Run as different user option available on their Windows 7 machines, but not on their Windows Server 2008 R2 machines. Does whether you have access t...

Sorry we got cut off, my phone just auto-rebooted
Aug 21, 2012
Post comments count 0
Post likes count 0

Sorry we got cut off, my phone just auto-rebooted

Raymond Chen
Raymond Chen

Some time ago, I was on the phone when the connection suddenly cut out. I looked at the my phone display and it said, Auto-restart in 7 seconds. The seconds counted down, and then the phone rebooted, and after about ten more seconds, it was back in business, acting like nothing was wrong. (Except that it just terminated a phone call without warning, but hey, who's keeping track?) Sometimes I think phones are getting too smart for their own good. Historical note: This entry was written over four years ago, and the model of IP phone in question has long since been replaced.

How do I customize how my application windows are grouped in the Taskbar?
Aug 20, 2012
Post comments count 0
Post likes count 0

How do I customize how my application windows are grouped in the Taskbar?

Raymond Chen
Raymond Chen

Benjamin Smedberg wants to know how to customize the icon used in the Taskbar for applications that are grouped, when the application is a runtime for multiple applications. (This is the other scenario I hinted at last time.) Actually, customizing the icon is only part of what you want to happen when your application is a runtime. In that case, you really want each inner application to be exposed to the user as an entirely separate application. In other words, if your application is hosting Product A and Product B, you want the windows for Product A and Product B to group separately, have...

My colleague picked a good day to go out and catch a baseball game
Aug 17, 2012
Post comments count 0
Post likes count 0

My colleague picked a good day to go out and catch a baseball game

Raymond Chen
Raymond Chen

I ran into one of my colleagues at the coffee stand and asked him how things were going. He said that Wednesday was his wife's birthday, and he asked her if she wanted to do anything special. "Let's catch a baseball game," she suggested. So off they went to watch a baseball game. Turns out they chose a good game to watch: Seattle Mariners pitcher Félix Hernández threw a perfect game. (I like how Wikipedia has a page dedicated to the 23rd perfect game in baseball history, but no page for the first perfect game in baseball history. Because Wikipedia covers pop culture prior to 2001 very differently...