The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

What’s up with window message <CODE>0x0091</CODE>? We’re getting it with unexpected parameters
Apr 16, 2026
Post comments count 7
Post likes count 1

What’s up with window message 0x0091? We’re getting it with unexpected parameters

Raymond Chen

Trespassing on system messages.

Why is there a long delay between a thread exiting and the <CODE>Wait­For­Single­Object</CODE> returning?
Apr 15, 2026
Post comments count 0
Post likes count 2

Why is there a long delay between a thread exiting and the Wait­For­Single­Object returning?

Raymond Chen

Maybe it didn't really exit.

Why was there a red telephone at every receptionist desk?
Apr 14, 2026
Post comments count 2
Post likes count 2

Why was there a red telephone at every receptionist desk?

Raymond Chen

Not a direct line to Bill Gates's office.

Finding a duplicated item in an array of <VAR>N</VAR> integers in the range 1 to <VAR>N</VAR> − 1
Apr 13, 2026
Post comments count 6
Post likes count 1

Finding a duplicated item in an array of N integers in the range 1 to N − 1

Raymond Chen

Taking advantage of special characteristics of the array.

How do you add or remove a handle from an active <CODE>Wait­For­Multiple­Objects</CODE>?, part 2
Apr 10, 2026
Post comments count 3
Post likes count 2

How do you add or remove a handle from an active Wait­For­Multiple­Objects?, part 2

Raymond Chen

Waiting for the waiting thread to acknowledge the change.

How do you add or remove a handle from an active <CODE>Wait­For­Multiple­Objects</CODE>?
Apr 9, 2026
Post comments count 4
Post likes count 2

How do you add or remove a handle from an active Wait­For­Multiple­Objects?

Raymond Chen

You can't, but you can cooperate with the other thread.

How do you add or remove a handle from an active <CODE>Msg­Wait­For­Multiple­Objects</CODE>?
Apr 8, 2026
Post comments count 4
Post likes count 2

How do you add or remove a handle from an active Msg­Wait­For­Multiple­Objects?

Raymond Chen

You can't, but you can arrange for the waiter to do it for you.

Were there any Windows 3.1 programs that were so incompatible with Windows 95 that there was no point trying to patch them?
Apr 7, 2026
Post comments count 9
Post likes count 6

Were there any Windows 3.1 programs that were so incompatible with Windows 95 that there was no point trying to patch them?

Raymond Chen

The permanently ineligible list.

Learning to read C++ compiler errors: Illegal use of <TT>-></TT> when there is no <TT>-></TT> in sight
Apr 6, 2026
Post comments count 3
Post likes count 2

Learning to read C++ compiler errors: Illegal use of -> when there is no -> in sight

Raymond Chen

If the compiler is complaining about things you didn't write, find out who wrote them.

How can I use <CODE>Read­Directory­ChangesW</CODE> to know when someone is copying a file out of the directory?
Apr 3, 2026
Post comments count 3
Post likes count 2

How can I use Read­Directory­ChangesW to know when someone is copying a file out of the directory?

Raymond Chen

File copying is not a fundamental operation, nor is it even detectable at the file system layer.

Why doesn’t the system let you declare your own messages to have the same semantics as <CODE>WM_<WBR>COPY­DATA</CODE>?
Apr 2, 2026
Post comments count 0
Post likes count 4

Why doesn’t the system let you declare your own messages to have the same semantics as WM_COPY­DATA?

Raymond Chen

Tempting but misleading.

The cover of <I>C++: The Programming Language</I> raises questions not answered by the cover
Apr 1, 2026
Post comments count 17
Post likes count 14

The cover of C++: The Programming Language raises questions not answered by the cover

Raymond Chen

What are we reading about here?

Before you check if an update caused your problem, check that it wasn’t a problem before the update
Mar 31, 2026
Post comments count 21
Post likes count 4

Before you check if an update caused your problem, check that it wasn’t a problem before the update

Raymond Chen

It was going to be like that when I got here.

A question about the maximimum number of values in a registry key raises questions about the question
Mar 30, 2026
Post comments count 4
Post likes count 3

A question about the maximimum number of values in a registry key raises questions about the question

Raymond Chen

Why is this even a question?

What if a dialog wants to intercept its own message loop?
Mar 27, 2026
Post comments count 1
Post likes count 4

What if a dialog wants to intercept its own message loop?

Raymond Chen

You can steal them from your owner.

Why doesn’t <CODE>WM_<WBR>ENTER­IDLE</CODE> work if the dialog box is a <CODE>Message­Box</CODE>?
Mar 26, 2026
Post comments count 3
Post likes count 3

Why doesn’t WM_ENTER­IDLE work if the dialog box is a Message­Box?

Raymond Chen

Because it opted out.

How can I change a dialog box’s message loop to do a <CODE>Msg­Wait­For­Multiple­Objects</CODE> instead of <CODE>Get­Message</CODE>?
Mar 25, 2026
Post comments count 2
Post likes count 4

How can I change a dialog box’s message loop to do a Msg­Wait­For­Multiple­Objects instead of Get­Message?

Raymond Chen

The dialog box lets you change how it waits.

Windows 95 defenses against installers that overwrite a file with an older version
Mar 24, 2026
Post comments count 6
Post likes count 6

Windows 95 defenses against installers that overwrite a file with an older version

Raymond Chen

A very primitive version of recovery.

How can I make sure the anti-malware software doesn’t terminate my custom service?
Mar 23, 2026
Post comments count 14
Post likes count 4

How can I make sure the anti-malware software doesn’t terminate my custom service?

Raymond Chen

You'll have to ask nicely.

Windows stack limit checking retrospective: arm64, also known as AArch64
Mar 20, 2026
Post comments count 6
Post likes count 2

Windows stack limit checking retrospective: arm64, also known as AArch64

Raymond Chen

Wrapping things up.

Windows stack limit checking retrospective: amd64, also known as x86-64
Mar 19, 2026
Post comments count 8
Post likes count 3

Windows stack limit checking retrospective: amd64, also known as x86-64

Raymond Chen

Reaching the modern day.

Windows stack limit checking retrospective: Alpha AXP
Mar 18, 2026
Post comments count 1
Post likes count 1

Windows stack limit checking retrospective: Alpha AXP

Raymond Chen

Double the size, double the fun.

Windows stack limit checking retrospective: x86-32 also known as i386, second try
Mar 17, 2026
Post comments count 2
Post likes count 4

Windows stack limit checking retrospective: x86-32 also known as i386, second try

Raymond Chen

Appeasing the invisible return address predictor.

Windows stack limit checking retrospective: PowerPC
Mar 16, 2026
Post comments count 0
Post likes count 3

Windows stack limit checking retrospective: PowerPC

Raymond Chen

Doing the math backwards.

Windows stack limit checking retrospective: MIPS
Mar 13, 2026
Post comments count 4
Post likes count 3

Windows stack limit checking retrospective: MIPS

Raymond Chen

Optimizing out the unnecessary probes comes with its own complexity.

Windows stack limit checking retrospective: x86-32, also known as i386
Mar 12, 2026
Post comments count 9
Post likes count 3

Windows stack limit checking retrospective: x86-32, also known as i386

Raymond Chen

One of the weirdest calling conventions you'll see.

How do compilers ensure that large stack allocations do not skip over the guard page?
Mar 11, 2026
Post comments count 6
Post likes count 6

How do compilers ensure that large stack allocations do not skip over the guard page?

Raymond Chen

Don't take steps that are too large.

A snappy answer when asked about dressing casually at IBM
Mar 10, 2026
Post comments count 3
Post likes count 5

A snappy answer when asked about dressing casually at IBM

Raymond Chen

Oh, this old thing?

The fine print giveth and the bold print taketh away: The countdown timer
Mar 9, 2026
Post comments count 8
Post likes count 2

The fine print giveth and the bold print taketh away: The countdown timer

Raymond Chen

Think fast, no pressure.

Learning to read C++ compiler errors: Ambiguous overloaded operator
Mar 9, 2026
Post comments count 2
Post likes count 2

Learning to read C++ compiler errors: Ambiguous overloaded operator

Raymond Chen

Look for the conflicting definitions to see where they are coming from.

When <CODE>Read­Directory­ChangesW</CODE> reports that a deletion occurred, how can I learn more about the deleted thing?
Mar 6, 2026
Post comments count 11
Post likes count 2

When Read­Directory­ChangesW reports that a deletion occurred, how can I learn more about the deleted thing?

Raymond Chen

It's already gone. If you need more information, you should have been remembering it.

The mystery of the posted message that was dispatched before reaching the main message loop
Mar 5, 2026
Post comments count 2
Post likes count 2

The mystery of the posted message that was dispatched before reaching the main message loop

Raymond Chen

Perhaps it's because you dispatched it.

Aha, I found a counterexample to the documentation that says that <CODE>Query­Performance­Counter</CODE> never fails
Mar 4, 2026
Post comments count 6
Post likes count 2

Aha, I found a counterexample to the documentation that says that Query­Performance­Counter never fails

Raymond Chen

Of course, anything can happen if you break the rules.

Just for fun: A survey of write protect notches on floppy disks and other media
Mar 3, 2026
Post comments count 18
Post likes count 2

Just for fun: A survey of write protect notches on floppy disks and other media

Raymond Chen

Just some useless trivia.

What sort of horrible things happen if my dialog has a non-button with the control ID of <CODE>IDCANCEL</CODE>?
Mar 2, 2026
Post comments count 3
Post likes count 1

What sort of horrible things happen if my dialog has a non-button with the control ID of IDCANCEL?

Raymond Chen

You get notifications that might not make sense.

Intercepting messages inside <CODE>Is­Dialog­Message</CODE>, fine-tuning the message filter
Feb 27, 2026
Post comments count 3
Post likes count 2

Intercepting messages inside Is­Dialog­Message, fine-tuning the message filter

Raymond Chen

Making sure it triggers when you need it, and not when you don't.