The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts
What’s the opposite of ClipCursor that lets me exclude the cursor from a region?
There is no such feature, but you can just exclude it virtually.
The Microsoft Company Party where everybody played name tag swap
Even the boss got into the festivities.
Rotation revisited: Shuffling more than three blocks, and other small notes
Generalizing the shuffle to arbitrary numbers of blocks.
The back cover of C++: The Programming Language also raises questions not answered by the front cover
Not doing the reading.
Rotation revisited: Avoiding having to calculate the gcd when doing cycle decomposition
Math is hard. Let's go counting!
Rotation revisited: Cycle decomposition in clang’s libcxx
Rotating in the minimum number of steps by performing cycle decomposition.
Rotation revisited: A shocking discovery about gcc’s unidirectional rotation algorithm
We've seen this before.
Rotation revisited: Another unidirectional algorithm
Moving in a straight line, in a different way.
The placeholder name for the Windows 8 experience was “modern”
Modern this and that.
Sharing the result of a single Windows Runtime IAsyncOperation among multiple coroutines, part 3
A variation where we try only once.
Sharing the result of a single Windows Runtime IAsyncOperation among multiple coroutines, part 2
Just let each person take turns trying.
Sharing the result of a single Windows Runtime IAsyncOperation among multiple coroutines, part 1
Caching the result and knowing when the cache is valid.
If C# and JavaScript lets me await a Windows Runtime asynchronous operation more than once, why not C++/WinRT?
A difference in philosophy.
A hypothetical redesign of System.Diagnostics.Process to avoid confusion over properties that are valid only when you are the one who called Start
Putting them in a place that can access only if you call <CODE>Start</CODE>.
Why do you say that a COM STA thread must pump messages if I see sample code creating STA threads and not pumping messages?
You need to pump messages when idle, but maybe you are never idle.
How do I use Win32 structures from the Windows Runtime?
Trick question: You can't. But maybe you can fake it.
The classic TreeView control lets me sort by name or by lParam, but why not both?
You need to arrange to get one from the other.
What is the history of the ERROR_ARENA_TRASHED error code?
The storage control blocks were destroyed.
Just shows that nobody cares about debugging the parity flag any more
Reported incorrectly since the day it was written.
The case of the CreateFileMapping that always reported ERROR_ALREADY_EXISTS
Maybe because it already exists?
A constant-space linear-time algorithm for deleting all but the 10 most recent files in a directory
Using data structures you already knew.
The case of the hang when the user changed keyboard layouts
Keeping things moving.
Why do Windows client editions on 32-bit x86 systems artificially limit RAM to 4 GB?
Compatibility, of course.
Additional notes on controlling which handles are inherited by CreateProcess
Putting the handles in a private container.
Developing more confidence when tracking renames via ReadDirectoryChangesW
You can track the file ID.
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.