The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Oct 16, 2008
Post comments count 0
Post likes count 1

Psychic debugging: Why your thread is spending all its time processing meaningless thread timers

Raymond Chen

I was looking at one of those "my program is consuming 100% of the CPU and I don't know why" bugs, and upon closer investigation, the proximate reason the program was consuming 100% CPU was that one of the threads was being bombarded with messages where the is . The program was dispatching them as fast as it could, but the messages just kept on coming. Curiously, the for these messages was zero. This should be enough information for you to figure out what is going on. First, you should refresh your memory as to what a null window handle in a message means: These are thread timers, timers which are associ...

Oct 15, 2008
Post comments count 0
Post likes count 0

Possessed: A documentary about hoarding

Raymond Chen

I found Possessed, a short documentary on hoarders, fascinating because I teeter on the brink of hoarding myself and have to fight it. Some days I am more successful than others. Notice how coherently the subjects talk about their obsession. They know it's pathological, but they can't stop themselves. I was able to beat my hoarding of cardboard boxes ("Hey, it'd be a waste to toss these cardboard boxes into the recycle bin; I could re-use it someday, like maybe if I have to mail a package or something") when a friend of mine was moving and needed cardboard boxes to pack up his things. I gladly handed over my s...

Oct 15, 2008
Post comments count 0
Post likes count 1

Disable your wireless network card to speed up VPN’ing

Raymond Chen

As a follow-up to my tip on speeding up connecting via RAS and a SmartCard, I've been told that another trick you can do is to disable your wireless networking card before initiating the VPN connection. Wireless networking cards are a huge attack surface, and the VPN software spends a lot of time trying to secure it. I don't have a wireless networking card on the machine I use at home to connect to the work network, so I haven't tried it, but who knows, maybe it'll work for you.

Oct 14, 2008
Post comments count 0
Post likes count 1

Why does Task Manager let me kill critical system processes?

Raymond Chen

Because you told it to. If you run Task Manager, highlight a critical system process like Winlogon, click End Task, and confirm, then gosh darn it, you just killed Winlogon, and the system will reboot. (Assuming, of course, that you have sufficient privileges to terminate Winlogon in the first place.) Task Manager in earlier versions of Windows would try to stop you from killing these critical system processes, but its algorithm for deciding which processes were critical wasn't very smart, and if you were sufficiently devious, you could fake it out and make your program seemingly unkillable.¹ To avoi...

Oct 13, 2008
Post comments count 0
Post likes count 1

Why does killing Winlogon take down the entire system?

Raymond Chen

Commenter Demeli asks, "Why does Winlogon take down the entire system when you attach a debugger to it? (drwtsn32 -p <pid of Winlogon>)" This question already has a mistaken in it. Running drwtsn32 on a process isn't attaching a debugger to it. Attaching a debugger would be something like , and this does work, assuming you have the necessary privileges, of course. (Indeed, this is how the Windows team debugs problems with Winlogon.) In other words, the literal answer to the question is "No, Winlogon does not take down the entire system when you attach a debugger to it." What does is take a crash dump...

Oct 10, 2008
Post comments count 0
Post likes count 1

How do I suppress the CapsLock warning on password edit controls?

Raymond Chen

One of the features added to version 6 of the shell common controls is a warning balloon that appears if CapsLock is on in a password control. Let's demonstrate. Take the scratch program, add a manifest that requests version 6 of the common controls (perhaps by using a Visual C++ extension), and add the following: BOOL OnCreate(HWND hwnd, LPCREATESTRUCT lpcs) { g_hwndChild = CreateWindow(TEXT("edit"), NULL, ES_PASSWORD | WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hwnd, NULL, g_hinst, 0); if (!g_hwndChild) return FALSE; return TRUE; } Run this program and hit the CapsL...

Oct 9, 2008
Post comments count 0
Post likes count 1

How can I increase the number of files I can open at a time?

Raymond Chen

People who ask this question invariably under-specify the question. They just say, "How can I increase the number of files I can open at a time?" without saying how they're opening them. From the operating system's point of view, the number of files you can open at a time is limited only by available resources. Call until you drop. (This remark applies to local files. When you talk over the network, things get weirder.) The fact that these people are asking the question, however, indicates that they're not using to open the files. They're using some other intermediate layer, and it's that layer that is imp...

Oct 8, 2008
Post comments count 0
Post likes count 1

Why does the Disk Management snap-in report my volume as Healthy when the drive is dying?

Raymond Chen

Windows Vista displays a big scary dialog when the hard drive's on-board circuitry reports that the hardware is starting to fail. Yet if you go to the Disk Management snap-in, it reports that the drive is Healthy. What's up with that? The Disk Management snap-in is interested in the logical structure of the drive. Is the partition table consistent? Is there enough information in the volume to allow the operating system to mount it? It doesn't know about the drive's physical condition. In other words, "As far as the Disk Management snap-in is concerned, the drive is healthy." Similarly, your car's on-board G...

Oct 7, 2008
Post comments count 0
Post likes count 1

Microspeak: Teaming

Raymond Chen

At training sessions, you don't participate in team-building exercises. No, that's old-fashioned terminology, the sort of thing those old stodgy Web 1.0 dinosaurs would say. The new word is teaming. Note: This Microspeak entry was submitted by a colleague from the UK, so it may be peculiar to the UK dialect of Microspeak. Pre-emptive clever comment: Verbing weirds language. [Raymond is currently away; this message was pre-recorded.]