The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts
When you upgrade your resource strings to Unicode, don’t forget to specify the L prefix
Otherwise, it'll get mapped back down to the 8-bit code page.
Why not have changes in API behavior depend on the SDK you link against?
Static libraries don't stand a chance.
A dispute over the TAB key highlights a mismatch between Microsoft and IBM organizational structures
I want to speak to your manager.
How do I inform Windows that I’m writing a binary file?
You don't. All files are binary at the file system level.
Developing a cross-process reader/writer lock with limited readers, part 4: Abandonment
Recovering from death of the owner.
Developing a cross-process reader/writer lock with limited readers, part 3: Fairness
Let the exclusive acquisition have a fair chance against shared acquisitions.
Developing a cross-process reader/writer lock with limited readers, part 2: Taking turns when being grabby
Please, not everybody, everything all at once.
Developing a cross-process reader/writer lock with limited readers, part 1: A semaphore
A pot of tokens.
Looking at consequences of passing too few register parameters to a C function on various architectures
It's bad news no matter how you slice it, but Itanium makes it even worse.
Defending against exceptions in a scope_exit RAII type
But maybe it's not worth it.
Another crash caused by uninstaller code injection into Explorer
Inadvertently destroying a staircase while standing on it.
Mapping the page tables into memory via the page tables
So-called "fractal page mapping".
Sure, xor’ing a register with itself is the idiom for zeroing it out, but why not sub?
Somehow xor became the most popular version.
How did code handle 24-bit-per-pixel formats when using video cards with bank-switched memory?
You still have to use aligned accesses, even though the pixels might not be aligned.
Forgotten message from the past: LB_INITSTORAGE
Preallocating memory to avoid quadratic behavior.
What’s up with window message 0x0091? We’re getting it with unexpected parameters
Trespassing on system messages.
Why is there a long delay between a thread exiting and the WaitForSingleObject returning?
Maybe it didn't really exit.
Why was there a red telephone at every receptionist desk?
Not a direct line to Bill Gates's office.
Finding a duplicated item in an array of N integers in the range 1 to N − 1
Taking advantage of special characteristics of the array.
How do you add or remove a handle from an active WaitForMultipleObjects?, part 2
Waiting for the waiting thread to acknowledge the change.
How do you add or remove a handle from an active WaitForMultipleObjects?
You can't, but you can cooperate with the other thread.
How do you add or remove a handle from an active MsgWaitForMultipleObjects?
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?
The permanently ineligible list.
Learning to read C++ compiler errors: Illegal use of -> when there is no -> in sight
If the compiler is complaining about things you didn't write, find out who wrote them.
How can I use ReadDirectoryChangesW to know when someone is copying a file out of the directory?
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 WM_COPYDATA ?
Tempting but misleading.
The cover of C++: The Programming Language raises questions not answered by the cover
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
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
Why is this even a question?
What if a dialog wants to intercept its own message loop?
You can steal them from your owner.
Why doesn’t WM_ENTERIDLE work if the dialog box is a MessageBox?
Because it opted out.
How can I change a dialog box’s message loop to do a MsgWaitForMultipleObjects instead of GetMessage?
The dialog box lets you change how it waits.
Windows 95 defenses against installers that overwrite a file with an older version
A very primitive version of recovery.
How can I make sure the anti-malware software doesn’t terminate my custom service?
You'll have to ask nicely.
Windows stack limit checking retrospective: arm64, also known as AArch64
Wrapping things up.
Windows stack limit checking retrospective: amd64, also known as x86-64
Reaching the modern day.
Windows stack limit checking retrospective: Alpha AXP
Double the size, double the fun.
Windows stack limit checking retrospective: x86-32 also known as i386, second try
Appeasing the invisible return address predictor.
Windows stack limit checking retrospective: PowerPC
Doing the math backwards.
Windows stack limit checking retrospective: MIPS
Optimizing out the unnecessary probes comes with its own complexity.
Windows stack limit checking retrospective: x86-32, also known as i386
One of the weirdest calling conventions you'll see.
How do compilers ensure that large stack allocations do not skip over the guard page?
Don't take steps that are too large.
A snappy answer when asked about dressing casually at IBM
Oh, this old thing?
The fine print giveth and the bold print taketh away: The countdown timer
Think fast, no pressure.
Learning to read C++ compiler errors: Ambiguous overloaded operator
Look for the conflicting definitions to see where they are coming from.
When ReadDirectoryChangesW reports that a deletion occurred, how can I learn more about the deleted thing?
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
Perhaps it's because you dispatched it.
Aha, I found a counterexample to the documentation that says that QueryPerformanceCounter never fails
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
Just some useless trivia.
What sort of horrible things happen if my dialog has a non-button with the control ID of IDCANCEL?
You get notifications that might not make sense.
Intercepting messages inside IsDialogMessage, fine-tuning the message filter
Making sure it triggers when you need it, and not when you don't.
Intercepting messages inside IsDialogMessage, installing the message filter
Using an <CODE>IsDialogMessage</CODE> extension point.
Intercepting messages before IsDialogMessage can process them
Process the message before you let <CODE>IsDialogMessage</CODE> see it.
Customizing the ways the dialog manager dismisses itself: Isolating the Close pathway
Intercepting the flow in your message loop.