The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Apr 24, 2026
Post comments count 3
Post likes count 2

Defending against exceptions in a scope_exit RAII type

Raymond Chen

But maybe it's not worth it.

Apr 23, 2026
Post comments count 12
Post likes count 2

Another crash caused by uninstaller code injection into Explorer

Raymond Chen

Inadvertently destroying a staircase while standing on it.

Apr 22, 2026
Post comments count 2
Post likes count 3

Mapping the page tables into memory via the page tables

Raymond Chen

So-called "fractal page mapping".

Apr 21, 2026
Post comments count 28
Post likes count 3

Sure, xor’ing a register with itself is the idiom for zeroing it out, but why not sub?

Raymond Chen

Somehow xor became the most popular version.

Apr 20, 2026
Post comments count 1
Post likes count 3

How did code handle 24-bit-per-pixel formats when using video cards with bank-switched memory?

Raymond Chen

You still have to use aligned accesses, even though the pixels might not be aligned.

Apr 17, 2026
Post comments count 1
Post likes count 4

Forgotten message from the past: LB_INIT­STORAGE

Raymond Chen

Preallocating memory to avoid quadratic behavior.

Apr 16, 2026
Post comments count 9
Post likes count 2

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

Raymond Chen

Trespassing on system messages.

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.

Apr 14, 2026
Post comments count 2
Post likes count 3

Why was there a red telephone at every receptionist desk?

Raymond Chen

Not a direct line to Bill Gates's office.

Apr 13, 2026
Post comments count 8
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.

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.

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.

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.

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.

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.

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.

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.

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?

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.

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?

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.

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.

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.

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.

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.

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.

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.

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.

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.

Mar 16, 2026
Post comments count 0
Post likes count 3

Windows stack limit checking retrospective: PowerPC

Raymond Chen

Doing the math backwards.

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.

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.

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.

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?

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.

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.

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.

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.

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.

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.

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.

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.

Feb 26, 2026
Post comments count 1
Post likes count 2

Intercepting messages inside Is­Dialog­Message, installing the message filter

Raymond Chen

Using an <CODE>Is­Dialog­Message</CODE> extension point.

Feb 25, 2026
Post comments count 4
Post likes count 1

Intercepting messages before Is­Dialog­Message can process them

Raymond Chen

Process the message before you let <CODE>Is­Dialog­Message</CODE> see it.

Feb 24, 2026
Post comments count 2
Post likes count 2

Customizing the ways the dialog manager dismisses itself: Isolating the Close pathway

Raymond Chen

Intercepting the flow in your message loop.

Feb 23, 2026
Post comments count 0
Post likes count 2

Customizing the ways the dialog manager dismisses itself: Detecting the ESC key, second (failed) attempt

Raymond Chen

Sniffing the synchronous keyboard state is still not precise enough.

Feb 20, 2026
Post comments count 0
Post likes count 0

The 2026/2027 Seattle Symphony subscription season at a glance

Raymond Chen

The pocket reference guide for 2026/2027.

Feb 20, 2026
Post comments count 12
Post likes count 3

Customizing the ways the dialog manager dismisses itself: Detecting the ESC key, first (failed) attempt

Raymond Chen

Sniffing the asynchronous keyboard state.

Feb 19, 2026
Post comments count 1
Post likes count 6

Exploring the signals the dialog manager uses for dismissing a dialog

Raymond Chen

Summarizing the flow.

Feb 18, 2026
Post comments count 3
Post likes count 2

Could Write­Process­Memory be made faster by avoiding the intermediate buffer?

Raymond Chen

I guess it could, but why bother?

Feb 17, 2026
Post comments count 8
Post likes count 2

Microspeak: Escrow

Raymond Chen

Final build, final, final, final 2, ship this one.

Feb 16, 2026
Post comments count 10
Post likes count 2

It rather involved being on the other side of the airtight hatchway: Tricking(?) a program into reading files

Raymond Chen

Is it really a trick when reading the file is the purpose of the program?

Feb 13, 2026
Post comments count 10
Post likes count 4

How can I distinguish between the numeric keypad 0 and the top-row 0 in the WM_CHAR message?

Raymond Chen

See if it matches the scan code.

Feb 12, 2026
Post comments count 2
Post likes count 3

How can I distinguish between the numeric keypad 0 and the top-row 0 in the WM_KEY­DOWN message?

Raymond Chen

Check whether it is an extended key.

Feb 11, 2026
Post comments count 0
Post likes count 4

How do I suppress the hover effects when I put a Win32 common controls ListView in single-click mode?

Raymond Chen

You can prevent the item from becoming hot-tracked.

Feb 10, 2026
Post comments count 11
Post likes count 6

How did Windows 95 get permission to put the Weezer video Buddy Holly on the CD?

Raymond Chen

Asking nicely, and asking a lot of people.

Feb 9, 2026
Post comments count 3
Post likes count 3

What should I do if a wait call reports WAIT_ABANDONED?

Raymond Chen

It's your one chance to make amends.

Feb 6, 2026
Post comments count 1
Post likes count 3

How can I prevent the user from changing the widths of ListView columns in version 5 of the common controls?, part 2

Raymond Chen

Preventing the resize cursor from appearing.

Feb 5, 2026
Post comments count 6
Post likes count 2

How can I prevent the user from changing the widths of ListView columns in version 5 of the common controls?

Raymond Chen

Deny changes to the width.

Feb 4, 2026
Post comments count 2
Post likes count 1

Super Bowl LX creates an opportunity for symphonic friendly wagering

Raymond Chen

Betting classical music.

Feb 4, 2026
Post comments count 3
Post likes count 2

How can I prevent the user from changing the widths of ListView columns?

Raymond Chen

You can ask the header to be non-resizing.

Feb 3, 2026
Post comments count 0
Post likes count 8

Some small stories about the giant satellite dish antenna that was behind Microsoft Building 11

Raymond Chen

A little trivia.

Feb 2, 2026
Post comments count 5
Post likes count 2

Studying compiler error messages closely: Input file paths

Raymond Chen

Are you even compiling the correct file?

Jan 30, 2026
Post comments count 1
Post likes count 1

Why not store the SAFEARRAY reference count as a hidden allocation next to the SAFEARRAY?

Raymond Chen

The case of "Bring your own <CODE>SAFEARRAY</CODE>."

Jan 29, 2026
Post comments count 1
Post likes count 2

How can I retain access to the data in a SAFEARRAY after my method returns?

Raymond Chen

Find a way to take ownership.

Jan 28, 2026
Post comments count 0
Post likes count 1

Why did I lose the data even though I called Safe­Array­Add­Ref?

Raymond Chen

You have to use the original pointer, but even that won't be good enough.

Jan 27, 2026
Post comments count 2
Post likes count 2

A digression on the design and implementation of Safe­Array­Add­Ref and extending APIs in general

Raymond Chen

The concerns when adding a feature to an existing API.

Jan 26, 2026
Post comments count 0
Post likes count 3

What’s the difference between Safe­Array­Access­Data and Safe­Array­Add­Ref?

Raymond Chen

Two ways of preserving the data.

Jan 23, 2026
Post comments count 15
Post likes count 6

C++ has scope_exit for running code at scope exit. C# says “We have scope_exit at home.”

Raymond Chen

You can wrap it in an <CODE>IDisposable</CODE>.

Jan 22, 2026
Post comments count 6
Post likes count 3

A simple helper function for attaching a progress handler to a Windows Runtime IAsync­Action­With­Progress or IAsync­Operation­With­Progress

Raymond Chen

It doesn't do much, but it saves typing.

Jan 21, 2026
Post comments count 2
Post likes count 2

On the proper usage of a custom Win32 dialog class

Raymond Chen

You are replacing the window procedure, not the dialog procedure.

Jan 20, 2026
Post comments count 5
Post likes count 2

Microspeak: On fire, putting out fires

Raymond Chen

Dealing with emergencies.

Jan 19, 2026
Post comments count 8
Post likes count 7

What was the secret sauce that allows for a faster restart of Windows 95 if you hold the shift key?

Raymond Chen

An old flag from 16-bit Windows.

Jan 16, 2026
Post comments count 1
Post likes count 2

How can I get the tab index number from a dialog box control?

Raymond Chen

The tab index number is an authoring concept, not a runtime concept.

Jan 15, 2026
Post comments count 26
Post likes count 4

When programs assume that the system will never change, episode 4: Stealing strings

Raymond Chen

The strings are an implementation detail.

Jan 14, 2026
Post comments count 0
Post likes count 1

Clipping the focus item when looking for its on-screen location, part 3

Raymond Chen

Finding <I>all</I> the clipping parents.

Jan 13, 2026
Post comments count 1
Post likes count 2

Clipping the focus item when looking for its on-screen location, part 2

Raymond Chen

Finding the correct clipping parent.

Jan 12, 2026
Post comments count 0
Post likes count 2

Clipping the focus item when looking for its on-screen location

Raymond Chen

Preventing the cursor from pointing to nothing.

Jan 9, 2026
Post comments count 1
Post likes count 1

Using Active Accessibility to find out where the focus item is

Raymond Chen

Looking at child objects.

Jan 8, 2026
Post comments count 4
Post likes count 2

Using Active Accessibility to find out where the Windows caret is

Raymond Chen

It's old and rather simple, but we like simple.

Jan 7, 2026
Post comments count 1
Post likes count 1

How can I find out where the Windows caret is?

Raymond Chen

You'll have go to a larger scope.

Jan 6, 2026
Post comments count 1
Post likes count 2

Swapping two blocks of memory that reside inside a larger block, in constant memory, refinement

Raymond Chen

Could do with a little less rotating.

Jan 5, 2026
Post comments count 1
Post likes count 3

How can you swap two non-adjacent blocks of memory using only forward iterators?

Raymond Chen

Applying the rotation trick to our new problem.

Jan 2, 2026
Post comments count 0
Post likes count 2

How can you swap two adjacent blocks of memory using only forward iterators?

Raymond Chen

A different algorithm, employing a different kind of cleverness.

Jan 1, 2026
Post comments count 10
Post likes count 2

Swapping two blocks of memory that reside inside a larger block, in constant memory

Raymond Chen

A variation on the constant-memory rotation.

Dec 31, 2025
Post comments count 5
Post likes count 2

2025 year-end link clearance

Raymond Chen

Another year gets relegated to history.

Dec 31, 2025
Post comments count 1
Post likes count 2

Understanding and mitigating a stack overflow in our task sequencer

Raymond Chen

The recurring problem of synchronous resumption.

Dec 30, 2025
Post comments count 6
Post likes count 3

Additional notes on color-keyed overlays as a way of doing smooth video rendering

Raymond Chen

Choosing the color-key and other brief discussions.

Dec 29, 2025
Post comments count 3
Post likes count 2

The Gävle Goat (Gävlebocken) succumbs in 2025 to a new menace

Raymond Chen

You could blow me over.

Dec 29, 2025
Post comments count 3
Post likes count 2

How can I detect that the system is running low on memory? Or that my job is running low on memory?

Raymond Chen

You can register for a memory notification.

Dec 26, 2025
Post comments count 7
Post likes count 4

Why are we worried about memory access semantics? Full barriers should be enough for anybody

Raymond Chen

You have to find new ways of going faster.

Dec 25, 2025
Post comments count 4
Post likes count 3

Reading the fine print, episode 4: Holiday promotions

Raymond Chen

Checking those validity dates.

Dec 25, 2025
Post comments count 0
Post likes count 3

Why is the last letter of my string not making it to the clipboard?

Raymond Chen

The struggle for null termination.

Dec 24, 2025
Post comments count 1
Post likes count 5

Why does my Ctrl+M accelerator key activate when I press the Enter key?

Raymond Chen

Understanding the difference between keys and characters for accelerators.

Dec 23, 2025
Post comments count 4
Post likes count 5

When irate product support customers demand to speak to Bill Gates

Raymond Chen

So transfer them to his office, or so it seems.

Dec 22, 2025
Post comments count 27
Post likes count 9

All the other cool languages have tryfinally. C++ says “We have tryfinally at home.”

Raymond Chen

The destructor serves as the "finally".

Dec 19, 2025
Post comments count 9
Post likes count 3

A shortcut gives me a weird path for a program shortcut that doesn’t point to the executable, so what is it?

Raymond Chen

It's a placeholder because the shortcut is to an MSI application.

Dec 18, 2025
Post comments count 10
Post likes count 4

Concluding thoughts on our deep dive into Windows clipboard text conversion

Raymond Chen

Stick to Unicode and you'll be fine.

Dec 17, 2025
Post comments count 3
Post likes count 4

Deducing the consequences of Windows clipboard text formats on UTF-8

Raymond Chen

Working out the implications.

Dec 16, 2025
Post comments count 3
Post likes count 2

Why is the Windows clipboard taking the scenic route when converting from CF_TEXT to CF_OEM­TEXT?

Raymond Chen

Something is forcing it down an alternate path.

Dec 15, 2025
Post comments count 3
Post likes count 1

Misunderstanding what the Cricket Celebration Bowl is

Raymond Chen

Apparently, not a bowl of crickets.

Dec 15, 2025
Post comments count 1
Post likes count 4

The Windows clipboard automatic text conversion algorithm is path-dependent

Raymond Chen

When the journey is not half of the fun.

Dec 12, 2025
Post comments count 8
Post likes count 3

Resolving an ambiguity in the Windows clipboard automated text conversion table

Raymond Chen

Who goes first?

Dec 11, 2025
Post comments count 11
Post likes count 3

Studying the various locale mismatch scenarios in Windows clipboard text format synthesis

Raymond Chen

If they don't match, then the 8-bit strings are basically broken already.

Dec 10, 2025
Post comments count 1
Post likes count 1

How does Windows synthesize the CF_LOCALE clipboard format?

Raymond Chen

Getting it from a place that might have been obvious in the past, but maybe not today.

Dec 9, 2025
Post comments count 2
Post likes count 2

How does Windows synthesize CF_UNICODE­TEXT from CF_TEXT and vice versa?

Raymond Chen

Let's ask the locale.

Dec 8, 2025
Post comments count 11
Post likes count 3

How does Windows synthesize CF_OEM­TEXT from CF_TEXT and vice versa?

Raymond Chen

Starting with the easy case, or at least it looks easy.

Dec 5, 2025
Post comments count 11
Post likes count 3

How can my process read its own standard output?

Raymond Chen

You'll have to trick yourself before anybody notices, which may not be possible.

Dec 4, 2025
Post comments count 5
Post likes count 1

How can I read the standard output of an already-running process?

Raymond Chen

You can't. You'll have to do it before the process starts.

Dec 3, 2025
Post comments count 6
Post likes count 5

How do I check whether the user has permission to create files in a directory?

Raymond Chen

Request the directory security attributes that correspond to your proposed operation.

Dec 2, 2025
Post comments count 3
Post likes count 2

Microspeak: Big rocks

Raymond Chen

The large obstacles.

Dec 1, 2025
Post comments count 0
Post likes count 2

How do I get my edit control text to be autoselected when I choose it to be the default focus in my dialog?

Raymond Chen

Remembering some old APIs.

Nov 28, 2025
Post comments count 8
Post likes count 5

How can I have a Win32 drop-down combo box with a read-only edit control?

Raymond Chen

You can ask for its handle and mark it read-only.

Nov 27, 2025
Post comments count 3
Post likes count 5

Message-only windows are for messaging, not as a convenient victim for hosting UI

Raymond Chen

If you want to host UI, use a real window (possibly hidden).

Nov 26, 2025
Post comments count 9
Post likes count 2

At what point in the Windows development cycle is it too late to change the text of a translatable string?

Raymond Chen

The translation team sets the deadline.

Nov 25, 2025
Post comments count 7
Post likes count 5

The apocryphal origins of the Hot Dog Stand color scheme

Raymond Chen

Challenge accepted.

Nov 24, 2025
Post comments count 5
Post likes count 4

Why does XAML break down when I have an element that is half a billion pixels tall?

Raymond Chen

You've far exceeded the design goals and have even exceeded the expressive ability of a float.

Nov 21, 2025
Post comments count 6
Post likes count 2

Maybe somebody can explain to me how weak references solve the ODR problem

Raymond Chen

I don't see it.

Nov 20, 2025
Post comments count 11
Post likes count 3

In the commit-on-demand pattern, what happens if an access violation straddles multiple pages?

Raymond Chen

The access violation exceptions will continue until commit improves.

Nov 19, 2025
Post comments count 3
Post likes count 8

Is Write­Process­Memory faster than shared memory for transferring data between two processes?

Raymond Chen

Shared memory is the copy-free solution.

Nov 18, 2025
Post comments count 1
Post likes count 5

Microspeak: Little-r

Raymond Chen

Harkening back to a very old mail program.

Nov 17, 2025
Post comments count 21
Post likes count 3

How can I detect that Windows is running in S-Mode, redux

Raymond Chen

Doing it on hard mode.

Nov 14, 2025
Post comments count 9
Post likes count 3

I can use WM_COPYDATA to send a block of data to another window, but how does it send data back?

Raymond Chen

They can send it back with their own <CODE>WM_<WBR>COPY­DATA</CODE> message, or they can put it in an agreed-upon shared location.

Nov 13, 2025
Post comments count 4
Post likes count 2

Could we use CTAD to simplify the use of WRL’s Callback function?

Raymond Chen

Not directly, but maybe indirectly.

Nov 12, 2025
Post comments count 5
Post likes count 6

Non-recursively deleting a binary tree in constant space: Rotating the tree

Raymond Chen

Preserving in-order while linearizing.

Nov 11, 2025
Post comments count 7
Post likes count 5

Behind the scenes on how Windows 95 application compatibility patched broken programs

Raymond Chen

Replacing bytes with the greatest of care.

Nov 10, 2025
Post comments count 0
Post likes count 2

How did Windows 3.1 distinguish two different programs that happened to share the same executable name?

Raymond Chen

The trouble with disambiguation.

Nov 7, 2025
Post comments count 3
Post likes count 1

Non-recursively deleting a binary tree in constant space: Restructuring the tree

Raymond Chen

Changing the tree structure to make it easier to delete.

Nov 6, 2025
Post comments count 3
Post likes count 1

Non-recursively deleting a binary tree in constant space: Synthesizing the parent pointer

Raymond Chen

Making one as you go.

Nov 5, 2025
Post comments count 11
Post likes count 2

Non-recursively deleting a binary tree in constant space: Traversal with parent pointers

Raymond Chen

First assume that you have a parent pointer.

Nov 4, 2025
Post comments count 4
Post likes count 3

The Microsoft SoftCard for the Apple II: Getting two processors to share the same memory

Raymond Chen

Reportedly Microsoft's first hardware product.

Nov 3, 2025
Post comments count 3
Post likes count 2

Why does SHFormat­Date­Time take an unaligned FILETIME?

Raymond Chen

Designed for its original use case.

Oct 31, 2025
Post comments count 4
Post likes count 1

Microspeak: turn into a pumpkin

Raymond Chen

To disappear, such as for the year-end holidays.

Oct 30, 2025
Post comments count 8
Post likes count 3

Trying to build a XAML tree in code throws a “No installed components were detected” exception

Raymond Chen

An unfortunate error code collision, but the explanatory text leads the way.

Oct 29, 2025
Post comments count 2
Post likes count 2

What to do when you have a crash in the runtime control flow guard check

Raymond Chen

You don't have to understand it, but you should be able to extract data from it.

Oct 28, 2025
Post comments count 18
Post likes count 10

How did the Windows 95 user interface code get brought to the Windows NT code base?

Raymond Chen

Ported bit by bit.

Oct 27, 2025
Post comments count 11
Post likes count 5

Dubious security vulnerability: Denial of service by loading a very large file

Raymond Chen

I mean, it's what you asked it to do.

Oct 24, 2025
Post comments count 0
Post likes count 2

The early history of the Windows Runtime PropertyValue and why there is a PropertyType.Inspectable that is never used

Raymond Chen

It used to be there because PropertyValue started out as the fundamental variant type before shifting focus to being the fundamental boxed type.

Oct 23, 2025
Post comments count 0
Post likes count 3

Windows Runtime design principle: Properties can be set in any order

Raymond Chen

If all you're doing is setting properties, you can do it any way you like.

Oct 22, 2025
Post comments count 7
Post likes count 3

What makes cheap_steady_clock faster than std::chrono::high_resolution_clock?

Raymond Chen

It's quite a bit faster, though maybe you don't care.

Oct 21, 2025
Post comments count 1
Post likes count 2

Microspeak: The hockey stick on wheels

Raymond Chen

You're always a year away.

Oct 20, 2025
Post comments count 15
Post likes count 6

What about the icons in pifmgr.dll?

Raymond Chen

Just for fun.

Oct 17, 2025
Post comments count 2
Post likes count 2

Using RAII to remedy a defect where not all code paths performed required exit actions, follow-up

Raymond Chen

If the callback requires copyability.

Oct 16, 2025
Post comments count 9
Post likes count 5

Using RAII to remedy a defect where not all code paths performed required exit actions

Raymond Chen

Passing the obligation onward.

Oct 15, 2025
Post comments count 10
Post likes count 4

Why can you increment a reference count with relaxed semantics, but you have to decrement with release semantics?

Raymond Chen

It's more important to clean up when you leave.

Oct 14, 2025
Post comments count 12
Post likes count 6

I remember taking a screen shot of a video, and when I opened it in Paint, the video was playing in it! What witchcraft is this?

Raymond Chen

You copied the green screen.

Oct 13, 2025
Post comments count 4
Post likes count 3

API design principle: Don’t tempt people to divide by zero

Raymond Chen

Remove it from the equation.

Oct 10, 2025
Post comments count 5
Post likes count 2

The self-assignment principle for Windows Runtime properties: Don’t change behavior based on whether a property has been written to

Raymond Chen

The fact that a property has been set does not by itself trigger functionality.

Oct 9, 2025
Post comments count 4
Post likes count 2

The self-assignment principle for Windows Runtime properties applies to default values

Raymond Chen

The default value must be legal.

Oct 8, 2025
Post comments count 7
Post likes count 2

Windows Runtime API design principles around read-write properties: Idempotence and self-assignment

Raymond Chen

Setting it to the value it already has is not a crime.

Oct 7, 2025
Post comments count 6
Post likes count 2

Remembering the end of support for VRML in Internet Explorer

Raymond Chen

No one left standing.

Oct 6, 2025
Post comments count 10
Post likes count 3

Code comments should apply to the state of the system at the point the comment “executes”

Raymond Chen

Putting them in the flow.

Oct 3, 2025
Post comments count 2
Post likes count 2

Can we get weak functions for static linking? The Visual C++ compiler says “We have weak functions at home”

Raymond Chen

It's already there, just under a different paradigm.

Oct 2, 2025
Post comments count 0
Post likes count 1

The problem with inferring from a function call operator is that there may be more than one

Raymond Chen

<CODE>auto</CODE> parameters make this easy to write, particularly for lambdas.

Oct 1, 2025
Post comments count 1
Post likes count 3

How do I convert a FILETIME to a C++ clock like std::system_clock or winrt::clock?

Raymond Chen

The <CODE>winrt::clock</CODE> has a conversion for you.

Sep 30, 2025
Post comments count 9
Post likes count 1

Microspeak: Convicted

Raymond Chen

False backformation.

Sep 29, 2025
Post comments count 1
Post likes count 3

How can I enumerate the overflow icons in the Notification Area without showing them?

Raymond Chen

If they aren't shown, then they aren't automatable, so there's no requirement that they exist in the UI automation tree.

Sep 26, 2025
Post comments count 9
Post likes count 6

Why didn’t Windows 95 setup install a miniature Windows 95 so that it could be written as a 32-bit program?

Raymond Chen

Getting to the GUI quickly, and rebooting only once.

Sep 25, 2025
Post comments count 8
Post likes count 4

Samples note: Use comments to describe what code does, not what you wish the code would do

Raymond Chen

Comments explain the code. They are not substitutes for the code.

Sep 24, 2025
Post comments count 13
Post likes count 8

Why is Windows still tinkering with critical sections?

Raymond Chen

The critical section may be an old dog, but it's still learning new tricks.

Sep 23, 2025
Post comments count 2
Post likes count 1

Another lesson learned from the Windows 98 on-stage USB blue screen

Raymond Chen

Test before using.

Sep 22, 2025
Post comments count 11
Post likes count 4

Why was Windows 3.0’s WinHelp called an online help system when it ran offline?

Raymond Chen

It was online in a different sense.

Sep 19, 2025
Post comments count 1
Post likes count 1

Learning to read C++ compiler errors: Not a legal base class

Raymond Chen

What would make it an illegal base class?

Sep 18, 2025
Post comments count 6
Post likes count 2

Can I close a duplicate handle while I’m waiting on the original?

Raymond Chen

That's fine, since you're not closing the handle that you're waiting on.

Sep 17, 2025
Post comments count 1
Post likes count 2

How can I get my shell thumbnail extractors to run in the same process?

Raymond Chen

Adding another level of indirection.

Sep 16, 2025
Post comments count 7
Post likes count 3

Translating the STATUS_STACK_BUFFER_OVERRUN status code into customer-ready text

Raymond Chen

Reducing the level of alarm.

Sep 15, 2025
Post comments count 14
Post likes count 9

Why is the name of the Microsoft Wireless Notebook Presenter Mouse 8000 hard-coded into the Bluetooth drivers?

Raymond Chen

Is it some sort of favoritism?

Sep 12, 2025
Post comments count 4
Post likes count 5

How can I convert a third party in-process server so it runs in the COM surrogate?

Raymond Chen

You can put your own object in the surrogate first.

Sep 11, 2025
Post comments count 4
Post likes count 1

Why can’t std::apply figure out which overload I intend to use? Only one of then will work!

Raymond Chen

The overload resolution happens before the compiler knows what it's going to be used for.

Sep 10, 2025
Post comments count 7
Post likes count 3

The documentation says that CompanyName version information is required, but my program seems to work without it, so how required is it?

Raymond Chen

It's more of a "Very strongly recommended" than a "Required".

Sep 9, 2025
Post comments count 11
Post likes count 3

A suggestion to people who assign nicknames to meeting rooms

Raymond Chen

Lean into the pattern. Don't try to cross it up.

Sep 8, 2025
Post comments count 15
Post likes count 1

Why didn’t Windows 95 simply special-case the laptops that locked up when it executed the HLT instruction?

Raymond Chen

The catastrophic risk of bricking a computer.

Sep 5, 2025
Post comments count 2
Post likes count 1

The case of the crash on a null pointer even though we checked it for null

Raymond Chen

Understanding what you're checking.

Sep 4, 2025
Post comments count 1
Post likes count 3

How can I write a C++/WinRT IAsyncOperation<T> where T is not a Windows Runtime type?, part 2

Raymond Chen

Safer smuggling.

Sep 3, 2025
Post comments count 1
Post likes count 3

How can I write a C++/WinRT IAsyncOperation<T> where T is not a Windows Runtime type?, part 1

Raymond Chen

It's not representable in the Windows Runtime, but you can smuggle it.

Sep 2, 2025
Post comments count 7
Post likes count 1

Dubious security vulnerability: Remembering passwords for recently-opened ZIP files

Raymond Chen

If it didn't remember them, you wouldn't like it.

Sep 1, 2025
Post comments count 4
Post likes count 1

Thoughts on creating a tracking pointer class, part 16: Second attempt to use a list

Raymond Chen

We can splice nodes to move them between lists.

Aug 29, 2025
Post comments count 2
Post likes count 1

Thoughts on creating a tracking pointer class, part 15: A custom shared pointer

Raymond Chen

Simplifying it for out limited use case.

Aug 28, 2025
Post comments count 2
Post likes count 1

Thoughts on creating a tracking pointer class, part 14: Nonthrowing moves with the shared tracking pointer

Raymond Chen

Moving the exception somewhere else.

Aug 27, 2025
Post comments count 0
Post likes count 1

Thoughts on creating a tracking pointer class, part 13: Restoring the strong exception guarantee

Raymond Chen

Don't commit to anything until you know you can finish the job.

Aug 26, 2025
Post comments count 0
Post likes count 1

Thoughts on creating a tracking pointer class, part 12: A shared tracking pointer

Raymond Chen

Sharing a single tracking pointer among all instances.

Aug 25, 2025
Post comments count 0
Post likes count 1

Thoughts on creating a tracking pointer class, part 11: Repairing assignment

Raymond Chen

Restoring things that were automatically deleted.

Aug 22, 2025
Post comments count 0
Post likes count 1

Thoughts on creating a tracking pointer class, part 10: Proper conversion

Raymond Chen

Making sure you cannot remove qualifiers.

Aug 21, 2025
Post comments count 0
Post likes count 1

Thoughts on creating a tracking pointer class, part 9: Conversion

Raymond Chen

Making a read-only tracking pointer from a read-write tracking pointer.

Aug 20, 2025
Post comments count 1
Post likes count 1

Thoughts on creating a tracking pointer class, part 8: Tracking const objects

Raymond Chen

Making tracking pointers to const objects.

Aug 19, 2025
Post comments count 1
Post likes count 1

Thoughts on creating a tracking pointer class, part 7: Non-modifying trackers, second try

Raymond Chen

Another attempt to make tracking pointers to objects that you can't modify.

Aug 18, 2025
Post comments count 0
Post likes count 1

Thoughts on creating a tracking pointer class, part 6: Non-modifying trackers

Raymond Chen

Making tracking pointers to objects that you can't modify.

Aug 15, 2025
Post comments count 2
Post likes count 2

Thoughts on creating a tracking pointer class, part 5: Copying our tracking pointer

Raymond Chen

How to copy from a const tracking pointer.

Aug 14, 2025
Post comments count 0
Post likes count 2

Thoughts on creating a tracking pointer class, part 4: Using a circular doubly linked list

Raymond Chen

Building our own circular doubly-linked list.

Aug 13, 2025
Post comments count 0
Post likes count 2

Thoughts on creating a tracking pointer class, part 3: Using a std::vector

Raymond Chen

Tracking your trackers with a vector.

Aug 12, 2025
Post comments count 3
Post likes count 2

Thoughts on creating a tracking pointer class, part 2: Using a std::list

Raymond Chen

Tracking your trackers with a <CODE>std::list</CODE>.

Aug 11, 2025
Post comments count 1
Post likes count 3

Thoughts on creating a tracking pointer class, part 1: Concept art

Raymond Chen

Following an object as it moves.

Aug 8, 2025
Post comments count 7
Post likes count 4

Under what conditions could a Read­File or Write­File fail to transfer all of the bytes, and how do I detect that?

Raymond Chen

If there is not enough data to read, or not room to write.

Aug 7, 2025
Post comments count 11
Post likes count 4

How can I detect that Windows is running in S-Mode?

Raymond Chen

Check the code integrity policy.

Aug 6, 2025
Post comments count 9
Post likes count 5

How do I disable pieces of the property sheet for a service in the Services MMC snap-in?

Raymond Chen

There's no secret setting. It's all based on access control.

Aug 5, 2025
Post comments count 24
Post likes count 5

Why are Windows semiannual updates named H1 and H2?

Raymond Chen

To address an unconscious bias.

Aug 4, 2025
Post comments count 24
Post likes count 3

How can I read more than 4GB of data from a file in a single call to Read­File?

Raymond Chen

You can't, but you can try to fake it.

Aug 1, 2025
Post comments count 2
Post likes count 1

Two related questions about keeping track of PIDs of IPC clients

Raymond Chen

Since you're doing IPC, you may as well let IPC do the work for you.

Jul 31, 2025
Post comments count 7
Post likes count 1

A consequence of the weird wReserved value at the start of the DECIMAL structure

Raymond Chen

It overwrites things by accident.

Jul 30, 2025
Post comments count 2
Post likes count 1

In C++/WinRT, how can I await multiple coroutines and capture the results?, part 0

Raymond Chen

If you don't really care about what happens if something goes wrong.

Jul 29, 2025
Post comments count 16
Post likes count 5

Why is there a window with no name blocking Windows shutdown?

Raymond Chen

They never expected you to see it.

Jul 28, 2025
Post comments count 2
Post likes count 3

API design note: Don’t make up multiple names for the same thing

Raymond Chen

It may be obvious to you, but that's because you wrote it.

Jul 25, 2025
Post comments count 0
Post likes count 3

How can I confirm in the Windows debugger that I’m looking at a COMDAT-folded function?

Raymond Chen

Ask for all the names for an address.

Jul 24, 2025
Post comments count 6
Post likes count 3

How can I wait until a named object (say a mutex) is created?

Raymond Chen

You can't, but maybe you can wait for something else.

Jul 23, 2025
Post comments count 6
Post likes count 1

Exploring possible solutions to the inconsistency in how Windows searches case-insensitively for named resources

Raymond Chen

Maintaining compatibility while addressing flaws.

Jul 22, 2025
Post comments count 2
Post likes count 2

Being more adamant about reporting that C++/WinRT was unable to resume execution on a dispatcher thread

Raymond Chen

Better versions in a different box.

Jul 21, 2025
Post comments count 1
Post likes count 4

What happens if C++/WinRT is unable to resume execution on a dispatcher thread?

Raymond Chen

What you get out of the box.

Jul 18, 2025
Post comments count 20
Post likes count 4

The case of the invalid instruction exception on an instruction that should never have executed

Raymond Chen

I don't recall ever asking you to do that.

Jul 17, 2025
Post comments count 0
Post likes count 3

If the Window Runtime PropertyValue is for boxing non-inspectables, why is there a PropertyValue.CreateInspectable?

Raymond Chen

For completeness, but not for functionality.

Jul 16, 2025
Post comments count 5
Post likes count 5

The Fundamental Failure-Mode Theorem: Systems lie about their proper functioning

Raymond Chen

It doesn't say what it does on the tin.

Jul 15, 2025
Post comments count 0
Post likes count 5

Perhaps not a recommended usage for an emergency power outlet

Raymond Chen

Maybe that's not a critical system.

Jul 14, 2025
Post comments count 5
Post likes count 5

There is a std::chrono::high_resolution_clock, but no low_resolution_clock

Raymond Chen

For when you care only enough to be roughly on time.

Jul 11, 2025
Post comments count 3
Post likes count 4

Detecting and reporting all unhandled C++ exceptions as well as all unhandled structured exceptions

Raymond Chen

Closing another exit point.

Jul 10, 2025
Post comments count 7
Post likes count 3

Our first attempt to detect and report all unhandled C++ exceptions as well as all unhandled structured exceptions

Raymond Chen

Identifying and classifying the exit points.

Jul 9, 2025
Post comments count 4
Post likes count 5

When I install an unhandled structured exception filter, why doesn’t std::terminate get called?

Raymond Chen

You're using the same hook that the compiler uses to call <CODE>std::<WBR>terminate</CODE>.

Jul 8, 2025
Post comments count 9
Post likes count 2

A walkthrough of the original Microsoft Building 3

Raymond Chen

Don't get lost on your walk down memory lane.

Jul 7, 2025
Post comments count 2
Post likes count 2

Dubious security vulnerability: If I perform this complex series of manual steps, I can crash a program I am running

Raymond Chen

What security boundary did you cross?

Jul 4, 2025
Post comments count 4
Post likes count 1

Why doesn’t LVIF_INDENT work without an image list?

Raymond Chen

Its original client had an image list.

Jul 3, 2025
Post comments count 13
Post likes count 0

German language cheat sheet: On changing quantities

Raymond Chen

How much there is, and how is it changing.

Jul 3, 2025
Post comments count 0
Post likes count 2

If the Format­Message function fails, and I requested that it allocate a buffer, do I have to free the buffer?

Raymond Chen

There was no buffer returned, so there's nothing to free anyway.

Jul 2, 2025
Post comments count 1
Post likes count 2

Unintended yet somehow entirely expected consequences of marking a COM interface as local

Raymond Chen

If it's local-only, then it can't be remote.

Jul 1, 2025
Post comments count 0
Post likes count 1

The sizzle reel that says things that nobody understands

Raymond Chen

Failing to understand your audience.

Jun 30, 2025
Post comments count 1
Post likes count 2

2025 mid-year link clearance

Raymond Chen

Halfway there.

Jun 30, 2025
Post comments count 17
Post likes count 3

Embracing the power of the empty set in API design: Requesting zero items

Raymond Chen

It's okay to ask for nothing. You get nothing.

Jun 27, 2025
Post comments count 8
Post likes count 1

Why do I get errors or warnings about some weird symbol called ?main@@YAHP$01E$AAV?$Array@PE$AAVString@Platform…, part 3

Raymond Chen

Forcing <CODE>main</CODE> to be found in the place we want.

Jun 26, 2025
Post comments count 0
Post likes count 1

Why do I get errors about some weird symbol called ?main@@YAHP$01E$AAV?$Array@PE$AAVString@Platform…, part 2

Raymond Chen

Figuring out why C++/CX makes a difference.

Jun 25, 2025
Post comments count 8
Post likes count 4

Your information has been permanently deleted, for small values of permanently

Raymond Chen

Is it really gone?

Jun 25, 2025
Post comments count 1
Post likes count 1

Why do I get errors about some weird symbol called ?main@@YAHP$01E$AAV?$Array@PE$AAVString@Platform…, part 1

Raymond Chen

Welcome to the world of C++/CX. Is "welcome" the right word?

Jun 24, 2025
Post comments count 11
Post likes count 5

Abusing copyright strings to trick software into thinking it’s running on your competitor’s PC

Raymond Chen

I did technically cross my fingers.

Jun 23, 2025
Post comments count 7
Post likes count 6

The MIDL compiler still has trouble with double greater-than signs, sadly

Raymond Chen

Many have tried.

Jun 20, 2025
Post comments count 2
Post likes count 5

The case of the invalid handle error when a handle is closed while a thread is waiting on it

Raymond Chen

You are theorizing one race but experiencing another.

Jun 19, 2025
Post comments count 2
Post likes count 1

Learning to read C++ compiler errors: Ambiguous symbol errors after including a header file

Raymond Chen

Finding out why multiple entities with the same name are visible.

Jun 18, 2025
Post comments count 0
Post likes count 1

You have to tell Get- and Set­Security­Info the object type, you can’t make it guess

Raymond Chen

It needs to know which provider to give it to.

Jun 17, 2025
Post comments count 0
Post likes count 3

Funding the Egghead store shopping spree took a little extra legwork

Raymond Chen

Just ask the boss.

Jun 16, 2025
Post comments count 1
Post likes count 5

Writing a helper class for generating a particular category of C callback wrappers around C++ methods

Raymond Chen

Another exercise in C++ template programming.

Jun 13, 2025
Post comments count 4
Post likes count 3

Thread pool threads are like preschool: Leave things the way you found them

Raymond Chen

Your mother always told you to clean up behind yourself.

Jun 12, 2025
Post comments count 7
Post likes count 1

Why does Windows even have Interlocked functions when we have std::atomic?

Raymond Chen

Well, you have to start somewhere.

Jun 11, 2025
Post comments count 7
Post likes count 4

Removing the MAX_PATH restriction on paths applies only to paths

Raymond Chen

The individual file names still retain their existing limits.

Jun 10, 2025
Post comments count 6
Post likes count 5

Application compatibility for Windows 95 crashed a cash register

Raymond Chen

Exceeding all reasonable maximums.

Jun 9, 2025
Post comments count 2
Post likes count 2

Dubious security vulnerability: Tricking a program into running non-elevated

Raymond Chen

You can do anything, but still within the limits of your authority.

Jun 6, 2025
Post comments count 0
Post likes count 4

Why does C++ think my class is copy-constructible when it can’t be copy-constructed?

Raymond Chen

You said that you had a copy constructor, even though it can't be compiled.

Jun 5, 2025
Post comments count 11
Post likes count 2

Why do some Windows functions fail if I pass an unaligned Unicode string?

Raymond Chen

Well, if you don't align it, then you've already broken the rules.

Jun 4, 2025
Post comments count 2
Post likes count 3

Riffing on a typo in the name of the opera Turandot

Raymond Chen

On the dot.

Jun 4, 2025
Post comments count 0
Post likes count 1

How can I programmatically find the network path by which a folder has been shared?

Raymond Chen

There is no direct query. You'll have to infer it.

Jun 3, 2025
Post comments count 8
Post likes count 6

The symbolism of the magnifying glass is not universal

Raymond Chen

Just making things bigger?

Jun 2, 2025
Post comments count 0
Post likes count 2

Stating the obvious about debugging an invalid parameter error when freeing memory

Raymond Chen

Writing it down for posterity.

May 30, 2025
Post comments count 5
Post likes count 1

Using an oracle to see where your code is producing the wrong output

Raymond Chen

If there is a reference implementation, then use it as a check.

May 29, 2025
Post comments count 6
Post likes count 7

The case of creating new instances when you wanted to use the same one

Raymond Chen

C++ language backward compatibility makes legal what you had hoped wasn't.

May 28, 2025
Post comments count 1
Post likes count 3

How do I convert a WIC bitmap back to a GDI HBITMAP?

Raymond Chen

You can copy the bits into a DIB section.

May 27, 2025
Post comments count 9
Post likes count 4

What was origin of the code name Redpill for Windows 8 feature lockout?

Raymond Chen

Pretty obvious, actually.

May 26, 2025
Post comments count 2
Post likes count 1

Why does Enum­Process­Modules report no modules on a process that was created suspended?

Raymond Chen

There are no modules yet because you didn't give them a chance to load.

May 23, 2025
Post comments count 6
Post likes count 4

How can I detect if one of my helper processes is launching child processes?

Raymond Chen

You can ask a job object to keep track for you.

May 22, 2025
Post comments count 4
Post likes count 3

How can I create a window the size of the screen without it being treated as a fullscreen window?

Raymond Chen

You can declare that you aren't rude.

May 21, 2025
Post comments count 5
Post likes count 3

Silly parlor tricks: Promoting a 32-bit value to a 64-bit value when you don’t care about garbage in the upper bits

Raymond Chen

Inline assembly that doesn't do anything.

May 20, 2025
Post comments count 7
Post likes count 3

Why does Windows report my processor speed twice, with slightly different values?

Raymond Chen

One is calculated. The other is self-promotion.

May 19, 2025
Post comments count 1
Post likes count 2

Secret passages on Microsoft main campus, episode 3

Raymond Chen

Another covered passage between buildings.

May 16, 2025
Post comments count 8
Post likes count 2

What’s with the weird wReserved value at the start of the DECIMAL structure?

Raymond Chen

It's where the discriminant goes when the <CODE>DECIMAL</CODE> is put "inside" a <CODE>VARIANT</CODE>.

May 15, 2025
Post comments count 6
Post likes count 2

How do I force RunOnce commands to run in a specific order?

Raymond Chen

Run them in the desired order yourself.

May 14, 2025
Post comments count 0
Post likes count 2

If I mark my thread pool callback as long-running, does it still count toward the thread pool thread limit?

Raymond Chen

Yes, because it's still in the thread pool.

May 13, 2025
Post comments count 9
Post likes count 3

What is the developer set-up for developing Windows for multiple processor architectures?

Raymond Chen

You usually just pick one and count on your friends for the others.

May 12, 2025
Post comments count 2
Post likes count 2

Dubious security vulnerability: A program does not run correctly if you run it the wrong way, redux

Raymond Chen

Trying to make the system run the program automatically.

May 9, 2025
Post comments count 12
Post likes count 4

How can I wait for Clipboard History to recognize a clipboard change before I change it again?

Raymond Chen

Listen for the change event.

May 8, 2025
Post comments count 6
Post likes count 3

Why doesn’t Clipboard History capture rapid changes to clipboard contents?

Raymond Chen

Clipboard history operates asynchronously, so you are changing it before it can respond to the changes.

May 7, 2025
Post comments count 14
Post likes count 9

What were the MS-DOS programs that the moricons.dll icons were intended for?

Raymond Chen

Tallying them up.

May 6, 2025
Post comments count 7
Post likes count 7

What were the MS-DOS programs that Windows used the progman.exe stock icons for?

Raymond Chen

Mostly generic-looking icons.

May 5, 2025
Post comments count 9
Post likes count 5

What were the intended uses of those icons in moricons.dll?

Raymond Chen

Icons for old MS-DOS apps.

May 2, 2025
Post comments count 4
Post likes count 3

Using type aliasing to avoid the ODR problem with conditional compilation, part 2

Raymond Chen

Ensuring that you pick a side.

May 1, 2025
Post comments count 3
Post likes count 2

Using C++ type aliasing to avoid the ODR problem with conditional compilation, part 1

Raymond Chen

Still one definition, but two types.

Apr 30, 2025
Post comments count 7
Post likes count 4

Why does Windows have trouble finding my Win32 resource if it contains an accented character?

Raymond Chen

Disagreements over the fine print.

Apr 29, 2025
Post comments count 9
Post likes count 3

Protecting Windows users from Janet Jackson’s Rhythm Nation

Raymond Chen

Granting an exception to a system policy.

Apr 28, 2025
Post comments count 14
Post likes count 9

Why did Windows 7, for a few months, log on slower if you have a solid color background?

Raymond Chen

It's waiting for Godot and eventually gives up.

Apr 25, 2025
Post comments count 11
Post likes count 3

If we can have std::atomic<std::shared_ptr>, why not std::atomic<com_ptr>?

Raymond Chen

Controlling the reference count.

Apr 24, 2025
Post comments count 5
Post likes count 3

When I define a window class with no default cursor, what is the explanation for the cursors that appear in my client area?

Raymond Chen

You said you'd take care of it, but you didn't.

Apr 23, 2025
Post comments count 7
Post likes count 3

What resource ID should I give my application’s main icon?

Raymond Chen

Applying what we know about how Explorer finds the "first" icon in a file.

Apr 22, 2025
Post comments count 6
Post likes count 1

Microspeak: top of mind

Raymond Chen

Things I'm thinking about.

Apr 21, 2025
Post comments count 20
Post likes count 1

The ongoing story of seconds on the taskbar

Raymond Chen

The cost of ticking.

Apr 18, 2025
Post comments count 2
Post likes count 1

The case of the feature flag that didn’t stay on long enough, part 2

Raymond Chen

Leaving everything the way you found it.

Apr 17, 2025
Post comments count 3
Post likes count 2

The case of the feature flag that didn’t stay on long enough, part 1

Raymond Chen

Understanding scope and order of destruction.

Apr 16, 2025
Post comments count 0
Post likes count 1

Using the classical model for linking to provide unit test overrides

Raymond Chen

Overriding a LIB with an OBJ for fun and profit.

Apr 15, 2025
Post comments count 16
Post likes count 2

There was a lot of imagined dropping tablets in swimming pools

Raymond Chen

The archetypical example of needing a replacement computer.

Apr 14, 2025
Post comments count 6
Post likes count 2

Dubious security vulnerability: Once I have tricked the user into running a malicious shortcut, I can install malware

Raymond Chen

Yes, that's sort of the point.

Apr 11, 2025
Post comments count 12
Post likes count 5

The case of the UI thread that hung in a kernel call

Raymond Chen

I did tell you not to do that.

Apr 10, 2025
Post comments count 0
Post likes count 1

Function overloading is more flexible (and more convenient) than template function specialization

Raymond Chen

You can change more things in an overload.

Apr 9, 2025
Post comments count 5
Post likes count 1

Why can’t I use SEC_LARGE_PAGES with a file-based file mapping?

Raymond Chen

No paging, no crying.

Apr 8, 2025
Post comments count 10
Post likes count 2

The Goldilocks zone of software stability

Raymond Chen

Not too new, not too old.

Apr 7, 2025
Post comments count 4
Post likes count 3

On priority inversion in the use of a spinlock to ensure atomic access to a shared_ptr

Raymond Chen

Priority inversion may be rare, but correctness doesn't care about rarity.

Apr 4, 2025
Post comments count 5
Post likes count 2

Adding delays to our task sequencer, part 3

Raymond Chen

Waiting more cheaply.

Apr 3, 2025
Post comments count 0
Post likes count 2

Adding delays to our task sequencer, part 2

Raymond Chen

Waiting the right amount of time.

Apr 2, 2025
Post comments count 0
Post likes count 2

Adding delays to our task sequencer, part 1

Raymond Chen

Not so fast there.

Apr 1, 2025
Post comments count 1
Post likes count 3

The return of Building 7

Raymond Chen

Pranksters lose one of their longtime inside jokes.

Mar 31, 2025
Post comments count 12
Post likes count 1

If one program blocks shutdown, then all programs block shutdown, revisited

Raymond Chen

No take-backs.

Mar 28, 2025
Post comments count 1
Post likes count 3

The 2025/2026 Seattle Symphony subscription season at a glance

Raymond Chen

The pocket reference guide for 2025/2026.

Mar 28, 2025
Post comments count 3
Post likes count 2

Fixing exception safety in our task_sequencer

Raymond Chen

Exception safety, the forgotten requirement.

Mar 27, 2025
Post comments count 8
Post likes count 2

On launching a dialog when a specific combo box item is selected

Raymond Chen

Changing selections is not a good time to launch a dialog box.

Mar 26, 2025
Post comments count 1
Post likes count 4

Why does INVALID_HANDLE_VALUE cast through a LONG_PTR first?

Raymond Chen

To ensure that the proper sign extension happens.

Mar 25, 2025
Post comments count 4
Post likes count 1

We’ll fly you to Atlanta, Texas, and getting to your hotel in Atlanta, Georgia is your problem

Raymond Chen

Reading the fine print.

Mar 25, 2025
Post comments count 7
Post likes count 4

A note on the USB-to-PS/2 mouse adapter that came with Microsoft mouse devices

Raymond Chen

It's a purely mechanical adapter that relies on smarts in the mouse itself.

Mar 24, 2025
Post comments count 11
Post likes count 2

On how different Windows ABIs choose how to pass 32-bit values in 64-bit registers

Raymond Chen

Surveying the options and looking for commonalities.

Mar 21, 2025
Post comments count 11
Post likes count 4

The case of the critical section that let multiple threads enter a block of code

Raymond Chen

It had one job.

Mar 20, 2025
Post comments count 4
Post likes count 1

What could cause a memory corruption bug to disappear in safe mode?

Raymond Chen

A simplified execution environment means fewer things that you can stumble over.

Mar 19, 2025
Post comments count 9
Post likes count 7

You can’t simulate keyboard input with PostMessage, revisited

Raymond Chen

If it didn't go through the input system, it only looks like input as much as the app allows itself to be fooled.

Mar 18, 2025
Post comments count 7
Post likes count 7

Why didn’t Windows 95 setup use a miniature version of Windows 95 as its fallback GUI?

Raymond Chen

Avoiding an interim GUI environment.

Mar 17, 2025
Post comments count 3
Post likes count 3

Dubious security vulnerability: A program does not run correctly if you run it the wrong way

Raymond Chen

So what did you expect?

Mar 14, 2025
Post comments count 0
Post likes count 2

The case of COM failing to pump messages in a single-threaded COM apartment

Raymond Chen

A customer encountered a hang caused by COM not pumping messages while waiting for a cross-thread operation to complete. They were using the class for serializing asynchronous operations on a UI thread they created to handle accessibility callbacks. The hang stack looked like this: We see that we have a UI thread (notice the at the bottom of the stack), yet COM decided to block without pumping messages ( instead of (). Is this a bug in the task sequencer? Let's look at the stack more closely. A message arrived via , and that then queued a task into the task sequencer. The saw that the task sequencer had...

Mar 13, 2025
Post comments count 12
Post likes count 3

Making sure that a DLL loads only from your application directory

Raymond Chen

You can ask for it as an option, but think about what you're actually protecting against.

Mar 12, 2025
Post comments count 2
Post likes count 4

What are the thread safety requirements of HSTRING and BSTR?

Raymond Chen

They do not have thread affinity.

Mar 11, 2025
Post comments count 9
Post likes count 3

What an insightful observation, you get to wear “the hat”

Raymond Chen

Maybe not so insightful.

Mar 10, 2025
Post comments count 0
Post likes count 4

How do I destroy an ABI pointer that I extracted from a C++/WinRT object?

Raymond Chen

You can clean it up the ABI way, whatever that is.

Mar 7, 2025
Post comments count 21
Post likes count 4

To some people, time zones are just a fancy way of sounding important, episode 2

Raymond Chen

Words have meaning.

Mar 6, 2025
Post comments count 6
Post likes count 6

How can I choose a different C++ constructor at runtime?

Raymond Chen

Make somebody else do it, and then use copy elision.

Mar 5, 2025
Post comments count 0
Post likes count 2

I tried to subscribe to a C++/WinRT event, but my callback was never called

Raymond Chen

Check how you registered your event handler.

Mar 4, 2025
Post comments count 2
Post likes count 3

Microspeak: Respin

Raymond Chen

Spin it up again, baby.

Mar 3, 2025
Post comments count 1
Post likes count 3

Lexically scoped functions accessing parent locals: The display

Raymond Chen

Using a well-known location instead of copying frame pointers.

Feb 28, 2025
Post comments count 1
Post likes count 2

C++/WinRT implementation inheritance: Notes on winrt::implements, part 8

Raymond Chen

Comparing the options.

Feb 27, 2025
Post comments count 0
Post likes count 2

C++/WinRT implementation inheritance: Notes on winrt::implements, part 7

Raymond Chen

Inheritance without involving <CODE>winrt::implements</CODE> at all.

Feb 26, 2025
Post comments count 0
Post likes count 1

C++/WinRT implementation inheritance: Notes on winrt::implements, part 6

Raymond Chen

Using CRTP to delegate the method.

Feb 25, 2025
Post comments count 0
Post likes count 1

C++/WinRT implementation inheritance: Notes on winrt::implements, part 5

Raymond Chen

When the base class isn't self-contained.

Feb 24, 2025
Post comments count 0
Post likes count 1

C++/WinRT implementation inheritance: Notes on winrt::implements, part 4

Raymond Chen

Simple inheritance of a self-contained <CODE>implements</CODE>.

Feb 21, 2025
Post comments count 9
Post likes count 1

C++/WinRT implementation inheritance: Notes on winrt::implements, part 3

Raymond Chen

Discovering the legal inheritance structures for <CODE>winrt::<WBR>implements</CODE>.

Feb 20, 2025
Post comments count 0
Post likes count 1

C++/WinRT implementation inheritance: Notes on winrt::implements, part 2

Raymond Chen

Untangling <CODE>unwrap_<WBR>implements_t</CODE>.

Feb 19, 2025
Post comments count 0
Post likes count 3

C++/WinRT implementation inheritance: Notes on winrt::implements, part 1

Raymond Chen

A closer look at the parameters to the <CODE>implements</CODE> template.

Feb 18, 2025
Post comments count 4
Post likes count 7

Your statement is now available, just two hidden flyouts and five clicks away

Raymond Chen

Beware of the leopard.

Feb 17, 2025
Post comments count 7
Post likes count 7

API design note: Beware of adding an “Other” enum value

Raymond Chen

What are you going to do when you add a new kind?

Feb 14, 2025
Post comments count 3
Post likes count 3

Investigating an argument-dependent lookup issue and working around it

Raymond Chen

Picking apart the language specification.

Feb 13, 2025
Post comments count 1
Post likes count 3

A sample implementation of the weak reference pattern for COM callbacks

Raymond Chen

A forwarder through a weak reference.

Feb 12, 2025
Post comments count 3
Post likes count 2

Async-Async revisited: What about cancellation?

Raymond Chen

Even the cancellation is async.

Feb 11, 2025
Post comments count 3
Post likes count 9

Did the Windows 95 setup team forget that MS-DOS can do graphics?

Raymond Chen

Oh look what you just made there.

Feb 10, 2025
Post comments count 4
Post likes count 3

How does Explorer find the “first” icon in a file

Raymond Chen

It enumerates them and takes the first one, so this is really a question about enumeration.

Feb 7, 2025
Post comments count 1
Post likes count 3

Using alternate locales to get more interesting case mapping than the C

Raymond Chen

Looking for something better.

Feb 6, 2025
Post comments count 7
Post likes count 1

The default C locale is not a very interesting one

Raymond Chen

It barely understands anything.

Feb 5, 2025
Post comments count 7
Post likes count 1

On exactly when XAML bindings are evaluated if an element is not yet loaded

Raymond Chen

It depends on which abstraction you prefer.

Feb 4, 2025
Post comments count 4
Post likes count 5

The original name for Flexible Single Master Operations in Active Directory

Raymond Chen

Not that kind of F-word.

Feb 3, 2025
Post comments count 2
Post likes count 2

On trying to log an exception as it leaves your scope

Raymond Chen

You can't watch it from an object on the outside.

Jan 31, 2025
Post comments count 1
Post likes count 1

Creating a generic insertion iterator, part 2

Raymond Chen

Satisfying the iterator requirements, perhaps with a little cheating.

Jan 30, 2025
Post comments count 0
Post likes count 1

Creating a generic insertion iterator, part 1

Raymond Chen

We provide the boilerplate; you provide the smarts.

Jan 29, 2025
Post comments count 6
Post likes count 2

How do I create an inserter iterator that does unhinted insertion into an associative container like std::map?

Raymond Chen

Curiously missing from the standard library.

Jan 28, 2025
Post comments count 11
Post likes count 4

My electric toothbrush was acting up, so I tried to reboot it

Raymond Chen

It didn't help.

Jan 27, 2025
Post comments count 9
Post likes count 3

A pattern for obtaining a single value while holding a lock

Raymond Chen

The immediately-invoked lambda that returns a value.

Jan 24, 2025
Post comments count 0
Post likes count 5

A brief and incomplete comparison of memory corruption detection tools

Raymond Chen

A short overview, definitely incomplete.

Jan 23, 2025
Post comments count 0
Post likes count 3

Memory corruption from outside the process looks like space aliens

Raymond Chen

The write isn't visible to your process, just the effect of the write.

Jan 22, 2025
Post comments count 15
Post likes count 4

Be mindful of temporal terms in documents: What is the reference point in time?

Raymond Chen

What is your implied point in time for the reference?

Jan 21, 2025
Post comments count 4
Post likes count 1

Why is there a bulge on my bicycle tire when I inflate it?

Raymond Chen

Get the order of operations right.

Jan 21, 2025
Post comments count 5
Post likes count 3

Why doesn’t the Windows blue screen of death prominently identify the company that created the driver that crashed?

Raymond Chen

Because the driver that crashed may not be the one at fault.

Jan 20, 2025
Post comments count 1
Post likes count 3

Reminder: When a C++ object fails to construct, the destructor does not run

Raymond Chen

If you need to run after a failed construction, you have to put it in a base class or member variable.

Jan 17, 2025
Post comments count 6
Post likes count 3

The case of the crash when trying to erase an element from a std::set

Raymond Chen

Another kind of fiasco.

Jan 16, 2025
Post comments count 3
Post likes count 2

In a C++ class template specialization, how can I call the unspecialized version of a method?

Raymond Chen

You can't talk about things that might exist, so instead talk about things that do.

Jan 15, 2025
Post comments count 0
Post likes count 2

How does Get­User­Default­Geo­Name choose between ISO 3166-1 and UN M.49 codes?

Raymond Chen

Clarifying the behavior.

Jan 14, 2025
Post comments count 5
Post likes count 2

Microspeak: The walk-on topic

Raymond Chen

Just walk on in with your topic.

Jan 13, 2025
Post comments count 4
Post likes count 3

A simplified overview of ways to add or update elements in a std::map

Raymond Chen

And using it to find missing opportunities.

Jan 10, 2025
Post comments count 2
Post likes count 1

Why does inadvertently passing a std::string instead of a char const* to a variadic function crash on x86-32 but not x86-64?

Raymond Chen

Looking at the calling convention and the small string optimization.

Jan 9, 2025
Post comments count 0
Post likes count 4

Inside STL: Waiting for a std::atomic<std::shared_ptr<T>> to change, part 2

Raymond Chen

Digging into the libstdc++ implementation.

Jan 8, 2025
Post comments count 1
Post likes count 2

Inside STL: Waiting for a std::atomic<std::shared_ptr<T>> to change, part 1

Raymond Chen

Waiting on a single pointer, but checking for two.

Jan 7, 2025
Post comments count 11
Post likes count 3

Gesellschaft zur Stärkung der Verben: The German Society for the Irregularization of Verbs

Raymond Chen

Stand strong and proud.

Jan 7, 2025
Post comments count 5
Post likes count 6

Emergency power resets on Lenovo, HP, Dell, and Acer laptops

Raymond Chen

Looking for the magic button.

Jan 6, 2025
Post comments count 6
Post likes count 1

How can I tell whether a change to a control was due to the user or due to my program?

Raymond Chen

You know when it was done by your program because you did it.

Jan 3, 2025
Post comments count 1
Post likes count 2

Forcing an ERROR_KEY_DELETED error when trying to open HKEY_CURRENT_USER\Software

Raymond Chen

Just an exercise to show that it can be done, even though it's highly unlikely to occur in practice.

Jan 2, 2025
Post comments count 1
Post likes count 2

Could I be getting ERROR_KEY_DELETED for HKEY_CURRENT_USER\Software when the user logs off?

Raymond Chen

Probably not, but there are some edge cases.

Jan 1, 2025
Post comments count 1
Post likes count 2

How is it possible to get ERROR_KEY_DELETED when I’m creating a key?

Raymond Chen

The key that got deleted is not the one you are trying to create.

Dec 31, 2024
Post comments count 6
Post likes count 3

2024 year-end link clearance

Raymond Chen

The cycle completes.

Dec 31, 2024
Post comments count 4
Post likes count 4

Making sure the Microsoft Visual C++ compiler chooses the right source encoding

Raymond Chen

Making sure the file and settings are set correctly.

Dec 30, 2024
Post comments count 4
Post likes count 3

How various git diff viewers represent file encoding changes in pull requests

Raymond Chen

The invisible UTF-8 BOM, and sometimes invisible encoding changes.

Dec 27, 2024
Post comments count 4
Post likes count 2

In C++, failure to meet the requirements does not always mean that you fail if you don’t meet the requirements

Raymond Chen

Combining SFINAE/requires, standard layout, and overload resolution.

Dec 26, 2024
Post comments count 8
Post likes count 4

Why are Win32 resources strings bundled at all? And why bundles of 16?

Raymond Chen

Balancing multiple performance factors.

Dec 25, 2024
Post comments count 0
Post likes count 2

How can I check if two GUIDs are equal when they are provided as strings?

Raymond Chen

A customer asked if there was a helper function in the system that accepted two strings and reported whether the s they represent are equal. This is a tricky question, because you first have to decide what "represent" means. There are many ways of representing a as a string. It could be just 32 case-insensitive hexadecimal digits. Or maybe there are internal hyphens to separate the groups. And the whole thing might be enclosed in braces or parentheses. External and interior whitespace might be allowed. Trailing garbage might be accepted (and ignored). And then there's the special format {0x00000000,0x0000,0x00...

Dec 24, 2024
Post comments count 0
Post likes count 3

A design flaw in the Windows 3D Pipes screen saver pointed out by a customer

Raymond Chen

Time-wasting.

Dec 23, 2024
Post comments count 5
Post likes count 2

A common proposed solution to certain categories of IFNDR: Getting the linker to verify identical functions

Raymond Chen

You could do it, but it could cramp your style.

Dec 20, 2024
Post comments count 0
Post likes count 2

How do I register a file type for a scripting language so that users get a warning when they run an untrusted script?

Raymond Chen

Use the FTA_AlwaysUnsafe edit flag.

Dec 19, 2024
Post comments count 7
Post likes count 5

Inside STL: The atomic shared_ptr

Raymond Chen

There's a lock hiding inside the pointer.

Dec 18, 2024
Post comments count 2
Post likes count 1

Is there a way to split the git history of a file or combine the histories of two files without a merge commit?

Raymond Chen

Studying how git recovers history.

Dec 17, 2024
Post comments count 6
Post likes count 3

Microspeak terms that didn’t take hold: airspace, synthetics, and AOI

Raymond Chen

Sometimes they don't stick.

Dec 16, 2024
Post comments count 0
Post likes count 2

Why do we have header files <pshpackN.h> and <poppack.h> instead of just issuing the pragma directly?

Raymond Chen

Because the pragma may not work everywhere.

Dec 13, 2024
Post comments count 0
Post likes count 3

Converting to a derived class from the future: How to cast from a base class to an incomplete derived class?

Raymond Chen

Deferring the definition until the class is complete.

Dec 12, 2024
Post comments count 0
Post likes count 3

API naming principles for conditional operations: On, When, and If

Raymond Chen

Describing when a condition is tested.

Dec 11, 2024
Post comments count 8
Post likes count 3

What is the CONTINUE_IF_FAILED equivalent of RETURN_IF_FAILED?

Raymond Chen

Be careful how you write it, or better: Don't write it at all.

Dec 10, 2024
Post comments count 3
Post likes count 1

It rather involved being on the other side of this airtight hatchway: Disabling anti-malware scanning

Raymond Chen

If you have already infiltrated the process, then you can disable things from the inside.

Dec 9, 2024
Post comments count 0
Post likes count 2

Learning to read C++ compiler errors: Failing to create a shared_ptr

Raymond Chen

Understanding what you asked the compiler to do, and why it couldn't comply.

Dec 6, 2024
Post comments count 4
Post likes count 1

Learning to read C++ compiler errors: Nonsensical errors from a function declaration

Raymond Chen

Look closely at what the error message is complaining about.

Dec 5, 2024
Post comments count 1
Post likes count 3

Won’t waiting for multiple threads one at a time introduce a severe performance issue?

Raymond Chen

It depends on how long you plan on waiting.

Dec 4, 2024
Post comments count 0
Post likes count 3

Why does my DLL reference count go up by one every time I create and exit a thread?

Raymond Chen

If you use a wrapper, you need to follow the wrapper's rules.

Dec 3, 2024
Post comments count 2
Post likes count 3

Tricks from product support: We’re not smart enough to debug the problem, can you help us?

Raymond Chen

It's not you, it's me.

Dec 2, 2024
Post comments count 1
Post likes count 4

News flash: Desire for loud cars correlates with psychopathy and sadism

Raymond Chen

More research into loud vehicles.

Dec 2, 2024
Post comments count 5
Post likes count 1

An analogy about register preservation rules in calling conventions

Raymond Chen

And tying it back to unwind codes.

Nov 29, 2024
Post comments count 1
Post likes count 1

Assessing the attack complexity of a race condition security vulnerability

Raymond Chen

It's not just how small the race window is, but how easy it is to hit the window.

Nov 28, 2024
Post comments count 0
Post likes count 3

Why does my program successfully take foreground only when running under the debugger?

Raymond Chen

That's a special exception to the normal foreground rules.

Nov 27, 2024
Post comments count 0
Post likes count 1

Checking whether a URI refers to a Web site root

Raymond Chen

Let somebody else do the parsing.

Nov 26, 2024
Post comments count 0
Post likes count 1

Microspeak: Real estate and Airspace

Raymond Chen

Space on the screen and negotiating control over it.

Nov 25, 2024
Post comments count 0
Post likes count 1

How can I know when a window has processed a message that I posted to it?

Raymond Chen

Best would be to have it tell you.

Nov 22, 2024
Post comments count 0
Post likes count 2

In C++, how can I make a default parameter be the this pointer of the caller?, revisited

Raymond Chen

Expanding on the previous pattern.

Nov 21, 2024
Post comments count 1
Post likes count 2

How can I detect which menu my item was invoked from?

Raymond Chen

Just give them all different IDs. But this might itself by an XY problem.

Nov 20, 2024
Post comments count 3
Post likes count 4

How do I determine whether Explorer is showing or hiding file extensions?

Raymond Chen

You can ask, but maybe you're asking the wrong question.

Nov 19, 2024
Post comments count 4
Post likes count 7

A wrinkle in how Windows 95 setup bootstrapped its initial GUI step

Raymond Chen

Getting access to the common controls that don't exist until Windows 95.

Nov 18, 2024
Post comments count 2
Post likes count 2

The operations for reading and writing single elements for C++ standard library maps

Raymond Chen

Breaking down the options.

Nov 15, 2024
Post comments count 6
Post likes count 4

How do I put a non-copyable, non-movable, non-constructible object into a std::optional?

Raymond Chen

Taking advantage of the conversion operator.

Nov 14, 2024
Post comments count 0
Post likes count 3

Solving the puzzle of trying to put an object into a std::optional

Raymond Chen

How do I set a value? Let me count the ways.

Nov 13, 2024
Post comments count 14
Post likes count 2

The puzzle of trying to put an object into a std::optional

Raymond Chen

The C++ standard library template type has one of two states. It could be empty (not contain anything), or it could contain a . Suppose you start with an empty . How do you put a into it? One of my colleagues tried to do it in what seemed to be the most natural way: Use the assignment operator. Unfortunately, the assignment failed to compile: I asked for the rest of the error message, because the details will explain what the compiler tried to do (and why it couldn't). It's long, but we'll walk through it. The compiler is showing its work. It's showing you all the possible overloaded assignment opera...

Nov 12, 2024
Post comments count 6
Post likes count 11

Why did Windows 95 setup use three operating systems?

Raymond Chen

Simplifying the problem to an earlier problem.

Nov 11, 2024
Post comments count 7
Post likes count 5

Debugger breakpoints are usually implemented by patching the in-memory copy of the code

Raymond Chen

The code in memory may not match what the debugger shows you if the debugger is itself is doing the changing.

Nov 8, 2024
Post comments count 4
Post likes count 13

The case of a program that crashed on its first instruction

Raymond Chen

Didn't even make it out of the gate.

Nov 7, 2024
Post comments count 6
Post likes count 5

Why do I observe reads from a memory-mapped file when writing large blocks?

Raymond Chen

The CPU doesn't see the entire write at once.

Nov 6, 2024
Post comments count 1
Post likes count 2

How do I declare an operator overload for my Windows Runtime class?

Raymond Chen

That's not something expressible in the Windows Runtime.

Nov 5, 2024
Post comments count 6
Post likes count 4

What’s the difference between Display size and Screen size in the Windows 95 display control panel?

Raymond Chen

No meaningful difference, though others have created a difference.

Nov 4, 2024
Post comments count 4
Post likes count 3

On the limits of time travel in the face of undefined behavior in C

Raymond Chen

C imposes some constraints, but the principle is mostly still there.

Nov 1, 2024
Post comments count 9
Post likes count 6

On locale-aware substring matching, either case-sensitive or case-insensitive

Raymond Chen

It's surprisingly complicated, but fortunately, somebody has done it for you.

Oct 31, 2024
Post comments count 23
Post likes count 10

What has case distinction but is neither uppercase nor lowercase?

Raymond Chen

It has one foot in each world but belongs to neither.

Oct 30, 2024
Post comments count 0
Post likes count 3

I have enabled “take ownership” permission, but I still cannot obtain write access

Raymond Chen

Taking ownership is only one part of gaining write access.

Oct 29, 2024
Post comments count 0
Post likes count 2

Reverse-engineering what a “short” section is

Raymond Chen

The long and short of it all.

Oct 28, 2024
Post comments count 1
Post likes count 2

How useful is the hint passed to the std::unordered_… collections?

Raymond Chen

Only a little, or sometimes not at all.

Oct 25, 2024
Post comments count 0
Post likes count 2

How can I explicitly specialize a templated C++ constructor, follow-up notes

Raymond Chen

You can use a maker function, but that doesn't let you escape the problem.

Oct 24, 2024
Post comments count 1
Post likes count 1

It rather involved being on the other side of the airtight hatchway: Defeating ASLR after you’ve gained RCE via ROP

Raymond Chen

If you defeat ASLR, then you can defeat ASLR.

Oct 23, 2024
Post comments count 2
Post likes count 2

How do I create a Windows Runtime IRandom­Access­Stream around a bunch of bytes or a classic COM IStream?

Raymond Chen

Another wrapper function.

Oct 22, 2024
Post comments count 3
Post likes count 5

Did Windows 95 shrink the default font size of windowed MS-DOS apps?

Raymond Chen

The effect was that it shrunk, but only sometimes.

Oct 21, 2024
Post comments count 10
Post likes count 2

Why does adding WS_MINIMIZE­BOX change how my window behaves when the user presses Win+D?

Raymond Chen

It minimizes your window if it can.

Oct 18, 2024
Post comments count 2
Post likes count 1

Evaluating tail call elimination in the face of return address protection, part 2

Raymond Chen

Rewriting the activation frame.

Oct 17, 2024
Post comments count 2
Post likes count 1

Evaluating tail call elimination in the face of return address protection, part 1

Raymond Chen

Reusing the activation frame.

Oct 16, 2024
Post comments count 4
Post likes count 3

Effects of classic return address tricks on hardware-assisted return address protection

Raymond Chen

Return address manipulations that are possibly even more impermissible than they already were.

Oct 15, 2024
Post comments count 4
Post likes count 2

A quick introduction to return address protection technologies

Raymond Chen

Detecting attempts to manipulate the return address.

Oct 14, 2024
Post comments count 13
Post likes count 3

On naming things: The tension between naming something for what it is, what it does, or how it is used

Raymond Chen

You are guaranteed to make someone upset.

Oct 11, 2024
Post comments count 1
Post likes count 3

How can I explicitly specialize a templated C++ constructor?

Raymond Chen

Looking for a C++ tag type for representing another type.

Oct 10, 2024
Post comments count 2
Post likes count 3

A correction to the awaitable lock for C++ PPL tasks

Raymond Chen

Over-scoped lock.

Oct 9, 2024
Post comments count 3
Post likes count 3

If threads are created without a message queue, why can I post to them immediately upon creation?

Raymond Chen

Check who is doing the posting.

Oct 8, 2024
Post comments count 1
Post likes count 2

Microspeak: Run to ground

Raymond Chen

Come to a resolution.

Oct 7, 2024
Post comments count 14
Post likes count 8

A popular but wrong way to convert a string to uppercase or lowercase

Raymond Chen

Converting character by character isn't good enough any more.

Oct 4, 2024
Post comments count 0
Post likes count 3

How does the linker decide whether to call WinMain or wWinMain?

Raymond Chen

If you don't tell it, it will try to figure it out.

Oct 3, 2024
Post comments count 8
Post likes count 6

How can I detect whether the user is running as an elevated administrator (as opposed to a natural administrator)?

Raymond Chen

You can ask for the elevation type.

Oct 2, 2024
Post comments count 0
Post likes count 3

A function for creating an absolute security descriptor from a self-relative one

Raymond Chen

Just wrap it up.

Oct 1, 2024
Post comments count 5
Post likes count 5

Misunderstanding the “Prevent access to registry editing tools” policy

Raymond Chen

It prevents access to the tools, but not to the registry itself.

Sep 30, 2024
Post comments count 3
Post likes count 1

Pulling a single item from a C++ parameter pack by its index, remarks

Raymond Chen

Why such a complicated way to pull the type from the pack?

Sep 27, 2024
Post comments count 3
Post likes count 5

The case of the crash when destructing a std::map

Raymond Chen

Who is corrupting the map?

Sep 26, 2024
Post comments count 3
Post likes count 3

If you’re going to specify the LVS_SORTASCENDING or LVS_SORTDESCENDING style, you had better be telling the truth

Raymond Chen

Because the listview control uses it to optimize searching.

Sep 25, 2024
Post comments count 1
Post likes count 3

Another example of the Windows Runtime interop pattern: Using the UserConsentVerifier from a Win32 program

Raymond Chen

Following the standard pattern.

Sep 24, 2024
Post comments count 3
Post likes count 2

The UserConsentVerifier confirms that the user is there, but it doesn’t protect any data

Raymond Chen

Is that really you?

Sep 23, 2024
Post comments count 6
Post likes count 2

Going beyond the empty set: Embracing the power of other empty things

Raymond Chen

Just because there's nothing in it doesn't mean it's not valid.

Sep 20, 2024
Post comments count 5
Post likes count 3

How can I check that all the changes in a git branch have been cherry-picked or rebased into its upstream branch?

Raymond Chen

You can pretend to merge it and see if anything happens.

Sep 19, 2024
Post comments count 0
Post likes count 5

My window has the WS_EX_NOACTIVATE extended style, but it got activated anyway

Raymond Chen

Well, at least it wasn't activated by a click.

Sep 18, 2024
Post comments count 6
Post likes count 3

More on the mysterious [default_interface] attribute in Windows Runtime classes

Raymond Chen

Forcing you to make a choice.

Sep 17, 2024
Post comments count 1
Post likes count 3

It rather involved being on the other side of this airtight hatchway: Posting completions to somebody else’s I/O completion port

Raymond Chen

If you have gained access to it, then that was the problem.

Sep 16, 2024
Post comments count 5
Post likes count 6

Some notes on Win32 carets

Raymond Chen

Assorted notes and musings.

Sep 13, 2024
Post comments count 3
Post likes count 4

The case of the fail-fast crashes coming from the power management system

Raymond Chen

Understanding why it decided to fail fast.

Sep 12, 2024
Post comments count 0
Post likes count 3

How can I tell whether two programs will share drive letter mappings?

Raymond Chen

You can compare the authentication IDs.

Sep 11, 2024
Post comments count 2
Post likes count 1

The case of the string being copied from a mysterious pointer to invalid memory, revisited

Raymond Chen

Reflections on an older topic.

Sep 10, 2024
Post comments count 1
Post likes count 2

Does the Resource Compiler have a separate preprocessor or doesn’t it?

Raymond Chen

It did, but now it doesn't.

Sep 9, 2024
Post comments count 6
Post likes count 4

GitHub trick to find the commit that deleted a file

Raymond Chen

Ask for the history of the file.

Sep 6, 2024
Post comments count 0
Post likes count 3

The case of the image that came out horribly slanted: Negative stride

Raymond Chen

It's all topsy-turvy.

Sep 5, 2024
Post comments count 6
Post likes count 2

The case of the image that came out horribly slanted: Taking the pitch into account

Raymond Chen

Getting the pieces to line up.

Sep 4, 2024
Post comments count 4
Post likes count 3

The case of the image that came out horribly slanted: Diagnosis

Raymond Chen

Imperfect pitch.

Sep 3, 2024
Post comments count 0
Post likes count 6

Why did Windows 95 use blue screen error messages instead of hard error messages?

Raymond Chen

You may not able to get there from here.

Sep 2, 2024
Post comments count 10
Post likes count 3

The Co­Initialize­Security function demands an absolute security descriptor

Raymond Chen

Even though you usually have a self-relative one in hand.

Aug 30, 2024
Post comments count 12
Post likes count 4

In the Windows kernel, what is a LUID, and what makes it loo-ey?

Raymond Chen

It's a locally-unique ID, for a specific definition of "local".

Aug 29, 2024
Post comments count 7
Post likes count 3

How is the Windows.Foundation.Uri.Domain property different from Host?

Raymond Chen

It's an educated guess.

Aug 28, 2024
Post comments count 0
Post likes count 2

On the strange status of wchar_t in classic MIDL

Raymond Chen

From the era before <CODE>wchar_t</CODE> was a standard type.

Aug 27, 2024
Post comments count 3
Post likes count 3

The Microsoft/IBM joint development was built on mutual respect, wait, is respect the right word?

Raymond Chen

Maybe it's some other word.

Aug 26, 2024
Post comments count 9
Post likes count 3

Thoughts on finding the essential elements of a set

Raymond Chen

Another binary search, but searching a different way.

Aug 23, 2024
Post comments count 7
Post likes count 5

What if I need to wait for more than MAXIMUM_WAIT_OBJECTS threads?

Raymond Chen

Studying your options, and the consequences of breaking things up.

Aug 22, 2024
Post comments count 3
Post likes count 1

The role of the activation factory in the Windows Runtime

Raymond Chen

The activation factory represents the class itself.

Aug 21, 2024
Post comments count 1
Post likes count 4

What does ERROR_KEY_DELETED mean?

Raymond Chen

You now have a handle to a key that doesn't exist, and there's nothing you can do with it.

Aug 20, 2024
Post comments count 1
Post likes count 4

Another tribute to Microsoft history hiding in Building 41

Raymond Chen

Logo touches.

Aug 19, 2024
Post comments count 11
Post likes count 1

Constructing nodes of a hand-made linked list, how hard can it be?

Raymond Chen

Trying to force copy elision.

Aug 16, 2024
Post comments count 4
Post likes count 1

The case of the missing ordinal 380

Raymond Chen

Untangling the error message and developing a theory.

Aug 15, 2024
Post comments count 9
Post likes count 4

Instead of putting a hash in the Portable Executable timestamp field, why not create a separate field for the hash?

Raymond Chen

That would defeat the purpose.

Aug 14, 2024
Post comments count 13
Post likes count 3

Temporarily dropping a lock: The anti-lock pattern

Raymond Chen

It's not to prevent locking, but rather to counteract a lock.

Aug 13, 2024
Post comments count 0
Post likes count 1

A look back at one of the (many) projects code-named Highlander

Raymond Chen

The showdown that almost repeated.

Aug 12, 2024
Post comments count 14
Post likes count 6

Embracing the power of the empty set in API design (and applying this principle to selectors and filters)

Raymond Chen

You got plenty of nothing.

Aug 9, 2024
Post comments count 2
Post likes count 3

What does it even mean to Close a Windows Runtime asynchronous operation or action?

Raymond Chen

That's the end of the road.

Aug 8, 2024
Post comments count 0
Post likes count 4

Why do I get E_ACCESS­DENIED when trying to access my brokered Windows Runtime object?COM is double-checking the trust level.

Raymond Chen

COM is double-checking the trust level.

Aug 7, 2024
Post comments count 1
Post likes count 1

How do I know when the user has finished interacting with the Accounts­Settings­Pane?

Raymond Chen

You can use the version that runs an asynchronous operation.

Aug 6, 2024
Post comments count 9
Post likes count 3

It rather involved being on the other side of the airtight hatchway: Disabling a security feature as an administrator

Raymond Chen

At least they don't beat around the bush.

Aug 5, 2024
Post comments count 9
Post likes count 1

What are the dire consequences of registering a RunOnce command from my RunOnce command?

Raymond Chen

The circle of life, or a perpetual motion machine.

Aug 2, 2024
Post comments count 3
Post likes count 3

The difference between undefined behavior and ill-formed C++ programs

Raymond Chen

They are two kinds of undefined-ness, one for runtime and one for compile-time.

Aug 1, 2024
Post comments count 2
Post likes count 1

What’s the difference between Data­Package­View.Get­Uri­Async and Data­Package­View.Get­Web­Link­Async?

Raymond Chen

Just improving on an ambiguous name.

Jul 31, 2024
Post comments count 1
Post likes count 3

How to compress out interior padding in a std::pair and why you don’t want to

Raymond Chen

Context-sensitive layout means you get a different structure each time you use it.

Jul 30, 2024
Post comments count 8
Post likes count 5

There is no mystery over who wrote the Blue Screen of Death, despite what some may want you to believe

Raymond Chen

No real contradictions in anybody's story.

Jul 29, 2024
Post comments count 1
Post likes count 1

Why don’t Windows Imaging Component pixel format GUIDs continue their nice pattern?

Raymond Chen

Patterns are predictable, which is not always a good thing.

Jul 26, 2024
Post comments count 2
Post likes count 2

What can I do if IMlangConvertCharset is unable to convert from code page 28591 directly to UTF-8?

Raymond Chen

You can do the conversion in two steps using things you already have.

Jul 25, 2024
Post comments count 0
Post likes count 2

In my Visual Studio project, I set my Conformance mode to permissive, but it’s still not permissive

Raymond Chen

Digging into what the compiler sees.

Jul 24, 2024
Post comments count 7
Post likes count 1

API naming principle: If there is no direct object, then the direct object is the source object

Raymond Chen

If you don't know what it operates on or produces, then it operates on or produces itself.

Jul 23, 2024
Post comments count 11
Post likes count 3

Unquoted service paths: The new frontier in script kiddie security vulnerability reports

Raymond Chen

Usually not exploitable, but the script kiddies don't know that.

Jul 22, 2024
Post comments count 9
Post likes count 5

Organizing the five creation dispositions of the Create­File function

Raymond Chen

Six possibilities, but only five useful ones.

Jul 19, 2024
Post comments count 0
Post likes count 1

Creating an already-completed asynchronous activity in C++/WinRT, part 9

Raymond Chen

Cheating the delegates.

Jul 18, 2024
Post comments count 1
Post likes count 1

Creating an already-completed asynchronous activity in C++/WinRT, part 8

Raymond Chen

Generalizing the pattern.

Jul 17, 2024
Post comments count 2
Post likes count 1

Creating an already-completed asynchronous activity in C++/WinRT, part 7

Raymond Chen

Implementing the contract directly.

Jul 16, 2024
Post comments count 0
Post likes count 1

Creating an already-completed asynchronous activity in C++/WinRT, part 6

Raymond Chen

Let the conversion do the talking.

Jul 15, 2024
Post comments count 0
Post likes count 1

Creating an already-completed asynchronous activity in C++/WinRT, part 5

Raymond Chen

Trying to fail more correctly.

Jul 12, 2024
Post comments count 2
Post likes count 3

Creating an already-completed asynchronous activity in C++/WinRT, part 4

Raymond Chen

Failing is easy. Failing correctly is hard.

Jul 11, 2024
Post comments count 0
Post likes count 2

Creating an already-completed asynchronous activity in C++/WinRT, part 3

Raymond Chen

Generalizing to the four kinds of Windows Runtime asynchronous activities.

Jul 10, 2024
Post comments count 2
Post likes count 3

Creating an already-completed asynchronous activity in C++/WinRT, part 2

Raymond Chen

Making our function a coroutine.

Jul 9, 2024
Post comments count 2
Post likes count 2

Creating an already-completed asynchonous activity in C++/WinRT, part 1

Raymond Chen

The simplest version.

Jul 8, 2024
Post comments count 5
Post likes count 3

What’s the point of std::monostate? You can’t do anything with it!

Raymond Chen

Not doing anything with it is exactly the point.

Jul 5, 2024
Post comments count 0
Post likes count 2

How do I produce a Windows Runtime asynchronous activity from C++/WinRT?

Raymond Chen

Somebody that deals with them natively.

Jul 4, 2024
Post comments count 2
Post likes count 3

How do I produce a Windows Runtime asynchronous activity from C#?

Raymond Chen

The AsyncInfo helper class converts Tasks to Windows Runtime asynchronous activities.

Jul 3, 2024
Post comments count 1
Post likes count 1

How do I produce a Windows Runtime asynchronous activity from C++/CX?

Raymond Chen

The Parallel Patterns Library has special support for C++/CX.

Jul 2, 2024
Post comments count 22
Post likes count 5

The history of Alt+number sequences, and why Alt+9731 sometimes gives you a heart and sometimes a snowman

Raymond Chen

Code pages and custom keyboard handling.

Jul 1, 2024
Post comments count 5
Post likes count 3

If I register the same shell extension as both a context menu extension and a drag/drop extension, how do I know which one the system is using?

Raymond Chen

Who forced you to register the same shell extension for both?

Jun 28, 2024
Post comments count 11
Post likes count 3

2024 mid-year link clearance

Raymond Chen

Emptying out the junk drawer.

Jun 28, 2024
Post comments count 2
Post likes count 3

Writing a remove_all_pointers type trait, part 2

Raymond Chen

Factoring out the type resolution to after the dangerous part.

Jun 27, 2024
Post comments count 3
Post likes count 3

Writing a remove_all_pointers type trait, part 1

Raymond Chen

Delaying the expansion to avoid infinite recursion.

Jun 26, 2024
Post comments count 2
Post likes count 1

Is there a built-in way in C++/WinRT to get the string name for a Windows Runtime enum?

Raymond Chen

No, and maybe you don't want to.

Jun 25, 2024
Post comments count 0
Post likes count 1

Microspeak: Fun fork

Raymond Chen

A place to party.

Jun 24, 2024
Post comments count 7
Post likes count 1

Finding a specific value in a sequence of integers that changes by at most 1

Raymond Chen

It's basically a discrete version of the intermediate value theorem.

Jun 21, 2024
Post comments count 1
Post likes count 1

The Windows Runtime winrt::hstring and the C++ std::wstring are inter-assignable

Raymond Chen

Just assign them over, no cermony necessary.

Jun 20, 2024
Post comments count 0
Post likes count 3

How to convert between different types of counted-string string types

Raymond Chen

Looking for constructors that take a character count.

Jun 19, 2024
Post comments count 12
Post likes count 2

On the sadness of treating counted strings as null-terminated strings

Raymond Chen

You're throwing away perfectly good data, there.

Jun 18, 2024
Post comments count 9
Post likes count 1

The time smart quotes prevented the entire Office division from committing code

Raymond Chen

Breaking your tools with your tools.

Jun 17, 2024
Post comments count 5
Post likes count 4

How can I view the list of symbols available in a library?

Raymond Chen

A tool hiding inside another tool.

Jun 14, 2024
Post comments count 3
Post likes count 1

Lock-free reference-counting a TLS slot using atomics, part 3

Raymond Chen

Keeping track of two things at once.

Jun 13, 2024
Post comments count 2
Post likes count 2

Lock-free reference-counting a TLS slot using atomics, part 2

Raymond Chen

Getting it is easy. Getting rid of it is hard.

Jun 12, 2024
Post comments count 6
Post likes count 1

Lock-free reference-counting a TLS slot using atomics, part 1

Raymond Chen

First, we do it with locks.

Jun 11, 2024
Post comments count 19
Post likes count 7

The origin story of the Windows 3D Pipes screen saver

Raymond Chen

Looking for a place to show off.

Jun 10, 2024
Post comments count 15
Post likes count 1

How do I get the name of a SID, and what does it mean when the conversion fails?

Raymond Chen

Most places will do it for you, or at least try.

Jun 7, 2024
Post comments count 4
Post likes count 2

What’s the deal with std::type_identity?

Raymond Chen

When you want to use a type without participating in type deduction.

Jun 6, 2024
Post comments count 8
Post likes count 3

Can INI files be Unicode? Yes, they can, but it has to be your idea

Raymond Chen

It'll only be Unicode if it's already Unicode.

Jun 5, 2024
Post comments count 0
Post likes count 3

How 16-bit Windows cached INI files for performance

Raymond Chen

Taking advantage of co-operative multitasking.

Jun 4, 2024
Post comments count 3
Post likes count 1

Why does Global­Lock max out at 255 locks?

Raymond Chen

Because that's how many bits were available for reporting the lock count.

Jun 3, 2024
Post comments count 9
Post likes count 1

More on harmful overuse of std::move

Raymond Chen

Could we expand copy elision to cover the harmful cases?

May 31, 2024
Post comments count 4
Post likes count 6

A graphical depiction of the steps in building a C++ executable, with XAML and packaging

Raymond Chen

Fleshing out the diagram.

May 30, 2024
Post comments count 1
Post likes count 1

A graphical depiction of the steps in building a C++ executable, enhanced for classic Win32

Raymond Chen

Adding in Microsoft-specific tools.

May 29, 2024
Post comments count 5
Post likes count 2

A graphical depiction of the steps in building a C++ executable, basics

Raymond Chen

A high-level overview.

May 28, 2024
Post comments count 6
Post likes count 4

How can I force a DLL to register itself if it won’t respond to regsvr32?

Raymond Chen

You can't force something that isn't there.

May 27, 2024
Post comments count 3
Post likes count 3

Is there any difference between String­From­IID and String­From­CLSID?

Raymond Chen

Not really.

May 24, 2024
Post comments count 0
Post likes count 2

Setting the contents of a Windows Runtime Vector from C++/WinRT in one call

Raymond Chen

The one-stop shop for updating a Windows Runtime Vector.

May 23, 2024
Post comments count 0
Post likes count 1

Creating a prepopulated Windows Runtime Vector from C++/WinRT without going through an explicit std::vector

Raymond Chen

Creating the vector inline.

May 22, 2024
Post comments count 3
Post likes count 1

If you have to create a Windows Runtime Vector from C++/WinRT, do it as late as possible

Raymond Chen

Stay with the <CODE>std::vector</CODE> until you really need the Window Runtime Vector.

May 21, 2024
Post comments count 6
Post likes count 7

A blurry photo of the legendary USB Cart of Death

Raymond Chen

And some details about that infamous on-stage bluescreen.

May 20, 2024
Post comments count 5
Post likes count 1

If you know what interface you want, just pass it directly to CoCreateInstance

Raymond Chen

Avoiding a second round trip.

May 17, 2024
Post comments count 0
Post likes count 1

Why can’t I find the injected name of a templated class’s templated base class?

Raymond Chen

The compiler needs help finding it because it's not findable at the time the template is parsed.

May 16, 2024
Post comments count 1
Post likes count 2

Pulling a single item from a C++ parameter pack by its index

Raymond Chen

Combining a few tools to make a new tool.

May 15, 2024
Post comments count 9
Post likes count 2

Building the most efficient device selector query that selects no devices

Raymond Chen

Looking for the most efficient way of rejecting everything.

May 14, 2024
Post comments count 1
Post likes count 5

The confidential coffee maker was not the only source of shenanigans at the IBM Boca office

Raymond Chen

The culture (and weather) clash continues.

May 13, 2024
Post comments count 2
Post likes count 5

Before you try to change something, make sure you can change nothing

Raymond Chen

Nobody touch anything.

May 10, 2024
Post comments count 4
Post likes count 7

An informal comparison of the three major implementations of std::string

Raymond Chen

Pros and cons.

May 9, 2024
Post comments count 0
Post likes count 1

Asking for a DispatcherQueue from a GUI thread you created

Raymond Chen

Grafting a DispatcherQueue onto an existing thread.

May 8, 2024
Post comments count 3
Post likes count 1

Awaiting a set of handles with a timeout, part 7: Just doing it one at a time

Raymond Chen

A simpler version with its own quirks.

May 7, 2024
Post comments count 7
Post likes count 1

Awaiting a set of handles with a timeout, part 6: Capturing the handles efficiently

Raymond Chen

SFINAE'ing the case of a random-access(ish) iterator.

May 6, 2024
Post comments count 0
Post likes count 1

Awaiting a set of handles with a timeout, part 5: Generalizing the awaiter

Raymond Chen

Fitting into existing patterns.

May 3, 2024
Post comments count 1
Post likes count 1

Awaiting a set of handles with a timeout, part 4: Building our own awaiter

Raymond Chen

To stop relying on unspecified behavior.

May 2, 2024
Post comments count 2
Post likes count 1

Awaiting a set of handles with a timeout, part 3: Going beyond two

Raymond Chen

Generalizing what we learned last time.

May 1, 2024
Post comments count 4
Post likes count 1

Awaiting a set of handles with a timeout, part 2: Continuing with two

Raymond Chen

Giving it another try.

Apr 30, 2024
Post comments count 3
Post likes count 1

Awaiting a set of handles with a timeout, part 1: Starting with two

Raymond Chen

Let's see by seeing if we can do it with just two.

Apr 29, 2024
Post comments count 0
Post likes count 2

Awaiting a set of handles in C++/WinRT

Raymond Chen

It's easier thank you think.

Apr 26, 2024
Post comments count 0
Post likes count 1

Adding state to the update notification pattern, part 8

Raymond Chen

Comparing the two algorithms.

Apr 25, 2024
Post comments count 5
Post likes count 1

Adding state to the update notification pattern, part 7

Raymond Chen

Going free-threaded.

Apr 24, 2024
Post comments count 0
Post likes count 2

Adding state to the update notification pattern, part 6

Raymond Chen

Using a change counter with coalescing.

Apr 23, 2024
Post comments count 1
Post likes count 1

Adding state to the update notification pattern, part 5

Raymond Chen

Using a change counter.

Apr 22, 2024
Post comments count 0
Post likes count 1

Adding state to the update notification pattern, part 4

Raymond Chen

What if the UI thread isn't there to save you?

Apr 19, 2024
Post comments count 2
Post likes count 1

Adding state to the update notification pattern, part 3

Raymond Chen

Abandoning the background work if we know that it is pointless.

Apr 18, 2024
Post comments count 2
Post likes count 1

Adding state to the update notification pattern, part 2

Raymond Chen

First attempt to try to fix the race condition.

Apr 17, 2024
Post comments count 0
Post likes count 3

Adding state to the update notification pattern, part 1

Raymond Chen

Where each notification depends on some state information.

Apr 16, 2024
Post comments count 4
Post likes count 0

In search of the Ballmer Peak, and other results from SIGBOVIK 2024

Raymond Chen

Continuing studies in silliness.

Apr 16, 2024
Post comments count 2
Post likes count 2

Dubious security vulnerability: Program allows its output to be exfiltrated

Raymond Chen

Once the output is generated, the program can't control where it goes.

Apr 15, 2024
Post comments count 4
Post likes count 2

What were the tax consequences of letting Windows 95 team members keep a piece of software as long as they tested it?

Raymond Chen

It basically falls under the <I>de minimis</I> rule.

Apr 12, 2024
Post comments count 8
Post likes count 7

The case of the string being copied from a mysterious pointer to invalid memory

Raymond Chen

Using AppVerifier to deduce the heap allocation history.

Apr 11, 2024
Post comments count 3
Post likes count 2

Why do STANDARD_RIGHTS_READ, STANDARD_RIGHTS_WRITE, and STANDARD_RIGHTS_EXECUTE have the same values?

Raymond Chen

Don't they mean different things?

Apr 10, 2024
Post comments count 1
Post likes count 1

How can I find out which process has locked me out of the clipboard?

Raymond Chen

You can ask for the clipboard opener.

Apr 9, 2024
Post comments count 0
Post likes count 1

If I enumerate all the processes and add up all the Get­Gui­Resources, why doesn’t it match the GR_GLOBAL value?

Raymond Chen

There are some things that aren't charged to processes.

Apr 8, 2024
Post comments count 18
Post likes count 4

How does the classic Win32 ListView handle incremental searching?

Raymond Chen

Combining prefix search with repeated search, to accommodate multiple styles.

Apr 5, 2024
Post comments count 0
Post likes count 2

The case of the exception that a catch (…) didn’t catch

Raymond Chen

Reconstructing a false history.

Apr 4, 2024
Post comments count 16
Post likes count 4

It rather involved being on the other side of this airtight hatchway: System corruption caused by an administrator

Raymond Chen

If your goal was to corrupt the system, you sure are doing it the hard way.

Apr 3, 2024
Post comments count 2
Post likes count 5

Windows debugger trick: Breaking when a specific debugger message is printed

Raymond Chen

A different kind of conditional breakpoint.

Apr 2, 2024
Post comments count 4
Post likes count 6

The history of computing, as told by the hallways of Microsoft Building 41

Raymond Chen

A walk through history, in the form of wall textures.

Apr 1, 2024
Post comments count 19
Post likes count 9

Subroutine calls in the ancient world, before computers had stacks or heaps

Raymond Chen

A lot of computing got done even before we had stacks and heaps.

Mar 29, 2024
Post comments count 10
Post likes count 5

How can I tell C++ that I want to discard a nodiscard value?

Raymond Chen

A variety of tricks, with different degrees of readability and legality.

Mar 28, 2024
Post comments count 8
Post likes count 3

I called Create­Environment­Block with a process’s token, but I didn’t get that process’s environment

Raymond Chen

That's not what the <CODE>Create­Environment­Block</CODE> function does.

Mar 27, 2024
Post comments count 9
Post likes count 5

Some choices for encrypting data so that it can be decrypted only by the same user or computer

Raymond Chen

There's your classic, and there's some newfangled stuff.

Mar 26, 2024
Post comments count 2
Post likes count 4

Dubious security vulnerability: Manual operations can cause a program to hang

Raymond Chen

You did this to yourself.

Mar 25, 2024
Post comments count 0
Post likes count 4

Why isn’t C++ using my default parameter to deduce a template type?

Raymond Chen

Trying to have it both ways.

Mar 22, 2024
Post comments count 7
Post likes count 2

Why does my thread get a broken string as its initial parameter?

Raymond Chen

It got converted too late.

Mar 21, 2024
Post comments count 13
Post likes count 2

Using the Display­Information class from a desktop Win32 application, part 2

Raymond Chen

Completing the prerequisites.

Mar 20, 2024
Post comments count 3
Post likes count 3

Using the Display­Information class from a desktop Win32 application, part 1

Raymond Chen

A little interop music.

Mar 19, 2024
Post comments count 0
Post likes count 1

How well does C++/WinRT com_ptr support class template argument deduction (CTAD)?

Raymond Chen

It doesn't even try, and probably doesn't want you to do it.

Mar 18, 2024
Post comments count 0
Post likes count 1

How well does wil com_ptr support class template argument deduction (CTAD)?

Raymond Chen

Falling into a hole in the C++ language, not filled in until C++20.

Mar 15, 2024
Post comments count 4
Post likes count 1

How well does WRL ComPtr support class template argument deduction (CTAD)?

Raymond Chen

It tries too hard and accidentally breaks CTAD.

Mar 14, 2024
Post comments count 1
Post likes count 1

How well does ATL CComPtr support class template argument deduction (CTAD)?

Raymond Chen

It actually works right out of the box.

Mar 13, 2024
Post comments count 1
Post likes count 1

How well does MFC IPTR/CIP support class template argument deduction (CTAD)?

Raymond Chen

Not very well, thanks to requiring the interface ID to be specified explicitly.

Mar 12, 2024
Post comments count 0
Post likes count 2

How well does _com_ptr_t support class template argument deduction (CTAD)?

Raymond Chen

Not very well, thanks to storing the pointer and IID pair in a helper type.

Mar 11, 2024
Post comments count 3
Post likes count 3

Class template argument deduction (CTAD) and C++ COM wrappers: Initial explorations

Raymond Chen

How well do these libraries support a feature that likely didn't exist at the time they were written?

Mar 8, 2024
Post comments count 0
Post likes count 0

The 2024/2025 Seattle Symphony subscription season at a glance

Raymond Chen

The pocket reference guide for 2024/2025.

Mar 8, 2024
Post comments count 5
Post likes count 1

How can I force a copy of a C++ value?

Raymond Chen

Forcing a copy with a minimum of typing.

Mar 7, 2024
Post comments count 4
Post likes count 1

In C++/WinRT, you shouldn’t destroy an object while you’re co_awaiting it

Raymond Chen

A generalization of the ground rules of programming.

Mar 6, 2024
Post comments count 5
Post likes count 1

How do I make an expression non-movable? What’s the opposite of std::move?

Raymond Chen

You can turn it into a const thing so it's no longer movable, in a conventional sense.

Mar 5, 2024
Post comments count 4
Post likes count 2

In domain\user syntax, you can often use the period as an abbreviation for “this computer”

Raymond Chen

A bit of a typing saver, particularly with complex machine names.

Mar 4, 2024
Post comments count 1
Post likes count 4

Is shadowing a member variable from a base class a bad thing? Maybe, but maybe not.

Raymond Chen

It depends on the order in which things occurred.

Mar 1, 2024
Post comments count 14
Post likes count 4

C++/WinRT performance trap: Switching to Windows Runtime too soon

Raymond Chen

Stay in the devirtualized world until you are forced to leave.

Feb 29, 2024
Post comments count 7
Post likes count 5

If a parameter isn’t used, what should I pass?

Raymond Chen

It doesn't matter what you pass, but if you have to ask, then just pass zero.

Feb 28, 2024
Post comments count 16
Post likes count 2

On the whole idea of giving away a reference to yourself at destruction

Raymond Chen

Hey, at least it's possible.

Feb 27, 2024
Post comments count 15
Post likes count 2

Mitigating attacks based on knowing the length of a Windows Hello PIN

Raymond Chen

Balancing convenience against security, and how you can tune the knobs toward more security.

Feb 26, 2024
Post comments count 21
Post likes count 1

A C# LINQ one-liner to check if exactly one of a set of conditions is met

Raymond Chen

Maybe not the most efficient, but it's easy to write.

Feb 23, 2024
Post comments count 4
Post likes count 4

Gotcha: Be careful how you shut down your dispatcher queues

Raymond Chen

The dispatcher queue thread isn't useful after it has shut down, so don't try anything.

Feb 22, 2024
Post comments count 1
Post likes count 1

Gotcha: Don’t forget to shut down your dispatcher queues

Raymond Chen

Keep that dispatcher queue controller around, or you'll never be able to clean up.

Feb 21, 2024
Post comments count 1
Post likes count 1

Once your object reaches final_release, you are committed to destructing it (eventually)

Raymond Chen

Don't try to resurrect it.

Feb 20, 2024
Post comments count 3
Post likes count 1

Microspeak: Closing out, duping out

Raymond Chen

Making work items no longer appear on a query.

Feb 19, 2024
Post comments count 9
Post likes count 5

Why can’t I trigger a manual blue screen crash by injecting the magic key sequence?

Raymond Chen

It has to come from the physical keyboard, because that's the code that detects the magic key sequence.

Feb 16, 2024
Post comments count 17
Post likes count 8

If you’re just going to sit there doing nothing, at least do nothing correctly

Raymond Chen

How to be inert.

Feb 15, 2024
Post comments count 3
Post likes count 8

Registered command lines are just command lines, not a programming language

Raymond Chen

If you want a programming language, you know where to find one.

Feb 14, 2024
Post comments count 6
Post likes count 4

Functions that return the size of a required buffer generally return upper bounds, not tight bounds

Raymond Chen

An over-estimate is better than an under-estimate.

Feb 13, 2024
Post comments count 3
Post likes count 3

It rather involved being on the other side of this airtight hatchway: Attacking a domain administrator from the local administrator

Raymond Chen

If you pwn the machine, then you pwn everyone on the machine.

Feb 12, 2024
Post comments count 1
Post likes count 3

How can I get the Windows Runtime HttpClient to display a basic authentication prompt?

Raymond Chen

You need to give it some help finding the right window.

Feb 9, 2024
Post comments count 25
Post likes count 12

On the virtues of the trailing comma

Raymond Chen

A more uniform appearance comes with its own benefits beyond aesthetics.

Feb 8, 2024
Post comments count 3
Post likes count 3

How do I suppress the error box that appears when a LoadLibrary fails?

Raymond Chen

They don't appear often, but they do appear occasionally.

Feb 7, 2024
Post comments count 4
Post likes count 2

Why doesn’t my program get fancy drag/drop effects in high contrast mode with CLSID_Drag­Drop­Helper?

Raymond Chen

You have to upgrade your manifest.

Feb 6, 2024
Post comments count 11
Post likes count 3

On using milliseconds as a measure of network latency

Raymond Chen

There's a limit to how much technology can improve.

Feb 5, 2024
Post comments count 1
Post likes count 4

How can I close a thread pool and cancel all work that had been queued to it?

Raymond Chen

You can put them in a group.

Feb 2, 2024
Post comments count 4
Post likes count 1

The case of the invalid parameter error from Measure­Override

Raymond Chen

Chasing it back to its origin.

Feb 1, 2024
Post comments count 7
Post likes count 2

Using virtual memory placeholders to allocate contiguous address space for multiple purposes

Raymond Chen

Can you hold this for a second?

Jan 31, 2024
Post comments count 10
Post likes count 2

How can I add an environment variable to a process launched via Shell­Execute­Ex or IContext­Menu?

Raymond Chen

Hooking into the way the Windows shell launches processes.

Jan 30, 2024
Post comments count 1
Post likes count 1

Smoothing over the differences (and defects) in the various implementations of IMemory­Buffer

Raymond Chen

Stick to the part that nobody messes up.

Jan 29, 2024
Post comments count 0
Post likes count 2

A comparison of various implementations of the Windows Runtime IMemory­Buffer

Raymond Chen

Every unhappy class is unhappy in its own way.

Jan 26, 2024
Post comments count 0
Post likes count 2

How can I expose a pre-existing block of memory as a Windows Runtime object without copying the data?

Raymond Chen

Assembling all the pieces.

Jan 25, 2024
Post comments count 8
Post likes count 1

How can I give away a COM reference just before my object destructs?

Raymond Chen

You have to do it before committing to destruction.

Jan 24, 2024
Post comments count 2
Post likes count 2

The dangerous implementations of the IMemory­Buffer­Reference.Closed event

Raymond Chen

Mistakenly handing out COM references that don't work.

Jan 23, 2024
Post comments count 1
Post likes count 2

The useless IMemory­Buffer­Reference.Closed event

Raymond Chen

It tells you that you have already lost.

Jan 22, 2024
Post comments count 0
Post likes count 3

Accessing a block of memory represented by a Windows Runtime IMemoryBuffer

Raymond Chen

Through the currency known as an IMemoryBufferReference.

Jan 19, 2024
Post comments count 2
Post likes count 1

The case of the fail-fast trying to log a caught exception

Raymond Chen

What is being thrown and why can't we log it?

Jan 18, 2024
Post comments count 0
Post likes count 2

Implementing two-phase initialization with ATL

Raymond Chen

ATL looks like it supports two-phase initialization, but it doesn't.

Jan 17, 2024
Post comments count 1
Post likes count 2

Getting a strong reference from the this pointer too soon

Raymond Chen

Giving out strong references to an object before you can guarantee that it will work.

Jan 16, 2024
Post comments count 4
Post likes count 9

What is a hard error, and what makes it harder than an easy error?

Raymond Chen

A throwback to the early days of 16-bit Windows.

Jan 15, 2024
Post comments count 5
Post likes count 2

C++/WinRT gotcha: Not all exceptions derive from hresult_error

Raymond Chen

There are also C++ standard exceptions, particularly <CODE>std::bad_alloc</CODE>.

Jan 12, 2024
Post comments count 1
Post likes count 2

In C++/WinRT, how can I await multiple coroutines and capture the results?, part 3

Raymond Chen

Dealing with awaitables that return <CODE>void</CODE>, and questioning our life choices.

Jan 11, 2024
Post comments count 0
Post likes count 3

In C++/WinRT, how can I await multiple coroutines and capture the results?, part 2

Raymond Chen

Wrapping the results and returning them in a tuple.

Jan 10, 2024
Post comments count 0
Post likes count 2

In C++/WinRT, how can I await multiple coroutines and capture the results?, part 1

Raymond Chen

Using a custom awaiter to suppress the <CODE>GetResults()</CODE>.

Jan 9, 2024
Post comments count 10
Post likes count 2

After I accidentally denied access to everyone, how do I get access back?

Raymond Chen

Congratulations, you locked your keys in the car.

Jan 8, 2024
Post comments count 0
Post likes count 2

How do I prevent my C++/WinRT implementation class from participating in COM aggregation?

Raymond Chen

Looking for a clue.

Jan 5, 2024
Post comments count 4
Post likes count 3

The case of the vector with an impossibly large size

Raymond Chen

Play threading games, win threading prizes.

Jan 4, 2024
Post comments count 9
Post likes count 4

How can I specify icons for my app to use on the Start menu in high contrast mode?

Raymond Chen

Put them in your manifest.

Jan 3, 2024
Post comments count 1
Post likes count 2

Why doesn’t my code compile when I change a shared_ptr<T>(p) to an equivalent make_shared<T>(p)?

Raymond Chen

It depends on who is doing the parameter conversion.

Jan 2, 2024
Post comments count 7
Post likes count 4

It rather involved being on the other side of this airtight hatchway: Attacking another program by modifying its memory

Raymond Chen

If you assume the existence of a vulnerability, you can use that vulnerability to attack something.

Jan 1, 2024
Post comments count 0
Post likes count 2

How do I prevent my ATL class from participating in COM aggregation? DECLARE_NOT_AGGREGATABLE didn’t work

Raymond Chen

That marker applies only to creation via the class factory.

Dec 29, 2023
Post comments count 8
Post likes count 4

2023 year-end link clearance

Raymond Chen

Ringing out another year.

Dec 29, 2023
Post comments count 2
Post likes count 4

How to allocate address space with a custom alignment or in a custom address region

Raymond Chen

Some new powers to guide the allocation.

Dec 28, 2023
Post comments count 1
Post likes count 4

On calling Afx­Connection­Advise with bAddRef set to FALSE

Raymond Chen

Playing fast and loose, and eventually you get burnt.

Dec 27, 2023
Post comments count 1
Post likes count 4

What does it mean when the compiler says that it can’t convert something to itself?

Raymond Chen

Why is it even thinking about a conversion?

Dec 26, 2023
Post comments count 1
Post likes count 9

Don’t keep state in your XAML item templates; put the state in the items

Raymond Chen

Beware of temporary alliances.

Dec 25, 2023
Post comments count 3
Post likes count 6

That time the Word team sent presents to the children of WordPerfect’s executive vice president

Raymond Chen

No, it wasn't creepy.

Dec 22, 2023
Post comments count 11
Post likes count 2

If I don’t have any items, what error should my IFolderView::Items method return?

Raymond Chen

It shouldn't return an error at all.

Dec 21, 2023
Post comments count 2
Post likes count 3

How do I get access to the wParam and lParam of the WM_QUERY­END­SESSION method from my MFC message handler?

Raymond Chen

Don't be afraid to see how the macros are built.

Dec 20, 2023
Post comments count 1
Post likes count 1

It rather involved being on the other side of this airtight hatchway: Spoofing another program

Raymond Chen

You already had the power to do it yourself.

Dec 19, 2023
Post comments count 1
Post likes count 1

Microspeak: Locked and loaded

Raymond Chen

Armed and ready, with the suggestion that no further changes will be needed (or accepted).

Dec 18, 2023
Post comments count 1
Post likes count 0

In 2023, the Gävle Goat faces a new threat to its survival

Raymond Chen

It's bock.

Dec 18, 2023
Post comments count 3
Post likes count 1

If the RegisterClass function takes ownership of the custom background brush, why is it leaking?

Raymond Chen

It takes ownership only on success.

Dec 15, 2023
Post comments count 2
Post likes count 1

How do I specify an optional string parameter to a Windows Runtime method?

Raymond Chen

Strings are sort of reference but sort of values.

Dec 14, 2023
Post comments count 1
Post likes count 1

How do I specify an optional parameter to a Windows Runtime method?

Raymond Chen

There is no way to express explicit optionality, but there are implicit ways.

Dec 13, 2023
Post comments count 0
Post likes count 2

How can I work around the absence of default parameters in the Windows Runtime?

Raymond Chen

You can fake it with overloads.

Dec 12, 2023
Post comments count 4
Post likes count 4

What happens if I define one environment variable in terms of the value of another environment variable?

Raymond Chen

Only certain types of dependencies are supported.

Dec 11, 2023
Post comments count 12
Post likes count 6

The mysterious second parameter to the x86 ENTER instruction

Raymond Chen

For an ABI that probably nobody uses.

Dec 8, 2023
Post comments count 6
Post likes count 3

A simpler version of the task sequencer that doesn’t promise fairness

Raymond Chen

Just let a kernel object control the access.

Dec 7, 2023
Post comments count 1
Post likes count 2

In C++, how can I make a default parameter be the this pointer of the caller?

Raymond Chen

Again, you can't, but you can fake it.

Dec 6, 2023
Post comments count 2
Post likes count 4

In C++, how can I make a member function default parameter depend on this?

Raymond Chen

You can't, but you can fake it.

Dec 5, 2023
Post comments count 6
Post likes count 8

What was the code name for 64-bit Windows?

Raymond Chen

Sundown, which was a hidden jab at the competition.

Dec 4, 2023
Post comments count 5
Post likes count 4

What is a static chain pointer in the context of calling convention ABI?

Raymond Chen

Buried in the System V Application Binary Interface.

Dec 1, 2023
Post comments count 6
Post likes count 3

Why does the Windows Portable Executable (PE) format have both an import section and input directory?

Raymond Chen

They seem to be the same thing. Do we need both?

Nov 30, 2023
Post comments count 2
Post likes count 5

Why does the Windows Portable Executable (PE) format have separate tables for import names and import addresses?, part 2

Raymond Chen

Keeping read-only data separate from read-write data.

Nov 29, 2023
Post comments count 6
Post likes count 4

Why does the Windows Portable Executable (PE) format have separate tables for import names and import addresses?, part 1

Raymond Chen

Even though their lifetimes don't overlap, you sometimes need to go back in time.

Nov 28, 2023
Post comments count 8
Post likes count 3

A reported vulnerability about getting paid apps for free is really about paying for free apps

Raymond Chen

Try shopping around.

Nov 27, 2023
Post comments count 3
Post likes count 5

In Windows 3.1 and Windows 95, what is a “grabber”?

Raymond Chen

It grabbed your MS-DOS screen and put it into a window.

Nov 24, 2023
Post comments count 10
Post likes count 11

On harmful overuse of std::move

Raymond Chen

Initial excitement leads to overuse.

Nov 23, 2023
Post comments count 0
Post likes count 2

On the need to keep most event sources alive if you want them to raise events

Raymond Chen

You can't receive a notification from something that doesn't exist.

Nov 22, 2023
Post comments count 1
Post likes count 5

How can I convert a Windows Runtime Software­Bitmap to a WIC bitmap?

Raymond Chen

The reverse of <CODE>ISoftware­Bitmap­Native­Factory::<WBR>Create­From­WIC­Bitmap</CODE>.

Nov 21, 2023
Post comments count 5
Post likes count 8

Microspeak revisited: Line of sight

Raymond Chen

A fancy way of saying unimpeded network connectivity.

Nov 20, 2023
Post comments count 0
Post likes count 3

If you’re going to crash on an unhandled exception, you may as well do it sooner rather than later

Raymond Chen

Avoiding the problem discovered by the case of the invalid argument exception from a method that takes no arguments.

Nov 17, 2023
Post comments count 0
Post likes count 3

The theory behind the IHttpFilter interface

Raymond Chen

Layering features on top of each other.

Nov 16, 2023
Post comments count 0
Post likes count 2

What happened to the custom exception description I threw from a C++/WinRT IAsyncAction?

Raymond Chen

The description is just a courtesy and is not part of the API contract.

Nov 15, 2023
Post comments count 2
Post likes count 2

Why does calling a coroutine allocate a lot of stack space even though the coroutine frame is on the heap?

Raymond Chen

Heap elision optimization kicks in, and doesn't kick out.

Nov 14, 2023
Post comments count 5
Post likes count 3

Starting on the other side of this airtight hatchway: Running a program that leaks memory

Raymond Chen

There are a lot of things you can do to consume memory.

Nov 13, 2023
Post comments count 2
Post likes count 4

What is the difference between UuidToString, StringFromCLSID, StringFromIID, and StringFromGUID2?

Raymond Chen

Different ways of stringizing a GUID.

Nov 10, 2023
Post comments count 2
Post likes count 2

The case of the invalid argument exception from a method that takes no arguments

Raymond Chen

Where did the invalid argument come from?

Nov 9, 2023
Post comments count 0
Post likes count 1

A clarification on the multithreading constraints of the Encrypt­Message function

Raymond Chen

Reading a sentence in the context of the whole paragraph.

Nov 8, 2023
Post comments count 0
Post likes count 1

How can I get information about media playing on the system, and optionally control their playback?

Raymond Chen

Going to the global system media transport controls world.

Nov 7, 2023
Post comments count 3
Post likes count 5

“Stop sharing this folder” is not the same as “Never share this folder”

Raymond Chen

It stops sharing the folder, but that doesn't prevent you from starting it again.

Nov 6, 2023
Post comments count 3
Post likes count 4

Why doesn’t reduction by modulo work for floating point values?

Raymond Chen

Working out why it works for integers and seeing what goes wrong.

Nov 3, 2023
Post comments count 1
Post likes count 5

Why does unsafe multithreaded use of an std::unordered_map crash more often than unsafe multithreaded use of a std::map?

Raymond Chen

It's all in the implementation details.

Nov 2, 2023
Post comments count 0
Post likes count 1

How come my custom exception message is lost when it is thrown from a IAsyncAction^?

Raymond Chen

Things that survive in the C++ world and things that are lost when you cross the ABI.

Nov 1, 2023
Post comments count 2
Post likes count 2

More notes on use of the DS_CONTROL style

Raymond Chen

Styles that have to go in, and styles that have to come out. (And styles that you can choose.)

Oct 31, 2023
Post comments count 9
Post likes count 3

What is the thread reaper?

Raymond Chen

Should you fear the thread reaper?

Oct 30, 2023
Post comments count 5
Post likes count 3

What are the dire consequences of not removing all the properties that were set via SetProp?

Raymond Chen

Not so much any more, but it could be a sign that you forgot something.

Oct 27, 2023
Post comments count 1
Post likes count 2

How to support a COM interface conditionally in WRL

Raymond Chen

Customizing the QueryInterface and GetIids methods.

Oct 26, 2023
Post comments count 0
Post likes count 3

How to support a COM interface conditionally in C++/WinRT

Raymond Chen

Prevent <CODE>winrt::implements</CODE> from responding to it or reporting it.

Oct 25, 2023
Post comments count 5
Post likes count 6

The format of icon resources, revisited

Raymond Chen

Filling in some gaps.

Oct 24, 2023
Post comments count 2
Post likes count 4

Why is there a hash of a weak password in the Windows cryptographic libraries?

Raymond Chen

They're part of an internal self-test.

Oct 23, 2023
Post comments count 2
Post likes count 4

How do I add a non-copyable, non-movable object to a std::map or std::unordered_map?

Raymond Chen

Fancy emplacement.

Oct 20, 2023
Post comments count 0
Post likes count 1

On the failed unrealized promise of Reg­Override­Predef­Key

Raymond Chen

An early attempt to sandbox the registry for a process.

Oct 19, 2023
Post comments count 3
Post likes count 2

What’s the difference between setting a page’s protection to PAGE_NOACCESS and freeing it?

Raymond Chen

Nobody can access it, but it's still there.

Oct 18, 2023
Post comments count 3
Post likes count 3

How can I check if I’m on a DispatcherQueue’s thread if I can’t call HasThreadAccess?

Raymond Chen

Looking at the tools you have available.

Oct 17, 2023
Post comments count 5
Post likes count 2

Microspeak: The As-Appropriate (AA) interviewer

Raymond Chen

So, how are things going so far?

Oct 16, 2023
Post comments count 9
Post likes count 3

API design principle: Reading a property or adding an event handler should not alter observable behavior

Raymond Chen

Don't punish people for looking.

Oct 13, 2023
Post comments count 0
Post likes count 2

On detecting improper use of std::enable_shared_from_this

Raymond Chen

Playing around with the standard library.

Oct 12, 2023
Post comments count 0
Post likes count 1

I created an overloaded operator for my C++/WinRT class, but it’s not working

Raymond Chen

Take a closer look at what you are overloading.

Oct 11, 2023
Post comments count 13
Post likes count 3

Why does IFileDialog still show non-filesystem folders when I pass FOS_FORCE­FILE­SYSTEM?

Raymond Chen

Because you need to pass through them to get there.

Oct 10, 2023
Post comments count 5
Post likes count 2

It rather required being on the other side of this airtight hatchway: Knowing the domain administrator password

Raymond Chen

If you give away the password, well, that's sort of on you.

Oct 9, 2023
Post comments count 2
Post likes count 2

Is there any performance advantage to marking a page read-only if I had no intention of writing to it anyway?

Raymond Chen

The CPU already figured it out.

Oct 6, 2023
Post comments count 2
Post likes count 1

A very belated improvement to the filtering of the Browse for Folder dialog so it shows only drive letters

Raymond Chen

The case of the very short UNC.

Oct 5, 2023
Post comments count 2
Post likes count 1

How can I get WideCharToMultiByte to convert strings encoded in UTF-16BE?

Raymond Chen

You first have to get it into a format the WideCharToMultiByte accepts.

Oct 4, 2023
Post comments count 3
Post likes count 2

On the confusing names for the Windows service SID types

Raymond Chen

Too much abbreviation.

Oct 3, 2023
Post comments count 1
Post likes count 6

A complaint about Links the Cat, the Office assistant

Raymond Chen

Do all cats do that?

Oct 2, 2023
Post comments count 0
Post likes count 1

How do I manually update a remote tracking branch, say, to undo a fetch?

Raymond Chen

Updating refs to point to whatever you like.

Sep 29, 2023
Post comments count 0
Post likes count 1

Template meta-programming: Avoiding saying a type before it is complete

Raymond Chen

Deferring use until after the class is defined.

Sep 28, 2023
Post comments count 2
Post likes count 2

C++/WinRT gotcha: get_strong() will produce a broken strong reference if destruction has already begun

Raymond Chen

A strong reference to nothing.

Sep 27, 2023
Post comments count 4
Post likes count 3

The dangers of releasing the last strong reference from within its own callback

Raymond Chen

Deadlocking with yourself.

Sep 26, 2023
Post comments count 8
Post likes count 6

Why is kernel32.dll running in user mode and not kernel mode, like its name implies?

Raymond Chen

It's just a name, and it comes from the days before user-mode/kernel-mode separation.

Sep 25, 2023
Post comments count 1
Post likes count 3

GetQueueStatus and the queue state

Raymond Chen

There's stuff going on that's hiding behind the innocuous-looking name.

Sep 22, 2023
Post comments count 3
Post likes count 6

When I try to call an exported function, the target crashes when it tries to call any Windows function

Raymond Chen

Using what you know about how functions are imported to construct a theory that matches the evidence.

Sep 21, 2023
Post comments count 9
Post likes count 8

How does Explorer calculate the “Date” of a file?

Raymond Chen

Mapping the generic concept to specific file types.

Sep 20, 2023
Post comments count 1
Post likes count 1

Why does my C++/WinRT project get unresolved externals for constructors?

Raymond Chen

You forgot to include the namespace header file, didn't you.

Sep 19, 2023
Post comments count 3
Post likes count 3

Why did the 16-bit _lopen and _lcreat function return -1 on failure instead of 0?

Raymond Chen

Trying to look like somebody else.

Sep 18, 2023
Post comments count 3
Post likes count 5

When looking to free up disk space, don’t forget your symbol file caches

Raymond Chen

They go all over the place.

Sep 15, 2023
Post comments count 6
Post likes count 2

How can I prevent myself from using a parameter after I’ve extracted all value from it?

Raymond Chen

You can shadow it with something useless.

Sep 14, 2023
Post comments count 7
Post likes count 3

I accidentally performed an operation on INVALID_HANDLE_VALUE, and it worked: What just happened?

Raymond Chen

Coincidentally valid, but not what you think.

Sep 13, 2023
Post comments count 1
Post likes count 2

How do I perform a case-insensitive comparison of two strings in the Deseret script?

Raymond Chen

It sort of depends on why you're comparing them.

Sep 12, 2023
Post comments count 4
Post likes count 3

The odd cadence of narrative engineering design documents

Raymond Chen

Following the rubric off a cliff.

Sep 11, 2023
Post comments count 27
Post likes count 8

Any sufficiently advanced uninstaller is indistinguishable from malware

Raymond Chen

The common pattern of trying to delete yourself.

Sep 8, 2023
Post comments count 3
Post likes count 4

On transferring or copying ABI pointers between smart pointers

Raymond Chen

Keep track of who owns the reference.

Sep 7, 2023
Post comments count 1
Post likes count 1

A freestanding JavaScript function that uses this is easily mistaken for a constructor

Raymond Chen

Because that's what constructors look like.

Sep 6, 2023
Post comments count 2
Post likes count 2

Detecting whether a tree-like data structure contains a cycle

Raymond Chen

Combining two things we already know.

Sep 5, 2023
Post comments count 2
Post likes count 1

When documentation cautions that something may not happen, that suggests that it normally does happen

Raymond Chen

Reading between the lines.

Sep 4, 2023
Post comments count 9
Post likes count 3

Just for fun: What happens when you shift a register by more than the register size?

Raymond Chen

A comparative study of processor architectures.

Sep 1, 2023
Post comments count 0
Post likes count 1

How do I find out more about the fail-fast exception that occurs when an exception in a PPL task goes unobserved?

Raymond Chen

Digging into the internals.

Aug 31, 2023
Post comments count 0
Post likes count 3

Diagnosing a crash when trying to call ReadFile via language interop

Raymond Chen

Checking the signatures and inferring what could have gone wrong.

Aug 30, 2023
Post comments count 2
Post likes count 5

How can I programmatically obtain the value of the “Make text bigger” slider?

Raymond Chen

The text scale factor property.

Aug 29, 2023
Post comments count 10
Post likes count 3

The popularity of DOS/4GW made Windows 95 game compatibility a little easier, but with higher stakes

Raymond Chen

A popular path to protected mode.

Aug 28, 2023
Post comments count 4
Post likes count 3

Just for fun: Which processors prefer sign-extended loads, and which prefer zero-extended loads?

Raymond Chen

Another pointless chart.

Aug 25, 2023
Post comments count 3
Post likes count 2

On writing loops in continuation-passing style, part 4

Raymond Chen

Equivalents in C# and JavaScript.

Aug 24, 2023
Post comments count 0
Post likes count 2

On writing loops in PPL and continuation-passing style, part 3

Raymond Chen

Explicit shared state.

Aug 23, 2023
Post comments count 0
Post likes count 2

On writing loops in PPL and continuation-passing style, part 2

Raymond Chen

Recursion comes back.

Aug 22, 2023
Post comments count 0
Post likes count 2

On writing loops in PPL and continuation-passing style, part 1

Raymond Chen

Keeping track of what to do next.

Aug 21, 2023
Post comments count 7
Post likes count 3

Inside STL: The different types of shared pointer control blocks

Raymond Chen

Well, some of them, at least.

Aug 18, 2023
Post comments count 1
Post likes count 2

Phantom and indulgent shared pointers

Raymond Chen

The phantom controls something yet holds nothing. The indulgent holds something but controls nothing.

Aug 17, 2023
Post comments count 1
Post likes count 2

What it means when you convert between different shared_ptrs

Raymond Chen

Changing the pointer while controlling the same object.

Aug 16, 2023
Post comments count 1
Post likes count 4

Inside STL: The shared_ptr constructor and enable_shared_from_this

Raymond Chen

Working together through a secret signal.

Aug 15, 2023
Post comments count 7
Post likes count 2

Inside STL: The shared_ptr constructor vs make_shared

Raymond Chen

Where to hide the control block.

Aug 14, 2023
Post comments count 4
Post likes count 6

Inside STL: Smart pointers

Raymond Chen

Simple pointers or more complicated pointers.

Aug 11, 2023
Post comments count 0
Post likes count 5

Inside STL: The array

Raymond Chen

It's just an array.

Aug 10, 2023
Post comments count 3
Post likes count 5

Inside STL: The deque, implementation

Raymond Chen

An array of (pointers to) arrays.

Aug 9, 2023
Post comments count 2
Post likes count 7

Inside STL: The deque, design

Raymond Chen

An array of (pointers to) arrays.

Aug 8, 2023
Post comments count 1
Post likes count 8

Inside STL: The unordered_map, unordered_set, unordered_multimap, and unordered_multiset

Raymond Chen

A hash table.

Aug 7, 2023
Post comments count 6
Post likes count 5

Inside STL: The map, set, multimap, and multiset

Raymond Chen

A red-black tree.

Aug 4, 2023
Post comments count 3
Post likes count 7

Inside STL: The lists

Raymond Chen

Your traditional singly- or doubly-linked list.

Aug 3, 2023
Post comments count 6
Post likes count 9

Inside STL: The string

Raymond Chen

An allocation, with a twist.

Aug 2, 2023
Post comments count 6
Post likes count 7

Inside STL: The vector

Raymond Chen

A contiguous memory block, reallocated as necessary.

Aug 1, 2023
Post comments count 7
Post likes count 8

Inside STL: The pair and the compressed pair

Raymond Chen

Two fields in one object, how hard can it be?

Jul 31, 2023
Post comments count 4
Post likes count 4

Misinterpreting the misleadingly-named STATUS_STACK_BUFFER_OVERRUN

Raymond Chen

The subcode tells you why we stopped executing, and it's rarely because of a stack buffer overflow.

Jul 28, 2023
Post comments count 1
Post likes count 1

How to split off an older copy of a file while preserving git line history

Raymond Chen

Variation on a theme.

Jul 27, 2023
Post comments count 0
Post likes count 1

Perfect forwarding forwards objects, not braced things that are trying to become objects

Raymond Chen

Before you can forward something, it needs to be a something.

Jul 26, 2023
Post comments count 0
Post likes count 2

On the various ways of creating Windows Runtime delegates in C++/WinRT and C++/CX

Raymond Chen

Comparing and contrasting.

Jul 25, 2023
Post comments count 7
Post likes count 34

Before you try to do something, make sure you can do nothing

Raymond Chen

If you can't do nothing, then don't expect to be able to do something.

Jul 24, 2023
Post comments count 0
Post likes count 2

Why does IAsyncAction or IAsyncOperation.GetResults() produce a E_ILLEGAL_METHOD_CALL exception?

Raymond Chen

You're asking too soon.

Jul 21, 2023
Post comments count 0
Post likes count 1

How to clone a Windows Runtime map in the face of possible concurrent modification, part 3

Raymond Chen

Doing it one more time, for C++/CX.

Jul 20, 2023
Post comments count 0
Post likes count 1

How to clone a Windows Runtime map in the face of possible concurrent modification, part 2

Raymond Chen

Applying what we learned about vectors.

Jul 19, 2023
Post comments count 0
Post likes count 1

How to clone a Windows Runtime map in the face of possible concurrent modification, part 1

Raymond Chen

Applying what we learned about vectors.

Jul 18, 2023
Post comments count 0
Post likes count 1

How to clone a Windows Runtime vector in the face of possible concurrent modification, part 4

Raymond Chen

Translating to C++/CX and dealing with some quirks of that language.

Jul 17, 2023
Post comments count 0
Post likes count 1

Cloning a Windows Runtime vector in the face of possible concurrent modification, denial of service?

Raymond Chen

Can you get sent into an infinite loop?

Jul 14, 2023
Post comments count 0
Post likes count 1

How to clone a Windows Runtime vector in the face of possible concurrent modification, part 3

Raymond Chen

Dealing with the pesky <CODE>std::vector<bool></CODE>.

Jul 13, 2023
Post comments count 0
Post likes count 1

How to clone a Windows Runtime vector in the face of possible concurrent modification, part 2

Raymond Chen

Trying to make a generic solution.

Jul 12, 2023
Post comments count 2
Post likes count 1

How to clone a Windows Runtime vector in the face of possible concurrent modification, part 1

Raymond Chen

Backing off and retrying, but the detection is the tricky part.

Jul 11, 2023
Post comments count 0
Post likes count 2

Why does the compiler complain about a missing constructor when I’m just resizing my std::vector to a smaller size?

Raymond Chen

The compiler doesn't know that you're shrinking.

Jul 10, 2023
Post comments count 1
Post likes count 2

How to wait for multiple C++ coroutines to complete before propagating failure, concluding remarks

Raymond Chen

The things that could go wrong before you even start.

Jul 7, 2023
Post comments count 1
Post likes count 1

How to wait for multiple C++ coroutines to complete before propagating failure, finding the awaiter

Raymond Chen

Making sure to wrap the right thing.

Jul 6, 2023
Post comments count 0
Post likes count 1

How to wait for multiple C++ coroutines to complete before propagating failure, wrapping the awaitable

Raymond Chen

Intercepting the exception on the front side.

Jul 5, 2023
Post comments count 2
Post likes count 1

How to wait for multiple C++ coroutines to complete before propagating failure, preallocating the coroutine frame

Raymond Chen

Avoiding dynamic memory allocation.

Jul 4, 2023
Post comments count 2
Post likes count 1

How to wait for multiple C++ coroutines to complete before propagating failure, memory allocation failure

Raymond Chen

There's no good way to report the failure, so we just have to give up.

Jul 3, 2023
Post comments count 0
Post likes count 1

How to wait for multiple C++ coroutines to complete before propagating failure, symmetric transfer

Raymond Chen

Avoiding stack build-up.

Jun 30, 2023
Post comments count 3
Post likes count 3

2023 mid-year link clearance

Raymond Chen

The tradition continues.

Jun 30, 2023
Post comments count 1
Post likes count 1

How to wait for multiple C++ coroutines to complete before propagating failure, custom promise

Raymond Chen

Taking things into our own hands.

Jun 29, 2023
Post comments count 0
Post likes count 2

How to wait for multiple C++ coroutines to complete before propagating failure, peeling away at a tuple

Raymond Chen

Iterating over a tuple recursively.

Jun 28, 2023
Post comments count 1
Post likes count 1

How to wait for multiple C++ coroutines to complete before propagating failure, false hope

Raymond Chen

Trying to iterate over a pack.

Jun 27, 2023
Post comments count 0
Post likes count 1

How to wait for multiple C++ coroutines to complete before propagating failure, unhelpful lambda

Raymond Chen

The usual trick doesn't work.

Jun 26, 2023
Post comments count 5
Post likes count 1

How to wait for multiple C++ coroutines to complete before propagating failure, initial plunge

Raymond Chen

Remembering the exception while finishing the other work.

Jun 23, 2023
Post comments count 5
Post likes count 4

What can go wrong if you release an SRWLock from a thread different from the one that acquired it?

Raymond Chen

It's not a supported scenario, so anything can happen.

Jun 22, 2023
Post comments count 1
Post likes count 1

How can I find out the last time a user logged on from C++?

Raymond Chen

The information is in the historically-named LANMAN APIs.

Jun 21, 2023
Post comments count 0
Post likes count 3

The case of the make_shared on a C++/WinRT type

Raymond Chen

Now you can't tell who's in charge.

Jun 20, 2023
Post comments count 2
Post likes count 2

Why is Windows using only even-numbered processors?

Raymond Chen

Spreading out the load over cores.

Jun 19, 2023
Post comments count 6
Post likes count 2

Why am I being told about a signed/unsigned comparison, and why only sometimes, and how can I fix it?

Raymond Chen

How the compiler back-end can influence warnings.

Jun 16, 2023
Post comments count 0
Post likes count 2

The case of the invalid handle despite being managed by an RAII type, part 2

Raymond Chen

Avoiding using an object after is has destructed, and maybe using a less-well-known corner of the C++ language.

Jun 15, 2023
Post comments count 0
Post likes count 2

The case of the invalid handle despite being managed by an RAII type

Raymond Chen

The handle remains valid for the object's lifetime, but what is the object's lifetime?

Jun 14, 2023
Post comments count 3
Post likes count 1

How expensive is it to create a Windows performance counter?

Raymond Chen

The cost depends on the performance counter.

Jun 13, 2023
Post comments count 2
Post likes count 2

SIDs are really just another a fancy way of creating unique IDs in a decentralized way

Raymond Chen

Keeping them from colliding with each other.

Jun 12, 2023
Post comments count 4
Post likes count 2

The move constructor that you have to declare, even though you don’t want anyone to actually call it

Raymond Chen

Forcing named return value optimization.

Jun 9, 2023
Post comments count 4
Post likes count 2

Reordering C++ template type parameters for usability purposes, and type deduction from the future

Raymond Chen

You want them to go first, but you also want to deduce them.

Jun 8, 2023
Post comments count 8
Post likes count 2

How can I register a program to auto-relaunch if it crashes or is terminated?, redux

Raymond Chen

You can get a little bit of the way there.

Jun 7, 2023
Post comments count 11
Post likes count 1

Pulling sleight of hand tricks in a security vulnerability report, episode 2

Raymond Chen

I see what you did there.

Jun 6, 2023
Post comments count 4
Post likes count 1

How can I make WiFi passwords per-user rather than per-system?

Raymond Chen

A little-known system configuration setting.

Jun 5, 2023
Post comments count 8
Post likes count 1

It’s great that you provide operator overloads, but it’s also nice to have names

Raymond Chen

Avoiding the need to invoke the operator explicitly as a specialized template, among other things.

Jun 2, 2023
Post comments count 0
Post likes count 1

C++/WinRT event handlers that are lambdas with weak pointers to the parent class, part 3

Raymond Chen

Extending to <CODE>std::weak_ptr</CODE>.

Jun 1, 2023
Post comments count 0
Post likes count 1

C++/WinRT event handlers that are lambdas with weak pointers to the parent class, part 2

Raymond Chen

Working out the boilerplate.

May 31, 2023
Post comments count 0
Post likes count 2

C++/WinRT event handlers that are lambdas with weak pointers to the parent class, part 1

Raymond Chen

Assessing the state of affairs.

May 30, 2023
Post comments count 10
Post likes count 1

How do I change the directory Windows uses for user profiles? revisited

Raymond Chen

You can still do it, but it's not really supported.

May 29, 2023
Post comments count 5
Post likes count 1

On writing functions that accept any specialization of a C++ template type

Raymond Chen

There are the obvious arguments, the non-obvious arguments, and the invisible arguments.

May 26, 2023
Post comments count 3
Post likes count 1

Getting a strong reference from the this pointer too late

Raymond Chen

Once destruction begins, strong references mean nothing.

May 25, 2023
Post comments count 0
Post likes count 4

How can I trigger a recalc of the mouse cursor after I changed some of my internal application state?, follow-up

Raymond Chen

You still need to filter to your window, so you don't mess up another window on the same thread.

May 24, 2023
Post comments count 4
Post likes count 4

Don’t name your header file security.h either

Raymond Chen

You may be overriding an SDK header by mistake.

May 23, 2023
Post comments count 4
Post likes count 4

On creating (and using) a transforming iterator

Raymond Chen

It lets you change the thing being iterated over, on the fly.

May 22, 2023
Post comments count 1
Post likes count 4

Speeding up the insertion of a sorted (or mostly-sorted) key list into a std::map or other ordered associative container

Raymond Chen

Provide a hint for the location of the next item.

May 19, 2023
Post comments count 0
Post likes count 1

On catching exceptions in PPL tasks

Raymond Chen

You also have to catch the exception when it comes out the end of the task chain.

May 18, 2023
Post comments count 3
Post likes count 2

What is the opposite of LVM_SORTITEMS?

Raymond Chen

How can you unring the bell?

May 17, 2023
Post comments count 2
Post likes count 2

How do I free the pointers returned by functions like Get­Token­Information?

Raymond Chen

They are all pointers back into the main memory block.

May 16, 2023
Post comments count 6
Post likes count 1

It appears that I’ve never made a complete visit to the Pacific Northwest

Raymond Chen

If the marketing department is to be believed.

May 16, 2023
Post comments count 3
Post likes count 4

Summary of the duck-typing requirements of C++ COM wrappers

Raymond Chen

Wrapping up and comparing.

May 15, 2023
Post comments count 1
Post likes count 2

What are the duck-typing requirements of C++/WinRT com_ptr?

Raymond Chen

The experiments conclude.

May 12, 2023
Post comments count 0
Post likes count 2

What are the duck-typing requirements of wil com_ptr?

Raymond Chen

The experiments continue.

May 11, 2023
Post comments count 0
Post likes count 2

What are the duck-typing requirements of WRL ComPtr?

Raymond Chen

Another round of experimentation.

May 10, 2023
Post comments count 1
Post likes count 1

What are the duck-typing requirements of ATL CComPtr?

Raymond Chen

Looking for the minimum requirements.

May 9, 2023
Post comments count 0
Post likes count 1

What are the duck-typing requirements of MFC IPTR?

Raymond Chen

Seeing what goes wrong and trying to fix it.

May 8, 2023
Post comments count 1
Post likes count 2

What are the duck-typing requirements of _com_ptr_t?

Raymond Chen

As long as you fulfill the contract, based on method names.

May 5, 2023
Post comments count 3
Post likes count 1

The case of the crash in a C++/WinRT coroutine: Unpeeling the onion

Raymond Chen

Digging deeper and deeper.

May 4, 2023
Post comments count 0
Post likes count 1

Why does XAML complain that none of the overloads of winrt::to_hstring could be used?

Raymond Chen

Look at what you are converting from and converting to.

May 3, 2023
Post comments count 7
Post likes count 3

What can I do if I don’t want my file version number to be a sequence of four integers?

Raymond Chen

The format is enforced by the Windows file format, but you can present the information in a custom way.

May 2, 2023
Post comments count 21
Post likes count 3

Why does Task Manager disappear briefly when you switch it into or out of Always on top?

Raymond Chen

Ascending to another plane of existence.

May 1, 2023
Post comments count 3
Post likes count 3

How is it even possible to cheat on a musical performance practical exam?

Raymond Chen

Nature finds a way.

May 1, 2023
Post comments count 2
Post likes count 2

A quick note about WRL’s Chain­Interfaces template class

Raymond Chen

For interfaces which extend each other.

Apr 28, 2023
Post comments count 0
Post likes count 3

On the finer points of cancelling timers and wait objects in Windows thread pool

Raymond Chen

Assorted little details.

Apr 27, 2023
Post comments count 2
Post likes count 3

What’s up with this new memory_order_consume memory order?

Raymond Chen

A weaker variation of acquire.

Apr 26, 2023
Post comments count 1
Post likes count 2

One way to defer work when a re-entrant call is detected

Raymond Chen

Tying a string on your finger, as a reminder to yourself.

Apr 25, 2023
Post comments count 7
Post likes count 2

A code comment noting the steps to take when a 256th enum field is added

Raymond Chen

A note for my future self.

Apr 24, 2023
Post comments count 2
Post likes count 3

Why is std::hardware_destructive_interference_size a compile-time constant instead of a run-time value?

Raymond Chen

The compiler is already making compile-time assumptions about the processor; you just don't realize it.

Apr 21, 2023
Post comments count 1
Post likes count 1

Protecting a broker from a failing delegate

Raymond Chen

Catching them in a different way.

Apr 20, 2023
Post comments count 0
Post likes count 2

Protecting a broker from a failing event handler

Raymond Chen

Gotta catch them all.

Apr 19, 2023
Post comments count 2
Post likes count 1

The case of the unhandled exception in a brokered Windows Runtime component

Raymond Chen

Digging into the event dispatch code.

Apr 18, 2023
Post comments count 14
Post likes count 2

No, it is not a security vulnerability that there is no certificate of appreciation for reporting a bug

Raymond Chen

It wasn't even a bug report.

Apr 17, 2023
Post comments count 3
Post likes count 2

How can I find the invalid class when C++/WinRT tells me that the class may not be final?

Raymond Chen

It's in the error details.

Apr 14, 2023
Post comments count 4
Post likes count 2

How can I convert a WIC bitmap to a Windows Runtime SoftwareBitmap? part 4: Handing it over

Raymond Chen

Just take the whole thing.

Apr 13, 2023
Post comments count 1
Post likes count 1

How can I convert a WIC bitmap to a Windows Runtime SoftwareBitmap? part 3: Filling the SoftwareBitmap directly

Raymond Chen

Avoiding the intermediate buffer.

Apr 12, 2023
Post comments count 0
Post likes count 1

How can I convert a WIC bitmap to a Windows Runtime SoftwareBitmap? part 2: Via a buffer

Raymond Chen

Passing raw pixels across.

Apr 11, 2023
Post comments count 0
Post likes count 1

How can I convert a WIC bitmap to a Windows Runtime SoftwareBitmap? part 1: Via an encoded stream

Raymond Chen

We'll start with the hard way, but it gets easier.

Apr 10, 2023
Post comments count 1
Post likes count 2

Why is there a large gap between some of the Windows system metrics indices?

Raymond Chen

An artifact of the internal implementation.

Apr 7, 2023
Post comments count 1
Post likes count 3

The case of the PasswordVault.Add call that the customer thinks was hung

Raymond Chen

But was it really hung? Or did it just look that way.

Apr 6, 2023
Post comments count 0
Post likes count 2

An ignored exception can be misinterpreted as a hang, particularly in coroutines

Raymond Chen

I mean, execution seems to have stopped.

Apr 5, 2023
Post comments count 9
Post likes count 1

How do I modify the contents of a boxed Windows Runtime value?

Raymond Chen

Once it's in the box, you can't change it.

Apr 4, 2023
Post comments count 4
Post likes count 2

What is the maximum size of a process environment block?

Raymond Chen

There's no hard-coded limit in Windows, but maybe somebody else has a limit.

Apr 3, 2023
Post comments count 3
Post likes count 6

C++17 creates a practical use of the backward array index operator

Raymond Chen

Possibly more than just a curiosity.

Mar 31, 2023
Post comments count 4
Post likes count 3

What is this [uuid(…)] in front of my C++ class declaration?

Raymond Chen

It's an old nonstandard syntax that you should try to move away from.

Mar 30, 2023
Post comments count 6
Post likes count 2

If you want to watch games on your tractor, please use your own iPad

Raymond Chen

Not an approved use of the embedded system.

Mar 30, 2023
Post comments count 0
Post likes count 2

How can I box a std::optional into a C++/WinRT IInspectable?

Raymond Chen

There's a handy conversion for that, but you have to know where to look.

Mar 29, 2023
Post comments count 2
Post likes count 3

The WM_GETDLGCODE message is a query message and should not modify state

Raymond Chen

Wait until you actually get the message.

Mar 28, 2023
Post comments count 16
Post likes count 4

How can I try to escape the disease-ridden hot-tubs known as the TEMP and Downloads directories?

Raymond Chen

You can ask that dependent DLLs be loaded from the System32 directory.

Mar 27, 2023
Post comments count 2
Post likes count 2

Using the contents of a file to define an MSBuild property

Raymond Chen

A little trick that maybe should be better known.

Mar 24, 2023
Post comments count 25
Post likes count 8

Adventures in application compatibility: The case of the jump into the middle of an instruction from nowhere

Raymond Chen

Another rogue patcher.

Mar 23, 2023
Post comments count 0
Post likes count 3

How unique must the uIdSubclass parameter be when I call Set­Window­Subclass?

Raymond Chen

Each one identifies an instance of the subclass for the window.

Mar 22, 2023
Post comments count 0
Post likes count 1

Why am I getting a weird error about promise_type when I try to write a coroutine? part 2

Raymond Chen

Are you even writing a coroutine?

Mar 21, 2023
Post comments count 5
Post likes count 2

Why does the usage of the initial registers of a Win32 process depend on whether it is a 32-bit or 64-bit process?

Raymond Chen

Well, I mean, it's a different processor.

Mar 20, 2023
Post comments count 0
Post likes count 2

On the proper care and feeding of the enigmatic Get­Distance­Of­Closest­Language­In­List function

Raymond Chen

Thinking about how this could be used.

Mar 17, 2023
Post comments count 2
Post likes count 3

Exploiting C++/WinRT CRTP: Property and event declarations

Raymond Chen

They don't have to be methods; they just have to look like methods.

Mar 16, 2023
Post comments count 0
Post likes count 2

Mind your C++/WinRT namespaces

Raymond Chen

What you say changes meaning depending on where you are.

Mar 15, 2023
Post comments count 0
Post likes count 2

How can I create a git feature branch that can merge into multiple other branches?

Raymond Chen

Just work in your patch branch.

Mar 14, 2023
Post comments count 4
Post likes count 2

Did Vienna ever exist or was it just misinformation?

Raymond Chen

It could be neither.

Mar 13, 2023
Post comments count 1
Post likes count 2

The 2023/2024 Seattle Symphony subscription season at a glance

Raymond Chen

The pocket reference guide for 2023/2024.

Mar 13, 2023
Post comments count 3
Post likes count 2

What is the expression language used by the Resource Compiler for non-preprocessor expressions?

Raymond Chen

Oddly different for a different audience.

Mar 10, 2023
Post comments count 7
Post likes count 2

When should I use CS_GLOBALCLASS?

Raymond Chen

When you want to be summoned from anywhere.

Mar 9, 2023
Post comments count 5
Post likes count 3

From a Windows app, how can I check whether there is an app installed that implements a particular URI scheme?, part 2

Raymond Chen

Alternatives that work for unpackaged apps.

Mar 8, 2023
Post comments count 1
Post likes count 3

From a Windows app, how can I check whether there is an app installed that implements a particular URI scheme?

Raymond Chen

Additional function to let you see what is available.

Mar 7, 2023
Post comments count 0
Post likes count 1

Microspeak: Baseball card

Raymond Chen

A one-page summary, and this time we mean it.

Mar 6, 2023
Post comments count 12
Post likes count 2

I can create a read-only page, but why not a write-only page?

Raymond Chen

At the end of the day, it comes down to processor support.

Mar 3, 2023
Post comments count 10
Post likes count 6

Enumerating Windows clipboard history in PowerShell

Raymond Chen

Doing Windows Runtime things from PowerShell.

Mar 2, 2023
Post comments count 2
Post likes count 2

Enumerating Windows clipboard history in C++/WinRT and C#

Raymond Chen

Exploring the clipboard history API.

Mar 1, 2023
Post comments count 1
Post likes count 2

If you want to sort a Windows Runtime collection, you may first want to capture it into something a bit easier to manipulate

Raymond Chen

Moving everything into the same universe.

Feb 28, 2023
Post comments count 5
Post likes count 2

Once you give away the farm, you can’t take it back: Recovering from a rogue administrator

Raymond Chen

Who knows what happened to it while you weren't looking.

Feb 27, 2023
Post comments count 4
Post likes count 1

The unintentionally-expanding scope of the SEM_NOGPFAULTERRORBOX flag

Raymond Chen

Other suppressions caught in its net.

Feb 24, 2023
Post comments count 2
Post likes count 2

Understanding a mysterious RPC_E_WRONG­THREAD exception when we’re on the right thread

Raymond Chen

Things can go wrong in ways you may not have realized.

Feb 23, 2023
Post comments count 0
Post likes count 3

Why am I getting an unhandled exception from my C++ function that catches all exceptions?

Raymond Chen

Yes, you caught an exception. But that's not the one that went unhandled.

Feb 22, 2023
Post comments count 9
Post likes count 4

Avoiding the redundancy of adding the object files to both the primary project and its unit test

Raymond Chen

Adding another level of indirection.

Feb 21, 2023
Post comments count 2
Post likes count 3

Microspeak: Light reading (ironic)

Raymond Chen

Just a fun diversion.

Feb 20, 2023
Post comments count 9
Post likes count 5

The case of the mysterious "out of bounds" error from CreateUri and memmove

Raymond Chen

Unfolding some COMDATs.

Feb 17, 2023
Post comments count 2
Post likes count 2

What happens if you co_await a std::future, and why is it a bad idea?

Raymond Chen

Just waiting for something to finish.

Feb 16, 2023
Post comments count 0
Post likes count 2

What does it mean when my cross-thread COM call fails with RPC_E_SYS_CALL_FAILED?

Raymond Chen

Look for an unresponsive recipient.

Feb 15, 2023
Post comments count 7
Post likes count 2

What are the potentially-erroneous results if you don’t pass NULL as the lpNumberOfBytesRead when issuing overlapped I/O?

Raymond Chen

It's to avoid a self-inflicted race condition.

Feb 14, 2023
Post comments count 4
Post likes count 2

Why are the Windows chassis hardware button hotkeys so strange?

Raymond Chen

Operating within the constraints of the system.

Feb 13, 2023
Post comments count 15
Post likes count 6

Adventures in application compatibility: The case of the display control panel crash on exit

Raymond Chen

When you get a 64-bit pointer, you probably should remember all 64 of the bits.

Feb 10, 2023
Post comments count 4
Post likes count 5

The case of the RPC_E_DISCONNECTED error thrown from await_resume

Raymond Chen

You can keep trying, but the result won't change.

Feb 9, 2023
Post comments count 5
Post likes count 1

A more direct and mistake-free way of creating a process in a job object

Raymond Chen

A new attribute for creating a process directly in a job object.

Feb 8, 2023
Post comments count 0
Post likes count 2

How can I get the original target of a shortcut without applying any 32-bit adjustments?

Raymond Chen

Disable the fancy tracking.

Feb 7, 2023
Post comments count 3
Post likes count 1

The frustration of finding a suitable time to hold a meeting when the participants are evenly spaced around the globe

Raymond Chen

Somebody has to suffer, but we try to make sure it's not the same person each time.

Feb 6, 2023
Post comments count 9
Post likes count 2

It rather involved being on the other side of this airtight hatchway: Reading the user’s saved passwords

Raymond Chen

Only the user can read their own saved passwords, so you must already have gained total control over the user.

Feb 3, 2023
Post comments count 0
Post likes count 2

Inside C++/WinRT: Coroutine completions: Cancellation propagation

Raymond Chen

Giving up.

Feb 2, 2023
Post comments count 6
Post likes count 1

Hyperlinking to Hutchison Whampoa Limited is still forbidden

Raymond Chen

Didn't make you look.

Feb 2, 2023
Post comments count 0
Post likes count 1

Inside C++/WinRT: Coroutine completions: Avoiding reentrant completion

Raymond Chen

Resuming the coroutine directly, rather than consuming yet more stack.

Feb 1, 2023
Post comments count 0
Post likes count 1

Inside C++/WinRT: Coroutine completion handlers: Disconnection

Raymond Chen

When the other end hangs up without even saying good-bye.

Jan 31, 2023
Post comments count 0
Post likes count 2

Inside C++/WinRT: Apartment switching: Error reporting

Raymond Chen

If you can't get back to where you started, who you gonna call?

Jan 30, 2023
Post comments count 0
Post likes count 2

Inside C++/WinRT: Apartment switching: COM without COM

Raymond Chen

Also known as Nano-COM.

Jan 27, 2023
Post comments count 0
Post likes count 1

Inside C++/WinRT: Apartment switching: Unwinding the stack

Raymond Chen

Reducing stack usage.

Jan 26, 2023
Post comments count 0
Post likes count 2

Inside C++/WinRT: Apartment switching: Bypassing the context callback

Raymond Chen

Reducing stack usage.

Jan 25, 2023
Post comments count 1
Post likes count 2

Inside C++/WinRT: Apartment switching: Unblocking the outgoing thread

Raymond Chen

Avoiding the problem of the synchronous apartment-changing callback: Let the outgoing thread do whatever it wants to do next.

Jan 24, 2023
Post comments count 0
Post likes count 2

Inside C++/WinRT: Apartment switching: The basic idea

Raymond Chen

Getting back to where you started.

Jan 23, 2023
Post comments count 3
Post likes count 3

Inside C++/WinRT: Coroutine completions: The oversimplified version

Raymond Chen

Resuming the coroutine when the asynchronous work completes.

Jan 20, 2023
Post comments count 0
Post likes count 1

How can I call a method on a derived class from a base class, say, to get a strong reference to the containing object?

Raymond Chen

A variety of patterns are available.

Jan 19, 2023
Post comments count 0
Post likes count 2

Windows Runtime asynchronous operations can fail in two different ways, so make sure you get them both

Raymond Chen

Fail me now or fail me later.

Jan 18, 2023
Post comments count 4
Post likes count 2

It rather involved being on the other side of this airtight hatchway: Attacking a user by modifying that user’s files

Raymond Chen

You're just attacking yourself.

Jan 17, 2023
Post comments count 8
Post likes count 1

A trio of dubious denial-of-service security vulnerability reports which are just style points piled on top of nothing

Raymond Chen

You could have accomplished the same thing with a garbage file.

Jan 16, 2023
Post comments count 0
Post likes count 1

Making C++ primitive types meaningfully movable when they have sentinel values

Raymond Chen

The value actually moves now.

Jan 13, 2023
Post comments count 18
Post likes count 4

Adventures in application compatibility: Querying for an internal interface

Raymond Chen

Reaching in and fiddling the internal knobs.

Jan 12, 2023
Post comments count 5
Post likes count 2

How should I interpret the various values of NLM_CONNECTIVITY?

Raymond Chen

Different levels of connectedness.

Jan 11, 2023
Post comments count 0
Post likes count 3

What does it mean when I get a mismatch from MSVC for _COROUTINE_ABI?

Raymond Chen

The two different kinds of coroutine interfaces shouldn't be mixed and matched.

Jan 10, 2023
Post comments count 10
Post likes count 1

It rather involved being on the other side of this airtight hatchway: Administrator attacking a domain account on the local system

Raymond Chen

You don't gain control over any other systems.

Jan 9, 2023
Post comments count 14
Post likes count 6

On leading underscores and names reserved by the C and C++ languages

Raymond Chen

The rules laid out.

Jan 6, 2023
Post comments count 1
Post likes count 1

Dubious security vulnerability: Granting access to SIDs that don’t exist yet

Raymond Chen

You can put anyone you like on your guest list, even if they don't exist.

Jan 5, 2023
Post comments count 0
Post likes count 1

How can I force a user to have a specific SID prefix, so that they go into a particular group?

Raymond Chen

The prefix doesn't define group membership.

Jan 4, 2023
Post comments count 11
Post likes count 3

Using perfect (and imperfect) forwarding to simplify C++ wrapper classes

Raymond Chen

Just call that other thing the same way you called this thing.

Jan 3, 2023
Post comments count 4
Post likes count 1

It rather involved being on the other side of this airtight hatchway: Gaining code execution from a Trojan horse

Raymond Chen

You already have code execution, so it's not surprising that you can gain code execution.

Jan 2, 2023
Post comments count 8
Post likes count 3

Opinionated notes on the Windows.Data.Json namespace

Raymond Chen

It's available if you need it, but there are some tricks and pitfalls, and you may very well have better options.

Dec 30, 2022
Post comments count 1
Post likes count 4

2022 year-end link clearance

Raymond Chen

Closing the book on another year.

Dec 30, 2022
Post comments count 3
Post likes count 1

When I create a waitable timer with a callback, do I have to wait alertably on that specific timer before the callback will run?

Raymond Chen

Any alertable wait will do.

Dec 29, 2022
Post comments count 2
Post likes count 2

How can I detect programmatically whether Windows is an N or KN version?

Raymond Chen

Don't check the version, just check the feature.

Dec 28, 2022
Post comments count 3
Post likes count 2

After importing a TLB, how do I convert from one type of _com_ptr_t to another?

Raymond Chen

Digging into the source code.

Dec 27, 2022
Post comments count 4
Post likes count 1

Why can’t I print when I boot Windows into audit mode?

Raymond Chen

It's not all there.

Dec 26, 2022
Post comments count 10
Post likes count 5

The worst-selling Microsoft software product of all time: OS/2 for the Mach 20

Raymond Chen

Count 'em on one hand.

Dec 23, 2022
Post comments count 4
Post likes count 2

The case of the recursively hung WM_DRAW­CLIPBOARD message

Raymond Chen

Understanding why it's happening and how you can avoid it.

Dec 22, 2022
Post comments count 7
Post likes count 3

Is there a fixed virtual address that the system promises never to use for anything, so I can use it?

Raymond Chen

Everything is up for grabs.

Dec 21, 2022
Post comments count 3
Post likes count 2

Running some UI code on a timer at a higher priority than your usual timer messages, or without coalescing

Raymond Chen

You can build your own timer system.

Dec 20, 2022
Post comments count 9
Post likes count 5

Why doesn’t the BitLocker wizard let me save the BitLocker key on an encrypted drive?

Raymond Chen

Don't lock your keys in the car.

Dec 19, 2022
Post comments count 6
Post likes count 4

On the large number of ways of expressing Microsoft Visual C++ compiler versions

Raymond Chen

So many version numbers.

Dec 16, 2022
Post comments count 7
Post likes count 6

Why doesn’t Windows use the 64-bit virtual address space below 0x00000000`7ffe0000?

Raymond Chen

It does use it, although it doesn't look like it.

Dec 15, 2022
Post comments count 1
Post likes count 1

Inside C++/WinRT: IReference<T>

Raymond Chen

Reverse-engineering the usages from the code.

Dec 14, 2022
Post comments count 0
Post likes count 1

In C++/WinRT, how do I create or consume an IReference<T> that wraps a particular value?

Raymond Chen

Conversions to and from <CODE>IReference</CODE>.

Dec 13, 2022
Post comments count 5
Post likes count 3

Thank you for conference announcement, but it would help if you told me what your conference was about

Raymond Chen

There was an announcement of an all-day Microsoft-internal conference featuring a project I will call Project Enzyme. The announcement went like this: The Project Enzyme Forum is our flagship community conference that brings together engineers, project managers, data scientists, and designers from around the company to learn about Project Enzyme and get a first look at some of the exciting new improvements in the platform. Senior leaders will share their vision for Project Enyzme and how we can use it to create the next wave of cutting-edge products and experiences. Other senior leaders will participate in a ...

Dec 12, 2022
Post comments count 0
Post likes count 1

What does it mean when the compiler tells me that promise_type: is not a member of coroutine_traits<void>?

Raymond Chen

Applying your understanding of the coroutine transformation.

Dec 9, 2022
Post comments count 0
Post likes count 2

How can I do the opposite of compare_exchange and exchange if the value is different?

Raymond Chen

An exchange with itself has no effect on the value.

Dec 8, 2022
Post comments count 1
Post likes count 1

If you’re going to wrap a Windows Runtime event, you may as well let the wrapped event source manage the token

Raymond Chen

It keeps the original object in control.

Dec 7, 2022
Post comments count 1
Post likes count 1

Reminder: If you intend to use a C++/WinRT namespace, you must include that namespace’s header file

Raymond Chen

Various errors that can be traced back to breaking that one rule.

Dec 6, 2022
Post comments count 6
Post likes count 1

Trouble connecting to Web sites and services because of certificate errors? Check if you’re being held captive

Raymond Chen

There's a man in the middle.

Dec 5, 2022
Post comments count 2
Post likes count 1

Instead of a C++ template parlor trick, why not just add support based on whether the header file has already been included?

Raymond Chen

Header file inclusion order dependencies.

Dec 2, 2022
Post comments count 10
Post likes count 3

C++ template parlor tricks: Using a type before it is defined

Raymond Chen

You can talk about hypothetical things, hoping that a real thing shows up later.

Dec 1, 2022
Post comments count 4
Post likes count 1

Not even trying to cross an airtight hatchway: Calling a function in your own process by synthesizing a function pointer

Raymond Chen

You can already attack yourself in far more interesting ways.

Nov 30, 2022
Post comments count 1
Post likes count 3

I used FILE_FLAG_SEQUENTIAL_SCAN but it didn’t seem to speed up my sequential scanning

Raymond Chen

It triggers prefetching, but your usage pattern may mean that prefetch doesn't mean much.

Nov 29, 2022
Post comments count 2
Post likes count 1

Dubious security vulnerability: Reading the files in the WindowsApps folder

Raymond Chen

You already had access to those files, by virtue of the fact that they ran in the first place.

Nov 28, 2022
Post comments count 0
Post likes count 1

What kind of caller diagnostic information can I get from exceptions thrown by C++/WinRT and wil?, C++20 edition

Raymond Chen

The state of the art has moved forward slightly.

Nov 28, 2022
Post comments count 8
Post likes count 3

The case of the application that used thread local storage it never allocated

Raymond Chen

Of course it's there, isn't it? I mean, it's always been there.

Nov 25, 2022
Post comments count 2
Post likes count 2

How do I pass a raw pointer to a Windows Runtime function?

Raymond Chen

Raw pointers don't exist in the Windows Runtime, so you'll have to re-express it in terms of something that does.

Nov 24, 2022
Post comments count 12
Post likes count 1

How does JavaScript represent output parameters in the Windows Runtime?

Raymond Chen

It has to fake it.

Nov 23, 2022
Post comments count 4
Post likes count 1

Sometimes perfect forwarding can be too perfect: Lazy conversion is lazy

Raymond Chen

Lazy conversion is too lazy.

Nov 22, 2022
Post comments count 2
Post likes count 1

Microspeak: Breaking into jail

Raymond Chen

Just asking for trouble.

Nov 21, 2022
Post comments count 0
Post likes count 2

What kind of caller diagnostic information can I get from exceptions thrown by C++/WinRT and wil?

Raymond Chen

A survey of the current state of the art.

Nov 18, 2022
Post comments count 0
Post likes count 2

On Windows Runtime asynchronous operations with critical progress reports

Raymond Chen

Make the caller provide the progress handler up front.

Nov 17, 2022
Post comments count 1
Post likes count 1

How soon is too soon to report progress from a C++/WinRT coroutine that implements a Windows Runtime asynchronous operation with progress?

Raymond Chen

If a progress is sent to a forest but there's no one there to hear it.

Nov 16, 2022
Post comments count 0
Post likes count 1

Why won’t C++/WinRT let me co_await a CoreDispatcher or DispatcherQueue?

Raymond Chen

Making sure you meet the usual prerequisites.

Nov 15, 2022
Post comments count 1
Post likes count 1

It’s important to get the most difficult part out of the way by putting it in the title

Raymond Chen

It does much less harm there than in the body.

Nov 15, 2022
Post comments count 11
Post likes count 6

How does Windows decide whether your computer has limited or full Internet access?

Raymond Chen

Looking for special servers.

Nov 14, 2022
Post comments count 7
Post likes count 6

C++ constexpr parlor tricks: How can I obtain the length of a string at compile time?

Raymond Chen

The <CODE>constexpr</CODE>'ification of <CODE>strlen</CODE>.

Nov 11, 2022
Post comments count 4
Post likes count 6

If I issue multiple overlapped I/O requests against the same region of a file, will they execute in the order I issued them?

Raymond Chen

Overlapped I/O refers to temporal overlap, and that includes completion out of order.

Nov 10, 2022
Post comments count 24
Post likes count 3

On the dangers of giving a product feature the name “new”

Raymond Chen

It may be new today, but it won't be new tomorrow.

Nov 9, 2022
Post comments count 6
Post likes count 6

Why don’t Windows functions begin with a pointless MOV EDI,EDI instruction on x86-64?

Raymond Chen

Applying the hot-patch in a different way.

Nov 8, 2022
Post comments count 3
Post likes count 4

Why is there a system sound called Asterisk? What sound does an Asterisk make anyway?

Raymond Chen

It's to accompany the asterisk, back when we had an asterisk.

Nov 7, 2022
Post comments count 1
Post likes count 1

My niece is just here for the food

Raymond Chen

The important part of the trip.

Nov 7, 2022
Post comments count 2
Post likes count 3

In the debugger, how can I get from a projected type back to the C++/WinRT implementation?

Raymond Chen

Look behind you.

Nov 4, 2022
Post comments count 1
Post likes count 2

Why am I getting a RPC_E_WRONG_THREAD exception when I’m on the right thread?

Raymond Chen

It's the wrong thread from XAML's point of view.

Nov 3, 2022
Post comments count 2
Post likes count 5

How does the dialog manager calculate the average width of a character?

Raymond Chen

It's a simple formula, perhaps too simple.

Nov 2, 2022
Post comments count 5
Post likes count 6

A history of the fd_set, FD_SETSIZE, and how it relates to WinSock

Raymond Chen

The <CODE>fd_set</CODE> started out as just a bitmap.

Nov 1, 2022
Post comments count 10
Post likes count 3

What is a “Select Administrator”? Is that some special elite kind of administrator?

Raymond Chen

It's two different messages that combine in an interesting way.

Oct 31, 2022
Post comments count 0
Post likes count 3

How can I test my geolocation code on a system without a GPS?

Raymond Chen

You can use the Windows Device Portal to create a synthetic GPS.

Oct 28, 2022
Post comments count 4
Post likes count 4

Setting properties in C++/WinRT is done by a function call, but you need to call the function the right way

Raymond Chen

The new value is the function parameter.

Oct 27, 2022
Post comments count 3
Post likes count 4

Why am I seeing two WRITE requests at the same offset from a single call to WriteFile?

Raymond Chen

It started as one write, but turned into a lot of other things.

Oct 26, 2022
Post comments count 3
Post likes count 3

What can or should I do with the cursor handle returned by SetCursor?

Raymond Chen

You can put it back, but sometimes you need to make sure you do it before anybody else can see the change.

Oct 25, 2022
Post comments count 8
Post likes count 5

Why are many Windows user interface elements positioned at multiples of 4 or 8 pixels?

Raymond Chen

It depends on whose pixels you're talking about.

Oct 24, 2022
Post comments count 0
Post likes count 2

Why can’t I programmatically inspect the check boxes in the Security property sheet any more?

Raymond Chen

Abusing the <CODE>ISecurity­Information::<WBR>Property­Sheet­Page­Callback</CODE> method.

Oct 21, 2022
Post comments count 1
Post likes count 3

What happens if my C++ exception handler itself raises an exception?

Raymond Chen

And comparing to the handling of structured exceptions.

Oct 20, 2022
Post comments count 1
Post likes count 4

Is it true that raising a structured exception from a structured exception handler terminates the process?

Raymond Chen

Untangling the myth.

Oct 19, 2022
Post comments count 1
Post likes count 4

Why is there a make_unique? Why not just overload the unique_ptr constructor?

Raymond Chen

You'll have to resolve the ambiguity, so you're still typing a lot.

Oct 18, 2022
Post comments count 10
Post likes count 7

Why is there a passwords.txt file on my system that’s filled with somebody else’s passwords?

Raymond Chen

It's part of an open-source password strength package.

Oct 17, 2022
Post comments count 11
Post likes count 3

How can I check the integrity level of my process?

Raymond Chen

A series of range checks.

Oct 14, 2022
Post comments count 3
Post likes count 1

The case of the memory corruption from a coroutine that already finished

Raymond Chen

The zombie coroutine.

Oct 13, 2022
Post comments count 1
Post likes count 4

How can I check whether the user’s network connection is roaming or metered?

Raymond Chen

The classic way and the Windows Runtime way.

Oct 12, 2022
Post comments count 0
Post likes count 1

One possible reason why your program crashes when submitted to the Microsoft Store, but it runs fine on your machine

Raymond Chen

Check your minimum requirements.

Oct 11, 2022
Post comments count 7
Post likes count 1

Clicking past the warning that you are about to cross the airtight hatchway: Vulnerable file type that you are warned about

Raymond Chen

Acknowledging the danger but complaining about it anyway.

Oct 10, 2022
Post comments count 5
Post likes count 2

On the overloading of the address-of operator & in smart pointer classes

Raymond Chen

Different patterns, which means you're never sure what you're going to get.

Oct 7, 2022
Post comments count 7
Post likes count 6

How can I perform a CopyFile, but also flush the file buffers before the destination handle is closed?

Raymond Chen

Your callback function can do things with the handle, even extend their lifetime.

Oct 6, 2022
Post comments count 9
Post likes count 4

The Import Address Table is now write-protected, and what that means for rogue patching

Raymond Chen

Making a potential attack vector less attractive.

Oct 5, 2022
Post comments count 7
Post likes count 5

The gotcha of the C++ temporaries that don’t destruct as eagerly as you thought

Raymond Chen

You have to look for the end of the full expression.

Oct 4, 2022
Post comments count 1
Post likes count 1

Starting on the other side of this airtight hatchway: Overwhelming the system

Raymond Chen

It'll take time for things to drain out.

Oct 3, 2022
Post comments count 0
Post likes count 1

Feel free to stop using IMultiLanguage2::DetectInputCodepage

Raymond Chen

You should have been keeping your eye on the code page all along.

Sep 30, 2022
Post comments count 1
Post likes count 1

Debugging coroutine handles: Looking for the source of a one-byte memory corruption

Raymond Chen

Applying what we know about coroutines.

Sep 29, 2022
Post comments count 1
Post likes count 1

I did that merge-as-cherry-pick thing, but my change still didn’t merge correctly

Raymond Chen

A case study of what goes wrong.

Sep 28, 2022
Post comments count 2
Post likes count 6

Why does COM express GUIDs in a mix of big-endian and little-endian? Why can’t it just pick a side and stick with it?

Raymond Chen

Oh, it does pick a side. It's just that some dashes are missing.

Sep 27, 2022
Post comments count 1
Post likes count 2

Microspeak: Break glass

Raymond Chen

Metaphorically breaking the glass in case of emergency.

Sep 26, 2022
Post comments count 3
Post likes count 1

What does the C++ error “A pointer to a bound function may only be used to call the function” mean?

Raymond Chen

You got all set to call a function but forgot to call it.

Sep 23, 2022
Post comments count 1
Post likes count 1

Why am I receiving SHCNE_UPDATE­DIR notifications that my code never generates?

Raymond Chen

You did generate them, indirectly.

Sep 22, 2022
Post comments count 0
Post likes count 1

How can I get WRL to link my object into its activation factory?

Raymond Chen

More magic macros.

Sep 21, 2022
Post comments count 3
Post likes count 5

How can I trigger a recalc of the mouse cursor after I changed some of my internal application state?

Raymond Chen

Go through the standard process one more time.

Sep 20, 2022
Post comments count 8
Post likes count 2

Janet Jackson had the power to crash laptop computers, follow-up

Raymond Chen

Deeper speculation by others.

Sep 19, 2022
Post comments count 11
Post likes count 3

Why load fs:[0x18] into a register and then dereference that, instead of just going for fs:[n] directly?

Raymond Chen

Simplifying the compiler.

Sep 16, 2022
Post comments count 0
Post likes count 4

Serializing asynchronous operations in C++/WinRT, gotchas and final assembly

Raymond Chen

Cancellation and abandonment.

Sep 15, 2022
Post comments count 0
Post likes count 4

Serializing asynchronous operations in C++/WinRT

Raymond Chen

Making them run one after the other.

Sep 14, 2022
Post comments count 0
Post likes count 3

Creating a lazy-start C++/WinRT coroutine from an eager-start one, part 2

Raymond Chen

Keeping a turkey in suspense.

Sep 13, 2022
Post comments count 0
Post likes count 3

Creating a manual-start C++/WinRT coroutine from an eager-start one, part 1

Raymond Chen

Ready, wait for it.

Sep 12, 2022
Post comments count 5
Post likes count 0

Serializing asynchronous operations in C#

Raymond Chen

Making them run one after the other.

Sep 9, 2022
Post comments count 18
Post likes count 3

The case of the APC that never arrives

Raymond Chen

Or maybe it did?

Sep 8, 2022
Post comments count 7
Post likes count 3

How do I consume raw COM interfaces from a Windows Runtime metadata file?

Raymond Chen

There's a handy tool for generating raw COM interfaces.

Sep 7, 2022
Post comments count 2
Post likes count 1

It rather involved being on the other side of this airtight hatchway: Replacing a service binary

Raymond Chen

Looking for misconfigured services.

Sep 6, 2022
Post comments count 21
Post likes count 7

Commonly-supported Windows shortcuts for pasting without formatting

Raymond Chen

Variations on a paste theme.

Sep 5, 2022
Post comments count 1
Post likes count 1

Is there any meaningful way to compare two Time Travel Debugging positions?

Raymond Chen

They are basically in chronological order, subject to the uncertainty of multiprocessing.

Sep 2, 2022
Post comments count 7
Post likes count 4

The case of the recursively-acquired non-recursive lock, and how to avoid the unintentional reentrancy

Raymond Chen

Watch what you do when you hold a lock.

Sep 1, 2022
Post comments count 2
Post likes count 2

Why am I getting a null pointer crash when trying to call a method on my C++/WinRT object?

Raymond Chen

Requirements weren't met.

Aug 31, 2022
Post comments count 27
Post likes count 3

The x86-64 processor (aka amd64, x64): Whirlwind tour

Raymond Chen

Pretty much a 64-bit-ification of the i386.

Aug 30, 2022
Post comments count 0
Post likes count 2

The AArch64 processor (aka arm64), part 25: The ARM64EC ABI

Raymond Chen

Aligning with the x86-64 calling convention.

Aug 29, 2022
Post comments count 1
Post likes count 0

The AArch64 processor (aka arm64), part 24: Code walkthrough

Raymond Chen

Putting theory into practice.

Aug 26, 2022
Post comments count 1
Post likes count 0

The AArch64 processor (aka arm64), part 23: Common patterns

Raymond Chen

Learning to recognize various code generation patterns.

Aug 25, 2022
Post comments count 0
Post likes count 0

The AArch64 processor (aka arm64), part 22: Other kinds of classic prologues and epilogues

Raymond Chen

Taking shortcuts, or maybe adding steps.

Aug 24, 2022
Post comments count 3
Post likes count 1

The AArch64 processor (aka arm64), part 21: Classic function prologues and epilogues

Raymond Chen

Implementing the ABI.

Aug 23, 2022
Post comments count 2
Post likes count 1

The AArch64 processor (aka arm64), part 20: The classic calling convention

Raymond Chen

How parameters are passed.

Aug 22, 2022
Post comments count 4
Post likes count 2

The AArch64 processor (aka arm64), part 19: Miscellaneous instructions

Raymond Chen

Sweeping up the crumbs.

Aug 19, 2022
Post comments count 3
Post likes count 3

The AArch64 processor (aka arm64), part 18: Return address protection

Raymond Chen

Making it even harder to smash the return address.

Aug 18, 2022
Post comments count 0
Post likes count 2

The AArch64 processor (aka arm64), part 17: Manipulating flags

Raymond Chen

Trying to twiddle the knobs directly.

Aug 17, 2022
Post comments count 2
Post likes count 2

The AArch64 processor (aka arm64), part 16: Conditional execution

Raymond Chen

Making decisions.

Aug 16, 2022
Post comments count 24
Post likes count 30

Janet Jackson had the power to crash laptop computers

Raymond Chen

Not an artistic judgement. Just a technical one.

Aug 15, 2022
Post comments count 0
Post likes count 4

The AArch64 processor (aka arm64), part 15: Control transfer

Raymond Chen

We're going places.

Aug 12, 2022
Post comments count 0
Post likes count 5

The AArch64 processor (aka arm64), part 14: Barriers

Raymond Chen

Keeping things in the right order.

Aug 11, 2022
Post comments count 3
Post likes count 1

The AArch64 processor (aka arm64), part 13: Atomic access

Raymond Chen

Don't let someone else get a word in edgewise.

Aug 10, 2022
Post comments count 0
Post likes count 2

The AArch64 processor (aka arm64), part 12: Memory access and alignment

Raymond Chen

The load and store part of the load/store architecture.

Aug 9, 2022
Post comments count 0
Post likes count 1

The AArch64 processor (aka arm64), part 11: Loading addresses

Raymond Chen

Finding a needle in the haystack of the 64-bit address space.

Aug 8, 2022
Post comments count 0
Post likes count 2

The AArch64 processor (aka arm64), part 10: Loading constants

Raymond Chen

Getting them into a register.

Aug 5, 2022
Post comments count 0
Post likes count 1

The AArch64 processor (aka arm64), part 9: Sign and zero extension

Raymond Chen

Nothing new here, but old things being used in clever ways.

Aug 4, 2022
Post comments count 4
Post likes count 3

The AArch64 processor (aka arm64), part 8: Bit shifting and rotation

Raymond Chen

Sliding around.

Aug 3, 2022
Post comments count 0
Post likes count 3

The AArch64 processor (aka arm64), part 7: Bitfield manipulation

Raymond Chen

Peeking inside the words.

Aug 2, 2022
Post comments count 0
Post likes count 1

The AArch64 processor (aka arm64), part 6: Bitwise operations

Raymond Chen

And their very strange immediates.

Aug 1, 2022
Post comments count 1
Post likes count 1

The AArch64 processor (aka arm64), part 5: Multiplication and division

Raymond Chen

Arithmetic gets harder.

Jul 29, 2022
Post comments count 0
Post likes count 1

The AArch64 processor (aka arm64), part 4: Addition and subtraction

Raymond Chen

Starting with the basic arithmetic.

Jul 28, 2022
Post comments count 0
Post likes count 4

The AArch64 processor (aka arm64), part 3: Addressing modes

Raymond Chen

The ways of accessing memory.

Jul 27, 2022
Post comments count 3
Post likes count 2

The AArch64 processor (aka arm64), part 2: Extended register operations

Raymond Chen

The weird ways of transforming the value in a register.

Jul 26, 2022
Post comments count 4
Post likes count 9

The AArch64 processor (aka arm64), part 1: Introduction

Raymond Chen

Make it a double.

Jul 25, 2022
Post comments count 6
Post likes count 3

Yes, the 8086 wanted to be mechanically translatable from the 8080, but why not add the ability to indirect through AX, CX and DX?

Raymond Chen

So many addressing modes, so little space.

Jul 22, 2022
Post comments count 2
Post likes count 2

Using C++/WinRT’s final_release to control which thread destructs your object

Raymond Chen

Once it's yours, you can take it wherever you like.

Jul 21, 2022
Post comments count 3
Post likes count 4

Making sure that people use make_unique and make_shared to make your object

Raymond Chen

Using a secret signal in what is required to be a public constructor.

Jul 20, 2022
Post comments count 0
Post likes count 2

My class derives from std::enable_shared_from_this, but shared_from_this() doesn’t work

Raymond Chen

Various cases where your enabled <CODE>shared_<WBR>from_<WBR>this</cODE> doesn't work.

Jul 19, 2022
Post comments count 4
Post likes count 2

Microspeak: The one-pager

Raymond Chen

Rarely ever one page long.

Jul 18, 2022
Post comments count 1
Post likes count 1

C++ coroutine gotcha: Falling off the end of a function-level catch

Raymond Chen

You still have to return something, but today's compilers don't warn you.

Jul 15, 2022
Post comments count 0
Post likes count 0

Processing a ValueSet or PropertySet even in the face of possible mutation, part 4

Raymond Chen

Processing the result differently.

Jul 14, 2022
Post comments count 0
Post likes count 1

Processing a ValueSet or PropertySet even in the face of possible mutation, part 3

Raymond Chen

Applying and adapting the pattern.

Jul 13, 2022
Post comments count 0
Post likes count 0

Processing a ValueSet or PropertySet even in the face of possible mutation, part 2

Raymond Chen

The first one there has to stay there until the work is done.

Jul 12, 2022
Post comments count 0
Post likes count 0

Processing a ValueSet or PropertySet even in the face of possible mutation, part 1

Raymond Chen

Watching out for iterator invalidation.

Jul 11, 2022
Post comments count 0
Post likes count 0

How can I provide a Windows Runtime ValueSet or PropertySet while non-intrusively monitoring changes to it?

Raymond Chen

Use the right kind of observer.

Jul 8, 2022
Post comments count 2
Post likes count 1

Windows Runtime observable collections don’t mix well with multithreading

Raymond Chen

Concurrent observation and mutation is a bit of a mess.

Jul 7, 2022
Post comments count 5
Post likes count 1

How can I write a coroutine that produces a result but keeps on running?

Raymond Chen

Returning without returning.

Jul 6, 2022
Post comments count 8
Post likes count 1

The empty Windows Runtime string is not just a pretty face

Raymond Chen

It really is an empty string.

Jul 5, 2022
Post comments count 0
Post likes count 1

How to write like Raymond: Intentional typographical errors, part 2

Raymond Chen

I can take you there, but you'll have to fix one tiny typo. Let's see if you can do that.

Jul 4, 2022
Post comments count 0
Post likes count 1

The case of the constructor that was being ignored

Raymond Chen

Retracing the compiler's steps.

Jul 1, 2022
Post comments count 1
Post likes count 1

Under what conditions can I modify the memory that I received in the form a STGMEDIUM?

Raymond Chen

If you own it, then it's yours to do with as you wish.

Jun 30, 2022
Post comments count 5
Post likes count 1

2022 mid-year link clearance

Raymond Chen

Another accumulation of stuff.

Jun 30, 2022
Post comments count 1
Post likes count 1

How can I build a URL query string in the Windows Runtime?

Raymond Chen

Pretend you're submitting a form.

Jun 29, 2022
Post comments count 2
Post likes count 1

How can I parse URL query string in the Windows Runtime?

Raymond Chen

There's a query parser built in, but it's a little cantankerous.

Jun 28, 2022
Post comments count 7
Post likes count 1

Microspeak: Inside baseball

Raymond Chen

Specialized jargon comprehensible only to a select few.

Jun 27, 2022
Post comments count 0
Post likes count 1

Starting on the other side of the airtight hatchway: Attacking the batch file parser

Raymond Chen

Why stop at denial of service when you have remote code execution?

Jun 24, 2022
Post comments count 0
Post likes count 0

The case of the mysterious over-release from deep inside the marshaling infrastructure

Raymond Chen

The tedium of monitoring reference counts.

Jun 23, 2022
Post comments count 0
Post likes count 0

Writing a marshal-by-value marshaler, part 2

Raymond Chen

Maybe you don't need a copy on the other side.

Jun 22, 2022
Post comments count 5
Post likes count 0

Understanding the marshaling flags: The free-threaded marshaler

Raymond Chen

Keeping your eye on the reference count.

Jun 21, 2022
Post comments count 1
Post likes count 0

Writing a compound marshaler

Raymond Chen

On the nature of streams.

Jun 20, 2022
Post comments count 0
Post likes count 0

On the importance of managing the stream pointer when manipulating marshal data

Raymond Chen

Making sure things are ready for the person who comes after you.

Jun 17, 2022
Post comments count 1
Post likes count 0

Writing a marshal-by-value marshaler, part 1

Raymond Chen

Creating an identical object on the other side.

Jun 16, 2022
Post comments count 1
Post likes count 0

The skeleton marshaler that does default marshaling

Raymond Chen

Starting with a marshaler that has no special features.

Jun 15, 2022
Post comments count 4
Post likes count 0

An initial look at the mechanics of how COM marshaling is performed

Raymond Chen

Pretend you're an oracle.

Jun 14, 2022
Post comments count 4
Post likes count 1

What are the various usage patterns for manually-marshaled interfaces?

Raymond Chen

The outermost simple layer, and the more complex inner layer.

Jun 13, 2022
Post comments count 10
Post likes count 2

Adventures in application compatibility: The case of the PC-relative indirect jump that reads from nowhere

Raymond Chen

A little too much copy/pasta.

Jun 10, 2022
Post comments count 10
Post likes count 1

How do I retrieve an extremely large range of cells from Excel if the clipboard functions all time out?

Raymond Chen

Maybe you shouldn't be using the clipboard.

Jun 9, 2022
Post comments count 6
Post likes count 1

How can I wait more than 30 seconds for a delay-rendered clipboard format to become rendered?

Raymond Chen

Provide your own delay.

Jun 8, 2022
Post comments count 7
Post likes count 4

Is there a maximum size for Windows clipboard data? Because I’m getting null for something I know should be there

Raymond Chen

There is no pre-set maximum size, but that null might be coming from somewhere else.

Jun 7, 2022
Post comments count 9
Post likes count 2

How to write like Raymond: Contacting another team for the first time

Raymond Chen

Flattery will get you in the door.

Jun 6, 2022
Post comments count 11
Post likes count 1

An opinionated comparison of C++ frameworks for consuming and implementing Windows Runtime types

Raymond Chen

The three leading contenders.

Jun 3, 2022
Post comments count 11
Post likes count 1

Assessing a read-after free for security implications: The string comparison

Raymond Chen

Can you get elevation? What are you disclosing?

Jun 2, 2022
Post comments count 1
Post likes count 1

Converting between Windows FILETIME and Unix time_t without having to type the magic number 116444736000000000

Raymond Chen

It's not exactly a number that you can rattle off the top of your head.

Jun 1, 2022
Post comments count 0
Post likes count 1

The case of the COM reference that suddenly went bad in the middle of a coroutine

Raymond Chen

Is the coroutine really to blame?

May 31, 2022
Post comments count 4
Post likes count 4

The activeCodePage manifest element can be used for more than just setting UTF-8 as the active code page

Raymond Chen

AppLocale grows up.

May 30, 2022
Post comments count 4
Post likes count 1

On passing iterables of iterables in the Windows Runtime

Raymond Chen

Different projections help you out in different ways, some more than others.

May 27, 2022
Post comments count 0
Post likes count 1

Why do rescued stack traces often have instability at the start?

Raymond Chen

Trying to pick up the scent.

May 26, 2022
Post comments count 0
Post likes count 1

Rescuing a stack trace the lazy way on x86-64 (aka amd64) after the debugger gave up

Raymond Chen

Looking for a good frame to start from.

May 25, 2022
Post comments count 4
Post likes count 1

How can I get my FileSavePicker to open in the same folder that was picked by the FileOpenPicker or FolderPicker?

Raymond Chen

Make them all share the same settings identifier.

May 24, 2022
Post comments count 14
Post likes count 4

What is the CreateExplorerShellUnelevatedTask scheduled task?

Raymond Chen

To keep Explorer running unelevated.

May 23, 2022
Post comments count 0
Post likes count 2

How does Windows decide whether a newly-created window should use LTR or RTL layout?

Raymond Chen

Gathering the algorithmic details scattered throughout the documentation into one place.

May 20, 2022
Post comments count 4
Post likes count 1

Writing a sort comparison function, part 4: descending sort

Raymond Chen

Flipping the script.

May 19, 2022
Post comments count 3
Post likes count 1

Writing a sort comparison function, part 3: spaceships

Raymond Chen

Sprinkling some C++20 magic.

May 18, 2022
Post comments count 5
Post likes count 1

Writing a sort comparison function, part 2: avoid unnecessary expense

Raymond Chen

Avoid doing the work until needed.

May 17, 2022
Post comments count 8
Post likes count 1

Writing a sort comparison function, part 1: basics

Raymond Chen

Trying to avoid the pitfalls.

May 16, 2022
Post comments count 7
Post likes count 1

How can I synthesize a C++20 three-way comparison from two-way comparisons?

Raymond Chen

Multiple ways of synthesizing a comparison.

May 13, 2022
Post comments count 5
Post likes count 1

Should I pay attention to the warning that I’m std::move‘ing from a trivial type? Part 2

Raymond Chen

It's not about the journey. It's about the destination.

May 12, 2022
Post comments count 0
Post likes count 1

Should I pay attention to the warning that I’m std::move‘ing from a trivial type? Part 1

Raymond Chen

It's just informing you that what you're doing may not have the desired effect, depending on what your desired effect was.

May 11, 2022
Post comments count 2
Post likes count 1

On ways of finding out when a C++/WinRT IAsyncAction has run to completion

Raymond Chen

Just some noodling on ideas.

May 10, 2022
Post comments count 5
Post likes count 2

A brief summary of the various versions of the Security Descriptor Definition Language (SDDL)

Raymond Chen

Things come, and rarely go.

May 9, 2022
Post comments count 0
Post likes count 1

Why does my overridable Windows Runtime method turn into a protected method, and how can I work around it?

Raymond Chen

Just an odd rule, but it's there for a reason.

May 6, 2022
Post comments count 3
Post likes count 1

On awaiting a task with a timeout in C++/WinRT

Raymond Chen

Doing the same thing, just in another language.

May 5, 2022
Post comments count 4
Post likes count 1

On awaiting a task with a timeout in C#

Raymond Chen

Putting something together from pieces you already have.

May 4, 2022
Post comments count 0
Post likes count 1

Producing an empty Windows Runtime type in C++/WinRT

Raymond Chen

How to say that you don't have anything.

May 3, 2022
Post comments count 2
Post likes count 2

What are these SIDs of the form S-1-15-3-xxx?

Raymond Chen

They are app capability SIDs.

May 2, 2022
Post comments count 5
Post likes count 3

What are these SIDs of the form S-1-15-2-xxx?

Raymond Chen

They are app container SIDs.

Apr 29, 2022
Post comments count 4
Post likes count 1

The case of the failed exchange of the vtable slot

Raymond Chen

Another application compatibility case.

Apr 28, 2022
Post comments count 2
Post likes count 5

What’s up with std::piecewise_construct and std::forward_as_tuple?

Raymond Chen

When you need to pass two sets of variadic parameters, and to work around other extremely weird edge cases.

Apr 27, 2022
Post comments count 0
Post likes count 1

How do I decode a #pragma detect_mismatch error?

Raymond Chen

The linker tells you a bunch of stuff. Here's what it means.

Apr 26, 2022
Post comments count 9
Post likes count 7

Be careful with that thing, it’s a confidential coffee maker

Raymond Chen

Just keep it under wraps.

Apr 25, 2022
Post comments count 0
Post likes count 1

How can I force a WriteFile or ReadFile to complete synchronously or hang, in order to test something?

Raymond Chen

You can use a named pipe.

Apr 22, 2022
Post comments count 3
Post likes count 1

Trying to create a factory that remembers the parameters to pass to another method

Raymond Chen

Lost in a twisty maze of universal references.

Apr 21, 2022
Post comments count 0
Post likes count 1

How do I access and customize the IInspectable methods of a Windows Runtime class written in C++/WinRT?

Raymond Chen

Special access methods, but normal overrides.

Apr 20, 2022
Post comments count 0
Post likes count 1

Class template argument deduction may be the new hotness, but we’ll always have maker functions

Raymond Chen

It's all or nothing, and sometimes you don't have all.

Apr 19, 2022
Post comments count 10
Post likes count 1

The Applesoft Compiler (TASC): We have the source code, in a sense

Raymond Chen

The desperation of programming under tight memory constraints.

Apr 18, 2022
Post comments count 2
Post likes count 1

The x86 architecture is the weirdo, part 2

Raymond Chen

It does everything differently, because of course it does.

Apr 15, 2022
Post comments count 3
Post likes count 1

How can I co_await on a Windows Runtime async action or operation with a timeout?

Raymond Chen

You can combine it with a timeout.

Apr 14, 2022
Post comments count 1
Post likes count 1

How can I tell the WIL RETURN_IF_FAILED macro that some errors are ignorable?

Raymond Chen

You can create a custom filter using things you already know how to do.

Apr 13, 2022
Post comments count 2
Post likes count 1

A survey of how implementations of Windows Runtime events deal with errors

Raymond Chen

All happy event delegates are alike; each unhappy event delegate is unhappy in its own way.

Apr 12, 2022
Post comments count 11
Post likes count 1

Notes on BitLocker and the TPM and the pre-boot password or PIN

Raymond Chen

How to get BitLocker and the TPM to play friendly.

Apr 11, 2022
Post comments count 35
Post likes count 1

Now that computers have more than 4MB of memory, can we get seconds on the taskbar?

Raymond Chen

Letting the CPU go to sleep.

Apr 8, 2022
Post comments count 5
Post likes count 1

Please repeat yourself: The noexcept(noexcept(…)) idiom

Raymond Chen

Each time you say it, it means something different.

Apr 7, 2022
Post comments count 7
Post likes count 1

If I am getting a DllNotFoundException from Windows 10 N, how do I get the missing DLLs?

Raymond Chen

Enter the Media Feature Pack.

Apr 6, 2022
Post comments count 6
Post likes count 1

All Windows threadpool waits can now be handled by a single thread

Raymond Chen

Come in and join the thread, the water's fine.

Apr 5, 2022
Post comments count 10
Post likes count 1

Adventures in application compatibility: The case of the RAII type that failed to run its destructor

Raymond Chen

Breaking all the rules and getting away with it.

Apr 4, 2022
Post comments count 0
Post likes count 1

How are Windows Runtime GUIDs represented in JavaScript?

Raymond Chen

They're strings, in various formats.

Apr 1, 2022
Post comments count 3
Post likes count 2

The std::invoke function does more than invoke functions

Raymond Chen

Inspiring a new level of code obfuscation.

Mar 31, 2022
Post comments count 8
Post likes count 1

Should I translate my window class names?

Raymond Chen

Who's going to read it?

Mar 30, 2022
Post comments count 0
Post likes count 1

Why am I getting the error message “This is only for weak ref support” when I try to create a C++/WinRT weak reference?

Raymond Chen

Reverse-engineering the error message.

Mar 29, 2022
Post comments count 3
Post likes count 1

How to become a Senior Detective, according to Murderville

Raymond Chen

A little copy pasta will take you far.

Mar 29, 2022
Post comments count 29
Post likes count 2

Why are there separate Program Files and Program Files (x86) directories?

Raymond Chen

Why can't we just combine them?

Mar 28, 2022
Post comments count 9
Post likes count 1

Why is every other line of my file mysteriously changed to nonsense Chinese characters?

Raymond Chen

Decoding another type of mojibake.

Mar 25, 2022
Post comments count 0
Post likes count 0

The 2022/2023 Seattle Symphony subscription season at a glance

Raymond Chen

The pocket reference guide for 2022/2023.

Mar 25, 2022
Post comments count 2
Post likes count 1

Behind C++/WinRT: How does C++/WinRT get the list of implemented interfaces?

Raymond Chen

Doing some template metaprogramming reverse engineering.

Mar 24, 2022
Post comments count 0
Post likes count 2

Behind C++/WinRT: How does C++/WinRT decide which interfaces are implemented?

Raymond Chen

Finding the code that does the interface detection.

Mar 23, 2022
Post comments count 0
Post likes count 1

Why does C++/WinRT say that first_interface is not a member of winrt::impl::interface_list<>?

Raymond Chen

An empty list has no first element, but why is the list empty?

Mar 22, 2022
Post comments count 6
Post likes count 1

A hypothetical magical musical power: The one-piece wonder

Raymond Chen

You can play one thing well, but only one.

Mar 22, 2022
Post comments count 0
Post likes count 1

How do I un-ignore an Outlook email thread, and how does it work?

Raymond Chen

A peek under the covers.

Mar 21, 2022
Post comments count 1
Post likes count 1

Injected class names: The C++ feature you didn’t even realize that you were using

Raymond Chen

Simplifying the name of what you are.

Mar 18, 2022
Post comments count 1
Post likes count 1

Making our multiple-interface query more C++-like, part 2

Raymond Chen

Letting you specify which interfaces are required and which are optional.

Mar 17, 2022
Post comments count 1
Post likes count 1

Making our multiple-interface query more C++-like, part 1

Raymond Chen

Maybe we can write a nice wrapper.

Mar 16, 2022
Post comments count 0
Post likes count 1

Reducing chattiness by querying for multiple interfaces at once, part 2

Raymond Chen

You can just load them into the cache.

Mar 15, 2022
Post comments count 1
Post likes count 1

Reducing chattiness by querying for multiple interfaces at once, part 1

Raymond Chen

The multiple-query alternatives.

Mar 14, 2022
Post comments count 6
Post likes count 1

How expensive is PssCaptureSnapshot? How fast is it? How much memory does it consume?

Raymond Chen

Think of it as a copy-on-write copy, like the Volume Snapshot Service.

Mar 11, 2022
Post comments count 7
Post likes count 1

Optimizing code to darken a bitmap, part 5

Raymond Chen

Once more, with ARM feeling.

Mar 10, 2022
Post comments count 9
Post likes count 1

Optimizing code to darken a bitmap, part 4

Raymond Chen

Bringing out the big SIMD guns, for x86 at least.

Mar 9, 2022
Post comments count 10
Post likes count 1

Optimizing code to darken a bitmap, part 3

Raymond Chen

Jumpless conditionals via masking.

Mar 8, 2022
Post comments count 11
Post likes count 1

Optimizing code to darken a bitmap, part 2

Raymond Chen

Exploiting parallel arithmetic.

Mar 7, 2022
Post comments count 15
Post likes count 1

Optimizing code to darken a bitmap, part 1

Raymond Chen

Starting with the basics.

Mar 4, 2022
Post comments count 0
Post likes count 2

If the slim reader/writer lock (SRWLOCK) doesn’t remember who the shared lock owner is, does that mean it’s okay to acquire it recursively?

Raymond Chen

No, but you sort of knew that deep down.

Mar 3, 2022
Post comments count 1
Post likes count 1

Filtering out fake keyboards from the GetRawInputDeviceList function

Raymond Chen

Maybe look to see if it has any keys.

Mar 2, 2022
Post comments count 1
Post likes count 1

How can I detect whether the system has a keyboard attached? On the GetRawInputDeviceList function

Raymond Chen

You can enumerate the input devices and see if there's a keyboard.

Mar 1, 2022
Post comments count 6
Post likes count 1

How does Windows decide what instructions to provide for unlocking the PC?

Raymond Chen

It sniffs around at your hardware capabilities.

Feb 28, 2022
Post comments count 15
Post likes count 2

Zero-cost exceptions aren’t actually zero cost

Raymond Chen

Shifting the cost to the exceptional path.

Feb 25, 2022
Post comments count 2
Post likes count 2

How can I monitor changes to the reference count of a C++/WinRT object?

Raymond Chen

A little cookbook.

Feb 24, 2022
Post comments count 2
Post likes count 1

COM asynchronous interfaces, part 9: Asynchronous release, assembling a solution

Raymond Chen

Juggling the references in the right way.

Feb 23, 2022
Post comments count 0
Post likes count 1

COM asynchronous interfaces, part 8: Asynchronous release, the problems

Raymond Chen

If you don't need something any more, then you usually don't really care when it gets taken away.

Feb 22, 2022
Post comments count 2
Post likes count 1

COM asynchronous interfaces, part 7: Being called directly when the operation completes

Raymond Chen

Becoming part of the system.

Feb 21, 2022
Post comments count 4
Post likes count 1

COM asynchronous interfaces, part 6: Learning about completion without polling

Raymond Chen

You can peek at the handle hiding inside the synchronization interface.

Feb 18, 2022
Post comments count 0
Post likes count 1

COM asynchronous interfaces, part 5: The unreliable server

Raymond Chen

Trying not to hang when the server is hung.

Feb 17, 2022
Post comments count 1
Post likes count 1

COM asynchronous interfaces, part 4: Doing work while waiting for the asynchronous operation

Raymond Chen

Just checking in on how things are going.

Feb 16, 2022
Post comments count 0
Post likes count 1

COM asynchronous interfaces, part 3: Abandoning the operation after a timeout

Raymond Chen

Waiting a little while, but not forever.

Feb 15, 2022
Post comments count 1
Post likes count 1

COM asynchronous interfaces, part 2: Abandoning the operation

Raymond Chen

Simply losing interest.

Feb 14, 2022
Post comments count 3
Post likes count 2

COM asynchronous interfaces, part 1: The basic pattern

Raymond Chen

Letting things run on their own, and then coming back for the answer later.

Feb 11, 2022
Post comments count 0
Post likes count 1

Notes on COM aggregation: How do you implement tear-offs in an aggregated object?

Raymond Chen

Keeping the controlling unknown in the know.

Feb 10, 2022
Post comments count 10
Post likes count 1

Notes on COM aggregation: Obtaining a pointer to your aggregated partner without introducing a reference cycle

Raymond Chen

Putting your thumb on the scale.

Feb 9, 2022
Post comments count 17
Post likes count 1

How can I find out which processor architectures are supported via emulation by the current system?

Raymond Chen

Fortunately, there's a special function for that, or at least for enough of that to serve your needs.

Feb 8, 2022
Post comments count 3
Post likes count 4

The cats sitting on a fence in early builds of Windows 8

Raymond Chen

Something to look at when all is lost.

Feb 7, 2022
Post comments count 11
Post likes count 1

On finding the average of two unsigned integers without overflow

Raymond Chen

Another code golfing adventure.

Feb 4, 2022
Post comments count 3
Post likes count 2

The case of the stack overflow exception when the stack is nowhere near overflowing

Raymond Chen

There's a problem with the stack that prevents it from growing, so you could consider than an overflow.

Feb 3, 2022
Post comments count 10
Post likes count 4

A closer look at the stack guard page

Raymond Chen

It is there to detect stack growth, but only if the stack grows into it.

Feb 2, 2022
Post comments count 1
Post likes count 1

Gotcha: C++/WinRT weak_ref.get() doesn’t get the weak reference; it gets the strong reference

Raymond Chen

What traditionally goes by the name <CODE>lock()</CODE>.

Feb 1, 2022
Post comments count 7
Post likes count 1

How do I customize the color of the Windows blue screen?

Raymond Chen

It's hard-coded now, sorry.

Jan 31, 2022
Post comments count 4
Post likes count 1

Why does the Windows debugger engine show a bunch of hex digits after one of the DLL names?

Raymond Chen

It's trying to disambiguate name collisions.

Jan 28, 2022
Post comments count 2
Post likes count 1

How can I recognize whether two handles refer to the same underlying file?

Raymond Chen

Exploring several avenues, hoping one of them leads somewhere.

Jan 27, 2022
Post comments count 3
Post likes count 1

How can I recognize file systems that don’t support 64-bit unique file identifiers?

Raymond Chen

It's buried somewhere in the specification.

Jan 26, 2022
Post comments count 0
Post likes count 1

What are these weird internal Visual C++ runtime functions named NLG?

Raymond Chen

They are part of exception handling.

Jan 25, 2022
Post comments count 11
Post likes count 1

I deleted a file from Explorer, but it came back when I refreshed, and I get Access Denied if I try to delete it again

Raymond Chen

The file is circling the drain, but it's not gone yet.

Jan 24, 2022
Post comments count 7
Post likes count 1

The MainWindowHandle property is just a guess based on heuristics

Raymond Chen

If you really need to find your main window, you'll have to come up with something more determinstic.

Jan 21, 2022
Post comments count 2
Post likes count 1

Fixing the crash that seems to be on a std::move operation

Raymond Chen

Getting the order of evaluation to be what you want.

Jan 20, 2022
Post comments count 0
Post likes count 1

The mystery of the crash that seems to be on a std::move operation

Raymond Chen

But is that really what's happening?

Jan 19, 2022
Post comments count 5
Post likes count 1

The error code you get might not be the one you want

Raymond Chen

Some error codes are contractual, but most aren't.

Jan 18, 2022
Post comments count 1
Post likes count 1

How to write like Raymond: The typing-saver

Raymond Chen

One of my little catch phrases.

Jan 17, 2022
Post comments count 4
Post likes count 1

C# and C++ type aliases and their consequences

Raymond Chen

Just some idle thoughts, and what it means for debugging.

Jan 14, 2022
Post comments count 5
Post likes count 2

Resolving confusion over how to return from a C++ coroutine

Raymond Chen

You have a few options, but you have to stay with it.

Jan 13, 2022
Post comments count 6
Post likes count 1

The oracle always tells the truth, even when it is wrong: COM method calls with a user-defined type as a return value

Raymond Chen

What you ship becomes the truth.

Jan 12, 2022
Post comments count 1
Post likes count 1

Standing on the shoulders of giants: Let the compiler tell you what the ABI is

Raymond Chen

Consult the oracle.

Jan 11, 2022
Post comments count 11
Post likes count 1

Jumping into the middle of an instruction is not as strange as it sounds

Raymond Chen

It's just another trick for saving space.

Jan 10, 2022
Post comments count 0
Post likes count 1

How can I detect that a thread pool work item is taking too long?

Raymond Chen

Call in a watchdog.

Jan 7, 2022
Post comments count 7
Post likes count 1

How do I upgrade a 32-bit tick count to a 64-bit one?

Raymond Chen

Fortunately, there's a 64-bit one sitting nearby.

Jan 6, 2022
Post comments count 17
Post likes count 1

Filling in some gaps in the story of Space Cadet Pinball on 64-bit Windows

Raymond Chen

The story as I experienced it.

Jan 5, 2022
Post comments count 0
Post likes count 1

How do I prevent folder verbs intended for file system directories from showing up in my shell extension’s virtual folder’s context menu?

Raymond Chen

They shouldn't be there in the first place.

Jan 4, 2022
Post comments count 4
Post likes count 14

My Excel spreadsheet doesn’t scroll even though I can use the arrows to move around

Raymond Chen

Freeze, and put your hands up!

Jan 3, 2022
Post comments count 1
Post likes count 1

Speculation on the design decisions that led to the common ABI for C++ coroutines

Raymond Chen

Considering some alternatives.

Dec 31, 2021
Post comments count 8
Post likes count 1

2021 year-end link clearance

Raymond Chen

Another trip around the sun.

Dec 31, 2021
Post comments count 6
Post likes count 1

The case of the programs that were launched with impossible command line options

Raymond Chen

Death and resurrection, unsuccessfully.

Dec 30, 2021
Post comments count 5
Post likes count 1

The C++/CX String^ is not an object, even though it wears a hat

Raymond Chen

A strange beast that thing is.

Dec 29, 2021
Post comments count 12
Post likes count 1

You can’t copy code with memcpy; code is more complicated than that

Raymond Chen

There's more to code than just instructions.

Dec 28, 2021
Post comments count 10
Post likes count 1

A rejected attempt to inject pseudo-physics into Windows 8 toast notifications

Raymond Chen

Like a mischievous rubber band flung across the screen.

Dec 27, 2021
Post comments count 3
Post likes count 1

How do I add custom controls to the common file open or file save dialogs?

Raymond Chen

A survey of the history of customization, leading to the present.

Dec 24, 2021
Post comments count 3
Post likes count 3

The Thanksgiving to Christmas sales nationwide of the VIS could be tabulated in an unsigned char

Raymond Chen

One of the great duds of console gaming history.

Dec 23, 2021
Post comments count 5
Post likes count 1

It’s easy to get data into the GPU, but harder to get it out

Raymond Chen

The continuing evolution of graphics memory.

Dec 22, 2021
Post comments count 1
Post likes count 2

How do I programmatically reposition monitors in a multiple-monitor system?

Raymond Chen

The magic phrase is <CODE>DM_POSITION</CODE>.

Dec 21, 2021
Post comments count 3
Post likes count 1

You thought Windows drivers from 2006 were old, wait’ll you see the Intel drivers from 1968!

Raymond Chen

It's the same driver date hack, just even more extreme.

Dec 20, 2021
Post comments count 8
Post likes count 1

Why do I have to add one when setting a class background brush to a system color?

Raymond Chen

To make sure it's not null.

Dec 17, 2021
Post comments count 7
Post likes count 1

Why is the stack overflow exception raised before the stack has overflowed?

Raymond Chen

You need some stack to deal with the exception.

Dec 16, 2021
Post comments count 1
Post likes count 1

Why does the precise point at which I get a stack overflow exception change from run to run?

Raymond Chen

The system is trying to introduce some unpredictability.

Dec 15, 2021
Post comments count 16
Post likes count 1

What does “Do not launch, but debug my code when it launches” mean?

Raymond Chen

Don't launch my code when it launches? Does that even make sense?

Dec 14, 2021
Post comments count 5
Post likes count 1

Embarrassing product names created: Windows CE

Raymond Chen

You do all you can, but at the end of the day, it's not yours to control.

Dec 13, 2021
Post comments count 0
Post likes count 1

Dubious security vulnerability: Accessing information across accounts after changing email address

Raymond Chen

It's still you, just with a different online façade.

Dec 10, 2021
Post comments count 10
Post likes count 1

It’s okay to be contrary, but you need to be consistently contrary: Going against the ambient character set

Raymond Chen

Code different.

Dec 9, 2021
Post comments count 2
Post likes count 1

If you’re going to configure a header file, you have to do it before you include the header file

Raymond Chen

It sounds obvious, but you can be faked out.

Dec 8, 2021
Post comments count 1
Post likes count 1

Using CRTP to your advantage: Simplifying overloaded Windows Runtime method projections in C++/WinRT

Raymond Chen

As long as the wrapper can call it, you can implement it any way you like.

Dec 7, 2021
Post comments count 2
Post likes count 1

What happens when a hot air balloon lands in your yard?

Raymond Chen

Break out the bubbly.

Dec 7, 2021
Post comments count 3
Post likes count 1

It rather involved being on the other side of this airtight hatchway: Producing malicious data in a kernel driver

Raymond Chen

Sure, you can fool other people, but you can do far more than that already.

Dec 6, 2021
Post comments count 7
Post likes count 1

Compiler error message metaprogramming: Helping to find the conflicting macro definition

Raymond Chen

Shaping the code so a required diagnostic will be useful.

Dec 3, 2021
Post comments count 1
Post likes count 1

How can I produce a C-style array from a Windows Runtime asynchronous operation?

Raymond Chen

No good solutions, but some workarounds.

Dec 2, 2021
Post comments count 0
Post likes count 1

How do I receive ownership of a C-style array in a Windows Runtime component?

Raymond Chen

The implementation side of the role reversal.

Dec 1, 2021
Post comments count 2
Post likes count 1

How can I transfer ownership of a C-style array to a Windows Runtime component?

Raymond Chen

Survey the options and realize that the only choice is to go backward.

Nov 30, 2021
Post comments count 1
Post likes count 1

How can my C++/WinRT component pass a std::vector back to the caller?

Raymond Chen

Implementing the ReceiveArray pattern.

Nov 29, 2021
Post comments count 8
Post likes count 2

How did Windows 3.1’s virtual machine manager get the information to show in the text-mode Alt+Tab switcher?

Raymond Chen

Getting by with a little help from a friend.

Nov 26, 2021
Post comments count 3
Post likes count 1

The two products may be identical, but they are not the same

Raymond Chen

No price-matching for you.

Nov 26, 2021
Post comments count 2
Post likes count 1

I called AdjustTokenPrivileges, but I was still told that a necessary privilege was not held, redux

Raymond Chen

Did any privilege adjustment occur at all?

Nov 25, 2021
Post comments count 4
Post likes count 1

How do I pass an array of variable-sized PROPSHEETPAGE structures to PropertySheet?

Raymond Chen

It's "just" an array of variable-sized structures.

Nov 24, 2021
Post comments count 7
Post likes count 1

Appending additional payload to a PROPSHEETPAGE structure

Raymond Chen

Taking it along for the ride.

Nov 23, 2021
Post comments count 10
Post likes count 1

Every business process secretly wants to fail

Raymond Chen

At least, that's how it looks from the outside.

Nov 22, 2021
Post comments count 7
Post likes count 1

A reminder about the correct way of accessing and manipulating the position of icons on the desktop

Raymond Chen

There's an interface for that. Please use it.

Nov 19, 2021
Post comments count 6
Post likes count 1

Why is my C++/CX ref class forbidden from having public methods that are templates or mention, say, std::vector?

Raymond Chen

C++/CX overloads the class member access control keywords to control metadata generation.

Nov 18, 2021
Post comments count 1
Post likes count 1

What does the CompileAsWinRT Visual Studio project option mean?

Raymond Chen

And why it's badly-named.

Nov 17, 2021
Post comments count 3
Post likes count 1

The mental model for StartThreadpoolIo

Raymond Chen

It's internally managing a reference count.

Nov 16, 2021
Post comments count 6
Post likes count 1

Microspeak: Righteous

Raymond Chen

A colloqualism that has become a preferred adjective.

Nov 15, 2021
Post comments count 0
Post likes count 1

A practical use for GetHGlobal­FromStream when sharing was never your intention

Raymond Chen

This may even have been its original purpose.

Nov 12, 2021
Post comments count 7
Post likes count 1

Another way of looking at C++ reverse iterators

Raymond Chen

It's the same thing, just going in the opposite direction, right?

Nov 11, 2021
Post comments count 4
Post likes count 1

I sort of knew that I’m a bad flute player, but I guess this proves it

Raymond Chen

The fault is in ourselves, after all.

Nov 11, 2021
Post comments count 20
Post likes count 2

The inside story of the outside investigation of SoftRAM 95

Raymond Chen

It had a plan, but didn't quite execute on it.

Nov 10, 2021
Post comments count 4
Post likes count 1

How am I supposed to create children of the Win32 tab control?

Raymond Chen

They look like children, but they're not.

Nov 9, 2021
Post comments count 3
Post likes count 1

If your domain name parser can’t handle internationalized domain names, then maybe that’s your parser’s problem

Raymond Chen

Don't blame someone else for letting strange domain names reach you.

Nov 8, 2021
Post comments count 1
Post likes count 1

Restoring support for pre-standardization coroutine free awaiters for even older code bases

Raymond Chen

Connecting the dots, and reaching back to an earlier time.

Nov 5, 2021
Post comments count 0
Post likes count 1

The case of the C++/WinRT cached factories that pointed into freed memory

Raymond Chen

Developing theories that match the evidence.

Nov 4, 2021
Post comments count 12
Post likes count 1

How can I prevent myself from accessing a lambda captured variable or a parameter after I’m done with it?

Raymond Chen

Name-hiding on purpose.

Nov 3, 2021
Post comments count 3
Post likes count 1

A capturing lambda can be a coroutine, but you have to save your captures while you still can

Raymond Chen

Save it all before it disappears.

Nov 2, 2021
Post comments count 8
Post likes count 1

The focus rectangle says, “I’m not orange. I’m just drawn that way.”

Raymond Chen

How does <CODE>Draw­Focus­Rect</CODE> draw the focus rectangle?

Nov 1, 2021
Post comments count 1
Post likes count 1

Why do all this coroutine stuff if you can just use std::future?

Raymond Chen

Escape from PPL.

Oct 29, 2021
Post comments count 0
Post likes count 1

Giving a single object multiple COM identities, part 4

Raymond Chen

Simplifying the pattern.

Oct 28, 2021
Post comments count 3
Post likes count 1

Giving a single object multiple COM identities, part 3

Raymond Chen

Returning to the scene of the crime.

Oct 27, 2021
Post comments count 1
Post likes count 1

Giving a single object multiple COM identities, part 2

Raymond Chen

Trying to develop a slightly more efficient multi-headed snake.

Oct 26, 2021
Post comments count 3
Post likes count 1

Giving a single object multiple COM identities, part 1

Raymond Chen

Like a multi-headed snake.

Oct 25, 2021
Post comments count 1
Post likes count 2

A very brief introduction to patterns for implementing a COM object that hands out references to itself

Raymond Chen

We'll look at many choices, but focus on one.

Oct 22, 2021
Post comments count 4
Post likes count 1

Renaming a file is a multi-step process, only one of which is changing the name of the file

Raymond Chen

If you're going to swoop in, make sure to swoop in carefully.

Oct 21, 2021
Post comments count 3
Post likes count 1

Why isn’t MapDialogRect mapping dialog rectangles?

Raymond Chen

Maybe you don't have a dialog.

Oct 20, 2021
Post comments count 0
Post likes count 2

My code crashed when I asked WIL to convert an exception to an HRESULT, did I throw an improper exception type?

Raymond Chen

Digging into the failure more closely.

Oct 19, 2021
Post comments count 4
Post likes count 1

That time we had a network outage due to unexpected hunter activity

Raymond Chen

Watch where you're pointing that thing.

Oct 18, 2021
Post comments count 1
Post likes count 1

How can I get the screen reader to read out an error message that I displayed inline on a page?

Raymond Chen

Make it a live region.

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

What does the SizeOfImage mean in the MODULEINFO structure?

Raymond Chen

It's the size in terms of mapped address space when loaded.

Oct 14, 2021
Post comments count 1
Post likes count 1

Why does GetModuleInfo fail to produce an entry point for executables?

Raymond Chen

Because it's getting the information from the loader, who has no use for such things.

Oct 13, 2021
Post comments count 3
Post likes count 1

Local variables are different from parameters in C++ coroutines

Raymond Chen

You tend to think of them the same, but they destruct differently.

Oct 12, 2021
Post comments count 2
Post likes count 1

The happy hand: A puzzle about odd names in Azure DevOps

Raymond Chen

Who's renaming everything into something cute?

Oct 11, 2021
Post comments count 5
Post likes count 1

Is there a way that my macro can detect that it’s running in a C++ coroutine?

Raymond Chen

You are part of the decision.

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

What can I do about timer build-up when waiting for COM outbound calls to complete?

Raymond Chen

You'll have to drain them out yourself.

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

Debugging coroutine handles: The Microsoft Visual C++ compiler, clang, and gcc

Raymond Chen

Peeking behind the curtain.

Oct 6, 2021
Post comments count 4
Post likes count 1

Why is the main() function always at address 0x00401000 in a simple program?

Raymond Chen

When multiple technical decision add up, literally.

Oct 5, 2021
Post comments count 6
Post likes count 1

Not from inside the Redmond Reality Distortion Field: Microsoft Streets and Trips support for ferries

Raymond Chen

From somebody else's reality distortion field.

Oct 4, 2021
Post comments count 6
Post likes count 4

Some lesser-known powers of std::optional

Raymond Chen

Things it does that you may not know about.

Oct 1, 2021
Post comments count 2
Post likes count 1

The subtleties of Create­Stream­On­HGlobal, part 4: Non-movable memory

Raymond Chen

Fear and reallocation.

Sep 30, 2021
Post comments count 0
Post likes count 1

The subtleties of Create­Stream­On­HGlobal, part 3: Suppressing the deletion of a shared HGLOBAL

Raymond Chen

Trying to set up joint custody.

Sep 29, 2021
Post comments count 5
Post likes count 1

The subtleties of Create­Stream­On­HGlobal, part 2: Suppressing the deletion of an unknown HGLOBAL

Raymond Chen

You don't know what it is, but you said you don't want it deleted automatically.

Sep 28, 2021
Post comments count 0
Post likes count 2

The subtleties of Create­Stream­On­HGlobal, part 1: Introduction and basic usage

Raymond Chen

Developing the mental model.

Sep 27, 2021
Post comments count 0
Post likes count 1

Why am I getting an unresolved external from C++/WinRT if it is a header-only C++ library?

Raymond Chen

Maybe you didn't get all of the headers.

Sep 24, 2021
Post comments count 2
Post likes count 2

The case of the UWP application that crashes at launch on Windows 10X

Raymond Chen

Look before you leap.

Sep 23, 2021
Post comments count 2
Post likes count 1

Why is there trailing garbage when I try to decode the bytes of a HttpContent object?

Raymond Chen

You need to know when to stop.

Sep 22, 2021
Post comments count 4
Post likes count 1

Converting between UTF-8 strings and UTF-16 strings in C++/WinRT

Raymond Chen

A pair of conversion functions.

Sep 21, 2021
Post comments count 9
Post likes count 1

The CertUtil program will decode Windows error codes, and in a variety of formats

Raymond Chen

Even more versatile than <CODE>NET HELPMSG</CODE>.

Sep 20, 2021
Post comments count 8
Post likes count 1

What does this mean? The caller specified wait timed out before the operation completed because a host termination is in queued

Raymond Chen

An error message written with infrastructure-colored glasses.

Sep 17, 2021
Post comments count 10
Post likes count 1

Adventures in application compatibility: The case of the wild instruction pointer that, upon closer inspection, might not be so wild after all

Raymond Chen

The search for clues leads to an unexpected place.

Sep 16, 2021
Post comments count 6
Post likes count 1

The C++ implicit assignment operator is a non-ref-qualified member, even if the base class’s assignment has a ref-qualifier

Raymond Chen

Does that count as dis-qualification?

Sep 15, 2021
Post comments count 3
Post likes count 1

How do I set the alpha channel of a GDI bitmap to 255?

Raymond Chen

Most things destroy the alpha channel, but there's a way to bring it back, or at least make it opaque.

Sep 14, 2021
Post comments count 0
Post likes count 1

Microspeak: Persona

Raymond Chen

A template for a prototypical user.

Sep 13, 2021
Post comments count 1
Post likes count 1

The C++/WinRT query_interface_tearoff extension point, and using it for COM aggregation

Raymond Chen

For adding your own <CODE>QueryInterface</CODE> magic.

Sep 10, 2021
Post comments count 0
Post likes count 1

Ordering asynchronous updates with coroutines, part 5: Bowing out via cancellation

Raymond Chen

Using the built-in way of stopping a coroutine.

Sep 9, 2021
Post comments count 2
Post likes count 1

Ordering asynchronous updates with coroutines, part 4: Bowing out, explicit version

Raymond Chen

Realizing you're not the one.

Sep 8, 2021
Post comments count 0
Post likes count 1

Ordering asynchronous updates with coroutines, part 3: Let them all compete, but only one wins

Raymond Chen

Everybody tries, but only one wins.

Sep 7, 2021
Post comments count 1
Post likes count 1

Ordering asynchronous updates with coroutines, part 2: Restart with hand-off

Raymond Chen

Everybody just waits their turn.

Sep 6, 2021
Post comments count 1
Post likes count 1

Ordering asynchronous updates with coroutines, part 1: Mutual exclusion

Raymond Chen

Everybody just waits their turn.

Sep 3, 2021
Post comments count 2
Post likes count 1

I declared my Windows Runtime method as accepting an array by reference, but it always arrives empty

Raymond Chen

You were only meant to put things into the box, not look at what was already there.

Sep 2, 2021
Post comments count 5
Post likes count 1

Adventures in application compatibility: The cost of forgetting to specify a calling convention

Raymond Chen

Cleaning up behind mistakes of the past.

Sep 1, 2021
Post comments count 5
Post likes count 1

Looking at world through __stdcall-colored glasses

Raymond Chen

It's the default, or at least it's my default.

Aug 31, 2021
Post comments count 0
Post likes count 0

Notes on the Seattle Symphony’s expanded concert schedule for 2021–2022 season

Raymond Chen

More concerts, more options.

Aug 31, 2021
Post comments count 6
Post likes count 1

What are the consequences of increasing the per-process GDI handle limit?

Raymond Chen

Striking a balance.

Aug 30, 2021
Post comments count 0
Post likes count 1

The various ways of moving between C++/WinRT and classic COM

Raymond Chen

Crossing to the other side.

Aug 27, 2021
Post comments count 0
Post likes count 1

How can I break down a shell item in the same way as the breadcrumb bar?

Raymond Chen

Gathering the folders that lead up to a shell item, walking up the tree, or walking from the root to the leaf, and then obtaining the desired name.

Aug 26, 2021
Post comments count 11
Post likes count 1

In C#, how do I get the descriptive text for an HRESULT?

Raymond Chen

You can pretend it was an exception.

Aug 25, 2021
Post comments count 10
Post likes count 1

The Windows Runtime PassArray is a read-only array, even though it isn’t declared const

Raymond Chen

Because in most languages, there is no such thing as const.

Aug 24, 2021
Post comments count 8
Post likes count 1

How to sneak the Windows 95 credits screen into the build without anybody noticing

Raymond Chen

Write it in an obscure language.

Aug 23, 2021
Post comments count 11
Post likes count 1

C++/WinRT nasty gotcha: winrt::param::hstring constructed from std::wstring_view requires null termination

Raymond Chen

An additional constraint not part of the rules.

Aug 20, 2021
Post comments count 8
Post likes count 2

How do I find out the size of the mouse cursor?

Raymond Chen

Well, first you have to decide which one you want to measure.

Aug 19, 2021
Post comments count 8
Post likes count 1

How to pwn an unattended laptop, according to Humans

Raymond Chen

According to television.

Aug 19, 2021
Post comments count 2
Post likes count 2

What is the deal with the SM_CXCURSOR system metric?

Raymond Chen

A metric from an earlier, simpler time.

Aug 18, 2021
Post comments count 4
Post likes count 1

What’s with all of the references to “dude” in the accessibility header files?

Raymond Chen

A catch phrase from long ago.

Aug 17, 2021
Post comments count 2
Post likes count 1

Is it expected that custom default pinned taskbar items via LayoutModification.xml keep coming back each time the user logs on?

Raymond Chen

Yes, so you need to plan accordingly.

Aug 16, 2021
Post comments count 9
Post likes count 1

What are these dire multithreading consequences that the GetFullPathName documentation is trying to warn me about?

Raymond Chen

The current directory is volatile, so plan accordingly.

Aug 13, 2021
Post comments count 0
Post likes count 1

Resolving the ambiguity when your C++ class inherits from multiple base classes that have the same method

Raymond Chen

Steer the compiler toward the method you want.

Aug 12, 2021
Post comments count 8
Post likes count 1

How can I find the heap that a memory block originally came from, so I can free it properly?

Raymond Chen

You'll have to keep track of it yourself.

Aug 11, 2021
Post comments count 1
Post likes count 1

How can I prevent my UWP app from showing up in the Start menu?

Raymond Chen

Deny its app list entry.

Aug 10, 2021
Post comments count 1
Post likes count 1

Why did the old RAID database use a signed 16-bit integer for its record count? Why not unsigned, or a 32-bit integer?

Raymond Chen

You have to understand decisions in context, and that includes knowing the problem it was trying to solve.

Aug 9, 2021
Post comments count 1
Post likes count 1

Why am I getting a weird error about promise_type when I try to write a coroutine?

Raymond Chen

Digging into the coroutine infrastructure for the answer.

Aug 6, 2021
Post comments count 0
Post likes count 1

Using Windows Runtime interop methods from C++/WinRT: Some helper functions

Raymond Chen

Getting the interface, and the capturing from it.

Aug 5, 2021
Post comments count 6
Post likes count 1

An example of using Windows Runtime interop methods from C++/WinRT: Request­Token­For­Window­Async

Raymond Chen

Understanding how the C++/WinRT interop pieces fit together.

Aug 4, 2021
Post comments count 13
Post likes count 1

What is a static Windows Runtime class, how should I express it, and when should I use it?

Raymond Chen

The underlying question is "Can you even make one?"

Aug 3, 2021
Post comments count 0
Post likes count 1

Why are all of the retail demo names male?

Raymond Chen

For localization consistency.

Aug 2, 2021
Post comments count 0
Post likes count 1

How can I figure out which object is being hosted in an instance of dllhost?

Raymond Chen

Finding the object.

Jul 30, 2021
Post comments count 4
Post likes count 1

Why doesn’t my asynchronous read operation complete when I close the handle?

Raymond Chen

Because the file isn't closed yet.

Jul 29, 2021
Post comments count 2
Post likes count 1

On the interaction between the FILE_FLAG_NO_BUFFERING and FILE_FLAG_WRITE_THROUGH flags

Raymond Chen

Let's fill in another table.

Jul 28, 2021
Post comments count 3
Post likes count 1

How can I prevent the mouse from moving in response to touch input?

Raymond Chen

You need to make your program pointer-aware.

Jul 27, 2021
Post comments count 7
Post likes count 1

Twitter misdetected the 2011 Build conference keynote as a denial-of-service attack

Raymond Chen

Just a lot of excited developers.

Jul 26, 2021
Post comments count 13
Post likes count 1

Diagnosing why your batch file prints a garbage character, one character, and nothing more

Raymond Chen

Following the clues you have.

Jul 23, 2021
Post comments count 0
Post likes count 1

The history of passing a null pointer as the key name to Reg­Open­Key­Ex

Raymond Chen

It doesn't mean anything special any more, but it once did.

Jul 22, 2021
Post comments count 7
Post likes count 1

The case of the strange NT-style path that was discovered by SearchPath

Raymond Chen

Remember where it searches.

Jul 21, 2021
Post comments count 4
Post likes count 1

I know I can change the color of the DC pen, but what about the other attributes?

Raymond Chen

They're locked in, sorry.

Jul 20, 2021
Post comments count 29
Post likes count 1

Why does the New menu even exist for creating new empty files?

Raymond Chen

You have to open the file anyway to make it useful, so why not just open the program directly?

Jul 19, 2021
Post comments count 1
Post likes count 1

C++11 braced initialization made the impossible possible (and how to fix it so it stays impossible)

Raymond Chen

Braced initialization to the rescue, or denied.

Jul 16, 2021
Post comments count 4
Post likes count 1

What’s the difference between throwing a winrt::hresult_error and using winrt::throw_hresult?

Raymond Chen

It affects the error origination.

Jul 15, 2021
Post comments count 0
Post likes count 1

On proper handling of buffers in COM and RPC methods

Raymond Chen

The RPC layer deals with most of the problems for you, assuming you're using the RPC layer.

Jul 14, 2021
Post comments count 10
Post likes count 1

How to perform more complicated search and replace-style renaming in a batch file

Raymond Chen

Try something other than wildcards.

Jul 13, 2021
Post comments count 3
Post likes count 2

How did copying and renaming with wildcards work in MS-DOS?

Raymond Chen

By lining up two parallel arrays.

Jul 12, 2021
Post comments count 1
Post likes count 2

Why do smart pointers null out the wrapped pointer before destroying it?

Raymond Chen

It's not a race condition, but it's some condition.

Jul 9, 2021
Post comments count 2
Post likes count 1

On the perils of holding a lock across a coroutine suspension point, part 3: Solutions

Raymond Chen

How to avoid the trap.

Jul 8, 2021
Post comments count 0
Post likes count 1

On the perils of holding a lock across a coroutine suspension point, part 2: Nonrecursive mutexes

Raymond Chen

Another way things can go wrong.

Jul 7, 2021
Post comments count 3
Post likes count 2

On the perils of holding a lock across a coroutine suspension point, part 1: The set-up

Raymond Chen

One way things can go wrong.

Jul 6, 2021
Post comments count 9
Post likes count 0

How to act like you know Chinese even though you don’t, episode 2

Raymond Chen

Find the magic word.

Jul 6, 2021
Post comments count 0
Post likes count 1

What happens if I use a squash instead of a true merge when performing one of the git tricks?

Raymond Chen

In many cases, the merge is where the magic is.

Jul 5, 2021
Post comments count 3
Post likes count 0

How a basketball became a featured instrument in a Sting song

Raymond Chen

It's all in the name.

Jul 2, 2021
Post comments count 3
Post likes count 1

Is it okay to call Map­View­Of­File on the same mapping handle simultaneously from different threads?

Raymond Chen

Or do you have to enforce serialization to ensure both calls succeed?

Jul 1, 2021
Post comments count 4
Post likes count 1

Studying linker error messages to find the cause of the unresolved external: Character sets

Raymond Chen

Puzzling out why the symbols don't match exactly.

Jun 30, 2021
Post comments count 0
Post likes count 0

2021 mid-year link clearance

Raymond Chen

A collection of stuff that has accumulated.

Jun 29, 2021
Post comments count 20
Post likes count 1

What should the CPU usage be of a fully-loaded CPU that has been throttled?

Raymond Chen

A valid difference of opinion.

Jun 28, 2021
Post comments count 2
Post likes count 1

The initializing constructor looks like an assignment, but it isn’t

Raymond Chen

There is no assignment going on; it's just a quirk of syntax.

Jun 25, 2021
Post comments count 1
Post likes count 0

The ARM processor (Thumb-2), part 20: Code walkthrough

Raymond Chen

Putting together what we've learned, with a surprise.

Jun 24, 2021
Post comments count 1
Post likes count 0

The ARM processor (Thumb-2), part 19: Common patterns

Raymond Chen

Code sequences you will learn to recognize.

Jun 23, 2021
Post comments count 1
Post likes count 0

The ARM processor (Thumb-2), part 18: Other kinds of prologues and epilogues

Raymond Chen

Taking shortcuts and combining steps, or omitting them entirely.

Jun 22, 2021
Post comments count 3
Post likes count 0

The ARM processor (Thumb-2), part 17: Prologues and epilogues

Raymond Chen

Implementing the receiving end of the calling convention.

Jun 21, 2021
Post comments count 3
Post likes count 0

The ARM processor (Thumb-2), part 16: The calling convention

Raymond Chen

Pretend it's on the stack, even if it isn't.

Jun 18, 2021
Post comments count 5
Post likes count 0

The ARM processor (Thumb-2), part 15: Miscellaneous instructions

Raymond Chen

The stuff that didn't fit anywhere else.

Jun 17, 2021
Post comments count 1
Post likes count 0

The ARM processor (Thumb-2), part 14: Manipulating flags

Raymond Chen

Reaching in and flipping the switches.

Jun 16, 2021
Post comments count 10
Post likes count 0

The ARM processor (Thumb-2), part 13: Trampolines

Raymond Chen

The overly-uniform program counter register strikes again.

Jun 15, 2021
Post comments count 4
Post likes count 0

The ARM processor (Thumb-2), part 12: Control transfer

Raymond Chen

Let's go places.

Jun 14, 2021
Post comments count 3
Post likes count 0

The ARM processor (Thumb-2), part 11: Atomic access and barriers

Raymond Chen

Doing things one at a time.

Jun 11, 2021
Post comments count 2
Post likes count 0

The ARM processor (Thumb-2), part 10: Memory access and alignment

Raymond Chen

It's just loads and stores.

Jun 10, 2021
Post comments count 2
Post likes count 0

The ARM processor (Thumb-2), part 9: Sign and zero extension

Raymond Chen

Making small things bigger.

Jun 9, 2021
Post comments count 4
Post likes count 0

The ARM processor (Thumb-2), part 8: Bit shifting and bitfield access

Raymond Chen

That barrel shifter again.

Jun 8, 2021
Post comments count 3
Post likes count 0

The ARM processor (Thumb-2), part 7: Bitwise operations

Raymond Chen

Flip-flopping the bits.

Jun 7, 2021
Post comments count 7
Post likes count 0

The ARM processor (Thumb-2), part 6: The lie hiding inside the CMN instruction

Raymond Chen

Don't let the name fool you.

Jun 4, 2021
Post comments count 2
Post likes count 0

The ARM processor (Thumb-2), part 5: Arithmetic

Raymond Chen

Starting with basic mathematics.

Jun 3, 2021
Post comments count 0
Post likes count 0

The ARM processor (Thumb-2), part 4: Single-instruction constants

Raymond Chen

Flaunt your barrel shifter if you've got it.

Jun 2, 2021
Post comments count 1
Post likes count 1

The ARM processor (Thumb-2), part 3: Addressing modes

Raymond Chen

It's a load-store architecture, but with rather fancy loads and stores.

Jun 1, 2021
Post comments count 1
Post likes count 0

The ARM processor (Thumb-2), part 2: Differences between classic ARM and Thumb-2

Raymond Chen

Squeezing into a 16-bit instruction size.

May 31, 2021
Post comments count 6
Post likes count 1

The ARM processor (Thumb-2), part 1: Introduction

Raymond Chen

Moving into the present.

May 28, 2021
Post comments count 2
Post likes count 1

On the proper care and feeding of the default_overload Windows Runtime attribute

Raymond Chen

Generally avoid it, but if use it you must, at least follow these rules.

May 27, 2021
Post comments count 5
Post likes count 3

How can I convert between IANA time zones and Windows registry-based time zones?

Raymond Chen

ICU to the rescue.

May 26, 2021
Post comments count 8
Post likes count 2

How ownership of the Windows clipboard is tracked in Win32

Raymond Chen

A simple model, complicated by the reality of misuse.

May 25, 2021
Post comments count 10
Post likes count 2

Why are device-independent bitmaps upside down?

Raymond Chen

Well, it depends on what you consider to be right-side up.

May 24, 2021
Post comments count 0
Post likes count 1

On static methods in the Windows Runtime and C++/WinRT

Raymond Chen

Transforming the ABI into a projection.

May 21, 2021
Post comments count 5
Post likes count 1

Obtaining attributed network usage information from the Windows Runtime

Raymond Chen

Breaking it down by application.

May 20, 2021
Post comments count 4
Post likes count 1

Obtaining network usage information from the Windows Runtime

Raymond Chen

Getting your foot in the door with the NetworkInformation class.

May 19, 2021
Post comments count 0
Post likes count 1

Awaiting Windows Runtime asynchronous operations from C# desktop apps

Raymond Chen

Need to find the awaiter.

May 18, 2021
Post comments count 2
Post likes count 1

The blessing of the leading zero

Raymond Chen

Sometimes it's not a curse.

May 17, 2021
Post comments count 9
Post likes count 1

Why did Windows 95 keep window coordinates at multiples of 8?

Raymond Chen

Because sub-byte memory access is really annoying.

May 14, 2021
Post comments count 1
Post likes count 1

Why isn’t my shell namespace extension getting every single DragOver mouse message?

Raymond Chen

Trying to avoid too much chattiness for things that aren't important.

May 13, 2021
Post comments count 7
Post likes count 1

Drag/drop effects: The little drop information box

Raymond Chen

Updating the description.

May 12, 2021
Post comments count 4
Post likes count 1

Using Explorer’s fancy drag/drop effects in your own programs

Raymond Chen

Accessing those pre-made shell drop effects.

May 11, 2021
Post comments count 13
Post likes count 1

Why does the mouse cursor jump a few pixels if you right-click on the Start button?

Raymond Chen

To give you a head start.

May 10, 2021
Post comments count 7
Post likes count 1

What are the page sizes used by Windows on various processors?

Raymond Chen

Usually there was no choice, but sometimes there was.

May 7, 2021
Post comments count 0
Post likes count 1

A subtle way your await_suspend can access the coroutine frame when it shouldn’t

Raymond Chen

Hiding in the coroutine machinery.

May 6, 2021
Post comments count 4
Post likes count 1

Is std::exception_ptr nothrow constructible and assignable?

Raymond Chen

Yes, buried in the fine print.

May 5, 2021
Post comments count 3
Post likes count 1

Why is coroutine_handle::resume() potentially-throwing?

Raymond Chen

It enables a very specific usage scenario.

May 4, 2021
Post comments count 4
Post likes count 1

A map through the three major coroutine series

Raymond Chen

For your casual reading convenience.

May 4, 2021
Post comments count 1
Post likes count 1

C++ coroutines: Promise constructors

Raymond Chen

Snooping on the coroutine parameters, with a gotcha.

May 3, 2021
Post comments count 0
Post likes count 1

C++ coroutines: Converting among tasks that use the same promise

Raymond Chen

Keeping the promise in the dark.

Apr 30, 2021
Post comments count 2
Post likes count 1

C++ coroutines: Waiting synchronously for our coroutine to complete

Raymond Chen

Using the extension point for another purpose.

Apr 29, 2021
Post comments count 0
Post likes count 1

C++ coroutines: Adding COM context support to our awaiter

Raymond Chen

Getting into the correct context on resume.

Apr 28, 2021
Post comments count 0
Post likes count 1

C++ coroutines: Snooping in on the coroutine body

Raymond Chen

Transformers are robots in disguise.

Apr 27, 2021
Post comments count 2
Post likes count 1

C++ coroutines: How do I create a coroutine that terminates on an unhandled exception?

Raymond Chen

You need to get inside the coroutine.

Apr 26, 2021
Post comments count 0
Post likes count 1

C++ coroutines: What does it mean when I declare my coroutine as noexcept?

Raymond Chen

The noexcept keyword doesn't mean what you think.

Apr 23, 2021
Post comments count 0
Post likes count 1

C++ coroutines: Associating multiple task types with the same promise type

Raymond Chen

Using the special initialization rule for <CODE>get_<WBR>return_<WBR>object</CODE>.

Apr 22, 2021
Post comments count 3
Post likes count 1

C++ coroutines: Improving cold-start coroutines which complete synchronously

Raymond Chen

Avoiding stack build-up.

Apr 21, 2021
Post comments count 3
Post likes count 1

C++ coroutines: Cold-start coroutines

Raymond Chen

On your mark, get set, wait for it!

Apr 20, 2021
Post comments count 1
Post likes count 1

C++ coroutines: Getting rid of our atomic variant discriminator

Raymond Chen

Don't look unless you know it's safe.

Apr 19, 2021
Post comments count 0
Post likes count 1

C++ coroutines: Allowing the awaiter to be destroyed while suspended

Raymond Chen

We were already there.

Apr 16, 2021
Post comments count 0
Post likes count 1

C++ coroutines: Getting rid of our reference count

Raymond Chen

It never goes up. It only comes down.

Apr 15, 2021
Post comments count 0
Post likes count 1

C++ coroutines: Getting rid of our mutex

Raymond Chen

We can capture the progress in a single value.

Apr 14, 2021
Post comments count 7
Post likes count 1

Pivot points and financial numerology

Raymond Chen

It will or it won't. That's the beauty of it.

Apr 14, 2021
Post comments count 0
Post likes count 2

C++ coroutines: Making it impossible to co_await a task twice

Raymond Chen

Always keep moving: Make the <CODE>co_await</CODE> consume the task.

Apr 13, 2021
Post comments count 0
Post likes count 1

C++ coroutines: Tradeoffs of making the promise be the shared state

Raymond Chen

Are you meant to be ephemeral, or are you intended to be durable?

Apr 12, 2021
Post comments count 0
Post likes count 1

C++ coroutines: The lifetime of objects involved in the coroutine function

Raymond Chen

Follow them as they pop into existence and vanish.

Apr 9, 2021
Post comments count 1
Post likes count 1

C++ coroutines: Managing the reference count of the coroutine state

Raymond Chen

Are we done yet?

Apr 8, 2021
Post comments count 0
Post likes count 1

C++ coroutines: Awaiting the simple_task

Raymond Chen

Let me know when it's ready.

Apr 7, 2021
Post comments count 0
Post likes count 1

C++ coroutines: Accepting types via return_void and return_value

Raymond Chen

A little bit of SFINAE tweaking.

Apr 6, 2021
Post comments count 0
Post likes count 1

C++ coroutines: Building a result holder for movable types

Raymond Chen

Not that kind of movable type.

Apr 5, 2021
Post comments count 0
Post likes count 1

C++ coroutines: Making the promise itself be the shared state, the outline

Raymond Chen

Now we do it.

Apr 2, 2021
Post comments count 1
Post likes count 1

C++ coroutines: Making the promise itself be the shared state, the inspiration

Raymond Chen

Just be it.

Apr 1, 2021
Post comments count 0
Post likes count 1

C++ coroutines: What happens if an exception occurs in my return_value?

Raymond Chen

What happens if you can't save the result?

Mar 31, 2021
Post comments count 0
Post likes count 3

C++ coroutines: The initial and final suspend, and improving our return_value method

Raymond Chen

Why would you stop before you start?

Mar 30, 2021
Post comments count 3
Post likes count 1

C++ coroutines: Basic implementation of a promise type

Raymond Chen

Filling in the diagram with code.

Mar 29, 2021
Post comments count 0
Post likes count 1

C++ coroutines: The mental model for coroutine promises

Raymond Chen

We start by drawing pictures.

Mar 26, 2021
Post comments count 0
Post likes count 1

Creating a task completion source for a C++ coroutine: Failing to produce a result

Raymond Chen

Stowing an exception.

Mar 25, 2021
Post comments count 4
Post likes count 1

Creating a task completion source for a C++ coroutine: Producing nothing

Raymond Chen

Nothing is produced, but you still want to know that the production completed.

Mar 24, 2021
Post comments count 7
Post likes count 1

SEO spammers don’t really understand who they spammed

Raymond Chen

Maybe we can help you.

Mar 24, 2021
Post comments count 0
Post likes count 1

Creating a task completion source for a C++ coroutine: Producing a result with references

Raymond Chen

Carefully preserved to prevent decay.

Mar 23, 2021
Post comments count 0
Post likes count 0

The 2021/2022 Seattle Symphony subscription season at a glance

Raymond Chen

The pocket reference guide for 2021/2022.

Mar 23, 2021
Post comments count 3
Post likes count 1

Creating a task completion source for a C++ coroutine: Producing a result

Raymond Chen

Let's call it a result holder.

Mar 22, 2021
Post comments count 2
Post likes count 1

Creating other types of synchronization objects that can be used with co_await, part 10: Wait for an event to clear

Raymond Chen

Something new.

Mar 19, 2021
Post comments count 0
Post likes count 1

Creating other types of synchronization objects that can be used with co_await, part 9: The shared mutex (continued)

Raymond Chen

Fixing some problems.

Mar 18, 2021
Post comments count 0
Post likes count 1

Creating other types of synchronization objects that can be used with co_await, part 8: The shared mutex

Raymond Chen

Two different kinds of waiting and releasing.

Mar 17, 2021
Post comments count 2
Post likes count 1

Creating other types of synchronization objects that can be used with co_await, part 7: The mutex and recursive

Raymond Chen

The mutex and recursive mutex as strange beasts in the world of coroutines.

Mar 16, 2021
Post comments count 0
Post likes count 1

Creating other types of synchronization objects that can be used with co_await, part 6: The semaphore

Raymond Chen

The asynchronous semaphore.

Mar 15, 2021
Post comments count 0
Post likes count 1

Creating other types of synchronization objects that can be used with co_await, part 5: The auto-reset event

Raymond Chen

The asynchronous auto-reset event.

Mar 12, 2021
Post comments count 0
Post likes count 1

Creating other types of synchronization objects that can be used with co_await, part 4: The manual-reset event

Raymond Chen

The asynchronous manual reset event.

Mar 11, 2021
Post comments count 0
Post likes count 1

Creating other types of synchronization objects that can be used with co_await, part 3: Parallel resumption

Raymond Chen

Resuming waiting coroutines in parallel on the thread pool.

Mar 10, 2021
Post comments count 0
Post likes count 1

Creating other types of synchronization objects that can be used with co_await, part 2: The basic library

Raymond Chen

Distilling the pattern to its essence, and the building back up.

Mar 9, 2021
Post comments count 1
Post likes count 1

Creating other types of synchronization objects that can be used with co_await, part 1: The one-shot event

Raymond Chen

First a little demonstration.

Mar 8, 2021
Post comments count 5
Post likes count 1

Creating a co_await awaitable signal that can be awaited multiple times, part 6

Raymond Chen

Looking back on what we've done.

Mar 5, 2021
Post comments count 0
Post likes count 1

Creating a co_await awaitable signal that can be awaited multiple times, part 5

Raymond Chen

Discussion of what we've done so far.

Mar 4, 2021
Post comments count 3
Post likes count 1

Creating a co_await awaitable signal that can be awaited multiple times, part 4

Raymond Chen

Why allocate memory when you can have it given to you?

Mar 3, 2021
Post comments count 5
Post likes count 1

Creating a co_await awaitable signal that can be awaited multiple times, part 3

Raymond Chen

Doing it all ourselves, without any need to go into kernel mode.

Mar 2, 2021
Post comments count 0
Post likes count 1

Creating a co_await awaitable signal that can be awaited multiple times, part 2

Raymond Chen

Because sharing is caring.

Mar 1, 2021
Post comments count 0
Post likes count 1

Creating a co_await awaitable signal that can be awaited multiple times, part 1

Raymond Chen

Sort of like an event.

Feb 26, 2021
Post comments count 4
Post likes count 1

What does error E_ILLEGAL_DELEGATE_ASSIGNMENT mean?

Raymond Chen

A delegate was assigned when not allowed, but when is it allowed?

Feb 25, 2021
Post comments count 0
Post likes count 1

What does it mean when a call fails with 0x8000001F = RO_E_BLOCKED_CROSS_ASTA_CALL?

Raymond Chen

Waiting wouldn't have helped.

Feb 24, 2021
Post comments count 4
Post likes count 2

What is so special about the Application STA?

Raymond Chen

Basically, it blocks re-entrancy.

Feb 23, 2021
Post comments count 16
Post likes count 1

Why does Task Manager tell me that I have a Startup program named Program?

Raymond Chen

It's a program that didn't register itself properly.

Feb 22, 2021
Post comments count 24
Post likes count 1

French is a very fragile language, or at least it seems so from the stories I hear

Raymond Chen

The slightest variation renders it incomprehensible.

Feb 22, 2021
Post comments count 0
Post likes count 4

How do I reset my PIN complexity requirements after removing a work account from Windows 10?

Raymond Chen

You need to remove the PIN and add it back.

Feb 19, 2021
Post comments count 0
Post likes count 1

How can I prevent a Windows Runtime WebView from loading any content beyond the initial request and its redirects?

Raymond Chen

Follow the bouncing redirect.

Feb 18, 2021
Post comments count 2
Post likes count 1

How can I prevent a Windows Runtime WebView from loading any content beyond the initial request?

Raymond Chen

You can intercept every resource request.

Feb 17, 2021
Post comments count 3
Post likes count 1

How can I return custom content for specific URLs requested by a Windows Runtime WebView?

Raymond Chen

Intercepting the attempts to contact the outside world.

Feb 16, 2021
Post comments count 17
Post likes count 1

Hardware engineers solve a usability problem with the PS/2 connector, but inadvertently create a new one

Raymond Chen

What's the difference between a mouse and a keyboard?

Feb 15, 2021
Post comments count 0
Post likes count 1

The COM static store, part 6: Using C++ weak references

Raymond Chen

A quicker way to get to what you have.

Feb 12, 2021
Post comments count 0
Post likes count 1

The COM static store, part 5: Using COM weak references

Raymond Chen

Avoiding having to go through the static store at all.

Feb 11, 2021
Post comments count 0
Post likes count 1

The COM static store, part 4: Aggregating into a single object

Raymond Chen

Batch all the things you need into a single object.

Feb 10, 2021
Post comments count 5
Post likes count 1

The COM static store, part 3: Avoiding creation of an expensive temporary when setting a singleton

Raymond Chen

Don't create one unless you really need one.

Feb 9, 2021
Post comments count 8
Post likes count 1

The COM static store, part 2: Race conditions in setting a singleton

Raymond Chen

There can be only one, so don't end up with two.

Feb 8, 2021
Post comments count 4
Post likes count 1

The COM static store, part 1: Introduction

Raymond Chen

Communal storage for COM things.

Feb 5, 2021
Post comments count 1
Post likes count 2

How do I get a foothold in the neutral apartment?

Raymond Chen

You can explicit ask for its context.

Feb 4, 2021
Post comments count 3
Post likes count 1

Usage patterns for winrt::unbox_value_or

Raymond Chen

Two templates, many patterns.

Feb 3, 2021
Post comments count 0
Post likes count 1

Why is there no useful information in the RetailInfo class?

Raymond Chen

It's just marketing nonsense.

Feb 2, 2021
Post comments count 2
Post likes count 1

A metric that is consistently at 100% is probably broken

Raymond Chen

They say that you get what you measure.

Feb 1, 2021
Post comments count 3
Post likes count 1

Why am I being told my fire_and_forget coroutine is not returning a value?

Raymond Chen

Fire-and-forget coroutines don't return a value, do they?

Jan 29, 2021
Post comments count 1
Post likes count 0

Autoscrolling on drag, part 5: Adding wiggle-to-scroll to escape velocity

Raymond Chen

Reintroducing a bug that's now a feature.

Jan 28, 2021
Post comments count 1
Post likes count 0

Autoscrolling on drag, part 4: Dynamic autoscroll based on escape velocity

Raymond Chen

Get a good running start.

Jan 27, 2021
Post comments count 5
Post likes count 0

Autoscrolling on drag, part 3: Dynamic autoscroll based on mouse position

Raymond Chen

Pull the rubber band more taut.

Jan 26, 2021
Post comments count 5
Post likes count 0

Autoscrolling on drag, part 2: Why does scrolling go faster if I wiggle the mouse?

Raymond Chen

You're tickling the adjustment code outside its normal cycle.

Jan 25, 2021
Post comments count 0
Post likes count 0

Autoscrolling on drag, part 1: Basic implementation

Raymond Chen

Setting the groundwork.

Jan 22, 2021
Post comments count 3
Post likes count 1

How do I protect myself against a COM call that can hang? I’m already running the server out-of-process.

Raymond Chen

You can cancel the call, and if the server ignores you, it's left working on a canceled operation.

Jan 21, 2021
Post comments count 8
Post likes count 1

What happens to the value returned from the function passed to Queue­User­Work­Item?

Raymond Chen

Nothing. Nothing at all.

Jan 20, 2021
Post comments count 2
Post likes count 1

How do I disassociate a thread from an I/O completion port?

Raymond Chen

Escaping the trap.

Jan 19, 2021
Post comments count 8
Post likes count 1

Why did I lose 3D display mode when I upgraded to the next version of Windows 10?

Raymond Chen

It's not the Windows version that lost it. It's your display driver that lost it.

Jan 18, 2021
Post comments count 10
Post likes count 1

How can I prevent another program from showing a thumbnail preview in the taskbar?

Raymond Chen

You can't, really. It's not your window.

Jan 15, 2021
Post comments count 6
Post likes count 1

The perils of the accidental C++ conversion constructor

Raymond Chen

Single-parameter constructors are also conversions.

Jan 14, 2021
Post comments count 9
Post likes count 1

How can I write a C++ class that iterates over its base classes?

Raymond Chen

Variadic templates to the rescue.

Jan 13, 2021
Post comments count 1
Post likes count 1

The misleading MIDL error message: MIDL5023: The arguments to the parameterized interface are not valid

Raymond Chen

They aren't valid, but then again, nothing would have been.

Jan 12, 2021
Post comments count 2
Post likes count 1

Why am I receiving SHCNE_UPDATEDIR notifications that my code never generates?

Raymond Chen

You did generate them, indirectly.

Jan 11, 2021
Post comments count 4
Post likes count 1

How did I find the old Windows binaries and compilers for the processor retrospective series?

Raymond Chen

Going through old virtual boxes of stuff.

Jan 8, 2021
Post comments count 1
Post likes count 1

The case of the crash during the release of an object from an unloaded DLL during apartment rundown

Raymond Chen

The great escape from the confines of the custom COM context.

Jan 7, 2021
Post comments count 0
Post likes count 1

What happens if I give contradictory values for the stack commit and stack reserve?

Raymond Chen

The system will try to massage the values into something less unreasonable.

Jan 6, 2021
Post comments count 6
Post likes count 1

How can I tell whether my process is running as SYSTEM?

Raymond Chen

Check your token.

Jan 5, 2021
Post comments count 1
Post likes count 1

Additional helpful pseudo-handles: The process token, the thread token, and the effective token

Raymond Chen

For quick queries.

Jan 4, 2021
Post comments count 8
Post likes count 1

How can I write a program that monitors another window for a change in size or position?

Raymond Chen

Accessibility hooks come to the rescue once again.

Jan 1, 2021
Post comments count 1
Post likes count 1

I’d like an IUnknown, I know you have many, I’ll take any of them

Raymond Chen

Taking the first one is as good as any other.

Dec 31, 2020
Post comments count 3
Post likes count 1

How can I create a non-circular tab order, or some other type of custom ordering in my Win32 dialog?

Raymond Chen

Taking things into your own hands.

Dec 30, 2020
Post comments count 10
Post likes count 1

Why are the C and C++ compilers giving me error messages about int when my code doesn’t mention int?

Raymond Chen

It's a manufactured <CODE>int</CODE>.

Dec 29, 2020
Post comments count 0
Post likes count 1

What are these duplicate services whose names differ just by random characters at the end?

Raymond Chen

You get a service, and you get a service, everybody gets a service!

Dec 28, 2020
Post comments count 2
Post likes count 1

Why is the HSHELL_WINDOWDESTROYED notification raised when a window is hidden, even if it hasn’t been destroyed?

Raymond Chen

Taskbar-colored glasses.

Dec 25, 2020
Post comments count 1
Post likes count 1

How can I emulate the REG_NOTIFY_THREAD_AGNOSTIC flag on systems that don’t support it? part 5

Raymond Chen

Using the new thread pool functions.

Dec 24, 2020
Post comments count 5
Post likes count 1

How can I emulate the REG_NOTIFY_THREAD_AGNOSTIC flag on systems that don’t support it? part 4

Raymond Chen

Onward to coroutines.

Dec 23, 2020
Post comments count 2
Post likes count 1

How can I emulate the REG_NOTIFY_THREAD_AGNOSTIC flag on systems that don’t support it? part 3

Raymond Chen

Getting more asynchronous.

Dec 22, 2020
Post comments count 3
Post likes count 1

How can I emulate the REG_NOTIFY_THREAD_AGNOSTIC flag on systems that don’t support it? part 2

Raymond Chen

Asking the thread pool for help.

Dec 21, 2020
Post comments count 3
Post likes count 1

How can I emulate the REG_NOTIFY_THREAD_AGNOSTIC flag on systems that don’t support it? part 1

Raymond Chen

An exercise from long ago.

Dec 18, 2020
Post comments count 6
Post likes count 2

What should the state of a moved-from object be?

Raymond Chen

It's formally unspecified, but there may be informal expectations.

Dec 17, 2020
Post comments count 1
Post likes count 1

On the ways of finding a dispatcher for the current thread in the Windows Runtime

Raymond Chen

You have to look around, but be careful not to trip over anything.

Dec 16, 2020
Post comments count 3
Post likes count 2

Why does PF_VIRT_FIRMWARE_ENABLED return false even when virtualization is enabled in the firmware?

Raymond Chen

It may be enabled, but it's not enabled for <I>you</I>.

Dec 15, 2020
Post comments count 8
Post likes count 1

Lost Windows feature: The Horizon

Raymond Chen

Unlike the real horizon, this one is up close.

Dec 14, 2020
Post comments count 3
Post likes count 1

How do I avoid race conditions in WaitOnAddress where the wake happens before I enter the blocking state?

Raymond Chen

You're waiting on it wrong.

Dec 11, 2020
Post comments count 1
Post likes count 0

Parsing ETL traces yourself, part 3: The TraceProcessor

Raymond Chen

Getting it from the same source as the Windows Performance Analyzer.

Dec 10, 2020
Post comments count 0
Post likes count 0

Parsing ETL traces yourself, part 2: The EventLogReader

Raymond Chen

For true programmatic processing of classic ETL events.

Dec 9, 2020
Post comments count 0
Post likes count 1

Parsing ETL traces yourself, part 1: wpaexporter

Raymond Chen

A simple converter that spits out comma-separated values.

Dec 8, 2020
Post comments count 13
Post likes count 1

How did Windows open a portal to another dimension when reporting a program error?

Raymond Chen

A momentary tear in the space-time continuum.

Dec 7, 2020
Post comments count 3
Post likes count 1

Why does CreateWindowEx take the extended style parameter as its first parameter instead of its last?

Raymond Chen

It sure looks like a strange place to add a new parameter.

Dec 4, 2020
Post comments count 3
Post likes count 1

The humor hiding behind “JavaScript error: Semicolon expected”

Raymond Chen

Apparently not automatic enough.

Dec 3, 2020
Post comments count 0
Post likes count 1

Additional notes on the various patterns for passing C-style arrays across the Windows Runtime boundary

Raymond Chen

Filling in some of the implicit details.

Dec 2, 2020
Post comments count 2
Post likes count 1

How can I check whether the user has disconnected from the session?

Raymond Chen

You'll have to ask Terminal Services.

Dec 1, 2020
Post comments count 11
Post likes count 1

Did Windows ever find solutions for programs that crashed?

Raymond Chen

It did on occasion.

Nov 30, 2020
Post comments count 2
Post likes count 1

What are the requirements for the built-in Windows 10 camera-based barcode scanner?

Raymond Chen

Basically, it needs to be able to get a good picture.

Nov 27, 2020
Post comments count 7
Post likes count 1

Disk and File I/O performance with ETW traces: Miscellany

Raymond Chen

A few other columns.

Nov 26, 2020
Post comments count 3
Post likes count 1

Disk and File I/O performance with ETW traces: Why is System doing so much stuff?

Raymond Chen

The System does many things, or at least many things are blamed on it.

Nov 25, 2020
Post comments count 4
Post likes count 1

Preliminary notes on analyzing Disk and File I/O performance with ETW traces

Raymond Chen

Deciphering the numbers.

Nov 24, 2020
Post comments count 15
Post likes count 2

Why does the disk optimizer put boot files at low-numbered sectors?

Raymond Chen

Taking advantage of disk geometry.

Nov 23, 2020
Post comments count 10
Post likes count 1

Virtual desktops are an end-user window management feature, not a programmatic one

Raymond Chen

It's for users to organize their windows, not for programs to organize them.

Nov 20, 2020
Post comments count 1
Post likes count 1

How thread-safe is the Windows Runtime PropertySet object?

Raymond Chen

It's thread-safe as far as it goes, but you may want to go further.

Nov 19, 2020
Post comments count 0
Post likes count 1

Other uses for the -library flag of the C++/WinRT compiler

Raymond Chen

Injecting a little something extra.

Nov 18, 2020
Post comments count 0
Post likes count 1

On combining static libraries that implement C++/WinRT activatable objects

Raymond Chen

Separating the shared names, so you can combine them yourself.

Nov 17, 2020
Post comments count 16
Post likes count 1

One senior executive’s warning about escalating conflicts to upper management

Raymond Chen

You're not gonna like what you get.

Nov 16, 2020
Post comments count 3
Post likes count 1

Why does my command line redirection echo with an extra 1? Who’s inserting these rogue 1s everywhere?

Raymond Chen

It just came out of nowhere, or did it?

Nov 13, 2020
Post comments count 2
Post likes count 1

The history of the EncodePointer function for obfuscating pointers

Raymond Chen

Still useful, but less painful.

Nov 12, 2020
Post comments count 10
Post likes count 1

Destructing outside the lock when removing items from C++ standard containers

Raymond Chen

Managing the order of destruction.

Nov 11, 2020
Post comments count 7
Post likes count 0

My strategy for playing Settlers of Catan

Raymond Chen

It doesn't work, but I use it anyway.

Nov 11, 2020
Post comments count 6
Post likes count 1

The hidden callout: The destructor

Raymond Chen

You may not know where that's going to lead.

Nov 10, 2020
Post comments count 8
Post likes count 1

The prank cursor that resulted in an employee being fired before they even started

Raymond Chen

Don't try this at home.

Nov 9, 2020
Post comments count 0
Post likes count 1

Why aren’t my custom backgrounds, animations, and colors working, such as ApplicationViewTitleBar colors?

Raymond Chen

You're subject to user and system policy.

Nov 6, 2020
Post comments count 0
Post likes count 1

How do I save a C++/WinRT array_view as a com_array?

Raymond Chen

There's a not-entirely-obvious constructor for that.

Nov 5, 2020
Post comments count 1
Post likes count 1

What’s the point of APTTYPE_CURRENT? I mean, of course I’m current.

Raymond Chen

No matter where you go, there you are.

Nov 4, 2020
Post comments count 9
Post likes count 1

What is the format of the data in the AudioBuffer memory buffer, and how do I convert it to something else?

Raymond Chen

It's a bunch of floating point samples, in a particular order.

Nov 3, 2020
Post comments count 17
Post likes count 2

The Settings app lets me pick a custom color for my mouse pointer, how do I get in on that action?

Raymond Chen

You'll have to build a better mouse pointer.

Nov 2, 2020
Post comments count 19
Post likes count 1

How can I ask the networking stack whether the system has obtained network connectivity?

Raymond Chen

Depends what kind of connectivity you're looking for.

Oct 30, 2020
Post comments count 3
Post likes count 1

Why am I getting an access violation trying to access a method on my C++/WinRT object?

Raymond Chen

The method vanishes.

Oct 29, 2020
Post comments count 2
Post likes count 1

Do any Windows Runtime projections cache nondefault Windows Runtime interfaces?

Raymond Chen

Possibly, but I know two that definitely don't.

Oct 28, 2020
Post comments count 4
Post likes count 1

Windows Runtime objects are represented by their default interface, so choose your default interface wisely

Raymond Chen

The choice is usually obvious, but on occasion, the non-obvious choice may be better.

Oct 27, 2020
Post comments count 4
Post likes count 1

The BurgerMaster segment may have been legendary, but some legends aren’t true

Raymond Chen

Just give them a call.

Oct 26, 2020
Post comments count 7
Post likes count 1

I told the Microsoft Visual C++ compiler not to generate AVX instructions, but it did it anyway!

Raymond Chen

Well, you explicitly generate them.

Oct 23, 2020
Post comments count 7
Post likes count 1

How can I tell whether a file is on an SSD?

Raymond Chen

Putting the pieces together.

Oct 22, 2020
Post comments count 1
Post likes count 1

Taking a shortcut: You can query properties from a volume, and it will forward to the physical drive

Raymond Chen

Saving a little extra trip.

Oct 21, 2020
Post comments count 7
Post likes count 1

How do I get from a volume to the physical disk that holds it?

Raymond Chen

Another step down the hierarchy.

Oct 20, 2020
Post comments count 6
Post likes count 2

How do I get from a file path to the volume that holds it?

Raymond Chen

Walking down the topology, with a little backslash weirdness thrown in.

Oct 19, 2020
Post comments count 8
Post likes count 1

Mount points, volumes, and physical drives, oh my!

Raymond Chen

Navigating the storage topology.

Oct 16, 2020
Post comments count 3
Post likes count 1

Structured binding in C++/WinRT: The key-value pair

Raymond Chen

Taking them apart in a simpler way.

Oct 15, 2020
Post comments count 3
Post likes count 2

How to add C++ structured binding support to your own types

Raymond Chen

Joining the cool kids.

Oct 14, 2020
Post comments count 7
Post likes count 1

A brief introduction to C++ structured binding

Raymond Chen

Just learning the basics.

Oct 13, 2020
Post comments count 11
Post likes count 2

Just for fun: Retail demo user names in Windows 10

Raymond Chen

A bunch of plausible but fictitious names.

Oct 12, 2020
Post comments count 11
Post likes count 1

In 1979, some software company in Bellevue was hiring

Raymond Chen

Digging through the archives.

Oct 9, 2020
Post comments count 13
Post likes count 2

A consequence of being the first to adopt a standard is that you may end up being the only one to adopt it: The sad story of Korean jamo

Raymond Chen

To be a leader, others must follow.

Oct 8, 2020
Post comments count 2
Post likes count 1

An iterable of iterables: C# collections support covariance, but C++ collections do not

Raymond Chen

You have to say exactly what you want, which may not be exactly what you have.

Oct 7, 2020
Post comments count 3
Post likes count 1

Error C3867: non-standard syntax; use ‘&’ to create a pointer to member: What it means and how to fix it

Raymond Chen

The compiler is trying to guess what you are trying to do. It sometimes guesses wrong.

Oct 6, 2020
Post comments count 20
Post likes count 1

How to plug in your USB Type A connector correctly the first time

Raymond Chen

Mating rituals.

Oct 5, 2020
Post comments count 3
Post likes count 1

How can I bulk-revert a subdirectory of a repo to an earlier commit?

Raymond Chen

Read it into the index.

Oct 2, 2020
Post comments count 6
Post likes count 1

Little gotcha with C++/WinRT iterators: The case of the mutated temporary

Raymond Chen

You are operating on copies, not the originals.

Oct 1, 2020
Post comments count 1
Post likes count 1

Bonus operations for C++/WinRT iterators: The IIterable<T>, and C++/WinRT collections

Raymond Chen

Stepping through a collection.

Sep 30, 2020
Post comments count 0
Post likes count 1

Bonus operations for C++/WinRT iterators: The IIterator<T>

Raymond Chen

The equivalent of an input iterator.

Sep 29, 2020
Post comments count 9
Post likes count 1

How did we end up parsing Savvyday 29 Oatmeal 94 as Saturday 29 October 1994?

Raymond Chen

Unsophisticated pattern matching.

Sep 28, 2020
Post comments count 5
Post likes count 1

git commit-tree parlor tricks, Part 9: How can I bulk-revert an entire repo to an earlier commit?

Raymond Chen

Take me back to a simpler time.

Sep 25, 2020
Post comments count 0
Post likes count 1

Structured binding may be the new hotness, but we’ll always have std::tie

Raymond Chen

Sometimes the old things are what you need.

Sep 24, 2020
Post comments count 2
Post likes count 1

Inside C++/WinRT: How does C++/WinRT represent ABI types?

Raymond Chen

Hiding in the internal <CODE>impl::abi</CODE> template.

Sep 23, 2020
Post comments count 0
Post likes count 1

How to get your C++/WinRT asynchronous operations to respond more quickly to cancellation, part 3

Raymond Chen

Automatic cancellation propagation is here.

Sep 22, 2020
Post comments count 5
Post likes count 3

Why does the Disk Cleanup tool’s Windows Update Cleanup take so long and consume so much CPU?

Raymond Chen

It's doing some real work.

Sep 21, 2020
Post comments count 5
Post likes count 1

Git commit-tree parlor tricks, Part 8: I just rebased my branch, but now I realize that I should have merged

Raymond Chen

You can rewrite the tree while preserving files.

Sep 18, 2020
Post comments count 2
Post likes count 1

I get a weird error about no matching function when I try to use winrt::capture

Raymond Chen

The confusing error message strikes again.

Sep 17, 2020
Post comments count 6
Post likes count 1

The C++/WinRT “capture” function helps you interoperate with the COM ABI world

Raymond Chen

Simplifying a common COM pattern.

Sep 16, 2020
Post comments count 2
Post likes count 1

Why did I lose the ability to co_await a std::future and concurrency::task?

Raymond Chen

Early moves in a direction that didn't pan out.

Sep 15, 2020
Post comments count 22
Post likes count 2

Embarrassing product names averted: Windows Embedded POS and Windows 10 for Advanced PCs

Raymond Chen

If you see something, say something.

Sep 14, 2020
Post comments count 1
Post likes count 1

What’s up with error C4838: a WinRT type cannot be a member of a union, and how can I work around it?

Raymond Chen

A restriction left over from C++03.

Sep 11, 2020
Post comments count 6
Post likes count 1

The macros for declaring COM interfaces, revisited: C++ implementation

Raymond Chen

Now to make things concrete.

Sep 10, 2020
Post comments count 4
Post likes count 2

The macros for declaring COM interfaces, revisited: C++ version

Raymond Chen

Apparently there's this new language people are using nowadays.

Sep 9, 2020
Post comments count 3
Post likes count 2

The macros for declaring COM interfaces, revisited: C version

Raymond Chen

Following the expansion.

Sep 8, 2020
Post comments count 20
Post likes count 1

How is it possible to jam a virtual card reader?

Raymond Chen

Did you feed it a bent virtual card?

Sep 7, 2020
Post comments count 6
Post likes count 1

This is definitely rare: It happens only ten times a month

Raymond Chen

Playing the bigger fool.

Sep 7, 2020
Post comments count 1
Post likes count 1

C++/WinRT injects additional constructors into each runtime class

Raymond Chen

For dealing with the objects as the smart pointers they actually are.

Sep 4, 2020
Post comments count 3
Post likes count 1

Rough edges in the when_all coroutine, part 2: Overloaded comma operator

Raymond Chen

Shame on you.

Sep 3, 2020
Post comments count 0
Post likes count 1

Rough edges in the when_all coroutine, part 1: Empty parameter list

Raymond Chen

I've got plenty of nothing.

Sep 2, 2020
Post comments count 1
Post likes count 1

Synthesizing a when_all coroutine from pieces you already have

Raymond Chen

You just need to await on all of them.

Sep 1, 2020
Post comments count 7
Post likes count 1

More on trivial functions like CopyRect and EqualRect

Raymond Chen

Let's go code golfing.

Aug 31, 2020
Post comments count 6
Post likes count 1

Is there a code page that matches ASCII and can round trip arbitrary bytes through Unicode?

Raymond Chen

For round-tripping binary data.

Aug 28, 2020
Post comments count 0
Post likes count 1

How do I convert from the C++/WinRT projection type to the C++/WinRT implementation type?

Raymond Chen

You have to trust what's inside the box.

Aug 27, 2020
Post comments count 2
Post likes count 1

How do I convert from the C++/WinRT implementation type to the C++/WinRT projection type?

Raymond Chen

Fortunately, there's a conversion for that.

Aug 26, 2020
Post comments count 13
Post likes count 1

Why are some system functions exported as stubs instead as forwarders?

Raymond Chen

Compatibility, of course, at least for some of them.

Aug 25, 2020
Post comments count 16
Post likes count 1

That time Bill Gates went through a McDonalds drive-through with no cash

Raymond Chen

No special treatment, not even for the richest man in the world.

Aug 24, 2020
Post comments count 8
Post likes count 1

How can I get the number of processors in the system, when there are more than 64?

Raymond Chen

You can ask for the active processor count.

Aug 21, 2020
Post comments count 0
Post likes count 1

Recognizing different types of exception objects that Windows platform libraries can throw

Raymond Chen

Just a few of the more common ones.

Aug 20, 2020
Post comments count 1
Post likes count 1

Inside the Microsoft STL: The std::exception_ptr

Raymond Chen

Digging inside, for debugging purposes.

Aug 19, 2020
Post comments count 2
Post likes count 1

On using FILE_FLAG_WRITE_THROUGH and FILE_FLAG_NO_BUFFERING for memory-mapped files

Raymond Chen

You're trying to control I/O you didn't issue.

Aug 18, 2020
Post comments count 4
Post likes count 1

What are the possible Status values for Win32_ComputerSystem?

Raymond Chen

There's really only one possible status.

Aug 17, 2020
Post comments count 10
Post likes count 1

How WRL squeezes a weak reference and a reference count into a single integer

Raymond Chen

It's basically a union of a pointer and an integer.

Aug 14, 2020
Post comments count 17
Post likes count 1

The case of Explorer calling into an unloaded DLL while trying to run down a reference to it

Raymond Chen

Let's do some debugging.

Aug 13, 2020
Post comments count 2
Post likes count 1

Working around the requirement that Concurrency Runtime task results must be default-constructible and copyable

Raymond Chen

Applying tricks to avoid the pitfalls.

Aug 12, 2020
Post comments count 3
Post likes count 1

Hidden constraints on the result type in Concurrency Runtime tasks

Raymond Chen

If you are using the Concurrency Runtime to represent asynchronous activity, there are some hidden constraints on the type . If you violate these constraints, the compiler will complain, but perhaps not in an obvious way.¹ If you try to create a where does not have a public default constructor, then you get an error like And if the is not copyable, then you get something like What's going on? Let's look at the copyability first. Task results must be copyable because the task result can be consumed multiple times in multiple ways. You can multiple times, and each time returns the task result. You can...

Aug 11, 2020
Post comments count 3
Post likes count 0

Microspeak: Placemat

Raymond Chen

Everything in its place.

Aug 10, 2020
Post comments count 6
Post likes count 1

How can I tell whether the user has disabled toast notifications for my app?

Raymond Chen

The ToastNotifier settings will tell you.

Aug 7, 2020
Post comments count 1
Post likes count 1

How do I make my accelerators apply only when used in the main window and not when the user is using a modeless dialog?

Raymond Chen

Sometimes you feel like an accelerator table, sometimes you don't.

Aug 6, 2020
Post comments count 8
Post likes count 1

What was so horrible about the FORMAT_MESSAGE_ALLOCATE_BUFFER flag that the Windows Store disallowed it for so long?

Raymond Chen

Letting in the riffraff.

Aug 5, 2020
Post comments count 3
Post likes count 1

What does it mean when it says that FORMAT_MESSAGE_ALLOCATE_BUFFER can be used in Store apps starting in Windows 10?

Raymond Chen

What happens if you use it anyway?

Aug 4, 2020
Post comments count 7
Post likes count 1

How can CharUpper and CharLower guarantee that the uppercase version of a string is the same length as the lowercase version?

Raymond Chen

Does it have a special under-the-table deal with the Unicode Consortium?

Aug 3, 2020
Post comments count 12
Post likes count 1

Peeking inside the implementation of AnsiUpper and AnsiLower in Windows 1.0

Raymond Chen

Some retro-reverse-engineering and the weird micro-optimizations.

Jul 31, 2020
Post comments count 7
Post likes count 2

What does the /ALTERNATENAME linker switch do?

Raymond Chen

In case of emergency, go look for something else.

Jul 30, 2020
Post comments count 4
Post likes count 1

What’s the deal with OLDNAMES.LIB?

Raymond Chen

For backward compatibility with pre-standard C.

Jul 29, 2020
Post comments count 21
Post likes count 1

C++/WinRT gotcha: Setting properties incorrectly

Raymond Chen

A bit too much search/replace during porting.

Jul 28, 2020
Post comments count 16
Post likes count 3

A look back at memory models in 16-bit MS-DOS

Raymond Chen

Ways of dealing with the fractured address space.

Jul 27, 2020
Post comments count 3
Post likes count 1

How do I set multiple items to a Windows Runtime vector in a single call?

Raymond Chen

It depends on the language projection.

Jul 24, 2020
Post comments count 1
Post likes count 1

C++/WinRT doesn’t let your coroutine cheat death, but it does get to say good-bye

Raymond Chen

Some manual cleanup.

Jul 23, 2020
Post comments count 4
Post likes count 1

How to get your C++/WinRT asynchronous operations to respond more quickly to cancellation, part 2

Raymond Chen

You can also take more proactive steps.

Jul 22, 2020
Post comments count 4
Post likes count 1

How to get your C++/WinRT asynchronous operations to respond more quickly to cancellation, part 1

Raymond Chen

Well, one way is to poll for it.

Jul 21, 2020
Post comments count 0
Post likes count 1

Deconstructing function pointers in a C++ template, returning to enable_if

Raymond Chen

Going back to the old standby to filter out unwanted specializations.

Jul 20, 2020
Post comments count 0
Post likes count 1

Deconstructing function pointers in a C++ template, addressing the calling convention conundrum

Raymond Chen

Finding a template metaprogramming trick that works.

Jul 17, 2020
Post comments count 2
Post likes count 1

Deconstructing function pointers in a C++ template, trying to address the calling convention conundrum

Raymond Chen

Hunting for the right template metaprogramming trick.

Jul 16, 2020
Post comments count 0
Post likes count 1

Deconstructing function pointers in a C++ template, the calling convention conundrum

Raymond Chen

Teasing out the calling convention from a function pointer.

Jul 15, 2020
Post comments count 1
Post likes count 1

Deconstructing function pointers in a C++ template, vexing variadics

Raymond Chen

Yet another function signature to specialize.

Jul 14, 2020
Post comments count 4
Post likes count 2

Deconstructing function pointers in a C++ template, the noexcept complication

Raymond Chen

Trying to infer the noexcept qualifier.

Jul 13, 2020
Post comments count 4
Post likes count 3

Deconstructing function pointers in a C++ template

Raymond Chen

Learning the magic incantation.

Jul 10, 2020
Post comments count 0
Post likes count 1

Cancelling a Windows Runtime asynchronous operation, part 8: C++/WinRT, revised

Raymond Chen

Using the completion result.

Jul 9, 2020
Post comments count 0
Post likes count 1

Cancelling a Windows Runtime asynchronous operation, part 7: WRL-generated asynchronous operations

Raymond Chen

The library that came before.

Jul 8, 2020
Post comments count 3
Post likes count 1

Cancelling a Windows Runtime asynchronous operation, part 6: C++/WinRT-generated asynchronous operations

Raymond Chen

It came from inside the building.

Jul 7, 2020
Post comments count 3
Post likes count 1

Cancelling a Windows Runtime asynchronous operation, part 5: C++/WinRT

Raymond Chen

Relying on the ABI result.

Jul 6, 2020
Post comments count 1
Post likes count 1

Cancelling a Windows Runtime asynchronous operation, part 4: C++/CX with PPL, coroutine style with raw IAsyncAction and IAsyncOperation

Raymond Chen

Looks the same, but actually tastes completely different.

Jul 3, 2020
Post comments count 0
Post likes count 1

Cancelling a Windows Runtime asynchronous operation, part 3: C++/CX with PPL, coroutine style

Raymond Chen

Same wrapper, different sugar.

Jul 2, 2020
Post comments count 1
Post likes count 1

Cancelling a Windows Runtime asynchronous operation, part 2: C++/CX with PPL, explicit continuation style

Raymond Chen

Going through a different wrapper.

Jul 1, 2020
Post comments count 4
Post likes count 1

Cancelling a Windows Runtime asynchronous operation, part 1: C#

Raymond Chen

How is the cancellation reported?

Jun 30, 2020
Post comments count 5
Post likes count 1

2020 mid-year link clearance

Raymond Chen

Another midpoint.

Jun 29, 2020
Post comments count 10
Post likes count 1

Mundane std::tuple tricks: Finding a type in a tuple

Raymond Chen

Inverting <CODE>tuple_element_t</CODE>.

Jun 26, 2020
Post comments count 0
Post likes count 1

Mundane std::tuple tricks: Creating more interesting index sequences

Raymond Chen

Generalizing our manipulations so far.

Jun 25, 2020
Post comments count 0
Post likes count 2

Mundane std::tuple tricks: Creating interesting index sequences

Raymond Chen

Building our own little template language.

Jun 24, 2020
Post comments count 0
Post likes count 1

Mundane std::tuple tricks: Selecting via an index sequence, part 2

Raymond Chen

Preserving references.

Jun 23, 2020
Post comments count 3
Post likes count 1

Mundane std::tuple tricks: Selecting via an index sequence

Raymond Chen

It all comes down to the index sequence.

Jun 22, 2020
Post comments count 0
Post likes count 2

Mundane std::tuple tricks: Getting started

Raymond Chen

Concatenating tuples the hard way, and the easy way (or maybe it's the lazy way).

Jun 19, 2020
Post comments count 4
Post likes count 1

Understanding warning C4265: class has virtual functions, but destructor is not virtual, part 2

Raymond Chen

Applying what we've learned.

Jun 18, 2020
Post comments count 5
Post likes count 1

Understanding warning C4265: class has virtual functions, but destructor is not virtual, part 1

Raymond Chen

What's it trying to warn you about? Does it matter?

Jun 17, 2020
Post comments count 14
Post likes count 1

Blaming the operating system for allowing people to create files with unusual characters in their names

Raymond Chen

Four fingers pointing back at your self.

Jun 16, 2020
Post comments count 6
Post likes count 1

Excuse me, has anybody seen the FOCAL interpreter?

Raymond Chen

I thought <I>you</I> had it.

Jun 12, 2020
Post comments count 0
Post likes count 1

Using fibers to expand a thread’s stack at runtime, part 6

Raymond Chen

Caching fibers to avoid bouncing.

Jun 11, 2020
Post comments count 5
Post likes count 1

Using fibers to expand a thread’s stack at runtime, part 5

Raymond Chen

Expanding only as needed.

Jun 10, 2020
Post comments count 6
Post likes count 1

Determining approximately how much stack space is available, part 2

Raymond Chen

Probing the stack limits.

Jun 9, 2020
Post comments count 9
Post likes count 1

Determining approximately how much stack space is available, part 1

Raymond Chen

Ask for the memory and give it back right away.

Jun 8, 2020
Post comments count 0
Post likes count 1

Comparing fibers to threads for the purpose of expanding a thread’s stack at runtime

Raymond Chen

Pros and cons.

Jun 5, 2020
Post comments count 0
Post likes count 1

Using fibers to expand a thread’s stack at runtime, part 4

Raymond Chen

Moving an exception from a fiber to the main thead.

Jun 4, 2020
Post comments count 2
Post likes count 1

Using fibers to expand a thread’s stack at runtime, part 3

Raymond Chen

Propagating additional thread state.

Jun 3, 2020
Post comments count 1
Post likes count 1

Using fibers to expand a thread’s stack at runtime, part 2

Raymond Chen

Reducing code size with type erasure.

Jun 2, 2020
Post comments count 0
Post likes count 1

Using fibers to expand a thread’s stack at runtime, part 1

Raymond Chen

The simple return value.

Jun 1, 2020
Post comments count 4
Post likes count 1

How can I expand my thread’s stack at runtime?

Raymond Chen

You can use fibers, but you need to use them carefully.

May 29, 2020
Post comments count 2
Post likes count 2

Hiding C++ template parameter packs in a tuple

Raymond Chen

So you can pull them back out.

May 28, 2020
Post comments count 7
Post likes count 1

Template metaprogramming trick: Get the compiler to tell you what type you have

Raymond Chen

Let the error message tell you.

May 27, 2020
Post comments count 5
Post likes count 1

The SetClientGuid method of the common file and folder dialogs lets you give names to those dialogs, too

Raymond Chen

Sort of like Bob and Carol for Win32.

May 26, 2020
Post comments count 28
Post likes count 1

When programs assume that the system will never change, episode 1, redux

Raymond Chen

It was never yours to begin with.

May 25, 2020
Post comments count 1
Post likes count 1

The SettingsIdentifier property of the various file pickers lets you give names to your pickers

Raymond Chen

Like Bob or Carol?

May 22, 2020
Post comments count 0
Post likes count 1

On the various ways of constructing a C++/WinRT com_array

Raymond Chen

Surveying the constructors.

May 21, 2020
Post comments count 2
Post likes count 1

A noinline inline function? What sorcery is this?

Raymond Chen

Two different senses of the word inline.

May 20, 2020
Post comments count 25
Post likes count 1

The case of the SHGet­Folder­Path(CSIDL_COMMON_DOCUMENTS) that returned ERROR_PATH_NOT_FOUND

Raymond Chen

Accidentally reconfiguring the system.

May 19, 2020
Post comments count 6
Post likes count 1

How can I view my devices based on how they are connected to each other?

Raymond Chen

You can view by connection.

May 18, 2020
Post comments count 5
Post likes count 1

Reporting on what you could do once you get to the other side of the airtight hatchway

Raymond Chen

Counting all those chickens.

May 15, 2020
Post comments count 2
Post likes count 1

Storing a non-capturing lambda in a generic object

Raymond Chen

Reimplementing a small corner of <CODE>std::function</CODE>.

May 14, 2020
Post comments count 8
Post likes count 1

Inside std::function, part 2: Storage optimization

Raymond Chen

Preallocating the storage yourself.

May 13, 2020
Post comments count 3
Post likes count 2

Inside std::function, part 1: The basic idea

Raymond Chen

Holding all different kinds of things.

May 12, 2020
Post comments count 4
Post likes count 1

When you start getting in-page errors on your hard drive, it’s time to go shopping for a new hard drive, redux

Raymond Chen

The click-click-click of impending doom.

May 11, 2020
Post comments count 4
Post likes count 1

Peeking inside WRL weak references

Raymond Chen

If you ever have to debug one of these things.

May 8, 2020
Post comments count 7
Post likes count 1

The C++ preprocessor doesn’t understand anything about C++, and certainly not templates

Raymond Chen

You need to help it along.

May 7, 2020
Post comments count 5
Post likes count 1

Why does Reg­Notify­Change­Key­Value stop notifying once the key is deleted?

Raymond Chen

Because that's the last thing a key ever does.

May 6, 2020
Post comments count 14
Post likes count 1

How can I prevent the user from using Snip and Sketch to take screen shots?

Raymond Chen

Programs can already specify that their windows should not be captured.

May 5, 2020
Post comments count 1
Post likes count 1

Why did the message on the Start menu change from Start to Ship It! for one build?

Raymond Chen

A rogue expression of mixed encouragement and impatience.

May 4, 2020
Post comments count 0
Post likes count 1

Peeking inside C++/CX weak references

Raymond Chen

If you ever have to debug one of these things.

May 1, 2020
Post comments count 0
Post likes count 1

Diagnosing a hang: Everybody stuck in Win­Http­Get­Proxy­For­Url

Raymond Chen

Putting on your thinking cap.

Apr 30, 2020
Post comments count 0
Post likes count 2

COM in-process DLL unloaded while trying to clean up from the destruction of the last object

Raymond Chen

Choosing the right time to bid farewell.

Apr 29, 2020
Post comments count 6
Post likes count 1

How can I detect that the system is no longer showing a UAC prompt?

Raymond Chen

Let's try to understand the actual problem.

Apr 28, 2020
Post comments count 6
Post likes count 1

When you set Windows 10 to allow only Windows Store apps, it allows them to be installed by anyone, not just the Store app

Raymond Chen

It's about the source of the program, not the delivery mechanism.

Apr 27, 2020
Post comments count 7
Post likes count 1

The paradoxical sense of relief when instructions to solve the problem fail at the first step

Raymond Chen

Time saved.

Apr 24, 2020
Post comments count 5
Post likes count 1

How do I use C++/WinRT to implement a classic COM interface that derives from another classic COM interface?

Raymond Chen

You can specialize <CODE>guid_of</CODE>.

Apr 23, 2020
Post comments count 1
Post likes count 1

Why does the value of my XAML Slider change when I updated its range?

Raymond Chen

Releasing the spring.

Apr 22, 2020
Post comments count 0
Post likes count 2

What kind of apartment is the private apartment I created via CLSID_Context­Switcher?

Raymond Chen

It's where you are.

Apr 21, 2020
Post comments count 6
Post likes count 4

Virtual desktops are a window management feature, not a performance feature

Raymond Chen

Everything runs the same as it did before.

Apr 20, 2020
Post comments count 26
Post likes count 1

It rather involved being on the other side of this airtight hatchway: Planting files onto a custom PATH

Raymond Chen

Adding a directory to the PATH comes with obligations.

Apr 17, 2020
Post comments count 3
Post likes count 1

What will be placed in the output parameter if the function fails?

Raymond Chen

Officially, it could be anything. In practice, though, there are some constraints.

Apr 16, 2020
Post comments count 2
Post likes count 1

Why can’t you return an IAsync­Action from a coroutine that also does a co_await?

Raymond Chen

You already returned. No take-backs.

Apr 15, 2020
Post comments count 2
Post likes count 1

When I ask the GetIpAddrTable function to sort the results, how are they sorted?

Raymond Chen

Nothing particularly fancy. Just plain numerical order.

Apr 14, 2020
Post comments count 21
Post likes count 1

If one program blocks shutdown, then all programs block shutdown

Raymond Chen

We're all in this together, as far as the Blocked Shutdown Resolver is concerned.

Apr 13, 2020
Post comments count 2
Post likes count 1

The type-dependent type or value that is independent of the type

Raymond Chen

To delay the evaluation until instantiation.

Apr 10, 2020
Post comments count 0
Post likes count 1

Creating a non-agile delegate in C++/WinRT, part 5: Waiting synchronously from a thread that may already be the right thread

Raymond Chen

You might already be there.

Apr 9, 2020
Post comments count 3
Post likes count 1

Creating a non-agile delegate in C++/WinRT, part 4: Waiting synchronously from a background thread

Raymond Chen

Using things you already have.

Apr 8, 2020
Post comments count 2
Post likes count 1

Creating a non-agile delegate in C++/WinRT, part 3: The other cases and why they aren’t interesting

Raymond Chen

We handled only one case, but that's the only one worth handling.

Apr 7, 2020
Post comments count 2
Post likes count 1

Creating a non-agile delegate in C++/WinRT, part 2: The synchronous coroutine

Raymond Chen

It awaits without waiting.

Apr 6, 2020
Post comments count 2
Post likes count 1

Creating a non-agile delegate in C++/WinRT, part 1: Initial plunge

Raymond Chen

Forcing the delegate to run in a specific apartment.

Apr 3, 2020
Post comments count 10
Post likes count 1

An observation about what people used iPads for in the early days

Raymond Chen

Does everything you need, if you also bring an assistant.

Apr 2, 2020
Post comments count 1
Post likes count 1

Error compiling C++/WinRT runtime class: function does not take N arguments

Raymond Chen

You need to cover all the overloads.

Apr 1, 2020
Post comments count 9
Post likes count 1

Pulling sleight of hand tricks in a security vulnerability report, or maybe it was a prank

Raymond Chen

Something up my sleeve.

Mar 31, 2020
Post comments count 8
Post likes count 1

Why am I ignoring my second monitor? A case study in working from home.

Raymond Chen

Settling into the new routine has its rough spots.

Mar 30, 2020
Post comments count 6
Post likes count 1

A sneaky way to make sure nobody assigns test failures to your team

Raymond Chen

Buffer overflow.

Mar 27, 2020
Post comments count 8
Post likes count 1

Are Windows Runtime asynchronous operations guaranteed to complete?

Raymond Chen

As much as anything is guaranteed to complete.

Mar 26, 2020
Post comments count 1
Post likes count 1

If you say that your minimum requirements are the Universal contract, then you need to probe for anything beyond that

Raymond Chen

Reaching beyond your declaration.

Mar 25, 2020
Post comments count 6
Post likes count 1

How can I check whether a Windows Runtime object supports a member before I try to use it?

Raymond Chen

You can sniff at the metadata.

Mar 24, 2020
Post comments count 2
Post likes count 1

Accessing a member of a Windows Runtime class raises an Invalid­Cast­Exception / throws a hresult_no_interface, what does this mean?

Raymond Chen

It's interfaces under the hood.

Mar 23, 2020
Post comments count 7
Post likes count 1

Why not just share a single event across all critical section?

Raymond Chen

How will you know when the thundering herd has calmed down?

Mar 20, 2020
Post comments count 10
Post likes count 1

The security check happens at the acquisition of the handle

Raymond Chen

Once you buy a handle, it's yours to keep.

Mar 19, 2020
Post comments count 7
Post likes count 1

Further refinements to the attempt to create a type-dependent expression that is always false

Raymond Chen

It still falls down, but for stranger reasons.

Mar 18, 2020
Post comments count 8
Post likes count 1

It rather involved being on the other side of this airtight hatchway: Booting into another operating system

Raymond Chen

It's not your computer any more.

Mar 17, 2020
Post comments count 15
Post likes count 1

We called it RAID because it kills bugs dead

Raymond Chen

The history of defect tracking databases in Windows.

Mar 16, 2020
Post comments count 3
Post likes count 1

The Windows Runtime IDL compiler lets you abbreviate some interface names

Raymond Chen

But only a few of them.

Mar 13, 2020
Post comments count 0
Post likes count 1

Providing a better error message when someone tries to use std::vector<bool> as a buffer

Raymond Chen

Defer the problem further.

Mar 12, 2020
Post comments count 1
Post likes count 1

Of what use is a type-dependent expression that is always false?

Raymond Chen

Deferring an assertion to instantiation.

Mar 11, 2020
Post comments count 2
Post likes count 1

How can I create a type-dependent expression that is always false?

Raymond Chen

Use information that you know to be true (or false).

Mar 10, 2020
Post comments count 10
Post likes count 1

The sad but short story of the SM_AccessoriesName registry value

Raymond Chen

Another victim of programs that reach into undocumented sections of the registry.

Mar 9, 2020
Post comments count 13
Post likes count 1

Why does MS-DOS put an int 20h at byte 0 of the COM file program segment?

Raymond Chen

In case you end up there, but how?

Mar 6, 2020
Post comments count 6
Post likes count 1

Why do people take a lock around CreateProcess calls?

Raymond Chen

Managing your inheritance.

Mar 5, 2020
Post comments count 0
Post likes count 1

Can I wait for a kernel event to become unsignaled?

Raymond Chen

Not directly, but maybe you can simulate it.

Mar 4, 2020
Post comments count 16
Post likes count 1

Meet me here on Savvyday 29 Oatmeal 94

Raymond Chen

<CODE>Internet­Time­To­System­Time</CODE> tries really hard to make sense out of that sentence.

Mar 3, 2020
Post comments count 7
Post likes count 1

The only thing preventing them from going home was two AA batteries

Raymond Chen

I wonder where we can find them.

Mar 2, 2020
Post comments count 19
Post likes count 1

How can I detect that my window has been suppressed from the screen by the shell?

Raymond Chen

Cloak and dagger, without the dagger.

Feb 28, 2020
Post comments count 11
Post likes count 1

Should there be a standard C++ pattern for this? transform_to

Raymond Chen

Or maybe you should expect to write it out the slow way.

Feb 27, 2020
Post comments count 7
Post likes count 0

How to save a lot of money on cable car tickets in San Francisco

Raymond Chen

Go downstairs and buy it from the machine.

Feb 27, 2020
Post comments count 1
Post likes count 1

How can I configure my Windows NT service to autostart when the system gains Internet access?

Raymond Chen

You can ask to be started when the system gets an IP address.

Feb 26, 2020
Post comments count 16
Post likes count 1

What’s up with the CF_SYLK and CF_DIF clipboard formats?

Raymond Chen

From a galaxy far, far away.

Feb 25, 2020
Post comments count 13
Post likes count 1

The custom-made computers powered by pepperoni pizza

Raymond Chen

Once more for old time's sake.

Feb 24, 2020
Post comments count 3
Post likes count 0

The 2020/2021 Seattle Symphony subscription season at a glance

Raymond Chen

The pocket reference guide for 2020/2021.

Feb 24, 2020
Post comments count 13
Post likes count 1

Why are there trivial functions like Copy­Rect and Equal­Rect?

Raymond Chen

You could call them to save a dozen bytes!

Feb 21, 2020
Post comments count 2
Post likes count 1

Why you might need additional control over the secret event hiding inside the file object

Raymond Chen

Sometimes every little bit of contention means a lot.

Feb 20, 2020
Post comments count 4
Post likes count 1

If you’re not keeping the parameter, then you still want to have separate T const& and T&& overloads

Raymond Chen

Forwarding it onward.

Feb 19, 2020
Post comments count 12
Post likes count 1

If you plan on keeping the parameter anyway, then there’s no need to have separate T const& and T&& overloads

Raymond Chen

You can just take it by value and move it out.

Feb 18, 2020
Post comments count 5
Post likes count 0

Microspeak: Click stop

Raymond Chen

A place to pause and refresh.

Feb 17, 2020
Post comments count 7
Post likes count 1

Gotcha: A threadpool periodic timer will not wait for the previous tick to complete

Raymond Chen

Don't be like Lucy in the chocolate factory.

Feb 14, 2020
Post comments count 12
Post likes count 1

Quality updates: Consequences for rogue-patched binaries

Raymond Chen

You can't get back any more.

Feb 13, 2020
Post comments count 22
Post likes count 1

Survey of Windows update formats: The Quality update, which obsoletes all the others

Raymond Chen

Supports everything the others do, at a fraction of the price.

Feb 12, 2020
Post comments count 8
Post likes count 1

Survey of Windows update formats: The Express update

Raymond Chen

It's faster in some ways, slower in others.

Feb 11, 2020
Post comments count 4
Post likes count 1

Survey of Windows update formats: The Delta update

Raymond Chen

Trying to do some trimming.

Feb 10, 2020
Post comments count 5
Post likes count 1

Survey of Windows update formats: The Full update

Raymond Chen

First we need to understand where we started.

Feb 7, 2020
Post comments count 6
Post likes count 1

Psychic debugging: Why does my app sometimes fail to change the display settings?

Raymond Chen

Maybe you're in the box.

Feb 6, 2020
Post comments count 1
Post likes count 1

Why does my C++/WinRT project get errors of the form “abi<…>::… is abstract see reference to producer<…>“?

Raymond Chen

Nobody said how to produce the interface.

Feb 5, 2020
Post comments count 7
Post likes count 1

The various patterns for passing C-style arrays across the Windows Runtime ABI boundary

Raymond Chen

It's not an object, but not a scalar either.

Feb 4, 2020
Post comments count 6
Post likes count 1

The legend of the library that caused Building 4 to sink

Raymond Chen

Are the rumors true? We'll let you decide.

Feb 3, 2020
Post comments count 2
Post likes count 1

It rather involved being on the other side of this airtight hatchway: Disclosure of information you already had access to

Raymond Chen

A peek behind your own curtain.

Jan 31, 2020
Post comments count 6
Post likes count 1

The XAML hat rule: Understanding how it works and why it doesn’t

Raymond Chen

Finding the point in the parsing where the rule kicks in.

Jan 30, 2020
Post comments count 0
Post likes count 1

Why am I getting an exception from the thread pool during process shutdown?

Raymond Chen

The thread pool is already gone. You can't schedule any work on it any more.

Jan 29, 2020
Post comments count 11
Post likes count 1

Crashing in COM after I call CoUninitialize, how can COM be running after it is uninitalized?

Raymond Chen

Mind your destructors.

Jan 28, 2020
Post comments count 29
Post likes count 1

You might call it a “cross”, but I’m still going to call it an “X”

Raymond Chen

Different usage on this side of the pond.

Jan 28, 2020
Post comments count 6
Post likes count 2

How do you pronounce WinDbg?

Raymond Chen

Just a lot of hot air.

Jan 27, 2020
Post comments count 6
Post likes count 1

Is there a difference between creating a null pen with Create­Pen and just using the stock null pen?

Raymond Chen

All null pens are functionally equivalent, so why have more than one? Are some pens more null than others?

Jan 24, 2020
Post comments count 3
Post likes count 1

Peeking inside C++/CX delegates

Raymond Chen

If you ever have to debug one of these things.

Jan 23, 2020
Post comments count 4
Post likes count 1

Windows Runtime delegates and object lifetime in C++/CX, redux

Raymond Chen

If you are the one calling the delegate, you have an extra thing to worry about.

Jan 22, 2020
Post comments count 5
Post likes count 1

Not even getting to the airtight hatchway: Creating a process with a different parent

Raymond Chen

Fiddling a knob that isn't connected to anything.

Jan 21, 2020
Post comments count 3
Post likes count 1

Microspeak: Bucket bugs, bucket spray, bug spray, and failure shift

Raymond Chen

How failures in the wild get categorized by analysis.

Jan 20, 2020
Post comments count 0
Post likes count 2

Can shrinking a std::string throw an exception?

Raymond Chen

It depends on how you shrink it.

Jan 16, 2020
Post comments count 7
Post likes count 1

How can I handle both structured exceptions and C++ exceptions potentially coming from the same source?

Raymond Chen

Call for a translator.

Jan 15, 2020
Post comments count 12
Post likes count 1

Why can’t I use SHSetKnownFolderPath to change the location of FOLDERID_LocalAppData?

Raymond Chen

A acknowledgement of the reality that it not only doesn't work, but leaves the user profile corrupted.

Jan 14, 2020
Post comments count 10
Post likes count 2

The historical significance of the Burgermaster drive-in restaurant

Raymond Chen

You can just phone it in.

Jan 13, 2020
Post comments count 7
Post likes count 1

It’s not a security vulnerability that users can access files that they have access to, even if the file is a little hard to find

Raymond Chen

Perhaps it's behind a sign that says <I>Beware of the Leopard</I>.

Jan 10, 2020
Post comments count 16
Post likes count 1

Over-documenting TTM_RELAYEVENT and why it results in a one-second periodic timer running as long as the tooltip is visible

Raymond Chen

Too much information leads to trouble.

Jan 9, 2020
Post comments count 5
Post likes count 1

Tree-walking algorithms: Incrementally performing an inorder walk of a binary tree

Raymond Chen

We need to keep track of where we came from.

Jan 8, 2020
Post comments count 0
Post likes count 1

Tree-walking algorithms: Incrementally performing a postorder walk of an N-ary tree

Raymond Chen

This time, we report on the way back up.

Jan 7, 2020
Post comments count 0
Post likes count 1

Tree-walking algorithms: Incrementally performing a preorder walk of an N-ary tree

Raymond Chen

Remembering whether you were moving down or up.

Jan 6, 2020
Post comments count 4
Post likes count 1

Tree-walking algorithms: Incrementally enumerating leaf nodes of an N-ary tree

Raymond Chen

Stop to rest when you turn.

Jan 3, 2020
Post comments count 19
Post likes count 3

Anybody who writes #pragma pack(1) may as well just wear a sign on their forehead that says “I hate RISC”

Raymond Chen

Alignment as well as padding.

Jan 2, 2020
Post comments count 3
Post likes count 1

Why doesn’t RegSetKeySecurity propagate inheritable ACEs, but SetSecurityInfo does?

Raymond Chen

An artifact of the timeline.

Jan 1, 2020
Post comments count 2
Post likes count 1

Nasty gotcha: Positioning your window beneath a topmost window makes it topmost

Raymond Chen

Picking up properties unintentionally.

Dec 31, 2019
Post comments count 18
Post likes count 1

2019 year-end link clearance: The different kinds of DLL planting

Raymond Chen

And why most of them aren't security vulnerabilities.

Dec 30, 2019
Post comments count 1
Post likes count 1

How do I make a clone of a Windows Runtime vector in C++/CX?

Raymond Chen

Taking shortcuts with special constructors.

Dec 27, 2019
Post comments count 17
Post likes count 1

Controversial extension methods: CastTo<T> and As<T>

Raymond Chen

Reduction in eye exercises.

Dec 26, 2019
Post comments count 4
Post likes count 1

C++ coroutines: The problem of the DispatcherQueue task that runs too soon, part 4

Raymond Chen

You can update it a different way.

Dec 25, 2019
Post comments count 0
Post likes count 1

C++ coroutines: The problem of the DispatcherQueue task that runs too soon, part 3

Raymond Chen

The storage was right in front of your nose.

Dec 24, 2019
Post comments count 1
Post likes count 1

C++ coroutines: The problem of the DispatcherQueue task that runs too soon, part 2

Raymond Chen

Hang on a little bit longer.

Dec 23, 2019
Post comments count 4
Post likes count 1

C++ coroutines: The problem of the DispatcherQueue task that runs too soon, part 1

Raymond Chen

Variables disappearing out from under you.

Dec 20, 2019
Post comments count 3
Post likes count 1

C++ coroutines: The problem of the synchronous apartment-changing callback

Raymond Chen

Holding the caller thread hostage.

Dec 19, 2019
Post comments count 4
Post likes count 1

C++ coroutines: The co_await operator and the function search algorithm

Raymond Chen

At the confluence of multiple C++ features.

Dec 18, 2019
Post comments count 1
Post likes count 1

C++ coroutines: Defining the co_await operator

Raymond Chen

Converting an awaitable into an awaiter.

Dec 17, 2019
Post comments count 0
Post likes count 1

C++ coroutines: no callable ‘await_resume’ function found for type

Raymond Chen

The thing you want isn't there.

Dec 16, 2019
Post comments count 2
Post likes count 1

C++ coroutines: Short-circuiting suspension, part 2

Raymond Chen

Avoiding suspension entirely.

Dec 13, 2019
Post comments count 1
Post likes count 1

C++ coroutines: Short-circuiting suspension, part 1

Raymond Chen

Avoiding needless stack buildup.

Dec 12, 2019
Post comments count 4
Post likes count 1

C++ coroutines: Awaiting an IAsyncAction without preserving thread context

Raymond Chen

Another use for a custom awaiter.

Dec 11, 2019
Post comments count 1
Post likes count 1

C++ coroutines: Framework interop

Raymond Chen

Plays well with others.

Dec 10, 2019
Post comments count 1
Post likes count 1

C++ coroutines: Constructible awaitable or function returning awaitable?

Raymond Chen

Two common patterns for simple awaitable objects.

Dec 9, 2019
Post comments count 3
Post likes count 2

C++ coroutines: Getting started with awaitable objects

Raymond Chen

Starting our walk-around.

Dec 6, 2019
Post comments count 4
Post likes count 1

In C++/WinRT, what happens when I treat an IInspectable as or convert one to a bool

Raymond Chen

Much less weird than C++/CX.

Dec 5, 2019
Post comments count 4
Post likes count 1

In C++/CX, hat pointers are contextually convertible to bool, but you can’t always static_cast them to bool

Raymond Chen

Because C++/CX is weird like that.

Dec 4, 2019
Post comments count 7
Post likes count 1

Not actually crossing the airtight hatchway: Harmless out-of-bounds read that is never disclosed

Raymond Chen

There's no way to make anything bad happen, so is anything bad actually happening?

Dec 3, 2019
Post comments count 6
Post likes count 1

The automotive emergency kit is not a toy

Raymond Chen

Please use it only for emergencies.

Dec 2, 2019
Post comments count 2
Post likes count 1

When should I use delayed-marshaling when creating an agile reference?

Raymond Chen

It's a balance between doing more work now in anticipation of saving work later.

Nov 29, 2019
Post comments count 5
Post likes count 0

My summer vacation: The Tower of London and Kensington Palace

Raymond Chen

Doing the admissions price math.

Nov 29, 2019
Post comments count 0
Post likes count 2

Using contexts to return to a COM apartment later

Raymond Chen

You can go back home again.

Nov 28, 2019
Post comments count 0
Post likes count 2

How do you get into a context via IContext­Callback::Context­Callback?

Raymond Chen

Piggybacking on the internal infrastructure.

Nov 27, 2019
Post comments count 0
Post likes count 2

Setting up private COM contexts to allow yourself to unload cleanly

Raymond Chen

Your private little enclave.

Nov 26, 2019
Post comments count 8
Post likes count 2

Yo dawg, I hear you like COM apartments, so I put a COM apartment in your COM apartment so you can COM apartment while you COM apartment

Raymond Chen

Or maybe this is subletting? Airbnb for COM apartments?

Nov 25, 2019
Post comments count 11
Post likes count 3

A slightly less brief introduction to COM apartments (but it’s still brief)

Raymond Chen

Managing the multithreading.

Nov 22, 2019
Post comments count 12
Post likes count 0

My summer vacation: Speaking German (wait, what?)

Raymond Chen

But you went to England and France.

Nov 22, 2019
Post comments count 0
Post likes count 2

How do I make a clone of a Windows Runtime vector in C++/WinRT?

Raymond Chen

You copy it into your own vector, but make sure you copy what you think you're copying.

Nov 21, 2019
Post comments count 3
Post likes count 0

Why does the Alpha AXP predict a coroutine transfer the way it does?

Raymond Chen

Working out the possibilities.

Nov 20, 2019
Post comments count 1
Post likes count 1

The case of the Uuid­Create­Sequential that didn’t use the MAC address

Raymond Chen

If you want to use it, make sure it's good.

Nov 19, 2019
Post comments count 8
Post likes count 1

The Magical Excel 97 Far East Language Build Screwdriver™

Raymond Chen

For your magical build needs.

Nov 18, 2019
Post comments count 10
Post likes count 1

I set the same ACL with the GUI and with icacls, yet the results are different

Raymond Chen

Sometimes your tools lie to you.

Nov 15, 2019
Post comments count 9
Post likes count 0

My summer vacation: The London Eye

Raymond Chen

Round and round. We'll, really just round. No "and round".

Nov 15, 2019
Post comments count 2
Post likes count 1

Why does my single-threaded program have multiple threads?

Raymond Chen

They're not your threads, but they're in your process.

Nov 14, 2019
Post comments count 2
Post likes count 1

Can the MTA thread exit while keeping its COM class registrations alive?

Raymond Chen

You can keep the MTA alive without having to dedicate a thread.

Nov 13, 2019
Post comments count 21
Post likes count 1

Not even getting to the airtight hatchway: Planting files in world-writable directories

Raymond Chen

But who uses that world-writable directory?

Nov 12, 2019
Post comments count 12
Post likes count 1

How can I copy or move a group of files into a new folder from Explorer?

Raymond Chen

Putting together things you already have.

Nov 11, 2019
Post comments count 7
Post likes count 1

The curious pattern of pre-emptively rejecting the solution to your problem: Redrawing during resizing

Raymond Chen

You'll have to invalidate it, either the easy way or the hard way.

Nov 8, 2019
Post comments count 6
Post likes count 1

Can I force a WM_TIMER message to be generated when the timer comes due, even if the message queue is not idle?

Raymond Chen

You can ask for it explicitly.

Nov 7, 2019
Post comments count 9
Post likes count 1

How can I give a C++ lambda expression more than one operator()?

Raymond Chen

Wacky template games.

Nov 6, 2019
Post comments count 10
Post likes count 1

How can I have a C++ function that returns different types depending on what the caller wants?

Raymond Chen

Quantum superposition comes to C++.

Nov 5, 2019
Post comments count 4
Post likes count 1

The legend of Steve Ballmer’s rental car, the most diligent employee in the world

Raymond Chen

What a hardworking new employee that must be.

Nov 4, 2019
Post comments count 28
Post likes count 2

I tried to adjust the time on my alarm clock. I failed.

Raymond Chen

Now it's not even wrong twice a day.

Nov 4, 2019
Post comments count 15
Post likes count 1

What happened if you tried to access a network file bigger than 2GB from MS-DOS?

Raymond Chen

What a strange world you live in.

Nov 1, 2019
Post comments count 9
Post likes count 1

Why does my program crash if I terminate a thread that is waiting to enter a critical section? It never got the critical section, so who cares?

Raymond Chen

But we care that it's still waiting.

Oct 31, 2019
Post comments count 2
Post likes count 1

For one internal build, Windows 95 contained an evil message

Raymond Chen

Another prank from the user interface team.

Oct 30, 2019
Post comments count 12
Post likes count 1

The program “G” is preventing you from shutting down

Raymond Chen

Minding your character set.

Oct 29, 2019
Post comments count 6
Post likes count 1

If you suppress GDI+ background thread, then you are expected to pump messages yourself

Raymond Chen

That stuff is now happening on your thread.

Oct 28, 2019
Post comments count 5
Post likes count 0

Did you hear that story about Bill Gates?: A PR person’s view

Raymond Chen

They've heard them all.

Oct 25, 2019
Post comments count 0
Post likes count 1

Why does Format­Message say that %0 terminates the message without a trailing newline? Is it secretly adding newlines?

Raymond Chen

Well, it's not <CODE>Format­Message</CODE> that's adding the newline.

Oct 24, 2019
Post comments count 3
Post likes count 2

If you want to terminate on an unexpected exception, then don’t sniff at every exception; just let the process terminate

Raymond Chen

Get the stack before it unwinds.

Oct 23, 2019
Post comments count 5
Post likes count 1

Why can’t I create a “Please wait” dialog from a background thread to inform the user that the main UI thread is busy?

Raymond Chen

Reversal of fortune.

Oct 22, 2019
Post comments count 5
Post likes count 1

What’s the difference between the hotkeys F6 and Alt+F6?

Raymond Chen

Switching between things, but different things.

Oct 21, 2019
Post comments count 1
Post likes count 1

When I tell the file or folder picker that I want only file system files and folders, why does it still show virtual folders?

Raymond Chen

Because there might be a file hiding under it.

Oct 18, 2019
Post comments count 0
Post likes count 1

C++/WinRT implementation extension points: abi_guard, abi_enter, abi_exit, and final_release

Raymond Chen

Coming in, going out, and going away.

Oct 17, 2019
Post comments count 0
Post likes count 0

By Grabthar’s Hammer, it’s a Galaxy Quest documentary

Raymond Chen

The seventh best Star Trek movie.

Oct 17, 2019
Post comments count 6
Post likes count 1

How can I make a call into an elevated service without requiring an elevation prompt?

Raymond Chen

This is actually quite old technology.

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

Why do I get a winrt::hresult_no_interface exception when I try to register an auto-revoke event handler?

Raymond Chen

The necessary infrastructure isn't there.

Oct 15, 2019
Post comments count 5
Post likes count 1

How should I create controls on my dialog box that has a tab control?

Raymond Chen

They are siblings of the tab control, not children.

Oct 14, 2019
Post comments count 4
Post likes count 0

Rugby: The rules for the casual viewer

Raymond Chen

What you need to know as an observer.

Oct 14, 2019
Post comments count 18
Post likes count 2

A common mistake when you try to create a C++ class that wraps a window procedure: Saving the window handle too late

Raymond Chen

You need it before then.

Oct 11, 2019
Post comments count 13
Post likes count 1

Fibers aren’t useful for much any more; there’s just one corner of it that remains useful for a reason unrelated to fibers

Raymond Chen

A better way to clean up.

Oct 10, 2019
Post comments count 15
Post likes count 0

My summer vacation: London public transportation

Raymond Chen

It's easy until you try to leave town.

Oct 10, 2019
Post comments count 5
Post likes count 1

Why are timer IDs and dialog control IDs 64-bit values on 64-bit Windows? Did you really expect people to create more than 4 billion timers or dialog controls?

Raymond Chen

Anywhere it's possible to put a pointer, somebody will try to put a pointer.

Oct 9, 2019
Post comments count 3
Post likes count 1

Kabaddi: The rules for the casual viewer

Raymond Chen

What you need to know as an observer.

Oct 9, 2019
Post comments count 6
Post likes count 1

A window can’t have two timers with the same ID, so how do I assign an ID that nobody else is using?

Raymond Chen

A pointer can be used like an ID.

Oct 8, 2019
Post comments count 3
Post likes count 0

Auctioning off the privilege of initiating the destruction of the Microsoft old campus

Raymond Chen

Emerging victorious in the bidding war.

Oct 7, 2019
Post comments count 9
Post likes count 1

Why does my string consist of this Korean character repeated over and over?

Raymond Chen

Decode that character to its code point.

Oct 4, 2019
Post comments count 3
Post likes count 0

My summer vacation: The Changing of the Guard at Buckingham Palace

Raymond Chen

Pomp and circumstance.

Oct 4, 2019
Post comments count 5
Post likes count 1

How do I define a UWP XAML dependency property that is a collection type?

Raymond Chen

Putting previous guidance into practice.

Oct 3, 2019
Post comments count 3
Post likes count 0

Odd things you find when you read the airplane safety information card

Raymond Chen

Will it float?

Oct 3, 2019
Post comments count 1
Post likes count 2

What if I want the default value for a XAML dependency property to be a mutable object?

Raymond Chen

Give it one, but save it for real.

Oct 2, 2019
Post comments count 6
Post likes count 0

My summer vacation: Watching a German movie on the plane and learning some language history

Raymond Chen

Trying to keep that part of my brain from disappearing.

Oct 2, 2019
Post comments count 2
Post likes count 2

The default value for a XAML dependency property should be immutable

Raymond Chen

Spooky action at a distance.

Oct 1, 2019
Post comments count 14
Post likes count 1

Reminiscences on 5.25″ floppy drives of the early 1980’s

Raymond Chen

Because you may have forgotten, or perhaps never knew.

Sep 30, 2019
Post comments count 2
Post likes count 1

Where did DirectX code names come from?

Raymond Chen

From too much pizza.

Sep 27, 2019
Post comments count 2
Post likes count 0

My summer vacation: Paris public transportation

Raymond Chen

Getting around is easy. Paying for it is hard.

Sep 27, 2019
Post comments count 3
Post likes count 1

Why does the compiler refuse to let me export my class? If I don’t export it, then the class works fine.

Raymond Chen

You forced the compiler to try to compile it.

Sep 26, 2019
Post comments count 1
Post likes count 0

My summer vacation: Versailles

Raymond Chen

Ostentation fatigue is a real thing.

Sep 26, 2019
Post comments count 6
Post likes count 1

Why does std::is_copy_constructible report that a vector of move-only objects is copy constructible?

Raymond Chen

Because it has a copy constructor, says so on the tin, even though the constructor itself doesn't compile.

Sep 25, 2019
Post comments count 6
Post likes count 0

My summer vacation: The Louvre Museum

Raymond Chen

Don't waste your time queueing to see the Mona Lisa.

Sep 25, 2019
Post comments count 1
Post likes count 1

How do I create a Windows Runtime method that accepts a lambda?

Raymond Chen

You can use a delegate as a generalized lambda.

Sep 24, 2019
Post comments count 11
Post likes count 1

How did MS-DOS decide that two seconds was the amount of time to keep the floppy disk cache valid?

Raymond Chen

A stopwatch and a race against time.

Sep 23, 2019
Post comments count 1
Post likes count 1

Stop cherry-picking, start merging, Part 11: Chasing the commit by taking a train

Raymond Chen

Let the train carry you.

Sep 20, 2019
Post comments count 6
Post likes count 1

Why perform all these complex git machinations when you can just tweak the command line to get what you want?

Raymond Chen

Who controls the command line?

Sep 19, 2019
Post comments count 4
Post likes count 3

How to duplicate a file while preserving git line history

Raymond Chen

Synthesize it in a branch via a rename.

Sep 18, 2019
Post comments count 1
Post likes count 1

How to split out pieces of a file while preserving git line history: The easy way with misleading commits

Raymond Chen

Anticipating the octopus.

Sep 17, 2019
Post comments count 5
Post likes count 1

How to split out pieces of a file while preserving git line history: The hard way with commit-tree

Raymond Chen

More commit-tree tricks.

Sep 16, 2019
Post comments count 8
Post likes count 2

How do I split a file into two while preserving git line history?

Raymond Chen

The octopus delivers.

Sep 13, 2019
Post comments count 7
Post likes count 0

My summer vacation: The Eiffel Tower

Raymond Chen

It's really tall, for one.

Sep 13, 2019
Post comments count 11
Post likes count 2

Another way to sort GUIDs: Java

Raymond Chen

Because it's Java.

Sep 12, 2019
Post comments count 6
Post likes count 1

The Turkish lira’s currency code is an unexpected source of problems with computer programmers

Raymond Chen

Following the rules for currency codes leads to a collision with popular macro.

Sep 11, 2019
Post comments count 3
Post likes count 1

The sad history of the MFC TRY/CATCH macros

Raymond Chen

Because standard C++ exception handling didn't exist yet.

Sep 10, 2019
Post comments count 4
Post likes count 1

Trying to wrangle a site visit to Paul Allen’s superyacht “Octopus”

Raymond Chen

An unsuccessful play for a site visit.

Sep 9, 2019
Post comments count 15
Post likes count 1

PowerShell programming puzzle: Convert snake_case to PascalCase in one line

Raymond Chen

Abusing linguistic helper functions for fun.

Sep 6, 2019
Post comments count 1
Post likes count 1

It rather involved being on the other side of this airtight hatchway: Guessing window procedure magic cookies

Raymond Chen

You created a very funny-looking function pointer.

Sep 5, 2019
Post comments count 0
Post likes count 1

Making the COM_INTERFACE_ENTRY macro better at detecting misuse

Raymond Chen

Playing around with compile-time errors.

Sep 4, 2019
Post comments count 2
Post likes count 1

The COM_INTERFACE_ENTRY must be a COM interface, but nobody actually checks

Raymond Chen

And if it isn't, bad things happen.

Sep 3, 2019
Post comments count 15
Post likes count 1

Any sufficiently advanced technology is indistinguishable from a bomb

Raymond Chen

Even though it doesn't tick. Do bombs even tick?

Sep 2, 2019
Post comments count 3
Post likes count 0

Silly Alexa trick: Speaking French with a horrible American accent

Raymond Chen

Asking for a repeat, but in a different speech synthesizer.

Sep 2, 2019
Post comments count 3
Post likes count 1

If FlushInstructionCache doesn’t do anything, why do you have to call it, revisited

Raymond Chen

The elixir of forgetfulness.

Aug 30, 2019
Post comments count 17
Post likes count 3

The sad history of Unicode printf-style format specifiers in Visual C++

Raymond Chen

Getting ahead of the standard, which went a different way.

Aug 29, 2019
Post comments count 38
Post likes count 1

What to do if you can’t get the stovetop in your London apartment to turn on

Raymond Chen

Look for an apparently-useless switch.

Aug 29, 2019
Post comments count 2
Post likes count 1

On resolving the type vs member conflict in C++, revisited

Raymond Chen

Filling in some gaps in the previous discussion.

Aug 28, 2019
Post comments count 4
Post likes count 2

The sad history of Visual Studio’s custom __if_exists keyword

Raymond Chen

When times were simpler and bytes were precious.

Aug 27, 2019
Post comments count 16
Post likes count 2

One byte used to cost a dollar

Raymond Chen

The cost of software distribution.

Aug 26, 2019
Post comments count 5
Post likes count 1

Custom-printing your own attendee pass to the Windows 95 launch

Raymond Chen

Only the highest quality forgeries will do.

Aug 23, 2019
Post comments count 2
Post likes count 0

The SuperH-3, part 15: Code walkthough

Raymond Chen

Taking this thing for a spin.

Aug 22, 2019
Post comments count 2
Post likes count 0

The SuperH-3, part 14: Patterns for function calls

Raymond Chen

Different ways of setting up a function call.

Aug 21, 2019
Post comments count 0
Post likes count 0

The SuperH-3, part 13: Misaligned data, and converting between signed vs unsigned values

Raymond Chen

Okay, now we're doing some programming.

Aug 20, 2019
Post comments count 0
Post likes count 0

The SuperH-3, part 12: Calling convention and function prologues/epilogues

Raymond Chen

A typical RISC pattern.

Aug 19, 2019
Post comments count 1
Post likes count 0

The SuperH-3, part 11: Atomic operations

Raymond Chen

How do you create an atomic operation when the processor doesn't support them?

Aug 16, 2019
Post comments count 8
Post likes count 0

The SuperH-3, part 10: Control transfer

Raymond Chen

The return of the branch delay slot.

Aug 15, 2019
Post comments count 5
Post likes count 0

Why is there a huge spike in cruise ship width at 32 meters?

Raymond Chen

Squeezing through tight spaces.

Aug 15, 2019
Post comments count 0
Post likes count 0

The SuperH-3, part 9: Constants

Raymond Chen

Squeezing constants into a tiny instruction.

Aug 14, 2019
Post comments count 2
Post likes count 0

The SuperH-3, part 8: Bit shifting

Raymond Chen

Sliding left and right.

Aug 13, 2019
Post comments count 2
Post likes count 0

The SuperH-3, part 7: Bitwise logical operations

Raymond Chen

Just the basic operations, not much fancy.

Aug 12, 2019
Post comments count 4
Post likes count 0

The SuperH-3, part 6: Division

Raymond Chen

And you thought multiplication was complicated.

Aug 9, 2019
Post comments count 0
Post likes count 0

The SuperH-3, part 5: Multiplication

Raymond Chen

Now things get more complicated.

Aug 8, 2019
Post comments count 6
Post likes count 0

The SuperH-3, part 4: Basic arithmetic

Raymond Chen

Basic elementary-school stuff.

Aug 7, 2019
Post comments count 4
Post likes count 0

How do I fill out the Canadian eTA if I have a green card with no expiration date?

Raymond Chen

Use your passport expiration date.

Aug 7, 2019
Post comments count 0
Post likes count 0

The SuperH-3, part 3: Status flags and miscellaneous instructions

Raymond Chen

Basically, there's only one flag.

Aug 6, 2019
Post comments count 4
Post likes count 0

The SuperH-3, part 2: Addressing modes

Raymond Chen

Quite a lot for a RISC.

Aug 5, 2019
Post comments count 8
Post likes count 0

The SuperH-3, part 1: Introduction

Raymond Chen

Digging into the dusty boxes in the closet.

Aug 2, 2019
Post comments count 1
Post likes count 1

How can I extract the color from a solid color GDI brush?

Raymond Chen

You can ask for the object information.

Aug 1, 2019
Post comments count 7
Post likes count 1

Not actually crossing the airtight hatchway: Applying per-user overrides

Raymond Chen

The user is merely attacking himself.

Jul 31, 2019
Post comments count 0
Post likes count 1

What about USERSEEUSERDO and GDISEEGDIDO?

Raymond Chen

Funny names for funny functions.

Jul 30, 2019
Post comments count 9
Post likes count 1

Why doesn’t the Programs and Features control panel show Last Used On information?

Raymond Chen

The system doesn't try to figure it out any more, because it was always a guess, and often a really bad one.

Jul 29, 2019
Post comments count 1
Post likes count 1

Is it a good idea to let WriteProcessMemory manage the page protection for me?

Raymond Chen

It's a courtesy, not a contractual obligation.

Jul 26, 2019
Post comments count 9
Post likes count 1

When it absolutely, positively has to be there for the product demo overnight

Raymond Chen

We can make up the time in the air.

Jul 25, 2019
Post comments count 8
Post likes count 1

Why do pinned apps sometimes go to the end of the taskbar, rather than going into the “pinned apps” section of the taskbar?

Raymond Chen

That's not really a "pinned apps" section. It just looks like one.

Jul 24, 2019
Post comments count 9
Post likes count 1

Adventures in application compatibility: Calling an internal function

Raymond Chen

Clearly wandering into unsupported implementation details.

Jul 23, 2019
Post comments count 9
Post likes count 2

How can I log users off after a period of inactivity, rather than merely locking the workstation? Is there a “logoff” screen saver?

Raymond Chen

Putting together some building blocks.

Jul 22, 2019
Post comments count 13
Post likes count 2

What was the code name for Windows 7?

Raymond Chen

Windows 7.

Jul 19, 2019
Post comments count 3
Post likes count 1

Providing a small amount of additional control over what happens when an asynchronous I/O completes synchronously

Raymond Chen

An option named with kernel-colored glasses.

Jul 18, 2019
Post comments count 3
Post likes count 1

Brännboll: The rules for the casual viewer

Raymond Chen

The minimum you need to know.

Jul 18, 2019
Post comments count 8
Post likes count 1

After I made my DLL delay-load another DLL, my DLL has started crashing in its process detach code

Raymond Chen

You started without it. You should be able to finish without it.

Jul 17, 2019
Post comments count 0
Post likes count 0

Apollo 11 in real time: Follow the lunar landing mission as it happened

Raymond Chen

A fifty-year-old replay.

Jul 17, 2019
Post comments count 5
Post likes count 1

Windows NT services are assigned a SID based on an SHA-1 hash, but what about the risk of collision?

Raymond Chen

Those collisions are going to be hard to manufacture.

Jul 16, 2019
Post comments count 2
Post likes count 1

That time Dana Carvey went off script at the Microsoft Company Meeting

Raymond Chen

Timing is important in investing as well as comedy.

Jul 15, 2019
Post comments count 7
Post likes count 0

Cricket: The practical exam for 2019

Raymond Chen

How much did you understand the rules?

Jul 15, 2019
Post comments count 2
Post likes count 1

My initial confusion when encountering functions whose names begin with Co

Raymond Chen

We aren't in the math department any more.

Jul 12, 2019
Post comments count 12
Post likes count 1

Detecting in C++ whether a type is defined, part 5: Augmenting the basic pattern

Raymond Chen

Making things more convenient for specific scenarios.

Jul 11, 2019
Post comments count 6
Post likes count 0

Pesäpallo: The rules for the casual viewer

Raymond Chen

I wonder how much of this I got right.

Jul 11, 2019
Post comments count 2
Post likes count 1

Detecting in C++ whether a type is defined, part 4: Predeclaring things you want to probe

Raymond Chen

Declaring the thing whose definition you are looking for.

Jul 10, 2019
Post comments count 0
Post likes count 2

Detecting in C++ whether a type is defined, part 3: SFINAE and incomplete types

Raymond Chen

You can give something a name without saying what it is.

Jul 9, 2019
Post comments count 4
Post likes count 1

Detecting in C++ whether a type is defined, part 2: Giving it a special name

Raymond Chen

Maybe it's the real thing, makybe it's a fake.

Jul 8, 2019
Post comments count 0
Post likes count 0

A difference between cricket and baseball that most people don’t mention

Raymond Chen

The pitch invasion.

Jul 8, 2019
Post comments count 3
Post likes count 2

Detecting in C++ whether a type is defined, part 1: The initial plunge

Raymond Chen

Let's play games with unqualified name lookup.

Jul 5, 2019
Post comments count 4
Post likes count 1

I set the OFN_NONETWORKBUTTON option in the OPENFILENAME structure, but it has no effect on the network item in the navigation pane

Raymond Chen

But hey, at least it's not a button.

Jul 4, 2019
Post comments count 12
Post likes count 0

Baseball: The rules for the casual viewer

Raymond Chen

The minimum you need to know.

Jul 4, 2019
Post comments count 7
Post likes count 2

Generating good error messages from code analysis tools is harder than it looks

Raymond Chen

Describing the problem accurately, with enough diagnostics to chase the problem

Jul 2, 2019
Post comments count 10
Post likes count 0

Cricket: The rules for the casual viewer

Raymond Chen

The minimum you need to know.

Jul 2, 2019
Post comments count 3
Post likes count 1

Microspeak: Ingestion

Raymond Chen

Let's hope it goes down easily.

Jul 1, 2019
Post comments count 6
Post likes count 1

A program to detect mojibake that results from a UTF-8-encoded file being misinterpreted as code page 1252

Raymond Chen

Because it happens.

Jun 28, 2019
Post comments count 2
Post likes count 1

2019 mid-year link clearance

Raymond Chen

Another checkpoint reached.

Jun 27, 2019
Post comments count 17
Post likes count 1

Why does the Get­Version function report the major version in the low-order byte, and the minor version in the high-order byte?

Raymond Chen

It seemed like a good idea at the time.

Jun 26, 2019
Post comments count 8
Post likes count 1

Why does Windows list my SSD system drive as removable?

Raymond Chen

Because the driver said it was removable.

Jun 25, 2019
Post comments count 16
Post likes count 1

Why was Windows for Workgroups pejoratively nicknamed Windows for Warehouses?

Raymond Chen

That's where most of the copies ended up, at least at first.

Jun 24, 2019
Post comments count 0
Post likes count 1

Detecting whether the -opt flag was passed to cppwinrt.exe: Using __has_include

Raymond Chen

Looking in the cushions of the couch.

Jun 21, 2019
Post comments count 3
Post likes count 1

The 2019 Microsoft Giving Campaign Run/Walk comes with some ground rules

Raymond Chen

Each rule has a story.

Jun 20, 2019
Post comments count 3
Post likes count 1

Getting a value from a std::variant that matches the type fetched from another variant

Raymond Chen

A bunch of type fiddling, but you'll get there eventually.

Jun 19, 2019
Post comments count 7
Post likes count 2

How do I write a function that accepts any type of standard container?

Raymond Chen

There's the standard way, and then there's the generous way.

Jun 18, 2019
Post comments count 0
Post likes count 3

What is WofCompressedData? Does WOF mean that Windows is a dog?

Raymond Chen

It stands for Windows Overlay Filter, but that name doesn't really tell you much.

Jun 17, 2019
Post comments count 6
Post likes count 1

A simple workaround for the fact that std::equal takes its predicate by value

Raymond Chen

Pass something else that is easy to copy.

Jun 14, 2019
Post comments count 4
Post likes count 1

Why does SetFocus fail without telling me why?

Raymond Chen

If you're going to replace part of the operating system, you have to replace the side effects, too.

Jun 13, 2019
Post comments count 3
Post likes count 1

What should you do if somebody passes a null pointer for a parameter that should never be null? What if it’s a Windows Runtime class?

Raymond Chen

They messed up, so make them suffer the consequences, but make the consequences diagnosable.

Jun 12, 2019
Post comments count 11
Post likes count 1

If you can use GUIDs to reference files, why not use them to remember “recently used” files so they can survive renames and moves?

Raymond Chen

Because the file that you think is the same file may not actually be the same file.

Jun 11, 2019
Post comments count 7
Post likes count 1

What order do the items in the “New” menu appear? It looks kind of random.

Raymond Chen

It's alphabetical order, but not in the obvious way.

Jun 10, 2019
Post comments count 3
Post likes count 1

How can I determine in a C++ header file whether C++/CX is enabled? How about C++/WinRT?

Raymond Chen

For conditionally enabling features, say.

Jun 7, 2019
Post comments count 10
Post likes count 2

The Resource Compiler defaults to CP_ACP, even in the face of subtle hints that the file is UTF-8

Raymond Chen

Subtlety is not its strong point.

Jun 6, 2019
Post comments count 0
Post likes count 1

Why does my C++/WinRT project get errors of the form "Unresolved external symbol void* __cdecl winrt_make_YourNamespace_YourClass(void)"?

Raymond Chen

You enabled optimizations, but there's some extra bookkeeping to support those optimizations.

Jun 5, 2019
Post comments count 1
Post likes count 1

Why does my C++/WinRT project get errors of the form ‘winrt::impl::produce<D, I>‘: cannot instantiate abstract class, missing method GetBindingConnector

Raymond Chen

The header file requirement was always present, but you often got away with omitting it. Not so much any more.

Jun 4, 2019
Post comments count 8
Post likes count 1

In the file copy conflict dialog, what happened to the option to copy the new file with a numeric suffix?

Raymond Chen

It's still there, but you have to dig a little deeper for it.

Jun 3, 2019
Post comments count 7
Post likes count 2

A bug so cool that the development team was reluctant to fix it

Raymond Chen

A nice parlor trick, if you had the memory for it.

May 31, 2019
Post comments count 2
Post likes count 1

I called AdjustTokenPrivileges, but I was still told that a necessary privilege was not held

Raymond Chen

Which token did you adjust?

May 30, 2019
Post comments count 5
Post likes count 3

Why does my C++/WinRT project get errors of the form “consume_Something: function that returns ‘auto’ cannot be used before it is defined”?

Raymond Chen

Narrowing down the source of the missing header file.

May 29, 2019
Post comments count 5
Post likes count 1

Why does my C++/WinRT project get errors of the form “unresolved external symbol … consume_Something”?

Raymond Chen

Declared but not defined, but what exactly wasn't defined?

May 28, 2019
Post comments count 16
Post likes count 1

In times of uncertainty, take your cue from the janitor

Raymond Chen

He's been there before.

May 28, 2019
Post comments count 13
Post likes count 1

Why does Explorer’s New menu take so long to appear the first time I open it?

Raymond Chen

It's trying to figure out what new things it can do.

May 27, 2019
Post comments count 13
Post likes count 1

Programming puzzle: Creating a map of command handlers given only the function pointer

Raymond Chen

Creating the magic decoder ring automatically.

May 24, 2019
Post comments count 0
Post likes count 1

Windows Runtime delegates and object lifetime in C++/WinRT

Raymond Chen

So many choices.

May 23, 2019
Post comments count 0
Post likes count 1

Windows Runtime delegates and object lifetime in C++/CX

Raymond Chen

You specify the lifetime rules, typically weak.

May 22, 2019
Post comments count 4
Post likes count 1

Windows Runtime delegates and object lifetime in C# and other GC languages

Raymond Chen

You've left the comfort of the CLR.

May 21, 2019
Post comments count 2
Post likes count 1

The secret signal that tells Windows Runtime events that the event recipient no longer exists

Raymond Chen

Watch out that you don't make the signal by mistake.

May 20, 2019
Post comments count 6
Post likes count 0

If each thread’s TEB is referenced by the fs selector, does that mean that the 80386 is limited to 1024 threads?

Raymond Chen

They don't all have to be different simultaneously.

May 17, 2019
Post comments count 10
Post likes count 1

When would CopyFile succeed but produce a file filled with zeroes?

Raymond Chen

Did the bytes actually make it to the disk?

May 16, 2019
Post comments count 7
Post likes count 1

Why are Bluetooth functions exported from the infrared control panel?

Raymond Chen

Artifacts of service pack constraints from long ago.

May 15, 2019
Post comments count 4
Post likes count 1

Mundane git commit-tree tricks, Part 7: Combining more than two files into one while preserving line history, manual octopus merging

Raymond Chen

Sometimes you just have to take things into your own hands.

May 14, 2019
Post comments count 7
Post likes count 3

Mundane git tricks: Combining two files into one while preserving line history

Raymond Chen

Starting with the two-file case.

May 13, 2019
Post comments count 0
Post likes count 1

Mundane git commit-tree tricks, Part 6: Resetting by reusing an earlier tree

Raymond Chen

Just take me back.

May 10, 2019
Post comments count 1
Post likes count 1

Mundane git commit-tree tricks, Part 5: Squashing without git rebase

Raymond Chen

Working completely from trees.

May 9, 2019
Post comments count 5
Post likes count 1

Mundane git commit-tree tricks, Part 4: Changing a squash to a merge

Raymond Chen

Retroactively removing a command line switch.

May 8, 2019
Post comments count 5
Post likes count 2

Mundane git commit-tree tricks, Part 3: Building a throwaway commit in order to perform a combined cherry-pick-squash

Raymond Chen

You can create a commit just so you can pick it.

May 7, 2019
Post comments count 0
Post likes count 1

Mundane git commit-tree tricks, Part 2: Building a merge commit manually out of a tree

Raymond Chen

A variation on a theme.

May 6, 2019
Post comments count 5
Post likes count 1

Mundane git commit-tree tricks, Part 1: Building a commit manually out of a tree

Raymond Chen

A little bit of plumbing.

May 3, 2019
Post comments count 6
Post likes count 1

Async-Async: Consequences for exceptions

Raymond Chen

The exception doesn't pop out until later.

May 2, 2019
Post comments count 2
Post likes count 1

Async-Async: Consequences for ordering of multiple calls in flight simultaneously

Raymond Chen

You don't know when they'll reach the other side.

May 1, 2019
Post comments count 5
Post likes count 1

Async-Async: Consequences for parameters to parallel asynchronous calls

Raymond Chen

Keep those parameter stable.

Apr 30, 2019
Post comments count 1
Post likes count 1

Async-Async: Reducing the chattiness of cross-thread asynchronous operations

Raymond Chen

Setting up fakes on both sides.

Apr 29, 2019
Post comments count 5
Post likes count 1

Spotting problems with destructors for C++ temporaries

Raymond Chen

It's sometimes later than you want.

Apr 26, 2019
Post comments count 13
Post likes count 2

How many ways are there to sort GUIDs? How much time do you have?

Raymond Chen

Look at all the pretty snowflakes.

Apr 25, 2019
Post comments count 15
Post likes count 2

How can I launch an unelevated process from my elevated process, redux

Raymond Chen

You can ask to execute it as if had been executed by somebody else.

Apr 24, 2019
Post comments count 10
Post likes count 1

The administrative assistant who lasted only one day: A legendary prank from days of yore

Raymond Chen

When you need to execute a prank effectively, hire a professional.

Apr 23, 2019
Post comments count 2
Post likes count 1

Why was Texas Hold ‘Em Poker a Windows Ultimate Extra instead of a built-in game?

Raymond Chen

Cultural sensitivity.

Apr 22, 2019
Post comments count 12
Post likes count 3

A little program to look for files with inconsistent line endings

Raymond Chen

Something I wrote.

Apr 19, 2019
Post comments count 3
Post likes count 1

On resolving the type vs member conflict in C++: The Color Color problem

Raymond Chen

You have to nudge the compiler in the right direction.

Apr 18, 2019
Post comments count 4
Post likes count 1

How arbitrary is the ArbitraryUserPointer in the TEB?

Raymond Chen

Another identifier defined with kernel-colored glasses.

Apr 17, 2019
Post comments count 4
Post likes count 1

What does this strange value for “Percent CPU” mean in Performance Monitor?

Raymond Chen

It's the percent CPU, but you have to undo the various adjustments you requested.

Apr 16, 2019
Post comments count 10
Post likes count 0

Microspeak: Occupant compression

Raymond Chen

Ouch, it hurts when you squeeze me there.

Apr 15, 2019
Post comments count 4
Post likes count 1

Today is tax day, but it’s also division meeting day, so let’s get you some forms to fill out

Raymond Chen

Render unto Caesar, but ask for a little more time.

Apr 12, 2019
Post comments count 8
Post likes count 2

How can a desktop app use a Windows Runtime object that infers UI context from its thread? The IInitializeWithWindow pattern

Raymond Chen

Explicitly associating with a window handle.

Apr 11, 2019
Post comments count 4
Post likes count 1

How can I determine the reason why my window is closing?

Raymond Chen

Listen for signals.

Apr 10, 2019
Post comments count 7
Post likes count 1

Even if you open a file with GUID, you can still get its name, or at least one of its names

Raymond Chen

GetFinalPathByHandle works even for files opened by ID.

Apr 9, 2019
Post comments count 8
Post likes count 1

When I select multiple files in the File Open dialog, why does the last item come first?

Raymond Chen

Because it's the focus.

Apr 8, 2019
Post comments count 13
Post likes count 1

Optimizing your cafeteria meal card stockpile

Raymond Chen

What's the rate of return on Microsoft cafeteria meal cards?

Apr 5, 2019
Post comments count 5
Post likes count 1

What does it mean when my attempt to stop a Windows NT service fails with ERROR_BROKEN_PIPE?

Raymond Chen

The Service Control Manager lost contact with the service, but why?

Apr 4, 2019
Post comments count 12
Post likes count 1

Why do we need atomic operations on the 80386, if it doesn’t support symmetric multiprocessing anyway?

Raymond Chen

You might race with yourself.

Apr 3, 2019
Post comments count 11
Post likes count 1

Dubious security vulnerability: Code execution via LNK file

Raymond Chen

The hard part is getting them to execute it in the first place.

Apr 2, 2019
Post comments count 3
Post likes count 0

On the bogosity of speculation: Guessing the price of the original Surface

Raymond Chen

Scraping the barrel.

Apr 1, 2019
Post comments count 10
Post likes count 1

Oh no, it’s inspection time again

Raymond Chen

Great moments in history.

Mar 29, 2019
Post comments count 5
Post likes count 1

C++/WinRT envy: Bringing thread switching tasks to C# (WPF and WinForms edition)

Raymond Chen

More magic tasks that break out of the thread configuration mold.

Mar 28, 2019
Post comments count 20
Post likes count 2

C++/WinRT envy: Bringing thread switching tasks to C# (UWP edition)

Raymond Chen

Magic tasks that break out of the thread configuration mold.

Mar 27, 2019
Post comments count 5
Post likes count 1

How do I wait for the completion of the delegate I passed to Core­Dispatcher.Run­Async and Thread­Pool.Run­Async?

Raymond Chen

You'll need your own signal.

Mar 26, 2019
Post comments count 2
Post likes count 0

When do Core­Dispatcher.Run­Async and Thread­Pool.Run­Async actions complete?

Raymond Chen

When the delegate returns, not when it completes.

Mar 25, 2019
Post comments count 6
Post likes count 1

What does the N in nmake stand for?

Raymond Chen

It's old now, but at the time, it was new.

Mar 22, 2019
Post comments count 0
Post likes count 0

Vintage Computer Festival Pacific Northwest 2019

Raymond Chen

For all your retro-computing gawking.

Mar 22, 2019
Post comments count 3
Post likes count 1

Turning anything into a fire-and-forget coroutine

Raymond Chen

Turning on the metaprogramming.

Mar 21, 2019
Post comments count 3
Post likes count 1

Expressing fire-and-forget coroutines more explicitly, -or- How to turn any coroutine into fire-and-forget

Raymond Chen

Putting it at the call site instead of in the function itself.

Mar 20, 2019
Post comments count 3
Post likes count 1

winrt::fire_and_forget was too forgetful

Raymond Chen

Usually, you don't care when it finishes, as long as it does.

Mar 19, 2019
Post comments count 19
Post likes count 1

Why does my app’s uninstaller disappear from the Start menu?

Raymond Chen

Keeping things tidy.

Mar 18, 2019
Post comments count 34
Post likes count 1

How do I design a class so that methods must be called in a certain order?

Raymond Chen

Consider it a chain of operation objects.

Mar 15, 2019
Post comments count 15
Post likes count 1

How can we use IsBadWritePtr to fix a buffer overflow, if IsBadWritePtr is itself bad?

Raymond Chen

Don't catch the overflow as it happens. Stop the overflow before it happens.

Mar 14, 2019
Post comments count 5
Post likes count 1

Resolving security issues sometimes involves its own degree of managing people’s egos

Raymond Chen

It's not purely technical. There's sociology here, too.

Mar 13, 2019
Post comments count 69
Post likes count 1

Welcome to my new home on the Microsoft Developer Tools and Services blog site

Raymond Chen

Pardon the dust.

Mar 13, 2019
Post comments count 14
Post likes count 1

Why is there a limit of 15 shell icon overlays?

Raymond Chen

Ran out of bits.

Mar 12, 2019
Post comments count 1
Post likes count 1

Asking for clear written documentation that “Require trusted path for credential entry” is no longer recommended

Raymond Chen

It was never recommended in the first place.

Mar 11, 2019
Post comments count 0
Post likes count 1

Precision questioning: The cynical description

Raymond Chen

Just keep digging.

Mar 8, 2019
Post comments count 2
Post likes count 1

Even if your assembly language code doesn’t call any Windows APIs, you still have to follow the ABI

Raymond Chen

You're not off by yourself; you're part of a society.

Mar 7, 2019
Post comments count 0
Post likes count 1

What order are pages in a memory-mapped file flushed out to disk?

Raymond Chen

There isn't one.

Mar 6, 2019
Post comments count 0
Post likes count 1

How do I destruct an object that keeps a reference to itself, because that reference prevents the object from being destructed

Raymond Chen

Keep a reference to the right thing.

Mar 5, 2019
Post comments count 0
Post likes count 1

Predator-prey reversal: Rock lobsters vs whelks on Malgas Island and Marcus Island

Raymond Chen

Multiple stable configurations.

Mar 5, 2019
Post comments count 0
Post likes count 1

Alternate definitions for English words, as inferred from bug reports

Raymond Chen

Lost in translation.

Mar 4, 2019
Post comments count 0
Post likes count 1

My initial frustration trying to configure our internal VoIP phones that were integrated with instant messaging

Raymond Chen

A combination of settings that the feature team considered nonsensical.

Mar 1, 2019
Post comments count 0
Post likes count 1

How to compare two packed bitfields without having to unpack each field

Raymond Chen

The magic carry-out vector.

Feb 28, 2019
Post comments count 0
Post likes count 1

How should I report errors from my Windows Runtime API?

Raymond Chen

It depends on what kind of error it is.

Feb 27, 2019
Post comments count 0
Post likes count 1

The std::map subscript operator is a convenience, but a potentially dangerous one

Raymond Chen

It makes code easy to read, but things happen behind the scenes you may not be expecting.

Feb 26, 2019
Post comments count 0
Post likes count 1

How to draw a nifty text box in your email message

Raymond Chen

This one weird trick.

Feb 25, 2019
Post comments count 0
Post likes count 2

That time the CEO of a company complained to Congress about Windows file extensions

Raymond Chen

Four fingers pointing back.

Feb 22, 2019
Post comments count 0
Post likes count 0

The 2019/2020 Seattle Symphony subscription season at a glance

Raymond Chen

The pocket reference guide for 2019/2020.

Feb 22, 2019
Post comments count 0
Post likes count 0

How do I permit a minus sign to be entered into my edit control, but only if it’s the first character?

Raymond Chen

Check the insertion point.

Feb 21, 2019
Post comments count 0
Post likes count 0

How do I allow negative numbers with the ES_NUMBER edit control style?

Raymond Chen

You'll have to roll your own.

Feb 20, 2019
Post comments count 0
Post likes count 1

The early history of the ES_NUMBER edit control style

Raymond Chen

It's just a little style bit.

Feb 19, 2019
Post comments count 0
Post likes count 1

How do I convert all these strange Unicode digits into the ones I remember from Sesame Street?

Raymond Chen

Know when to fold'em.

Feb 18, 2019
Post comments count 0
Post likes count 1

How can I check in Win32 whether a Unicode character is any kind of digit?

Raymond Chen

Ask for its character type.

Feb 15, 2019
Post comments count 0
Post likes count 1

Accidentally creating a choke point for what was supposed to hand work off quickly to a background task, part 3

Raymond Chen

Keeping the MTA alive without a thread.

Feb 14, 2019
Post comments count 0
Post likes count 1

Accidentally creating a choke point for what was supposed to hand work off quickly to a background task, part 2

Raymond Chen

Synchronizing on the thread pool makes you wait for the thread pool.

Feb 13, 2019
Post comments count 0
Post likes count 1

Accidentally creating a choke point for what was supposed to hand work off quickly to a background task, part 1

Raymond Chen

A few simple decisions accumulate and interact.

Feb 12, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 17: Future developments

Raymond Chen

Where we went next.

Feb 10, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 16: Code walkthrough

Raymond Chen

Putting the information into practice.

Feb 7, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 15: Common compiler-generated code sequences

Raymond Chen

Recognizing the patterns.

Feb 6, 2019
Post comments count 0
Post likes count 1

The Intel 80386, part 14: Rescuing a stack trace after the debugger gave up when it reached an FPO function

Raymond Chen

Pretend to be the computer.

Feb 5, 2019
Post comments count 0
Post likes count 1

The Intel 80386, part 13: Calling conventions

Raymond Chen

A refresher course.

Feb 4, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 12: The stuff you don’t need to know

Raymond Chen

For completeness but not for usefulness.

Feb 3, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 11: The TEB

Raymond Chen

I need another register, let's see what scraps I can find.

Jan 31, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 10: Atomic operations and memory alignment

Raymond Chen

Not much to work from.

Jan 30, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 9: Stack frame instructions

Raymond Chen

For creating and tearing down stack frames.

Jan 29, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 8: Block operations

Raymond Chen

One of the highly specialized groups of instructions.

Jan 28, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 7: Conditional instructions and control transfer

Raymond Chen

Maybe yes, maybe no.

Jan 27, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 6: Data transfer instructions

Raymond Chen

Keeping things moving.

Jan 24, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 5: Logical operations

Raymond Chen

Fiddling with bits.

Jan 23, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 4: Arithmetic

Raymond Chen

The things that computers do.

Jan 22, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 3: Flags and condition codes

Raymond Chen

It's just a bunch of stuff that happened.

Jan 21, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 2: Memory addressing modes

Raymond Chen

Thirteen different ways to access memory.

Jan 20, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 1: Introduction

Raymond Chen

Hitting a bit closer to home.

Jan 18, 2019
Post comments count 0
Post likes count 1

How do I get the effect of C#’s async void in a C++ coroutine? Part 3: Simplifying the boilerplate

Raymond Chen

Factoring it out.

Jan 17, 2019
Post comments count 0
Post likes count 1

How do I get the effect of C#’s async void in a C++ coroutine? Part 2: Keeping track of the lifetimes

Raymond Chen

There are two types of lambdas you have to write, so why not write two lambdas?

Jan 16, 2019
Post comments count 0
Post likes count 2

How do I get the effect of C#’s async void in a C++ coroutine? Part 1: Why does the obvious solution crash?

Raymond Chen

Wrap it up, but watch out how you do it.

Jan 15, 2019
Post comments count 0
Post likes count 1

Don’t pass lambdas (or other multi-line entities) as parameters to macros

Raymond Chen

It makes debugging much more difficult.

Jan 14, 2019
Post comments count 0
Post likes count 1

Why would the incremental linker insert padding between section fragments?

Raymond Chen

So it can be incremental more easily.

Jan 11, 2019
Post comments count 0
Post likes count 3

Why do we even need to define a red zone? Can’t I just use my stack for anything?

Raymond Chen

I mean, it's my stack, isn't it?

Jan 10, 2019
Post comments count 0
Post likes count 1

Why am I getting mojibake when I try to create a window?

Raymond Chen

Look for the character set mismatch.

Jan 9, 2019
Post comments count 0
Post likes count 1

It rather involved being on the other side of this airtight hatchway: Messing with somebody’s registry

Raymond Chen

Getting to the other side is left as an exercise.

Jan 8, 2019
Post comments count 0
Post likes count 2

STATUS_STACK_BUFFER_OVERRUN doesn’t mean that there was a stack buffer overrun

Raymond Chen

It used to mean that, but now it can mean other things, too.

Jan 7, 2019
Post comments count 0
Post likes count 1

The GetRegionData function fails if the buffer is allocated on the stack. Is it allergic to stack memory or something?

Raymond Chen

One of the lesser-known ground rules.

Jan 4, 2019
Post comments count 0
Post likes count 1

A trick for keeping an object alive in a C++ lambda while still being able to use the this keyword to refer to it

Raymond Chen

Capture it twice, once for the money, and once for the show.

Jan 3, 2019
Post comments count 0
Post likes count 1

Why am I getting mojibake when I try to create a shell link?

Raymond Chen

Make sure the thing you ask for is the thing you want.

Jan 2, 2019
Post comments count 0
Post likes count 1

How can I prevent a WebView control from opening a browser window?

Raymond Chen

It will check with you first, but you have to be listening.

Jan 1, 2019
Post comments count 0
Post likes count 2

Why does the elevation prompt have only the wallpaper as its background?

Raymond Chen

Caught unprepared.

Dec 31, 2018
Post comments count 0
Post likes count 1

2018 year-end link clearance

Raymond Chen

We made it to the end!

Dec 28, 2018
Post comments count 0
Post likes count 1

The case of the orphaned critical section despite being managed by an RAII type

Raymond Chen

Rolling up the debugging sleeves.

Dec 27, 2018
Post comments count 0
Post likes count 1

SHOpenRegStream does not mix with smart pointers

Raymond Chen

Old school meets new school, again.

Dec 26, 2018
Post comments count 0
Post likes count 1

Don’t forget: std::pair does lexicographical ordering, so you don’t have to

Raymond Chen

Let it do the comparing.

Dec 25, 2018
Post comments count 0
Post likes count 4

How do I save the results of a file search in Explorer? Not the query itself, but the results

Raymond Chen

Copy them to the clipboard.

Dec 24, 2018
Post comments count 0
Post likes count 1

Random internal Windows terminology: IDW, Razzle, and their forgotten partners IDS and Dazzle

Raymond Chen

A peek behind the history of the terms.

Dec 21, 2018
Post comments count 0
Post likes count 1

On the attempts to resurrect Space Cadet Pinball

Raymond Chen

Not many options remain.

Dec 20, 2018
Post comments count 0
Post likes count 1

In 16-bit Windows, some per-process data structures were really per-data segment

Raymond Chen

You just have to set up a private data segment.

Dec 19, 2018
Post comments count 0
Post likes count 1

It rather involved being on the other side of this airtight hatchway: Hanging the loader

Raymond Chen

You're already there. No need to brag.

Dec 18, 2018
Post comments count 0
Post likes count 1

How come Explorer reports higher disk space used on my volume than my third party disk space tool?

Raymond Chen

It's probably in a place your tool can't see.

Dec 17, 2018
Post comments count 0
Post likes count 1

Not getting past the title: This is not the bug you’re looking for

Raymond Chen

The title contains the same word, but that's about the only thing that's the same.

Dec 14, 2018
Post comments count 0
Post likes count 1

The case of the mysterious LoadLibrary error message after signing in

Raymond Chen

A little screen shot forensics.

Dec 13, 2018
Post comments count 0
Post likes count 2

How can I programmatically wait until the taskbar has finished booting completely before I create my notification icon?

Raymond Chen

It will let you know.

Dec 12, 2018
Post comments count 0
Post likes count 1

How can I programmatically wait until the system has finished booting completely before doing my own computations?

Raymond Chen

Your observation of the system mutates the system.

Dec 11, 2018
Post comments count 0
Post likes count 1

Why doesn’t my lock screen image change after I replace the image file?

Raymond Chen

It got captured when it was set.

Dec 10, 2018
Post comments count 0
Post likes count 1

When a customer asks for something unsupported, and they promise not to get upset when it stops working, don’t believe them

Raymond Chen

Because they'll be back.

Dec 7, 2018
Post comments count 0
Post likes count 1

The case of the buffer overflow vulnerability that was neither a buffer overflow nor a vulnerability

Raymond Chen

Not quite knowing how assembly language works, I guess.

Dec 6, 2018
Post comments count 0
Post likes count 0

Xformer 10: The Atari 800 emulator has gotten a huge update

Raymond Chen

It's over 30 years old, but can still be improved, and it sure did.

Dec 6, 2018
Post comments count 0
Post likes count 1

How is it that WriteProcessMemory succeeds in writing to read-only memory?

Raymond Chen

Because it tries really hard.

Dec 4, 2018
Post comments count 0
Post likes count 0

The plural of Nexus is Nexūs, in case you cared (which you almost certainly don’t)

Raymond Chen

Only for Latin nerds.

Dec 4, 2018
Post comments count 0
Post likes count 1

Why can’t I close windows directly from the Alt+Tab interface in Windows Vista?

Raymond Chen

Elevation and interruption.

Dec 3, 2018
Post comments count 0
Post likes count 1

Choosing error codes based on a really nice #define doesn’t necessarily lead to a readable message to the user

Raymond Chen

Device not ready? What device?

Nov 30, 2018
Post comments count 0
Post likes count 1

Why does Clipboard.SetData put extra junk in the clipboard data? And how can I get it to stop?

Raymond Chen

Strings and things, but you need the things.

Nov 29, 2018
Post comments count 0
Post likes count 1

Taking advantage of the ordering guarantees of the LINQ GroupBy method

Raymond Chen

Sorting and grouping in a particular way.

Nov 28, 2018
Post comments count 0
Post likes count 1

What happens if I mutate a string in a p/invoke?

Raymond Chen

It seems to work, for specific meanings of "seems".

Nov 27, 2018
Post comments count 0
Post likes count 1

Nifty trick: Combining constructor with collection initializer

Raymond Chen

Two great tastes that work great together.

Nov 26, 2018
Post comments count 0
Post likes count 1

What’s up with Code Analysis rule CA2202: Do not dispose objects multiple times?

Raymond Chen

It's trying to get inside your head.

Nov 23, 2018
Post comments count 0
Post likes count 1

If activation of your gift card lasts more than four hours, consult a physician immediately

Raymond Chen

Is it ready yet?

Nov 23, 2018
Post comments count 0
Post likes count 1

The default number of threads in an I/O completion port is the number of processors, but is that logical or physical processors?

Raymond Chen

How much stuff can happen at once?

Nov 22, 2018
Post comments count 0
Post likes count 1

How can I make a dialog box right-to-left at runtime?

Raymond Chen

You'll have to get that style change in quickly.

Nov 21, 2018
Post comments count 0
Post likes count 1

Trying to allocate the same virtual address in multiple processes

Raymond Chen

But what are you going to put there?

Nov 20, 2018
Post comments count 0
Post likes count 2

For a brief period, the kernel tried to deal with gamma rays corrupting the processor cache

Raymond Chen

Not sure what good it does.

Nov 19, 2018
Post comments count 0
Post likes count 1

How do I suppress the “Did you mean to switch apps?” warning message from my XAML WebView control?

Raymond Chen

It will ask you what to do, and you can tell it to do nothing.

Nov 16, 2018
Post comments count 0
Post likes count 0

The Moncler 1 Pierpaolo Piccioli, your high fashion for the elegant parties that take place in a walk-in freezer

Raymond Chen

I'm sure it looks better after you unpack it from the bubble wrap.

Nov 16, 2018
Post comments count 0
Post likes count 1

Closing the race window between creating a suspended process and putting it in a job

Raymond Chen

Start it there from the beginning.

Nov 15, 2018
Post comments count 0
Post likes count 0

Songs with every other beat removed, how to make your own!

Raymond Chen

Sounds familiar, but oddly wrong.

Nov 15, 2018
Post comments count 0
Post likes count 2

How do I revert a control back to its default theme?

Raymond Chen

The special signal.

Nov 14, 2018
Post comments count 0
Post likes count 1

What’s the point of passing a never-signaled event to MsgWaitForMultipleObjects?

Raymond Chen

It's a placeholder for something that didn't need a placeholder.

Nov 13, 2018
Post comments count 0
Post likes count 0

Saying good-bye to the original Microsoft Redmond campus

Raymond Chen

The home of many memories, perhaps not all good ones.

Nov 12, 2018
Post comments count 0
Post likes count 1

The case of the System process that consumed a lot of CPU

Raymond Chen

Let's look at the performance trace.

Nov 9, 2018
Post comments count 0
Post likes count 1

Gotchas when using linker sections to arrange data, part 2

Raymond Chen

An unexpected null could throw the whole thing out of alignment.

Nov 8, 2018
Post comments count 0
Post likes count 2

Gotchas when using linker sections to arrange data, part 1

Raymond Chen

Nulls can show up in unexpected places.

Nov 7, 2018
Post comments count 0
Post likes count 1

Using linker segments and __declspec(allocate(…)) to arrange data in a specific order

Raymond Chen

Getting the ducks in a row, in order.

Nov 6, 2018
Post comments count 0
Post likes count 1

Dubious security vulnerability: A program that adds a user to the Administrators group in the usual way

Raymond Chen

This is a perfectly legitimate program.

Nov 5, 2018
Post comments count 0
Post likes count 1

Sure, you can implement your own cryptographic service provider for a standard algorithm, but why would you?

Raymond Chen

You are signing up for a very big world of hurt.

Nov 2, 2018
Post comments count 0
Post likes count 1

Why does the MonthCalendar control show the wrong week numbers in Romania?

Raymond Chen

Wrong from whose point of view?

Nov 1, 2018
Post comments count 0
Post likes count 0

In the state of Washington, you are allowed to turn left on a red light onto a one-way street

Raymond Chen

And freeway onramps count as one-way streets.

Nov 1, 2018
Post comments count 0
Post likes count 1

If the prototypes of DispatchMessageA and DispatchMessageW are identical, why have both?

Raymond Chen

Because there's still a character set dependency.

Oct 31, 2018
Post comments count 0
Post likes count 2

Dulce et decorum est pro patria party

Raymond Chen

Anyone up for a toga party?

Oct 30, 2018
Post comments count 0
Post likes count 1

What happened to the Arial Unicode MS font?

Raymond Chen

It couldn't do what it was originally created to do.

Oct 29, 2018
Post comments count 0
Post likes count 1

The case of the oplock deadlock poppycock

Raymond Chen

Call Sherlock.

Oct 26, 2018
Post comments count 0
Post likes count 0

How do I prevent users from using the mouse to drag the trackbar thumb to positions that aren’t multiples of five? Part 2: Nudging the thumb position

Raymond Chen

A little nudging here, a little nudging there.

Oct 25, 2018
Post comments count 0
Post likes count 0

How do I prevent users from using the mouse to drag the trackbar thumb to positions that aren’t multiples of five? Part 1: Reframe the problem

Raymond Chen

Make <I>everything</I> a multiple of five.

Oct 24, 2018
Post comments count 0
Post likes count 0

Adding a Ctrl+arrow accelerator for moving the trackbar by just one unit, part 2: Second try

Raymond Chen

Intercepting the thumb motion.

Oct 23, 2018
Post comments count 0
Post likes count 0

Adding a Ctrl+arrow accelerator for moving the trackbar by just one unit, part 1: Initial plunge

Raymond Chen

The obvious thing starts to get out of hand.

Oct 22, 2018
Post comments count 0
Post likes count 1

Why does the Entry Point Not Found error dialog sometimes not include the name of the missing entry point?

Raymond Chen

Because the name is too long.

Oct 19, 2018
Post comments count 0
Post likes count 1

File-extending writes are not always synchronous, which is entirely within the contract

Raymond Chen

It is an option but not a requirement.

Oct 18, 2018
Post comments count 0
Post likes count 1

After reporting a non-responsive program to Windows Error Reporting, why does the process spawn a suspended child process?

Raymond Chen

That's just a ghost, a shadow of the original.

Oct 17, 2018
Post comments count 0
Post likes count 2

What does the “Ae” stand for in AeDebug?

Raymond Chen

I'm not sure, but I think it's Application Error.

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

Why does Windows ask me to pick a program with which to open a file, even when I already specified which program I want to use to open the file?

Raymond Chen

It's just double-checking after the situation has changed.

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

How can I programmatically inspect and manipulate a registry hive file without mounting it?

Raymond Chen

Enter the offline registry library.

Oct 12, 2018
Post comments count 0
Post likes count 1

So, um, what are we looking at?

Raymond Chen

The wonders of nature, perhaps.

Oct 12, 2018
Post comments count 0
Post likes count 1

Why doesn’t GetTextExtentPoint return the correct extent for strings containing tabs?

Raymond Chen

It doesn't do carriage control.

Oct 11, 2018
Post comments count 0
Post likes count 1

How can I include/exclude specific memory blocks in user-mode crash dumps?

Raymond Chen

Add it to the inclusion or exclusion list.

Oct 10, 2018
Post comments count 0
Post likes count 2

Notes on DrawText and tab stops

Raymond Chen

You can ask, but then you can't ask for other things, unless you ask a different way.

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

The numerology of the sample directory listing in the Windows 95 font selector property sheet page

Raymond Chen

Leave a thumbprint.

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

When I call Crypt­Protect­Data with the same parameters, why aren’t the results identical?

Raymond Chen

A little added seasoning.

Oct 5, 2018
Post comments count 0
Post likes count 1

How can I use WS_CLIP­CHILDREN and still be able to draw a control with a transparent background?

Raymond Chen

Removing all the barriers to painting, perhaps too many.

Oct 4, 2018
Post comments count 0
Post likes count 1

Can I be sure that turning on automatic generation of short file names will get me short file names?

Raymond Chen

You can try hard, but it may not succeed.

Oct 3, 2018
Post comments count 0
Post likes count 1

Practical example of why you need to leave room for German localization

Raymond Chen

Try to say it all in one breath.

Oct 2, 2018
Post comments count 0
Post likes count 2

All sorts of bad things happen when we disable the Task Scheduler service, is that bad?

Raymond Chen

Well, it sure doesn't sound good.

Oct 1, 2018
Post comments count 0
Post likes count 1

Generating a table with vertical text, like I did with the sad history of the C++ throw(…) exception specifier

Raymond Chen

Here's how I did it.

Sep 28, 2018
Post comments count 0
Post likes count 2

The sad history of the C++ throw(…) exception specifier

Raymond Chen

I promise not to throw, but who's going to check?

Sep 27, 2018
Post comments count 0
Post likes count 1

Can you wear wallpaper on your feet? You can if it’s a PARTY.BMP!

Raymond Chen

Wearing your history.

Sep 27, 2018
Post comments count 0
Post likes count 2

Considering the performance implications of converting recursion to an explicit stack

Raymond Chen

Another game of trade-offs and balances.

Sep 26, 2018
Post comments count 0
Post likes count 1

What does the thread parameter to Set­Windows­Hook­Ex actually mean?

Raymond Chen

What does it mean to be "associated" with a thread?

Sep 25, 2018
Post comments count 0
Post likes count 2

How do I prevent my program’s temporary documents from appearing in Search?

Raymond Chen

Put them in the right place.

Sep 24, 2018
Post comments count 0
Post likes count 1

Why does the compiler turn my conditional loop into an infinite one?

Raymond Chen

It's all in the threading.

Sep 21, 2018
Post comments count 0
Post likes count 1

Why is regsvr32 exiting with code 3?

Raymond Chen

Coming up with theories and ways to test those theories.

Sep 20, 2018
Post comments count 0
Post likes count 1

What do the various regsvr32 exit codes mean?

Raymond Chen

Reporting which step the problem occurred at.

Sep 19, 2018
Post comments count 0
Post likes count 1

Why did every Windows 3.0 DLL have an exported function called WEP?

Raymond Chen

The Windows Exit Procedure.

Sep 18, 2018
Post comments count 0
Post likes count 1

Why is Alt+F4 the hotkey for closing a window? Why not Alt+F5 or Alt+F3?

Raymond Chen

It was the next one available.

Sep 17, 2018
Post comments count 0
Post likes count 1

A lack of species sensitivity when serving pizza to guests

Raymond Chen

This bacon thing is getting out of hand.

Sep 17, 2018
Post comments count 0
Post likes count 1

What defines an old-style common dialog?

Raymond Chen

Going back into the Before Time.

Sep 14, 2018
Post comments count 0
Post likes count 2

Why does the Zune HD have the message “For our Princess” on the inside of the case, and why is she a princess?

Raymond Chen

A tribute to a team member who passed away.

Sep 13, 2018
Post comments count 0
Post likes count 1

Raising the colon off the ground

Raymond Chen

Not something your gastroenterologist says, surprisingly.

Sep 12, 2018
Post comments count 0
Post likes count 1

Anything is a soldering kit if you’re brave enough: The MOnSter 6502

Raymond Chen

Are you nuts? Probably.

Sep 12, 2018
Post comments count 0
Post likes count 1

How do I get the system to run my program in this very special way?

Raymond Chen

You can set up the special way yourself.

Sep 11, 2018
Post comments count 0
Post likes count 1

Le Chatelier’s principle in action: Notifications

Raymond Chen

Let me notify you about things you don't care about.

Sep 10, 2018
Post comments count 0
Post likes count 2

How can I conditionally compile based on a preprocessor macro value, while ensuring that the macro is correctly spelled?

Raymond Chen

Another stupid preprocessor trick.

Sep 7, 2018
Post comments count 0
Post likes count 1

Removing the Terminate­Thread from a DLL that needs to shut down a helper thread at unload

Raymond Chen

Designing it out again.

Sep 6, 2018
Post comments count 0
Post likes count 1

What does it mean for a window to be Unicode?

Raymond Chen

The expected character set of the current window procedure.

Sep 5, 2018
Post comments count 0
Post likes count 1

How do I request that my out-of-process COM server run unelevated?

Raymond Chen

Back to the interactive user.

Sep 4, 2018
Post comments count 0
Post likes count 1

Apparently they know more information about me than me, but dare I ask?

Raymond Chen

Blind content retweeting.

Sep 3, 2018
Post comments count 0
Post likes count 1

That time the Word team hired somebody who never showed up, who turned out to be an important member of the team in spite of not being on it

Raymond Chen

Well, we've got the nameplate at least.

Aug 31, 2018
Post comments count 0
Post likes count 1

Removing the Terminate­Thread from code that waits for a job object to empty

Raymond Chen

Designing it out.

Aug 30, 2018
Post comments count 0
Post likes count 2

The early history of Windows file attributes, and why there is a gap between System and Directory

Raymond Chen

One, two, four, sixteen.

Aug 29, 2018
Post comments count 0
Post likes count 0

Obsolete Microspeak: TDBN and the six-pack

Raymond Chen

Old Windows 8 terminology.

Aug 28, 2018
Post comments count 0
Post likes count 1

The evolution of Windows 8 charms

Raymond Chen

For regaling people at your next cocktail party, perhaps.

Aug 27, 2018
Post comments count 0
Post likes count 1

How do I force the Task Manager window closed whenever it opens?

Raymond Chen

Um, that's not really your decision.

Aug 24, 2018
Post comments count 0
Post likes count 1

The Windows 95 team were proud slackers

Raymond Chen

Another adopted slight.

Aug 23, 2018
Post comments count 0
Post likes count 0

The PowerPC 600 series, part 14: Code walkthrough

Raymond Chen

Putting the theory into practice.

Aug 22, 2018
Post comments count 0
Post likes count 0

The PowerPC 600 series, part 13: Common patterns

Raymond Chen

How to recognize different kinds of jumps and calls.

Aug 21, 2018
Post comments count 0
Post likes count 0

The PowerPC 600 series, part 12: Leaf functions

Raymond Chen

Making do with what you are given.

Aug 20, 2018
Post comments count 0
Post likes count 0

The PowerPC 600 series, part 11: Glue routines

Raymond Chen

Binding the two sides together.

Aug 17, 2018
Post comments count 0
Post likes count 0

The PowerPC 600 series, part 10: Passing parameters, function prologues and epilogues

Raymond Chen

The most dangerous parts of flying a function are take-off and landing.

Aug 16, 2018
Post comments count 0
Post likes count 0

The PowerPC 600 series, part 9: The table of contents

Raymond Chen

Finding your bearings.

Aug 15, 2018
Post comments count 0
Post likes count 0

The PowerPC 600 series, part 8: Control transfer

Raymond Chen

Jump around.

Aug 14, 2018
Post comments count 0
Post likes count 0

The PowerPC 600 series, part 7: Atomic memory access and cache coherency

Raymond Chen

How to avoid a break-up.

Aug 13, 2018
Post comments count 0
Post likes count 0

The PowerPC 600 series, part 6: Memory access

Raymond Chen

Load 'em up.

Aug 10, 2018
Post comments count 0
Post likes count 1

The PowerPC 600 series, part 5: Rotates and shifts

Raymond Chen

Get out your Swiss army knife.

Aug 9, 2018
Post comments count 0
Post likes count 0

The PowerPC 600 series, part 4: Bitwise operations and constants

Raymond Chen

Twiddling around.

Aug 8, 2018
Post comments count 0
Post likes count 0

The PowerPC 600 series, part 3: Arithmetic

Raymond Chen

Who knew there were so many ways to add numbers.

Aug 7, 2018
Post comments count 0
Post likes count 0

The PowerPC 600 series, part 2: Condition registers and the integer exception register

Raymond Chen

Keeping track of things that happened.

Aug 6, 2018
Post comments count 0
Post likes count 0

The PowerPC 600 series, part 1: Introduction

Raymond Chen

Here we go again.

Aug 3, 2018
Post comments count 0
Post likes count 2

A puzzle aboard the Anacortes-Sidney ferry: How do the cars get off?

Raymond Chen

At an apparent impasse.

Aug 3, 2018
Post comments count 0
Post likes count 1

Creating an awaitable lock for WinJS and JavaScript Promises

Raymond Chen

Rolling onward.

Aug 2, 2018
Post comments count 0
Post likes count 1

Creating an awaitable lock for C++ PPL tasks

Raymond Chen

Rolling our own.

Aug 1, 2018
Post comments count 0
Post likes count 1

Creating an apartment-aware PPL task from nothing

Raymond Chen

It says it has to be <CODE>IAsync­Action</CODE>- or <CODE>IAync­Operation<T></CODE>-derived, so let's do that.

Jul 31, 2018
Post comments count 0
Post likes count 1

Server names: One of the remaining places where IT managers can be a little silly

Raymond Chen

Usually by establishing a theme.

Jul 30, 2018
Post comments count 0
Post likes count 1

Dark Pattern: Opt-in above the fold, but opt-out below the fold

Raymond Chen

Don't stop yet. Read all the way to the end.

Jul 27, 2018
Post comments count 0
Post likes count 2

Is the Terminate­Thread function synchronous?

Raymond Chen

Nope. It merely starts the termination but does not wait for the termination to complete.

Jul 26, 2018
Post comments count 0
Post likes count 1

What happens to custom unhandled exception filters if a debugger is not running?

Raymond Chen

Nothing, that's what. Absolutely nothing.

Jul 25, 2018
Post comments count 0
Post likes count 1

Why are my file write operations synchronous, even though I opened the file as FILE_FLAG_OVERLAPPED?

Raymond Chen

Extending the valid bytes is always synchronous.

Jul 24, 2018
Post comments count 0
Post likes count 1

Pushing the boundaries of cryptography in a security vulnerability report

Raymond Chen

If it's what you say, then you don't need a supercomputer.

Jul 23, 2018
Post comments count 0
Post likes count 1

The heavy metal umlaut reaches baked goods

Raymond Chen

For that extra Germanic oomph.

Jul 23, 2018
Post comments count 0
Post likes count 1

How do I trigger an EN_UPDATE notification for all of my edit controls when the user’s locale information changes?

Raymond Chen

It's your edit control, so you can do it yourself.

Jul 20, 2018
Post comments count 0
Post likes count 2

How can I get the actual window procedure address and not a thunk?

Raymond Chen

Match the character set of the top-level window procedure.

Jul 19, 2018
Post comments count 0
Post likes count 1

When is it appropriate to use the current processor number as an optimization hint?

Raymond Chen

Try not to let it slip out from under you.

Jul 18, 2018
Post comments count 0
Post likes count 1

Sure I can protect data with CryptProtectData, but how do I remove the ability to decrypt it?

Raymond Chen

You can put a secret in the nonce, though it's not really a secret by that point.

Jul 17, 2018
Post comments count 0
Post likes count 14

What is this vmmem program that is using up all my CPU and memory?

Raymond Chen

That's where your virtual machine resource usage goes.

Jul 16, 2018
Post comments count 0
Post likes count 1

Internal training video on expense reports contains inconsistency: Alert the media!

Raymond Chen

Was this a test? I'm not sure.

Jul 13, 2018
Post comments count 0
Post likes count 1

Warning: Ruler is not to scale

Raymond Chen

Inches enlarged to show texture.

Jul 13, 2018
Post comments count 0
Post likes count 1

When generating a random password, the result must still be a valid string

Raymond Chen

Invalid strings can't round trip through multiple encodings.

Jul 12, 2018
Post comments count 0
Post likes count 1

Why does a non-recursive Read­Directory­ChangesW still report files created inside subdirectories?

Raymond Chen

Because they do affect the top-level directory.

Jul 11, 2018
Post comments count 0
Post likes count 1

Const methods don’t prevent a method from having side effects

Raymond Chen

Though they shouldn't if you know what's good for you, but the compiler doesn't know whether you know what's good for you.

Jul 10, 2018
Post comments count 0
Post likes count 1

How do I change the password of another user without having to sign in as them?

Raymond Chen

You can do it from the password change screen.

Jul 9, 2018
Post comments count 0
Post likes count 1

Stop merging if you need to cherry-pick

Raymond Chen

An opposing view from the VSTS team.

Jul 6, 2018
Post comments count 0
Post likes count 2

The case of the very large memory blocks of the same size, mostly zero, but whose nonzero bytes follow a pattern

Raymond Chen

Some initial pattern recognition, followed by an ad-hoc tool.

Jul 5, 2018
Post comments count 0
Post likes count 1

How can I detect whether the user is logging off?

Raymond Chen

It's hidden as a strange sort of system metric.

Jul 4, 2018
Post comments count 0
Post likes count 1

The Windows Calculator no longer generates tiny errors when calculating the square root of a perfect square

Raymond Chen

Tweaking the algorithm.

Jul 3, 2018
Post comments count 0
Post likes count 1

Did you happen to lose something in the Amstel River? Say within the past 500 years?

Raymond Chen

Maybe you can find it here.

Jul 3, 2018
Post comments count 0
Post likes count 1

How can I determine why the System process is listening on port 80?

Raymond Chen

netsh can tell you.

Jul 2, 2018
Post comments count 0
Post likes count 1

Consider the environment: Do you want a receipt?

Raymond Chen

Actually, I don't really care whether you want one. The decision is foregone.

Jun 29, 2018
Post comments count 0
Post likes count 1

2018 mid-year link clearance

Raymond Chen

Reaching the halfway point.

Jun 28, 2018
Post comments count 0
Post likes count 1

How can I detect from the preprocessor what a macro’s definition is?

Raymond Chen

Evil preprocessor tricks.

Jun 27, 2018
Post comments count 0
Post likes count 1

Lock free many-producer/single-consumer patterns: A work queue of distinct events, order not important, follow-up question

Raymond Chen

We try to minimize spurious wake-ups, but eliminating them is probably not worth the effort.

Jun 26, 2018
Post comments count 0
Post likes count 1

Taking advantage of the asymmetry of offline compression

Raymond Chen

You can spend a lot of time compressing, but decompression still needs to be fast.

Jun 25, 2018
Post comments count 0
Post likes count 1

The cost/benefit analysis of comparing before an assignment

Raymond Chen

Factors pull in both directions. The result is a balance.

Jun 22, 2018
Post comments count 0
Post likes count 0

How I learned to type

Raymond Chen

On an old manual typewriter.

Jun 21, 2018
Post comments count 0
Post likes count 1

What can influence how much stack is consumed when sending a message?

Raymond Chen

Who wants to know? No really, that's the answer.

Jun 20, 2018
Post comments count 0
Post likes count 1

When I intentionally create a stack overflow with SendMessage, why do I sometimes not get a stack overflow?

Raymond Chen

It depends on what overflows first.

Jun 19, 2018
Post comments count 0
Post likes count 0

Microspeak: knobs

Raymond Chen

Configuration settings, basically.

Jun 18, 2018
Post comments count 0
Post likes count 0

Woodworking, the opposite of software development

Raymond Chen

According to self-reported data from one person who could have just made it up.

Jun 15, 2018
Post comments count 0
Post likes count 1

Is there a problem with Create­Remote­Thread on 64-bit systems?

Raymond Chen

There's more to injecting code than copying bytes.

Jun 14, 2018
Post comments count 0
Post likes count 0

How do I programmatically control the order of my program’s notification icons?

Raymond Chen

That's not something you can control programmatically.

Jun 13, 2018
Post comments count 0
Post likes count 0

Even though the brand is called One A Day, none of them actually should be taken one a day

Raymond Chen

For large values of one.

Jun 13, 2018
Post comments count 0
Post likes count 0

Why does the CREATOR_OWNER SID sometimes reset itself to the object’s current owner rather than its original owner?

Raymond Chen

It's a snapshot, but you can ask for a new snapshot.

Jun 12, 2018
Post comments count 0
Post likes count 0

Stupid cmd.exe tricks: Entering a directory that doesn’t exist, then immediately leaving

Raymond Chen

It's as if it never existed. Oh wait, it never existed.

Jun 11, 2018
Post comments count 0
Post likes count 0

Where is the Seattle BoltBus stop?

Raymond Chen

Adjacent to the Uwajimaya parking lot on 5th, at least as of this writing.

Jun 11, 2018
Post comments count 0
Post likes count 0

Pulling the rug out from under an internet protocol

Raymond Chen

Extracting maximum value from licensing.

Jun 8, 2018
Post comments count 0
Post likes count 0

Unusual choice of units: 1.8 billion square millimeters

Raymond Chen

So many yet so small.

Jun 8, 2018
Post comments count 0
Post likes count 1

Why does GetServiceDisplayNameA report a larger required buffer size than actually necessary?

Raymond Chen

It's making a conservative guess.

Jun 7, 2018
Post comments count 0
Post likes count 1

What is this weird constructory syntax C::C()?

Raymond Chen

An archaic syntax from ancient times.

Jun 6, 2018
Post comments count 0
Post likes count 0

The unhandled exception filter is the responsibility of the process; don’t change it without permission

Raymond Chen

It's only common courtesy.

Jun 5, 2018
Post comments count 0
Post likes count 1

Stupid cmd.exe tricks: Changing directories with forward slashes instead of backslashes

Raymond Chen

Provided it doesn't look like a switch.

Jun 4, 2018
Post comments count 0
Post likes count 0

Adventures in application compatibility: Following a detour off a cliff

Raymond Chen

An arrow pointing to nowhere.

Jun 1, 2018
Post comments count 0
Post likes count 0

How can I write a program that monitors another window for a title change?

Raymond Chen

Accessibility saves the day once again.

May 31, 2018
Post comments count 0
Post likes count 1

How can I obtain the heap from which a heap block was allocated?

Raymond Chen

You'll have to keep track of that yourself.

May 30, 2018
Post comments count 0
Post likes count 1

When you call Open­Thread­Token while impersonating, you have to say who is asking for the thread token

Raymond Chen

I am for you.

May 29, 2018
Post comments count 0
Post likes count 0

The alphabet, in alphabetical order, in various languages

Raymond Chen

From A to Z, or beyond.

May 29, 2018
Post comments count 0
Post likes count 1

How do I get file version information from the command line?

Raymond Chen

PowerShell does for you.

May 28, 2018
Post comments count 0
Post likes count 0

How are BitBlt raster opcodes calculated?

Raymond Chen

The complicated language of raster operation codes.

May 25, 2018
Post comments count 0
Post likes count 1

My namespace importing trick imported the same three namespaces into each top-level namespace, yet it worked?

Raymond Chen

They are different namespaces, spelled the same.

May 24, 2018
Post comments count 0
Post likes count 1

How do I create a disabled checkbox for a listview item?

Raymond Chen

A little state image magic.

May 23, 2018
Post comments count 0
Post likes count 1

If you say that your buffer can hold 200 characters, then it had better hold 200 characters

Raymond Chen

Otherwise the mistake is on you.

May 22, 2018
Post comments count 0
Post likes count 2

Why does the install date and size of a program change roughly two days after I install it, even though no changes were made to the program in the meantime?

Raymond Chen

Because the system is trying to fill in missing information.

May 21, 2018
Post comments count 0
Post likes count 4

Maintaining Notepad is not a full-time job, but it’s not an empty job either

Raymond Chen

Adding features by removing code.

May 18, 2018
Post comments count 0
Post likes count 1

Misdirected security vulnerability: Malformed file results in memory corruption

Raymond Chen

Who did the corrupting?

May 17, 2018
Post comments count 0
Post likes count 1

How do I create a SAL annotation for a structure with a variable-length array?

Raymond Chen

The <CODE>_Field_size_</CODE> annotation does the trick.

May 16, 2018
Post comments count 0
Post likes count 1

C++ namespace parlor tricks

Raymond Chen

Shuffling names around.

May 15, 2018
Post comments count 0
Post likes count 3

Why is Windows Compressed Folders (Zip folders) support stuck at the turn of the century?

Raymond Chen

Because that's where we last left it.

May 14, 2018
Post comments count 0
Post likes count 6

For a brief period, Windows 95 could run Windows 3.1 in a virtual machine

Raymond Chen

The ultimate in backward compability.

May 11, 2018
Post comments count 0
Post likes count 1

Why can’t FindWindowEx find another program’s window by name?

Raymond Chen

Are you sure it's there?

May 10, 2018
Post comments count 0
Post likes count 2

On the difficulty of getting pixel-perfect layout in Win32 dialog templates

Raymond Chen

That's not what it's for.

May 9, 2018
Post comments count 0
Post likes count 1

Why does my shortcut to a nonexistent file end up with spaces changed to underscores?

Raymond Chen

Trying to make the best of a bad situation.

May 8, 2018
Post comments count 0
Post likes count 0

Microspeak: ZBB, recall class, glide path, and RTM

Raymond Chen

Bug tracking jargon.

May 7, 2018
Post comments count 0
Post likes count 1

After all, it’s called a hotkey, not a hotcharacter

Raymond Chen

Hotkeys are based on keys.

May 4, 2018
Post comments count 0
Post likes count 0

See you at Build 2018 next week

Raymond Chen

Hopping across the lake.

May 4, 2018
Post comments count 0
Post likes count 1

Avoiding deadlocks when cancelling a thread pool callback, part 2: Referring back to the containing object

Raymond Chen

Run it, but only as long as I still exist.

May 3, 2018
Post comments count 0
Post likes count 1

Avoiding deadlocks when cancelling a thread pool callback, part 1: External callback data

Raymond Chen

Breaking the deadlock by disassociating from the thread pool.

May 2, 2018
Post comments count 0
Post likes count 1

How to avoid accessing freed memory when canceling a thread pool callback

Raymond Chen

Making sure everybody is done before you free it.

May 1, 2018
Post comments count 0
Post likes count 1

Windows 10 virtual desktops are a window management feature, not a security feature

Raymond Chen

It's just for helping you focus.

Apr 30, 2018
Post comments count 0
Post likes count 1

The seasoned pianist’s guide to musical collaborators

Raymond Chen

What's it like working with others?

Apr 30, 2018
Post comments count 0
Post likes count 1

I don’t know how I managed to be presenting at the same conference as Dona Sarkar

Raymond Chen

Maybe if I hang out with her enough, some of the cool will rub off.

Apr 27, 2018
Post comments count 0
Post likes count 1

A cute hidden message in a image to entertain you while you wait

Raymond Chen

Pull out your handy decoder ring.

Apr 26, 2018
Post comments count 0
Post likes count 1

How can I have my program execute some code only if run from the Visual Studio debugger?

Raymond Chen

Let's look at the problem rather than the question.

Apr 25, 2018
Post comments count 0
Post likes count 2

Microspeak: Tented

Raymond Chen

No peeking into the tent.

Apr 23, 2018
Post comments count 0
Post likes count 1

The early history of redundant function pointer casts: MakeProcInstance

Raymond Chen

The generic function pointer.

Apr 20, 2018
Post comments count 0
Post likes count 0

The MIPS R4000, part 15: Code walkthrough

Raymond Chen

Let's look at some code.

Apr 19, 2018
Post comments count 0
Post likes count 0

The MIPS R4000, part 14: Common patterns

Raymond Chen

How to recognize different kinds of jumps and calls.

Apr 18, 2018
Post comments count 0
Post likes count 0

The MIPS R4000, part 13: Function prologues and epilogues

Raymond Chen

Keeping the unwinding bookkeeping straight.

Apr 17, 2018
Post comments count 0
Post likes count 0

Whoa, that fitness tracker is a really expensive watch

Raymond Chen

And you only have to recharge it every few days, instead of every two years.

Apr 17, 2018
Post comments count 0
Post likes count 0

The MIPS R4000, part 12: Calling convention

Raymond Chen

Pretty standard… for a MIPS.

Apr 16, 2018
Post comments count 0
Post likes count 0

The MIPS R4000, part 11: More on branch delay slots

Raymond Chen

I guess this really confuses people.

Apr 13, 2018
Post comments count 0
Post likes count 0

The MIPS R4000, part 10: Trampolines and stubs

Raymond Chen

You can't get there from here, at least not in one go.

Apr 12, 2018
Post comments count 0
Post likes count 0

The MIPS R4000, part 9: Branch delay slot parlor tricks

Raymond Chen

Technically legal, but strange.

Apr 11, 2018
Post comments count 0
Post likes count 0

The MIPS R4000, part 8: Control transfer

Raymond Chen

Branch, but wait, not quite yet.

Apr 10, 2018
Post comments count 0
Post likes count 1

The MIPS R4000, part 7: Memory access (atomic)

Raymond Chen

Load and lock, erm, link.

Apr 9, 2018
Post comments count 0
Post likes count 0

The MIPS R4000, part 6: Memory access (unaligned)

Raymond Chen

Split 'em up.

Apr 6, 2018
Post comments count 0
Post likes count 0

The MIPS R4000, part 5: Memory access (aligned)

Raymond Chen

Simple loads and stores.

Apr 5, 2018
Post comments count 0
Post likes count 0

The MIPS R4000, part 4: Constants

Raymond Chen

Load them up, a half at a time.

Apr 4, 2018
Post comments count 0
Post likes count 0

The MIPS R4000, part 3: Multiplication, division, and the temperamental HI and LO registers

Raymond Chen

You have to treat them nicely or they will refuse to coöperate.

Apr 3, 2018
Post comments count 0
Post likes count 0

The MIPS R4000, part 2: 32-bit integer calculations

Raymond Chen

The usual suspects.

Apr 2, 2018
Post comments count 0
Post likes count 0

The MIPS R4000, part 1: Introduction

Raymond Chen

Here we go again.

Mar 30, 2018
Post comments count 0
Post likes count 1

How do I choose between the strong and weak versions of compare-exchange?

Raymond Chen

It depends on how bad a spurious failure is for your algorithm.

Mar 29, 2018
Post comments count 0
Post likes count 1

Geology throwdown: The whisper of the rocks

Raymond Chen

Listen or don't listen. Pick a side.

Mar 29, 2018
Post comments count 0
Post likes count 1

What’s up with compare_exchange_weak anyway?

Raymond Chen

It's handy for certain classes of processors.

Mar 28, 2018
Post comments count 0
Post likes count 1

When I memcpy a struct into a std::atomic of that struct, why does the result not match?

Raymond Chen

You're storing it wrong.

Mar 27, 2018
Post comments count 0
Post likes count 1

The WMI root node is just a node in the WMI namespace

Raymond Chen

Don't let the name fool you.

Mar 26, 2018
Post comments count 0
Post likes count 0

A rare opportunity to fact-check the “celebrity net worth” sites

Raymond Chen

Well, technically it's "north".

Mar 26, 2018
Post comments count 0
Post likes count 1

What are the odds that two pull requests get completed at the exact same time?

Raymond Chen

Merges do not occur instantaneously, so there is a window of opportunity for overlap.

Mar 23, 2018
Post comments count 0
Post likes count 3

Stop cherry-picking, start merging: Index

Raymond Chen

For one-stop reading.

Mar 23, 2018
Post comments count 0
Post likes count 1

Stop cherry-picking, start merging, Part 10: Web-based workflow for Azure DevOps (formerly VSTS)

Raymond Chen

Clicking your way to a merged cherry-pick.

Mar 22, 2018
Post comments count 0
Post likes count 1

The mystery of the stalker dental hygienist

Raymond Chen

Haven't I seen you before?

Mar 22, 2018
Post comments count 0
Post likes count 1

Stop cherry-picking, start merging, Part 9: Chasing the commit

Raymond Chen

Catch the train.

Mar 21, 2018
Post comments count 0
Post likes count 2

Stop cherry-picking, start merging, Part 8: How to merge a partial cherry-pick

Raymond Chen

Pick what you want.

Mar 20, 2018
Post comments count 0
Post likes count 1

Stop cherry-picking, start merging, Part 7: Preventing a change from leaving a branch

Raymond Chen

More advanced merge base tricks.

Mar 19, 2018
Post comments count 0
Post likes count 1

Stop cherry-picking, start merging, Part 6: Replacing the temporary fix with the permanent fix

Raymond Chen

Advanced merge base tricks.

Mar 16, 2018
Post comments count 0
Post likes count 1

Stop cherry-picking, start merging, Part 5: Exploiting the three-way merge

Raymond Chen

Making sure you have the correct merge base.

Mar 15, 2018
Post comments count 0
Post likes count 2

Stop cherry-picking, start merging, Part 4: Exploiting the recursive merge algorithm

Raymond Chen

Recursive merging for fun and profit.

Mar 14, 2018
Post comments count 0
Post likes count 6

Stop cherry-picking, start merging, Part 3: Avoiding problems by creating a new merge base

Raymond Chen

Move the cherry-pick into the merge base so that git knows it exists in both sides.

Mar 13, 2018
Post comments count 0
Post likes count 2

Stop cherry-picking, start merging, Part 2: The merge conflict that never happened (but should have)

Raymond Chen

You wish you got a merge conflict, but you didn't.

Mar 12, 2018
Post comments count 0
Post likes count 9

Stop cherry-picking, start merging, Part 1: The merge conflict

Raymond Chen

Setting the pieces into motion.

Mar 9, 2018
Post comments count 0
Post likes count 0

Torsken har ankommet

Raymond Chen

Cod you believe it?

Mar 9, 2018
Post comments count 0
Post likes count 1

Why is the daylight saving time cutover time 1 millisecond too soon in some time zones?

Raymond Chen

Another other time zone anomalies.

Mar 8, 2018
Post comments count 0
Post likes count 1

What’s the difference between CreateTimerQueueTimer and SetThreadpoolTimer?

Raymond Chen

They are both the same thing under the covers.

Mar 7, 2018
Post comments count 0
Post likes count 1

When MSDN says NULL, is it okay to use nullptr?

Raymond Chen

One of many equivalent formulations.

Mar 6, 2018
Post comments count 0
Post likes count 1

Microspeak: The triad, the ad-hoc acronyms that result, and the arithmetic problem 3 × 3

Raymond Chen

There are six possible ways of arranging them. Surely one of them must look good.

Mar 5, 2018
Post comments count 0
Post likes count 1

Inadvertently designing a horrible time and date picker

Raymond Chen

Perhaps inspired by the worst possible volume control.

Mar 2, 2018
Post comments count 0
Post likes count 1

If I call GetExitCodeThread for a thread that I know for sure has exited, why does it still say STILL_ACTIVE?

Raymond Chen

Because that's not the thread handle you think it is.

Mar 1, 2018
Post comments count 0
Post likes count 2

How does Task Manager choose the icon to show for a process?

Raymond Chen

It uses your window icon, and if you don't have a window, then it starts hunting.

Feb 28, 2018
Post comments count 0
Post likes count 3

An amusing story about a practical use of the null garbage collector

Raymond Chen

The computer itself ceases to exist.

Feb 27, 2018
Post comments count 0
Post likes count 1

It rather involved being on the other side of this airtight hatchway: Replacing an unsigned writable MSI package

Raymond Chen

Another case of the insecurely-configured system.

Feb 26, 2018
Post comments count 0
Post likes count 1

I just met you, and this is crazy, but here’s my callstack. Debug me maybe.

Raymond Chen

You gave me nothing at all, but still, you're in my way.

Feb 23, 2018
Post comments count 0
Post likes count 0

The 2018/2019 Seattle Symphony subscription season at a glance

Raymond Chen

The pocket reference guide for 2018/2019.

Feb 23, 2018
Post comments count 0
Post likes count 1

How do I make sure that my shell extension is at the top of the context menu?

Raymond Chen

The battle for absolute supremacy continues.

Feb 22, 2018
Post comments count 0
Post likes count 1

Why does IsPathRelative return FALSE for paths that are drive-relative?

Raymond Chen

It's complicated.

Feb 21, 2018
Post comments count 0
Post likes count 1

How can I call freopen but open the file with shared access instead of exclusive access?

Raymond Chen

Coming through the back way.

Feb 20, 2018
Post comments count 0
Post likes count 1

We couldn’t create a new partition or locate an existing one, possible workarounds

Raymond Chen

Well, it worked for me.

Feb 19, 2018
Post comments count 0
Post likes count 1

This is a race the display driver wouldn’t normally expect to lose

Raymond Chen

But flukes can happen.

Feb 16, 2018
Post comments count 0
Post likes count 1

So what is a Windows “critical process” anyway?

Raymond Chen

<CODE>Is­Process­Critical</CODE> tells you whether a process is critical, but what does that mean?

Feb 15, 2018
Post comments count 0
Post likes count 1

Why are there two kinds of Universal Windows apps, one for Windows 8 and another for Windows 10?

Raymond Chen

Universality is not universal.

Feb 14, 2018
Post comments count 0
Post likes count 1

What’s the difference between the zero width non-joiner and the zero width space?

Raymond Chen

Are you separating two words?

Feb 13, 2018
Post comments count 0
Post likes count 2

When Windows copies a file, does it ever copy bytes that are in the slack space?

Raymond Chen

Keeping tabs on the slackers.

Feb 12, 2018
Post comments count 0
Post likes count 1

There are no bugs in the I/O manager

Raymond Chen

True each time it is uttered.

Feb 9, 2018
Post comments count 0
Post likes count 1

Optimizing BitBlt by generating code on the fly

Raymond Chen

Artisanal bit block transfers made to order.

Feb 8, 2018
Post comments count 0
Post likes count 1

What do the output values from CoGetApartmentType mean?

Raymond Chen

Four types of threads, possibly in the neutral apartment temporarily.

Feb 7, 2018
Post comments count 0
Post likes count 1

Why does misinterpreting UTF16-LE Unicode text as ANSI tend to show up as just one character?

Raymond Chen

Because you're probably working in the ASCII subset.

Feb 6, 2018
Post comments count 0
Post likes count 5

Microspeak: POR

Raymond Chen

The plan of record.

Feb 5, 2018
Post comments count 0
Post likes count 1

// If this happens, I am going to quit and become a barista

Raymond Chen

Maybe you should check if Starbucks is hiring.

Feb 2, 2018
Post comments count 0
Post likes count 1

The case of the SRWLock violation in a thread pool work item

Raymond Chen

Application verifier tells the story.

Feb 1, 2018
Post comments count 0
Post likes count 2

Spurious wake-ups in Win32 condition variables

Raymond Chen

Another peek behind the curtain.

Jan 31, 2018
Post comments count 0
Post likes count 1

How can I get a signature for a Windows system that will remain unchanged even if the user reinstalls Windows?

Raymond Chen

The SystemIdentification class will give you something.

Jan 30, 2018
Post comments count 0
Post likes count 0

Communication by hand signals, and other complex coordination problems

Raymond Chen

The secret language.

Jan 30, 2018
Post comments count 0
Post likes count 3

Why does hypervisor remain enabled even when Hyper-V is disabled in Windows Features?

Raymond Chen

Because somebody else needs it.

Jan 29, 2018
Post comments count 0
Post likes count 1

Microspeak sighting: over-index

Raymond Chen

It's like birdwatching, but for words.

Jan 29, 2018
Post comments count 0
Post likes count 1

Well that was a helpful error message

Raymond Chen

I guess they don't know what went wrong either.

Jan 26, 2018
Post comments count 0
Post likes count 1

The saga of Heartland vs. The United States Beet Sugar Association

Raymond Chen

Is molasses a foreign substance with respect to sugar?

Jan 25, 2018
Post comments count 0
Post likes count 1

Like love, taxes make people do the strangest things

Raymond Chen

Tariff engineering.

Jan 24, 2018
Post comments count 0
Post likes count 1

How can I reserve a range of address space and receive notifications when the program first reads or writes a page in the range?

Raymond Chen

Be in the exception handler chain.

Jan 23, 2018
Post comments count 0
Post likes count 1

Microspeak: Impedance mismatch

Raymond Chen

Any kind of mismatch, really.

Jan 22, 2018
Post comments count 0
Post likes count 1

The history of change-packing tools at Microsoft (so far)

Raymond Chen

They all say "pack" for one reason or another.

Jan 19, 2018
Post comments count 0
Post likes count 1

A helper template function to wait for a Win32 condition variable in a loop

Raymond Chen

Another case of the spurious wake-up.

Jan 18, 2018
Post comments count 0
Post likes count 1

Stuff my father-in-law says: On taking the train

Raymond Chen

A five-minute tour.

Jan 18, 2018
Post comments count 0
Post likes count 1

A helper template function to wait for WaitOnAddress in a loop

Raymond Chen

Because this is what you always have to do.

Jan 17, 2018
Post comments count 0
Post likes count 2

Why does HRESULT begin with H when it’s not a handle to anything?

Raymond Chen

Well, it used to be a handle.

Jan 16, 2018
Post comments count 0
Post likes count 2

As far as the French government is concerned, I am the expert on Windows XP

Raymond Chen

At least it's my name on the paperwork.

Jan 15, 2018
Post comments count 0
Post likes count 1

How do I know that Resource Monitor isnt just retaining a handle to the terminated process?

Raymond Chen

Let's try it again, with feeling.

Jan 12, 2018
Post comments count 0
Post likes count 1

Why don’t context menus respect the UI state for keyboard accelerators?

Raymond Chen

Well, technically, they're a separate window.

Jan 11, 2018
Post comments count 0
Post likes count 1

What does it mean when the documentation says that you must specify the app in the system’s metadata before you can retrieve Smbios­Information properties?

Raymond Chen

It's talking to a specific "you" that's not you.

Jan 10, 2018
Post comments count 0
Post likes count 1

Why is there a semicircular bar at the base of the ORCA card reader?

Raymond Chen

Another mystery.

Jan 10, 2018
Post comments count 0
Post likes count 0

How do I get the computer’s serial number? Consuming Windows Runtime classes in desktop apps, part 5: PowerShell

Raymond Chen

Now we're cooking with power.

Jan 9, 2018
Post comments count 0
Post likes count 0

How do I get the computer’s serial number? Consuming Windows Runtime classes in desktop apps, part 4: C#

Raymond Chen

Over into managed code.

Jan 8, 2018
Post comments count 0
Post likes count 1

How do I get the computer’s serial number? Consuming Windows Runtime classes in desktop apps, part 3: C++/WinRT

Raymond Chen

Getting into the modern swing of things.

Jan 5, 2018
Post comments count 0
Post likes count 1

How do I get the computer’s serial number? Consuming Windows Runtime classes in desktop apps, part 2: C++/CX

Raymond Chen

Annoying to set up, but easier to use.

Jan 4, 2018
Post comments count 0
Post likes count 1

How do I get the computer’s serial number? Consuming Windows Runtime classes in desktop apps, part 1: Raw C++

Raymond Chen

We can do this the easy way or the hard way. Let's do it the hard way.

Jan 3, 2018
Post comments count 0
Post likes count 3

Why are the module timestamps in Windows 10 so nonsensical?

Raymond Chen

They're really a uniqueness identifier.

Jan 2, 2018
Post comments count 0
Post likes count 1

What happens when a huge number of people share a single grocery store loyalty card?

Raymond Chen

They can tell.

Jan 1, 2018
Post comments count 0
Post likes count 1

How do I know that Resource Monitor isn’t just retaining a handle to the terminated process?

Raymond Chen

Let's run some more experiments.

Dec 29, 2017
Post comments count 0
Post likes count 1

2017 year-end link clearance

Raymond Chen

Another year passes.

Dec 28, 2017
Post comments count 0
Post likes count 1

How does Resource Monitor get information for processes that already terminated?

Raymond Chen

It's an optical illusion.

Dec 27, 2017
Post comments count 0
Post likes count 1

Why do I have to pass a valid page protection value to VirtualAlloc even if it ignores it?

Raymond Chen

It ignores it, after it validates it.

Dec 26, 2017
Post comments count 0
Post likes count 2

Microspeak: over-index

Raymond Chen

To give too much prominence to something in a discussion or analysis.

Dec 25, 2017
Post comments count 0
Post likes count 1

Time travel is here, at least when it comes to debugging

Raymond Chen

A present for all the developers out there.

Dec 22, 2017
Post comments count 0
Post likes count 1

Exposing undefined behavior when trying to port code to another platform

Raymond Chen

Oops, that wasn't allowed after all.

Dec 21, 2017
Post comments count 0
Post likes count 1

What’s the difference between VARIANT and VARIANTARG?

Raymond Chen

Well, is it an argument?

Dec 20, 2017
Post comments count 0
Post likes count 1

How do I ShellExecute a file, but with a specific program instead of the default program?

Raymond Chen

Count the ways.

Dec 19, 2017
Post comments count 0
Post likes count 1

How does Task Manager categorize processes as App, Background Process, or Windows Process?

Raymond Chen

It's a made-up term.

Dec 18, 2017
Post comments count 0
Post likes count 1

On the little-documented role of the page-turner

Raymond Chen

Intended to be invisible.

Dec 18, 2017
Post comments count 0
Post likes count 2

What kind of messages can a message-only window receive?

Raymond Chen

Only messages that are sent directly to that window.

Dec 12, 2017
Post comments count 0
Post likes count 1

Why not slipstream ZDP fixes into the bits downloaded by the installer rather than being a separate download?

Raymond Chen

Well, yeah, but what if it was downloaded months ago?

Dec 11, 2017
Post comments count 0
Post likes count 1

Coroutines mean that the thing that looks like a stack variable may not technically be one

Raymond Chen

Hoisted into the future.

Dec 8, 2017
Post comments count 0
Post likes count 1

How do I respond to the WM_MENUCHAR message?

Raymond Chen

You identify the menu item that corresponds to the character.

Dec 7, 2017
Post comments count 0
Post likes count 1

Knowing just enough about debugging IRPs to chase the problem out of the I/O stack

Raymond Chen

Fumbling around and stumbling into a diagnosis.

Dec 6, 2017
Post comments count 0
Post likes count 1

How can I prevent the keyboard focus rectangle from appearing on a control I created?

Raymond Chen

You can lie to the control.

Dec 5, 2017
Post comments count 0
Post likes count 2

Tree view check boxes: The extended check box states

Raymond Chen

Partial, dimmed, and exclusion.

Dec 4, 2017
Post comments count 0
Post likes count 2

Tree view check boxes: A sordid history

Raymond Chen

How we got into the mess we did.

Dec 1, 2017
Post comments count 0
Post likes count 1

Creating tree view check boxes manually: Themed check boxes

Raymond Chen

Using visual styles.

Nov 30, 2017
Post comments count 0
Post likes count 1

Creating tree view check boxes manually: Responding to clicks

Raymond Chen

Cycling through the state images.

Nov 29, 2017
Post comments count 0
Post likes count 1

Creating tree view check boxes manually: A simple state image list

Raymond Chen

Rebuilding the states, maybe with some new ones.

Nov 28, 2017
Post comments count 0
Post likes count 1

Beware of the leaked image list when using the TVS_CHECKBOXES style

Raymond Chen

It'll make one for you, but it's still on you to destroy it.

Nov 27, 2017
Post comments count 0
Post likes count 1

The TVS_CHECKBOXES style is quirky, which is a polite way of saying that it is crazy

Raymond Chen

You have to set it at just the right time.

Nov 24, 2017
Post comments count 0
Post likes count 1

Getting a parent and child window to have the same UI states

Raymond Chen

Wrangling them into agreement.

Nov 23, 2017
Post comments count 0
Post likes count 1

Demonstrating what happens when a parent and child window have different UI states

Raymond Chen

Setting up for a fail.

Nov 22, 2017
Post comments count 0
Post likes count 1

What is the documentation for SetParent trying to tell me about synchronizing the UI state?

Raymond Chen

There's this thing called a UI state, see, and it should be synchronized.

Nov 20, 2017
Post comments count 0
Post likes count 1

How can I find the installation directory for my UWP application?

Raymond Chen

You can ask PowerShell.

Nov 17, 2017
Post comments count 0
Post likes count 1

The wrong way of benchmarking the most efficient integer comparison function

Raymond Chen

Missing the forest for the blade of grass.

Nov 16, 2017
Post comments count 0
Post likes count 1

Why is there no way to add a permission to a page with VirtualProtect instead of replacing it?

Raymond Chen

Who's in charge here?

Nov 15, 2017
Post comments count 0
Post likes count 1

What happens if you simply return from the thread callback passed to _beginthread and _beginthreadex?

Raymond Chen

Who's got the thread handle?

Nov 14, 2017
Post comments count 0
Post likes count 2

Microspeak: FCIB

Raymond Chen

Foreign checked-in binary, or at least that's what it means now.

Nov 13, 2017
Post comments count 0
Post likes count 1

On memory allocations larger than 64KB on 16-bit Windows

Raymond Chen

The mysterious __AHINCR.

Nov 10, 2017
Post comments count 0
Post likes count 1

Cancelling the INamespace­Walk::Walk operation a little faster

Raymond Chen

You can use <CODE>IAction­Progress</CODE>

Nov 9, 2017
Post comments count 0
Post likes count 1

How can I cancel the INamespace­Walk::Walk operation?

Raymond Chen

You can cancel it during a <CODE>INamespace­Walk­CB</CODE> callback.

Nov 8, 2017
Post comments count 0
Post likes count 1

How can I control which parts of the shell namespace the INamespaceWalk::Walk operation will walk into?

Raymond Chen

You can ask it to skip the folder, or you can tell it to give up entirely.

Nov 7, 2017
Post comments count 0
Post likes count 1

Was there a problem with Windows 95-era programs relying on undocumented information disclosure stuff?

Raymond Chen

Surprisingly not.

Nov 6, 2017
Post comments count 0
Post likes count 1

Why did Windows 95 store image list bitmaps four-across instead of as a strict vertical strip?

Raymond Chen

To make sure they all fit in a 16-bit coordinate space.

Nov 3, 2017
Post comments count 0
Post likes count 1

Why are my notification icon customizations lost after six months of disuse?

Raymond Chen

Sorry, didn't realize you were still using it.

Nov 2, 2017
Post comments count 0
Post likes count 1

What are the dire consequences of accessing the fields of __m128i directly?

Raymond Chen

It works, but not well.

Nov 1, 2017
Post comments count 0
Post likes count 1

How can I detect that a shell item refers to a virtual folder, or to a file system inside a file?

Raymond Chen

Unpacking the attributes.

Oct 31, 2017
Post comments count 0
Post likes count 1

Why does upgrading my project to Unicode cause Visual Studio to use a different version of the common controls?

Raymond Chen

Because it's now possible.

Oct 30, 2017
Post comments count 0
Post likes count 1

Should I name my file mapping after the file it was created from?

Raymond Chen

Well, it depends on why you're giving it a name at all.

Oct 27, 2017
Post comments count 0
Post likes count 1

How do I preserve the user’s notification icon preferences for my program after I update it?

Raymond Chen

Give it a GUID.

Oct 26, 2017
Post comments count 0
Post likes count 1

How do I prevent my registered hotkey from firing repeatedly due to auto-repeat?

Raymond Chen

You can ask for auto-repeat to be ignored.

Oct 25, 2017
Post comments count 0
Post likes count 1

Why was the Windows 95 precursor project code-named Panther abandoned?

Raymond Chen

Didn't fit in a 4-megabyte bag.

Oct 24, 2017
Post comments count 0
Post likes count 1

When I use Alt+PrtSc to take a screen shot of a maximized window, why does it capture a few pixels from an adjacent monitor?

Raymond Chen

Because it's hanging over the edge.

Oct 23, 2017
Post comments count 0
Post likes count 2

A closer look at the complexity analysis of finding the k’th smallest element in two sorted arrays

Raymond Chen

Let's calculate it properly.

Oct 20, 2017
Post comments count 0
Post likes count 1

On the gradual improvements in how the system deals with the failure to initialize a critical section

Raymond Chen

Gradually improve the situation until the problem vanishes completely.

Oct 19, 2017
Post comments count 0
Post likes count 1

How do I create a shortcut whose target is specified by a relative path?

Raymond Chen

It's already in there.

Oct 18, 2017
Post comments count 0
Post likes count 1

I used WS_EX_COMPOSITED to get rid of my redrawing flicker, but it resulted in sluggish response

Raymond Chen

The system needs to know when to present the back-buffer.

Oct 17, 2017
Post comments count 0
Post likes count 1

When a stopgap solution becomes an undocumented feature some people rely on

Raymond Chen

It was never meant to be long for this world.

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

Nasty gotcha: Powershell aliases that match commands you might want to run

Raymond Chen

Because two-letter names would never collide, right?

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

Exploring the problem: Create a file that only one process can write to

Raymond Chen

That's not the real problem.

Oct 12, 2017
Post comments count 0
Post likes count 1

Why does my program crash when I throw an exception from an APC?

Raymond Chen

Because c'mon.

Oct 11, 2017
Post comments count 0
Post likes count 1

How can I specify that my DLL should resolve a DLL dependency from the same directory that the DLL is in?

Raymond Chen

Use the manifest.

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

Microspeak: Gardening

Raymond Chen

General housekeeping.

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

Why does NTVDM create empty IO.SYS and MSDOS.SYS files?

Raymond Chen

Compatibility, of course.

Oct 6, 2017
Post comments count 0
Post likes count 2

How can I investigate the possibility of a lot of leaked window classes (RegisterClass)?

Raymond Chen

Looking for names.

Oct 5, 2017
Post comments count 0
Post likes count 1

Evaluating the security consequences of an instance of reading past the end of a buffer

Raymond Chen

In order to get the information, you must already have significant powers.

Oct 4, 2017
Post comments count 0
Post likes count 1

Reconciling yucky boys and gross kissing with the occasional dance

Raymond Chen

Just friends.

Oct 4, 2017
Post comments count 0
Post likes count 2

The Resource Compiler’s preprocessor is not the same as the C preprocessor

Raymond Chen

It's a very limited subset.

Oct 3, 2017
Post comments count 0
Post likes count 1

Alas, Microsoft Building 109 Conference Room A is no more

Raymond Chen

Another code word bites the dust.

Oct 2, 2017
Post comments count 0
Post likes count 1

How can I detect that my window is on the current virtual desktop?

Raymond Chen

And what are the recommended policies for using virtual desktops anyway?

Sep 29, 2017
Post comments count 0
Post likes count 1

Why does my thread handle suddenly go bad? All I did was wait on it!

Raymond Chen

The scary world of _beginthread.

Sep 28, 2017
Post comments count 0
Post likes count 1

CancelIoEx can cancel synchronous I/O, which is kind of nice

Raymond Chen

Get me out of there.

Sep 27, 2017
Post comments count 0
Post likes count 2

How to check if a pointer is in a range of memory

Raymond Chen

Thanks to the C language standard, it's trickier than it seems.

Sep 26, 2017
Post comments count 0
Post likes count 1

Who implemented the Windows NT blue screen of death?

Raymond Chen

My colleague John Vert.

Sep 25, 2017
Post comments count 0
Post likes count 2

What happens if I wake a condition variable when nobody is waiting for it? Is the wake saved for the next thread that waits?

Raymond Chen

It shouldn't matter.

Sep 22, 2017
Post comments count 0
Post likes count 1

What does it mean when I get an access violation at a very low address when entering a critical section?

Raymond Chen

It probably means that you're entering a critical section that is not initialized.

Sep 21, 2017
Post comments count 0
Post likes count 1

How accurate are the various Windows time-querying functions?

Raymond Chen

Most of them are based on the system timer, but some are better.

Sep 20, 2017
Post comments count 0
Post likes count 1

What is the correct way of using SaveDC and RestoreDC?

Raymond Chen

Understanding the model.

Sep 19, 2017
Post comments count 0
Post likes count 2

The NET HELPMSG command will decode Windows error codes, at least the simple ones

Raymond Chen

It's originally for decoding network error messages, but it doesn't actually care.

Sep 18, 2017
Post comments count 0
Post likes count 1

The increasingly complex Kremlinology surrounding Windows

Raymond Chen

Wait, who's standing next to whom?

Sep 15, 2017
Post comments count 0
Post likes count 1

How can I diagnose why my FreeLibrary isn’t freeing the library?

Raymond Chen

Application Verifier to the rescue.

Sep 14, 2017
Post comments count 0
Post likes count 1

Why is my window unexpectedly becoming topmost?

Raymond Chen

There are a few places where the system will auto-topmost a window.

Sep 13, 2017
Post comments count 0
Post likes count 1

What is the correct way of using the string buffer returned by the WindowsPreallocateStringBuffer function?

Raymond Chen

Write the characters you allocated, but only those characters.

Sep 12, 2017
Post comments count 0
Post likes count 1

Microspeak: Ripcord

Raymond Chen

Deploy the emergency parachute.

Sep 11, 2017
Post comments count 0
Post likes count 1

If you configure a program to run in Windows 2000 compatibility mode, then it is also vulnerable to Windows 2000 security issues

Raymond Chen

Bug-for-bug compatibility.

Sep 8, 2017
Post comments count 0
Post likes count 1

Nasty gotcha: SetThreadUILanguage cannot be used to restore the thread UI language

Raymond Chen

You have to use some other function entirely.

Sep 7, 2017
Post comments count 0
Post likes count 1

What are anonymous structs, and more importantly, how do I tell windows.h to stop using them?

Raymond Chen

The struct with no name.

Sep 6, 2017
Post comments count 0
Post likes count 1

Can I enable Large Address Awareness dynamically at runtime?

Raymond Chen

No, but you can maybe fake it.

Sep 5, 2017
Post comments count 0
Post likes count 0

Does anybody know what really happened on August 25, 2017 at the Red Sox/Orioles game?

Raymond Chen

A strange thing might have happened, but did it?

Sep 5, 2017
Post comments count 0
Post likes count 1

Why did my systems reboot into the Recovery Environment and how do I prevent that from happening in the future?

Raymond Chen

You can disable it in the boot configuration.

Sep 4, 2017
Post comments count 0
Post likes count 1

Inadvertently becoming the change you wish to see in the world

Raymond Chen

Sharing some duties.

Sep 1, 2017
Post comments count 0
Post likes count 1

I guess I may as well confess that I wrote the Itanium information in the Debugging Tools for Windows package

Raymond Chen

The story of how I ended up being the guy who understands all these processors.

Aug 31, 2017
Post comments count 0
Post likes count 1

The Alpha AXP, epilogue: A correction about file system compression on the Alpha AXP

Raymond Chen

Setting the record straight, even though the lie has already circumnavigated the world.

Aug 30, 2017
Post comments count 0
Post likes count 0

The Alpha AXP, part 17: Reconstructing a call stack

Raymond Chen

Putting the information into practice.

Aug 29, 2017
Post comments count 0
Post likes count 0

The Alpha AXP, part 16: What are the dire consequences of having 32-bit values in non-canonical form?

Raymond Chen

It depends on what the next calculation is.

Aug 28, 2017
Post comments count 0
Post likes count 0

The Alpha AXP, part 15: Variadic functions

Raymond Chen

Keeping two sets of books that eventually become one.

Aug 25, 2017
Post comments count 0
Post likes count 0

The Alpha AXP, part 14: On the strange behavior of writes to the zero register

Raymond Chen

Room for future optimization.

Aug 24, 2017
Post comments count 0
Post likes count 1

Yes, that was a horrifically awkward video, but it wasn’t the Windows 95 launch

Raymond Chen

Some sort of sales event, probably.

Aug 23, 2017
Post comments count 0
Post likes count 0

The Alpha AXP, part 13: On treating a 64-bit processor as if it were a 32-bit processor

Raymond Chen

It's all in the point of view.

Aug 22, 2017
Post comments count 0
Post likes count 0

The Alpha AXP: Part 12: How you detect carry on a processor with no carry?

Raymond Chen

The same way you do it in C, which also doesn't have a carry.

Aug 21, 2017
Post comments count 0
Post likes count 0

The Alpha AXP, part 11: Processor faults

Raymond Chen

Sometimes you know where it happened. Sometimes you don't.

Aug 18, 2017
Post comments count 0
Post likes count 0

The Alpha AXP, part 10: Atomic updates to byte and word memory units

Raymond Chen

Putting together some things we've learned.

Aug 17, 2017
Post comments count 0
Post likes count 0

The Alpha AXP, part 9: The memory model and atomic memory operations

Raymond Chen

When does it happen? I have no idea!

Aug 16, 2017
Post comments count 0
Post likes count 0

The Alpha AXP, part 8: Memory access, storing bytes and words and unaligned data

Raymond Chen

Those little pieces.

Aug 15, 2017
Post comments count 0
Post likes count 1

The Alpha AXP, part 7: Memory access, loading unaligned data

Raymond Chen

Now it gets harder.

Aug 14, 2017
Post comments count 0
Post likes count 1

The Alpha AXP, part 6: Memory access, basics

Raymond Chen

Start with the easy cases.

Aug 11, 2017
Post comments count 0
Post likes count 1

The Alpha AXP, part 5: Conditional operations and control flow

Raymond Chen

But there is no flags register.

Aug 10, 2017
Post comments count 0
Post likes count 0

The Alpha AXP, part 4: Bit 15. Ugh. Bit 15.

Raymond Chen

Let's make some bits.

Aug 9, 2017
Post comments count 0
Post likes count 1

The Alpha AXP, part 3: Integer constants

Raymond Chen

Building them up a piece at a time.

Aug 8, 2017
Post comments count 0
Post likes count 1

The Alpha AXP, part 2: Integer calculations

Raymond Chen

It's all fun and games until somebody does sign extension.

Aug 7, 2017
Post comments count 0
Post likes count 2

The Alpha AXP, part 1: Initial plunge

Raymond Chen

Pretty registers, all in a row.

Aug 4, 2017
Post comments count 0
Post likes count 1

Wrapping some other scripting language inside a batch file

Raymond Chen

Polyglot to the rescue.

Aug 3, 2017
Post comments count 0
Post likes count 1

Decomposing file paths (and extracting other information like file size, date and time, and attributes) from a batch file

Raymond Chen

FOR to the rescue.

Aug 2, 2017
Post comments count 0
Post likes count 1

Why does attempting to echo an undefined environment variable result in the message “ECHO is on”?

Raymond Chen

Because that's what happens when you echo nothing.

Aug 1, 2017
Post comments count 0
Post likes count 1

The redirection can come anywhere on the line, and you can use that to get rid of the spaces

Raymond Chen

Up front and personal.

Jul 31, 2017
Post comments count 0
Post likes count 1

The redirection can come anywhere on the line, so watch out for those spaces

Raymond Chen

The operator vanishes.

Jul 28, 2017
Post comments count 0
Post likes count 2

Can I throw a C++ exception from a structured exception?

Raymond Chen

Technically okay, but it's unusual and doesn't solve your problem.

Jul 27, 2017
Post comments count 0
Post likes count 1

How am I supposed to free the memory the system allocates in the SetPrivateObjectSecurity function?

Raymond Chen

It comes from the process heap.

Jul 26, 2017
Post comments count 0
Post likes count 0

Trip report: Sequim Lavender Festival and the Olympic Game Farm

Raymond Chen

Some learned travel tips.

Jul 26, 2017
Post comments count 0
Post likes count 1

Wrapping up 2017’s extended CLR Week-and-a-half with some links to other CLR trivia

Raymond Chen

Additional useless reading.

Jul 25, 2017
Post comments count 0
Post likes count 2

If there is no difference between two options, choose the one that is easier to debug

Raymond Chen

Because you're going to be debugging it eventually.

Jul 24, 2017
Post comments count 0
Post likes count 1

How can I find out how many threads are active in the CLR thread pool?

Raymond Chen

Let's answer the question, but then look at the scenario.

Jul 21, 2017
Post comments count 0
Post likes count 1

The perils of async void

Raymond Chen

Go on without me.

Jul 20, 2017
Post comments count 0
Post likes count 1

Crash course in async and await

Raymond Chen

Hang on a second, I'll get back to you.

Jul 19, 2017
Post comments count 0
Post likes count 1

Do people write insane code with multiple overlapping side effects with a straight face?

Raymond Chen

I guess some do.

Jul 18, 2017
Post comments count 0
Post likes count 1

Why does the assignment operator in C# evaluate left to right instead of right to left?

Raymond Chen

Because that's what people expect, for certain values of "people".

Jul 17, 2017
Post comments count 0
Post likes count 0

Revisions to previous discussion of the implementation of anonymous methods in C#

Raymond Chen

All instance all the time.

Jul 14, 2017
Post comments count 0
Post likes count 1

Discussion of how to add UTF-16 support to a library that internally uses UTF-8

Raymond Chen

Convert it, but make sure it can convert back.

Jul 13, 2017
Post comments count 0
Post likes count 1

Customizing the window handle for item enumeration in IShellItem

Raymond Chen

It's on the site.

Jul 12, 2017
Post comments count 0
Post likes count 1

Why is the maximum number of TLS slots 1088? What a strange number.

Raymond Chen

It's a little less strange in binary.

Jul 11, 2017
Post comments count 0
Post likes count 1

Microspeak: To stand up

Raymond Chen

To get something working and available for use.

Jul 10, 2017
Post comments count 0
Post likes count 1

On the circular path from RAII to crazy-town back to RAII: Thoughts on emulating C#’s using in C++

Raymond Chen

A trip around the block.

Jul 7, 2017
Post comments count 0
Post likes count 1

How can I tell whether two paths reside on the same underlying volume, so I can know whether they can be hard-linked?

Raymond Chen

Don't try to guess. Just do it.

Jul 6, 2017
Post comments count 0
Post likes count 1

Debugging tip: Use .frame /r to recover nonvolatile registers from the stack frame

Raymond Chen

Saving you the trouble of reconstructing it manually.

Jul 5, 2017
Post comments count 0
Post likes count 2

How fair are SRW locks, particularly when there are both readers and writers?

Raymond Chen

Not fair! As with the other Windows synchronization objects.

Jul 4, 2017
Post comments count 0
Post likes count 0

Urban and suburban camouflage

Raymond Chen

Hey, what's that in my backyard?

Jul 3, 2017
Post comments count 0
Post likes count 1

Emulating the C# using keyword in C++

Raymond Chen

The co_await enables new patterns.

Jun 30, 2017
Post comments count 0
Post likes count 1

2017 mid-year link clearance

Raymond Chen

Marking the halfway point.

Jun 30, 2017
Post comments count 0
Post likes count 1

Extracting pages from a PDF document and saving them as separate image files, C++/CX edition with co_await

Raymond Chen

Everybody seems to be converging on C#.

Jun 29, 2017
Post comments count 0
Post likes count 1

Extracting pages from a PDF document and saving them as separate image files, C++/CX edition with explicit tasks

Raymond Chen

Sliding over to C++/CX.

Jun 28, 2017
Post comments count 0
Post likes count 1

Extracting pages from a PDF document and saving them as separate image files, JavaScript edition with async

Raymond Chen

Diving into an upcoming feature of ES8.

Jun 27, 2017
Post comments count 0
Post likes count 1

Extracting pages from a PDF document and saving them as separate image files, JavaScript edition with Promises

Raymond Chen

Trying it out a different way.

Jun 26, 2017
Post comments count 0
Post likes count 2

Extracting pages from a PDF document and saving them as separate image files, C# edition

Raymond Chen

A Little Program I needed.

Jun 23, 2017
Post comments count 0
Post likes count 1

Trying to make the thread pool more responsive to a large queue of long-running work items

Raymond Chen

Convert them to tasks.

Jun 22, 2017
Post comments count 0
Post likes count 1

When can GetSecurityInfo API return ERROR_INSUFFICIENT_BUFFER?

Raymond Chen

It's the race condition called out in the documentation.

Jun 21, 2017
Post comments count 0
Post likes count 1

Summertime, and the lemonade is easy

Raymond Chen

Unearthing an old game from my youth.

Jun 20, 2017
Post comments count 0
Post likes count 1

Why is Explorer opted out of Data Execution Prevention and termination on heap corruption, and how effective is the policy to opt it back in?

Raymond Chen

It's out, but it quickly comes back in, unless you tell it to stay out.

Jun 19, 2017
Post comments count 0
Post likes count 1

How do I set the initial directory of the File Open dialog to a virtual directory?

Raymond Chen

Use the IFileDialog::SetDefaultFolder method.

Jun 16, 2017
Post comments count 0
Post likes count 1

Stuff my father-in-law says: On baking bread

Raymond Chen

Three hours.

Jun 16, 2017
Post comments count 0
Post likes count 1

Combining the work queue of distinct events, order not important, with an auto-reset event

Raymond Chen

Combining two solutions into a bigger solution.

Jun 15, 2017
Post comments count 0
Post likes count 1

Creating an automatic-reset event from WaitOnAddress

Raymond Chen

Completing the quartet.

Jun 14, 2017
Post comments count 0
Post likes count 1

Creating a manual-reset event from WaitOnAddress

Raymond Chen

A diversion, in the form of a different exercise.

Jun 13, 2017
Post comments count 0
Post likes count 1

Creating a semaphore with a maximum count from WaitOnAddress

Raymond Chen

The exercises continue.

Jun 12, 2017
Post comments count 0
Post likes count 1

Creating a semaphore from WaitOnAddress

Raymond Chen

More exercises.

Jun 9, 2017
Post comments count 0
Post likes count 1

The case of the longjmp from nowhere trying to open a registry key

Raymond Chen

Close your eyes and jump.

Jun 8, 2017
Post comments count 0
Post likes count 1

What will GetLastError() return after a failed InitOnceExecuteOnce?

Raymond Chen

Whatever you tell it to.

Jun 7, 2017
Post comments count 0
Post likes count 1

On enabling NX and ASLR for a module after the fact

Raymond Chen

You can flip the bit, but you can't regenerate relocation information.

Jun 6, 2017
Post comments count 0
Post likes count 3

Microspeak: ROB and Office Hours

Raymond Chen

Rhythm of business.

Jun 5, 2017
Post comments count 0
Post likes count 1

How can I register a program to auto-relaunch if it crashes or is terminated?

Raymond Chen

There is no system registration. You'll have to roll one yourself.

Jun 2, 2017
Post comments count 0
Post likes count 2

How likely is it that a window will receive a WM_NULL message out of the blue?

Raymond Chen

Not entirely unlikely, let's put it that way.

Jun 1, 2017
Post comments count 0
Post likes count 3

Comparing WaitOnAddress with futexes (futexi? futexen?)

Raymond Chen

Two different ways of creating a synchronization object out of nothing.

May 31, 2017
Post comments count 0
Post likes count 1

Extending our critical section based on WaitOnAddress to support timeouts

Raymond Chen

Ooh, look, a new feature.

May 30, 2017
Post comments count 0
Post likes count 1

Why isn’t the original window order always preserved when you undo an Aero Shake?

Raymond Chen

Acts the same way as undoing a Minimize All, since that's basically what it is.

May 29, 2017
Post comments count 0
Post likes count 1

Does DebugBreak work to launch the debugger, or doesn’t it?

Raymond Chen

It does, eventually, but not because it is DebugBreak.

May 26, 2017
Post comments count 0
Post likes count 1

Why are hidden files with a leading tilde treated as super-hidden?

Raymond Chen

Because in practice they are ultra-temporary.

May 25, 2017
Post comments count 0
Post likes count 1

Diagnosing why you cannot create a stable subkey under a volatile parent key

Raymond Chen

You can't do it, but why is the parent volatile?

May 24, 2017
Post comments count 0
Post likes count 1

Some questions about unflushed data and calling FlushFileBuffers on a new handle to a file

Raymond Chen

Will it get flushed out eventually?

May 23, 2017
Post comments count 0
Post likes count 2

What do these hard drive icons mean?

Raymond Chen

Various kinds of BitLocker, mostly.

May 22, 2017
Post comments count 0
Post likes count 1

Why doesn’t searching my Start menu with Cortana find Internet shortcuts in my All Programs list?

Raymond Chen

Because our A/B testing showed that showing them was worse.

May 19, 2017
Post comments count 0
Post likes count 1

Debugging a GDI resource leak: Case study

Raymond Chen

If it leaked once, it'll leak again.

May 18, 2017
Post comments count 0
Post likes count 1

Why is the !locks command called !locks even though it debugs only critical sections?

Raymond Chen

Because those were the only kind of locks, back in the day.

May 17, 2017
Post comments count 0
Post likes count 1

Why do my PDF file associations get reset every time I restart?

Raymond Chen

Hey, that doesn't look right.

May 16, 2017
Post comments count 0
Post likes count 1

There’s a group policy for Action Center, and another one for Action Center

Raymond Chen

Two things with the same name, how confusing.

May 15, 2017
Post comments count 0
Post likes count 1

At least it wasn’t on a Web page with the warning “Beware of the leopard”

Raymond Chen

But it was simple.

May 12, 2017
Post comments count 0
Post likes count 1

A question about avoiding page faults the first time newly-allocated memory is accessed

Raymond Chen

What are you trying to optimize?

May 11, 2017
Post comments count 0
Post likes count 1

How to calculate the resulting security descriptor of a child object without creating it

Raymond Chen

Pretend that it's a private object.

May 10, 2017
Post comments count 0
Post likes count 1

Revised notes on the reliability of FlushFileBuffers

Raymond Chen

A check-in on what's happened over the past few years.

May 9, 2017
Post comments count 0
Post likes count 1

The early Windows phone devices were liquid-cooled, sort of

Raymond Chen

Soda is a liquid, right?

May 8, 2017
Post comments count 0
Post likes count 1

Couldn’t we fix the lackey catastrophe by using #pragma init_seg(user)?

Raymond Chen

That doesn't help, for more than one reason.

May 5, 2017
Post comments count 0
Post likes count 1

Remember that in a stack trace, the addresses are return addresses, not call addresses

Raymond Chen

It's where the function is going to return to, not where it came from.

May 4, 2017
Post comments count 0
Post likes count 1

The interaction between AppBars and Windows 10 virtual desktops

Raymond Chen

They apply to all virtual desktops.

May 3, 2017
Post comments count 0
Post likes count 1

Why don’t I get thumbnails for files that are marked offline?

Raymond Chen

Because offline files are assumed to be expensive to access.

May 2, 2017
Post comments count 0
Post likes count 1

Microspeak: Work-back

Raymond Chen

Start and the end and work backwards.

May 1, 2017
Post comments count 0
Post likes count 1

Those blue boxes all over the place, I always wondered what they were for

Raymond Chen

Non-electronic mail.

May 1, 2017
Post comments count 0
Post likes count 1

Why doesn’t SHGetFileInfo give me customized folder icons?

Raymond Chen

Because you asked for it that way.

Apr 28, 2017
Post comments count 0
Post likes count 2

Why does the compiler generate memory operations on the full variable even though only one byte is involved?

Raymond Chen

Store-to-load forwarding.

Apr 27, 2017
Post comments count 0
Post likes count 1

Static hooking through predefinition

Raymond Chen

Creating your own hook points.

Apr 26, 2017
Post comments count 0
Post likes count 1

Why are there two incompatible ways of specifying a serial port baud rate?

Raymond Chen

Toto, I don't think we're on an IBM PC XT any more.

Apr 25, 2017
Post comments count 0
Post likes count 3

How do I kill a program that hung with an always-on-top fullscreen window?

Raymond Chen

Hey, look at that desktop over there.

Apr 24, 2017
Post comments count 0
Post likes count 2

Filtering the Browse for Folder dialog so it shows only drive letters

Raymond Chen

An exercise in filtering.

Apr 21, 2017
Post comments count 0
Post likes count 1

Application crash reported as security vulnerability, but you never crossed the airtight hatchway

Raymond Chen

A crash is not a priori a security vulnerability.

Apr 20, 2017
Post comments count 0
Post likes count 1

On generating sentinel pointer values in Windows

Raymond Chen

That's not a pointer. <B>This</B> is a pointer.

Apr 19, 2017
Post comments count 0
Post likes count 1

Under what conditions could a commit of reserved memory fail?

Raymond Chen

Usually because you are out of memory, but really it's when you're out of commit.

Apr 18, 2017
Post comments count 0
Post likes count 1

That time a customer reported an error in the map used by Flight Simulator

Raymond Chen

But whose map is right?

Apr 17, 2017
Post comments count 0
Post likes count 1

Why does my __FILE__ macro produce an invalid address, which mysteriously becomes valid a few moments later?

Raymond Chen

It's not there until somebody demands it.

Apr 14, 2017
Post comments count 0
Post likes count 1

How can I atomically leave a critical section and delete it?

Raymond Chen

Even if you could, it wouldn't help you.

Apr 13, 2017
Post comments count 0
Post likes count 1

Can memcpy go into an infinite loop? Why is it being blamed for a busy hang?

Raymond Chen

Look at the bigger picture.

Apr 12, 2017
Post comments count 0
Post likes count 1

How do I get the current directory for a non-current drive?

Raymond Chen

GetFullPathName will tell you.

Apr 11, 2017
Post comments count 0
Post likes count 1

The Windows 8 close gestures, a retrospective

Raymond Chen

Top to bottom.

Apr 10, 2017
Post comments count 0
Post likes count 1

When I enable page heap, why is my one-byte buffer overrun not detected immediately?

Raymond Chen

I thought that was the point of page heap.

Apr 7, 2017
Post comments count 0
Post likes count 1

If I have a thread waiting on an event, and I call SetEvent immediately followed by ResetEvent, is the waiting thread guaranteed to be released?

Raymond Chen

Congratulations, you reinvented PulseEvent.

Apr 6, 2017
Post comments count 0
Post likes count 1

What can I do if I want to throw a C++ exception from my InitOnce callback?

Raymond Chen

There's the naïve solution and a sneakier one.

Apr 5, 2017
Post comments count 0
Post likes count 3

How do I programmatically obtain the user’s selected accent color in Windows 10?

Raymond Chen

It's in the UISettings object.

Apr 4, 2017
Post comments count 0
Post likes count 1

Microspeak: snap

Raymond Chen

To take a snapshot of the source code in order to produce a build.

Apr 3, 2017
Post comments count 0
Post likes count 1

How do I create a shortcut in the Send To menu that runs a program with a command line option?

Raymond Chen

Put the option in the shortcut target.

Mar 31, 2017
Post comments count 0
Post likes count 1

A survey of the various ways of creating GDI bitmaps with predefined data

Raymond Chen

So many to choose from.

Mar 30, 2017
Post comments count 0
Post likes count 1

For sale: One TARDIS, working (lights), you must pick up from Vancouver

Raymond Chen

Time travel circuits disabled by Time Lords, however.

Mar 30, 2017
Post comments count 0
Post likes count 1

The gradual erosion of the SEM_NOOPENFILEERRORBOX error mode

Raymond Chen

It does less and less, until it basically does nothing.

Mar 29, 2017
Post comments count 0
Post likes count 1

A brief discussion on how best to respond to the end-session messages

Raymond Chen

You can start early, but be aware that the user might change their mind.

Mar 28, 2017
Post comments count 0
Post likes count 1

Explorer is a single-instance application, but you can find other ways to get the effect of running a separate instance

Raymond Chen

Look for the explorer browser helpers.

Mar 27, 2017
Post comments count 0
Post likes count 1

How real-mode Windows loaded code from the disk, and how you could use that to minimize disk swapping

Raymond Chen

Send in the clones.

Mar 24, 2017
Post comments count 0
Post likes count 1

When you submit a security vulnerability report, we go the extra mile and try to fix your typos

Raymond Chen

Even if the typo is what confused you.

Mar 23, 2017
Post comments count 0
Post likes count 1

Responses to various ideas on how to get people to stop using that leaked build

Raymond Chen

Over-engineering the solution.

Mar 22, 2017
Post comments count 0
Post likes count 1

You can peek to see whether your delay-loaded function loaded successfully

Raymond Chen

Predicting the future.

Mar 21, 2017
Post comments count 0
Post likes count 1

Why does the volume control let me set the volume only to even numbers?

Raymond Chen

Because pressing Volume-Up 100 times would be really annoying.

Mar 20, 2017
Post comments count 0
Post likes count 1

Secret passages on Microsoft main campus, episode 2

Raymond Chen

Getting from one point to another.

Mar 17, 2017
Post comments count 0
Post likes count 0

Happy St. Patrick’s Day. Watch out for that throne.

Raymond Chen

A challenger from North Bend.

Mar 17, 2017
Post comments count 0
Post likes count 0

Not interested in college basketball? No problem. Follow the Name of the Year 2017 bracket

Raymond Chen

The greatest names of real people.

Mar 17, 2017
Post comments count 0
Post likes count 1

If I want to maintain a free list of pages, should I use MEM_RESET or MEM_DECOMMIT?

Raymond Chen

It depends.

Mar 16, 2017
Post comments count 0
Post likes count 1

How do I provide data to the sharing pane from a Win32 desktop application?

Raymond Chen

Continuing the interop pattern.

Mar 15, 2017
Post comments count 0
Post likes count 1

How do I show the sharing pane from a Win32 desktop application?

Raymond Chen

Unwrapping the projection, but now with interop.

Mar 14, 2017
Post comments count 0
Post likes count 1

Why is Alt+D the keyboard shortcut for putting focus on the address bar?

Raymond Chen

Because it was Ad&dress.

Mar 13, 2017
Post comments count 0
Post likes count 0

Raymond’s highly scientific predictions for the 2017 NCAA men’s basketball tournament

Raymond Chen

This one will definitely work, right?

Mar 13, 2017
Post comments count 0
Post likes count 1

Which languages are fully-localized by Windows?

Raymond Chen

And your little console too.

Mar 10, 2017
Post comments count 0
Post likes count 1

Is GENERIC_ALL equivalent to GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE?

Raymond Chen

Only if the object says so.

Mar 9, 2017
Post comments count 0
Post likes count 1

How do I keep thread pool threads, or other threads in general, from competing with my render thread for CPU?

Raymond Chen

You assign them to the default CPU set.

Mar 8, 2017
Post comments count 0
Post likes count 1

How do we improve the performance of conhost processes when we ping a bunch of servers?

Raymond Chen

How about avoiding them entirely?

Mar 7, 2017
Post comments count 0
Post likes count 1

Microspeak: to reason over

Raymond Chen

To make programmatic decisions based on, usually to produce a higher-level result.

Mar 6, 2017
Post comments count 0
Post likes count 1

Some internal developer chatter on a bug that caused your screen to turn black

Raymond Chen

A little dry humor for your amusement.

Mar 3, 2017
Post comments count 0
Post likes count 1

The case of the 32-bit program that tries to load a 64-bit DLL

Raymond Chen

A continuing saga which ultimately comes to a resolution.

Mar 2, 2017
Post comments count 0
Post likes count 0

What happens when you tell a Millennial to take pictures of a party

Raymond Chen

Oh, how tasty.

Mar 2, 2017
Post comments count 0
Post likes count 1

Don’t forget to implement canonical names for verbs in your shell context menu extension

Raymond Chen

The system uses it to find you later.

Mar 1, 2017
Post comments count 0
Post likes count 0

Want to include a gift message with your tires? Nice try.

Raymond Chen

You'll have to show your love some other way.

Mar 1, 2017
Post comments count 0
Post likes count 1

Why does my attempt to acquire an SRW lock block even though !locks report no locks held?

Raymond Chen

!locks is looking for critical sections.

Feb 28, 2017
Post comments count 0
Post likes count 1

Great moments in journalism: “Confirmed Microsoft Surface Pro 5 launch date”

Raymond Chen

Confirmed by rumor?

Feb 27, 2017
Post comments count 0
Post likes count 1

Baking soda has hundreds of uses, but what about what it says on the tin?

Raymond Chen

Can you bake with it?

Feb 27, 2017
Post comments count 0
Post likes count 1

How do I disable the press-and-hold gesture for my window?

Raymond Chen

Digging back into ancient history.

Feb 24, 2017
Post comments count 0
Post likes count 1

Eventually you reach a critical mass of LEGO pieces where you can build most things from what you already have

Raymond Chen

Just look it up.

Feb 24, 2017
Post comments count 0
Post likes count 1

The system manages the system image lists; don’t go changing the art on the walls

Raymond Chen

You can read from them, but don't modify them.

Feb 23, 2017
Post comments count 0
Post likes count 1

How am I supposed to print my print-at-home tickets if I can’t reproduce them?

Raymond Chen

Legal disclaimers from the past.

Feb 23, 2017
Post comments count 0
Post likes count 1

How to create a folder that inherits its parent’s ACL, and then overrides part of it

Raymond Chen

Creating it with a custom security descriptor isn't working.

Feb 22, 2017
Post comments count 0
Post likes count 1

Those Year 2000 disaster preparedness trucks were originally there for a different reason

Raymond Chen

Originally for long-haul testing in the power-unstable Pacific Northwest.

Feb 21, 2017
Post comments count 0
Post likes count 1

What little kids think of lifeguards

Raymond Chen

Lots of yelling.

Feb 21, 2017
Post comments count 0
Post likes count 1

Psychic debugging: Why does opening a command prompt always print a weird error message?

Raymond Chen

Check your AutoRun.

Feb 20, 2017
Post comments count 0
Post likes count 0

The 2017/2018 Seattle Symphony subscription season at a glance

Raymond Chen

The pocket reference guide for 2017/2018.

Feb 20, 2017
Post comments count 0
Post likes count 1

Another more efficient solution to the problem of a long-running task running on the thread pool persistent thread

Raymond Chen

The thread-agnostic change notification.

Feb 17, 2017
Post comments count 0
Post likes count 1

Follow-up: The bus that straddles traffic

Raymond Chen

Sitting motionless over half a road.

Feb 17, 2017
Post comments count 0
Post likes count 1

A more efficient solution to the problem of a long-running task running on the thread pool persistent thread

Raymond Chen

Break it up a little more.

Feb 16, 2017
Post comments count 0
Post likes count 1

How do I fix the problem of a long-running task running on the thread pool persistent thread?

Raymond Chen

Hey, you, get off of my thread.

Feb 15, 2017
Post comments count 0
Post likes count 1

Man, this housing downturn is hitting everyone, follow-up

Raymond Chen

Down we go.

Feb 15, 2017
Post comments count 0
Post likes count 1

Why did my thread pool stop processing work once it hit a long-running work item?

Raymond Chen

Because you ran the work item on the persistent thread.

Feb 14, 2017
Post comments count 0
Post likes count 1

Pipelining your laundry, and the ensuing silliness

Raymond Chen

When geeks go overboard.

Feb 13, 2017
Post comments count 0
Post likes count 1

Advertisement for ink cartridges doesn’t do all the math

Raymond Chen

Maybe they are trying to minimize the frequency of ink cartridge changes.

Feb 13, 2017
Post comments count 0
Post likes count 2

Sometimes you get so worked up about the compatibility consequences of a change that you miss the obvious

Raymond Chen

It clearly was not happening before, because it crashed.

Feb 10, 2017
Post comments count 0
Post likes count 1

How do I do an interlocked exchange of a hat pointer?

Raymond Chen

Perform a raw exchange of the underlying native pointer.

Feb 9, 2017
Post comments count 0
Post likes count 1

Suspicious memory leak in std::basic_string

Raymond Chen

There are not the PODs you are looking for.

Feb 8, 2017
Post comments count 0
Post likes count 5

Why are all Windows drivers dated June 21, 2006? Don’t you ever update drivers?

Raymond Chen

Are you just a bunch of slackers?

Feb 7, 2017
Post comments count 0
Post likes count 1

Microspeak: Placemat review

Raymond Chen

Put the fork here and the knife there.

Feb 6, 2017
Post comments count 0
Post likes count 1

My proposal for an episode of the new Star Trek series

Raymond Chen

Darmok says, "Internet, its tubes clogged."

Feb 6, 2017
Post comments count 0
Post likes count 1

Why does a Microsoft mouse accept two batteries even though it works just fine on only one battery?

Raymond Chen

To reduce the frequency of battery changes.

Feb 3, 2017
Post comments count 0
Post likes count 1

It is a great deal and not a great deal, both at the same time

Raymond Chen

At least until you open the box.

Feb 3, 2017
Post comments count 0
Post likes count 2

Why am I getting a crash at shutdown inside the thread pool?

Raymond Chen

Stop talking to a dead thread pool.

Feb 2, 2017
Post comments count 0
Post likes count 1

Some friendly advice from the Redmond Public Safety department on nighttime nude jogging

Raymond Chen

Stay healthy out there, folks.

Feb 2, 2017
Post comments count 0
Post likes count 1

Are DDE and WM_COPYDATA related as IPC mechanisms?

Raymond Chen

Specifically, is one dependent on the other?

Feb 1, 2017
Post comments count 0
Post likes count 0

I wasn’t fooled into thinking the Star Wars trench run was along the equatorial trench, but I was fooled anyway

Raymond Chen

I thought it was a different route entirely.

Feb 1, 2017
Post comments count 0
Post likes count 1

How am I supposed to free the information passed to the SetSecurityInfo function?

Raymond Chen

You allocated it. You get to free it.

Jan 31, 2017
Post comments count 0
Post likes count 1

Why does my Surface power brick keep blinking on and off?

Raymond Chen

Power negotiations break down.

Jan 30, 2017
Post comments count 0
Post likes count 1

Creating an object on the other side of the airtight hatchway isn’t yet a security vulnerability

Raymond Chen

What can you do with that object?

Jan 27, 2017
Post comments count 0
Post likes count 2

How can a COM local server keep itself alive even though there are no active clients?

Raymond Chen

CoAddRefServerProcess to the rescue.

Jan 26, 2017
Post comments count 0
Post likes count 2

How can I control the directory from which my delay-loaded DLL is loaded?

Raymond Chen

Use the hook.

Jan 25, 2017
Post comments count 0
Post likes count 1

Are there alternatives to _lock and _unlock in Visual Studio 2015?

Raymond Chen

This is unlikely to work.

Jan 24, 2017
Post comments count 0
Post likes count 1

Why do my program’s notifications sometimes show a small icon, and sometimes a large icon?

Raymond Chen

And why does it sometimes show the program name?

Jan 23, 2017
Post comments count 0
Post likes count 2

How do I prevent users from terminating a service?

Raymond Chen

Use the ACL.

Jan 20, 2017
Post comments count 0
Post likes count 1

How important is it nowadays to ensure that all my DLLs have non-conflicting base addresses?

Raymond Chen

Not so much, since ASLR changes it anyway.

Jan 19, 2017
Post comments count 0
Post likes count 1

A fine detail on how DLLs are relocated as the result of a base address collision, and consequences

Raymond Chen

Fixed up as necessary, but only as necessary.

Jan 18, 2017
Post comments count 0
Post likes count 1

Does ASLR relocate all DLLs by the same offset?

Raymond Chen

No.

Jan 17, 2017
Post comments count 0
Post likes count 1

Microspeak: ladder up

Raymond Chen

Let's puzzle it out.

Jan 16, 2017
Post comments count 0
Post likes count 1

How come my CreateMutex call sometimes fails with Access denied?

Raymond Chen

Because the creator didn't grant you access.

Jan 13, 2017
Post comments count 0
Post likes count 2

A survey of the various ways of declaring pages of memory to be uninteresting

Raymond Chen

Let me tell you how much I don't care.

Jan 12, 2017
Post comments count 0
Post likes count 1

How do I detect Windows 10 if I cannot GetProcAddress for the function IsWindows10OrGreater?

Raymond Chen

Just like in a cheesy movie, the answer was inside you all along.

Jan 11, 2017
Post comments count 0
Post likes count 1

Applying a permutation to a vector, part 6

Raymond Chen

Completing an earlier exercise: The reverse permutation.

Jan 10, 2017
Post comments count 0
Post likes count 1

Applying a permutation to a vector, part 5

Raymond Chen

Error checking.

Jan 9, 2017
Post comments count 0
Post likes count 1

Applying a permutation to a vector, part 4: What is the computational complexity of the apply_permutation function?

Raymond Chen

It's linear, though it doesn't look that way at first glance.

Jan 6, 2017
Post comments count 0
Post likes count 1

Sorting by indices, part 2: The Schwartzian transform

Raymond Chen

Decorate-sort-undecorate.

Jan 5, 2017
Post comments count 0
Post likes count 1

Sorting by indices, part 1

Raymond Chen

Putting things together.

Jan 4, 2017
Post comments count 0
Post likes count 1

Applying a permutation to a vector, part 3

Raymond Chen

Permuting more than just vectors.

Jan 3, 2017
Post comments count 0
Post likes count 1

Applying a permutation to a vector, part 2

Raymond Chen

To swap or not to swap. That is the question.

Jan 2, 2017
Post comments count 0
Post likes count 1

Applying a permutation to a vector, part 1

Raymond Chen

Tinkering with an algorithm.

Dec 30, 2016
Post comments count 0
Post likes count 1

2016 year-end link clearance

Raymond Chen

Another year.

Dec 30, 2016
Post comments count 0
Post likes count 1

The invisible work of preparing PC BIOSes for the year 2000

Raymond Chen

Nursing the BIOS into the new century.

Dec 29, 2016
Post comments count 0
Post likes count 1

The evolution of the text size limits related to the standard static control

Raymond Chen

Smaller, then bigger.

Dec 28, 2016
Post comments count 0
Post likes count 1

The case of the four unlabeled toggle buttons

Raymond Chen

Make up whatever you like.

Dec 27, 2016
Post comments count 0
Post likes count 1

Why don’t I get properly translated program output after installing the corresponding language pack?

Raymond Chen

There's localization and there's localization.

Dec 26, 2016
Post comments count 0
Post likes count 1

Wireless AC is, unfortunately, not what it sounds like

Raymond Chen

The strange naming conventions of IEEE 802.11 standards.

Dec 23, 2016
Post comments count 0
Post likes count 1

The mother lode of well-known SIDs

Raymond Chen

Jackpot.

Dec 22, 2016
Post comments count 0
Post likes count 2

Another pattern for using the InitOnce functions

Raymond Chen

The synchronous two-phase initialization.

Dec 21, 2016
Post comments count 0
Post likes count 1

What is the maximum numeric value for a socket, and what is the maximum number of sockets a Windows program can create?

Raymond Chen

You can create as many as you want, subject to the usual resource constraints.

Dec 20, 2016
Post comments count 0
Post likes count 1

If you ask robocopy to destroy the destination, then it will destroy the destination

Raymond Chen

Be careful what you ask for. You might get it.

Dec 19, 2016
Post comments count 0
Post likes count 1

Why can’t VarDateFromStr parse back a Hungarian date that was generated by VarBstrFromDate?

Raymond Chen

Parsing is hard. Date parsing doubly so.

Dec 16, 2016
Post comments count 0
Post likes count 1

My colleague who thought he held the unofficial record for consecutive months of skiing

Raymond Chen

He stumbled upon an entire community of like-minded skiers.

Dec 15, 2016
Post comments count 0
Post likes count 1

How bad is it to delay closing a thread handle for a long time after the thread has exited?

Raymond Chen

Not too bad, as long as you don't make a habit of it.

Dec 14, 2016
Post comments count 0
Post likes count 1

Dubious security vulnerability: Discovering the salt

Raymond Chen

The salt is not a secret.

Dec 13, 2016
Post comments count 0
Post likes count 1

Can a server-side Web application trigger the creation of thumbs.db files?

Raymond Chen

Probably not.

Dec 12, 2016
Post comments count 0
Post likes count 1

Why does tapping the Alt key cause my owner-draw static control to repaint?

Raymond Chen

Time to draw the underlines.

Dec 9, 2016
Post comments count 0
Post likes count 1

Answers to a customer’s questions about memory and DLLs

Raymond Chen

Simple questions and hopefully simple answers.

Dec 8, 2016
Post comments count 0
Post likes count 1

What is this race condition that the OpenMutex documentation is trying to warn me about?

Raymond Chen

Open it, but it won't come.

Dec 7, 2016
Post comments count 0
Post likes count 1

Why don’t I get a broken pipe when the child process terminates?

Raymond Chen

The pipe isn't broken yet.

Dec 6, 2016
Post comments count 0
Post likes count 1

How can I reset a PC if I forgot the administrator password?

Raymond Chen

What I reboot three times is true.

Dec 5, 2016
Post comments count 0
Post likes count 4

The case of the unexpected ERROR_ACCESS_DENIED when calling MapViewOfFile

Raymond Chen

Mind those weakly-typed integers.

Dec 2, 2016
Post comments count 0
Post likes count 1

Why do I get a _BLOCK_TYPE_IS_VALID debug assertion failure when I try to delete a WIC pixel buffer?

Raymond Chen

Because that's not your pixel buffer.

Dec 1, 2016
Post comments count 0
Post likes count 1

What is __wchar_t (with the leading double underscores) and why am I getting errors about it?

Raymond Chen

It's the internal wchar_t.

Nov 30, 2016
Post comments count 0
Post likes count 1

What could be happening in Safe Mode to make my heap corruption bug go away?

Raymond Chen

It's more about what's not happening.

Nov 29, 2016
Post comments count 0
Post likes count 1

The case of the volume label that doesn’t change

Raymond Chen

Who can read it?

Nov 28, 2016
Post comments count 0
Post likes count 1

If I simply want to create a registry key but don’t intend to do anything else with it, what security access mask should I ask for?

Raymond Chen

If you need nothing, then ask for nothing.

Nov 25, 2016
Post comments count 0
Post likes count 0

The Gävle Goat is now 50 years old

Raymond Chen

Welcome to Gävle. Please don't burn down our goat.

Nov 25, 2016
Post comments count 0
Post likes count 1

Lock free many-producer/single-consumer patterns: A work queue of distinct events, FIFO

Raymond Chen

No cutting in line.

Nov 24, 2016
Post comments count 0
Post likes count 0

Turkeys Away: An Oral History

Raymond Chen

The most famous sitcom Thanksgiving Day episode.

Nov 24, 2016
Post comments count 0
Post likes count 1

Lock free many-producer/single-consumer patterns: A work queue of distinct events, order not important

Raymond Chen

Each one is different in its own special way, but we don't care what order they are processed.

Nov 23, 2016
Post comments count 0
Post likes count 1

Lock free many-producer/single-consumer patterns: A work queue of identical non-coalescable events

Raymond Chen

They're all the same, but each one counts.

Nov 22, 2016
Post comments count 0
Post likes count 1

Lock free many-producer/single-consumer patterns: A work queue where the last one wins

Raymond Chen

There can be more than one, but only the last one counts.

Nov 21, 2016
Post comments count 0
Post likes count 1

Lock free many-producer/single-consumer patterns: A work queue with task coalescing

Raymond Chen

Starting out simple.

Nov 18, 2016
Post comments count 0
Post likes count 2

Why does calling SetForegroundWindow immediately followed by GetForegroundWindow not return the same window back?

Raymond Chen

Because it's not the foreground window... yet.

Nov 17, 2016
Post comments count 0
Post likes count 1

Is RunAsInvoker a secret, even higher UAC setting?

Raymond Chen

Actually, it's a secret even lower UAC setting.

Nov 16, 2016
Post comments count 0
Post likes count 1

When you decide to travel at the speed of light, you have to accept the consequences

Raymond Chen

Lots of things break down.

Nov 15, 2016
Post comments count 0
Post likes count 1

The speed of light is unlikely to improve: consequences

Raymond Chen

The limits of resolution.

Nov 14, 2016
Post comments count 0
Post likes count 1

What does the shield over a WiFi network mean?

Raymond Chen

It means that the network is not secure.

Nov 11, 2016
Post comments count 0
Post likes count 1

The long-awaited Redmond Costco opens today, and some useless Costco trivia

Raymond Chen

Home sweet home.

Nov 11, 2016
Post comments count 0
Post likes count 1

If you don’t blow up a debug session every so often, you’re not debugging hard enough

Raymond Chen

Life on the edge.

Nov 10, 2016
Post comments count 0
Post likes count 1

Under what circumstances will GetProcessTimes report that a process exited before it was created?

Raymond Chen

If it hasn't exited yet.

Nov 9, 2016
Post comments count 0
Post likes count 1

Zeroing out my memory does cause them to page in faster after all

Raymond Chen

Thanks to a special check in the memory manager.

Nov 8, 2016
Post comments count 0
Post likes count 1

Why do my file creation, access, or modified time disappear if I set it to midnight on January 1, 1980?

Raymond Chen

Mind the epoch.

Nov 7, 2016
Post comments count 0
Post likes count 1

How do I programmatically add a folder to my Documents library?

Raymond Chen

You can use SHAddFolderPathToLibrary, but there's a catch.

Nov 4, 2016
Post comments count 0
Post likes count 1

Why is my crash dump file filled with 0xAAAAAAAA?

Raymond Chen

No, it's just that the original data was scrubbed out.

Nov 3, 2016
Post comments count 0
Post likes count 1

Solving the problem instead of answering the question: How do I get this RichEdit control to look just like a static control?

Raymond Chen

That's not your problem.

Nov 2, 2016
Post comments count 0
Post likes count 1

What happens if you call RevertToSelf when not impersonating?

Raymond Chen

Nothing, but be careful.

Nov 1, 2016
Post comments count 0
Post likes count 0

Windows file system compression had to be dumbed down

Raymond Chen

Adjusting the trade-off.

Oct 31, 2016
Post comments count 0
Post likes count 1

This processor has no stack (insert spooky laughter)

Raymond Chen

Nothing to push here.

Oct 28, 2016
Post comments count 0
Post likes count 1

Why does SetThreadPriority sometimes take a really long time?

Raymond Chen

Because you asked for it.

Oct 27, 2016
Post comments count 0
Post likes count 1

How to electrify your own fence: ProcessStrictHandleCheckPolicy

Raymond Chen

Don't touch that; it's a live wire.

Oct 26, 2016
Post comments count 0
Post likes count 1

Why does the documentation for ReadFile say that the lpNumberOfBytesRead parameter is optional when it is sometimes mandatory?

Raymond Chen

In the fine print, due to incomplete expressiveness.

Oct 25, 2016
Post comments count 0
Post likes count 1

Microspeak: lift up

Raymond Chen

Take a look around you.

Oct 24, 2016
Post comments count 0
Post likes count 1

Why is Identical COMDAT Folding called Identical COMDAT Folding?

Raymond Chen

Common data, as in FORTRAN.

Oct 21, 2016
Post comments count 0
Post likes count 1

Is there anything better than GetThreadTimes for obtaining per-thread CPU usage information?

Raymond Chen

QueryThreadCycleTime.

Oct 20, 2016
Post comments count 0
Post likes count 1

Using DuplicateHandle to help manage the ownership of kernel handles

Raymond Chen

That one's mine.

Oct 19, 2016
Post comments count 0
Post likes count 1

Three short questions about LogonUser (with answers!)

Raymond Chen

The answers are probably the most useful part.

Oct 18, 2016
Post comments count 0
Post likes count 1

Was it intentional that the Media Control Interface has the same acronym as a telecommunications company?

Raymond Chen

Why yes, actually.

Oct 17, 2016
Post comments count 0
Post likes count 3

The Windows 8.1 ship-it awards were yellow

Raymond Chen

Code name Blue.

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

How can I force memory to be allocated above the 4GB boundary (for debugging purposes) on Windows 7?

Raymond Chen

Sadly, no easy solution.

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

Dubious security vulnerability: Attacking the application directory in order to fool yourself?

Raymond Chen

Look over there. Ha ha made you look.

Oct 12, 2016
Post comments count 0
Post likes count 2

Nasty gotcha: The inadvertently named resource

Raymond Chen

No such thing as undefined.

Oct 11, 2016
Post comments count 0
Post likes count 1

Oh, you’re with them?

Raymond Chen

Unconscious biases in the workplace.

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

A Little Program to fix one particular type of mojibake

Raymond Chen

Keep your eye on the code page.

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

How can I get the default code page for a locale?

Raymond Chen

Ask GetLocaleInfo.

Oct 6, 2016
Post comments count 0
Post likes count 1

How do I cancel autoplay from a wizard page?

Raymond Chen

You need to listen on the top-level window.

Oct 5, 2016
Post comments count 0
Post likes count 1

Why doesn’t my custom-drawn trackbar get a paint notification when the position changes from 1 to 0?

Raymond Chen

It had no visible effect.

Oct 4, 2016
Post comments count 0
Post likes count 0

Wow, that’s amazing. You got Picabo Street and Alberto Tomba to autograph the same poster!

Raymond Chen

Partly true.

Oct 3, 2016
Post comments count 0
Post likes count 1

You can register your child’s name in any language providing you use any Unicode character

Raymond Chen

Happy birthday, Unicode!

Sep 30, 2016
Post comments count 0
Post likes count 1

When are global objects constructed and destructed by Visual C++?, redux

Raymond Chen

Adding another column to the table.

Sep 29, 2016
Post comments count 0
Post likes count 1

The lackey catastrophe

Raymond Chen

You know it will be done, but you don't know when.

Sep 28, 2016
Post comments count 0
Post likes count 1

When can you free the memory backing the HSTRING you created with WindowsCreateStringReference?

Raymond Chen

Nothing you haven't had to deal with already.

Sep 27, 2016
Post comments count 0
Post likes count 1

What’s up with Windows developer tools being written in perl?

Raymond Chen

It's socially acceptable.

Sep 26, 2016
Post comments count 0
Post likes count 1

It says that I should use USB usage page 1 and usage 6 to get raw keyboard data, but what if I have a PS/2 keyboard?

Raymond Chen

The numbers came from the USB HID specification, but that doesn't require the keyboard to be USB.

Sep 23, 2016
Post comments count 0
Post likes count 1

When you break into a user-mode application in the kernel debugger, how do you connect a user-mode debugger?

Raymond Chen

Make the program its own bridge.

Sep 22, 2016
Post comments count 0
Post likes count 1

Dither me this

Raymond Chen

Where did the error go?

Sep 21, 2016
Post comments count 0
Post likes count 1

The case of the system() call that returned before finishing

Raymond Chen

Study the output more carefully.

Sep 20, 2016
Post comments count 0
Post likes count 1

The social skills of a thermonuclear device: Ruining a conversation

Raymond Chen

The party's over.

Sep 19, 2016
Post comments count 0
Post likes count 1

It’s an unfortunate choice of data type for the file system redirection cookie

Raymond Chen

The untyped pointer strikes again.

Sep 16, 2016
Post comments count 0
Post likes count 1

Does the page table entry really have a sad-face for pages that are reserved?

Raymond Chen

Not exactly, but it's not as silly a question as it sounds.

Sep 15, 2016
Post comments count 0
Post likes count 1

Decoding the parameters of a thrown C++ exception (0xE06D7363), revisited

Raymond Chen

The mysterious second parameter.

Sep 14, 2016
Post comments count 0
Post likes count 1

What exactly does the msWindowLength parameter to SetThreadpoolTimer mean?

Raymond Chen

It's the maximum delay, but never the maximum anticipation.

Sep 13, 2016
Post comments count 0
Post likes count 2

What are these ghost drivers named dump_diskdump.sys and other dump_*.sys that didn’t come from any file?

Raymond Chen

Send in the clones.

Sep 12, 2016
Post comments count 0
Post likes count 1

How can I have a window that rejects activation but still receives pointer input?

Raymond Chen

The obscure return values of the WM_MOUSEACTIVATE message.

Sep 9, 2016
Post comments count 0
Post likes count 1

How can I get the memory manager to prefetch bigger chunks of data from my memory-mapped file?

Raymond Chen

Explicit prefetch.

Sep 8, 2016
Post comments count 0
Post likes count 2

How can I change a registry key from within the debugger?

Raymond Chen

There's the hard way and the easy way.

Sep 7, 2016
Post comments count 0
Post likes count 1

If I zero out my memory pages, does that make them page in faster?

Raymond Chen

Not really.

Sep 6, 2016
Post comments count 0
Post likes count 1

How to get people who installed a leaked build to stop using that build?

Raymond Chen

Change the wallpaper.

Sep 5, 2016
Post comments count 0
Post likes count 0

The complicated engineering behind an ice cream social

Raymond Chen

Lost in translation.

Sep 2, 2016
Post comments count 0
Post likes count 1

A customer question about shortcuts that don’t have a target path

Raymond Chen

Digging into the question to find the solution.

Aug 31, 2016
Post comments count 0
Post likes count 1

The ship date predictor: Redux

Raymond Chen

Each project is different.

Aug 30, 2016
Post comments count 0
Post likes count 1

What is the NTDiskQuotaSidCache.ndx file for?

Raymond Chen

It's the SID cache for the disk quota control panel.

Aug 29, 2016
Post comments count 0
Post likes count 1

Detecting what language or script a run of text is written in, redux

Raymond Chen

One step closer to actually doing it.

Aug 26, 2016
Post comments count 0
Post likes count 2

Spurious wakes, race conditions, and bogus FIFO claims: A peek behind the curtain of WaitOnAddress

Raymond Chen

Watch the gears turn.

Aug 25, 2016
Post comments count 0
Post likes count 0

Soarin’ over California + Seattle = Wings over Washington

Raymond Chen

I wonder what it's like.

Aug 25, 2016
Post comments count 0
Post likes count 3

Implementing a critical section in terms of WaitOnAddress

Raymond Chen

Building things out of other things.

Aug 24, 2016
Post comments count 0
Post likes count 0

The International Fair Play Committee announces the Rio 2016 Fair Play Awards, but spends most of the time congratulating themselves

Raymond Chen

Sporteaucratic nonsense.

Aug 24, 2016
Post comments count 0
Post likes count 2

Implementing a synchronization barrier in terms of WaitOnAddress

Raymond Chen

Kicking the tires by building another kind of tire.

Aug 23, 2016
Post comments count 0
Post likes count 3

WaitOnAddress lets you create a synchronization object out of any data variable, even a byte

Raymond Chen

Pick a byte, any byte.

Aug 22, 2016
Post comments count 0
Post likes count 1

Adventures in application compatibility: The bogus memory calculation

Raymond Chen

Let's add some numbers together, shall we?

Aug 19, 2016
Post comments count 0
Post likes count 1

Is it okay to call TryAcquireSRWLock from a thread that has already acquired the lock?

Raymond Chen

No.

Aug 18, 2016
Post comments count 0
Post likes count 1

If I have a modeless dialog box with custom accelerators, which should I call first: IsDialogMessage or TranslateAccelerator

Raymond Chen

Only one way works.

Aug 17, 2016
Post comments count 0
Post likes count 1

On installing a custom unhandled exception filter and intentionally raising an exception to get its attention

Raymond Chen

Mind those stack frames.

Aug 16, 2016
Post comments count 0
Post likes count 3

There are really only two effectively distinct settings for the UAC slider

Raymond Chen

Off and on.

Aug 15, 2016
Post comments count 0
Post likes count 1

Things I learned from my recent trip to Vancouver

Raymond Chen

It's not butter.

Aug 15, 2016
Post comments count 0
Post likes count 1

How can I debug a function that has been subjected to COMDAT folding?

Raymond Chen

The easy way is to mutate the function.

Aug 12, 2016
Post comments count 0
Post likes count 1

On the importance of making sure WaitForInputIdle doesn’t think you’re idle, episode 2

Raymond Chen

WaitForInputIdle is how the shell knows that your DDE server.

Aug 11, 2016
Post comments count 0
Post likes count 1

I’m speaking at the brand new Microsoft Canada Excellence Centre tomorrow

Raymond Chen

But only for Microsoft employees, sorry.

Aug 11, 2016
Post comments count 0
Post likes count 1

On the importance of making sure WaitForInputIdle doesn’t think you’re idle, episode 1

Raymond Chen

WaitForInputIdle is how the shell knows that your DDE server.

Aug 10, 2016
Post comments count 0
Post likes count 1

How to create a file mapping that allows others to open the file in exclusive mode?

Raymond Chen

This is a job for opportunistic locks.

Aug 9, 2016
Post comments count 0
Post likes count 1

What is a ZDP, and what’s so Z about it?

Raymond Chen

Zero Day Package, but not that kind of zero day.

Aug 8, 2016
Post comments count 0
Post likes count 1

Why didn’t Windows 95 suck the brains out of the XMS driver?

Raymond Chen

It was working fine up until now.

Aug 5, 2016
Post comments count 0
Post likes count 1

The case of the hung Explorer window

Raymond Chen

Decoding the deadlock.

Aug 4, 2016
Post comments count 0
Post likes count 2

The origin story of the Microsoft ninjacat

Raymond Chen

So it begins.

Aug 3, 2016
Post comments count 0
Post likes count 2

Using #pragma detect_mismatch to help catch ODR violations

Raymond Chen

There can be more than one, but they must be the same.

Aug 2, 2016
Post comments count 0
Post likes count 1

Why don’t I get a file deletion confirmation warning from Explorer when I undo a copy?

Raymond Chen

Because this is not really a deletion operation.

Aug 1, 2016
Post comments count 0
Post likes count 1

How do I disable edge gestures when my window is full screen?

Raymond Chen

System.EdgeGesture.DisableTouchWhenFullscreen.

Jul 29, 2016
Post comments count 0
Post likes count 1

Further discussion of the synchronization barrier

Raymond Chen

It's really just a switch.

Jul 28, 2016
Post comments count 0
Post likes count 1

How can I check whether a parameter is a pointer to a stack variable?

Raymond Chen

Check it against the thread limits.

Jul 27, 2016
Post comments count 0
Post likes count 1

Why does setting the horizontal scroll bar range for the first time also set the vertical range, and vice versa?

Raymond Chen

An attempt at delay-initialization.

Jul 26, 2016
Post comments count 0
Post likes count 1

Why does sharing a folder in Explorer grant full permission on the share to everyone?

Raymond Chen

The ACLs will do the work.

Jul 25, 2016
Post comments count 0
Post likes count 1

Is there a Windows API for IntelliSense?

Raymond Chen

That's not really an operating system thing.

Jul 22, 2016
Post comments count 0
Post likes count 1

What is the significance of changing the registration for CLSIDs to point to a private copy of MSXML3?

Raymond Chen

You hijacked the CLSID, which is not going to end well.

Jul 20, 2016
Post comments count 0
Post likes count 1

Microspeak: Tick-tock

Raymond Chen

Who's doing what when?

Jul 19, 2016
Post comments count 0
Post likes count 1

Having trouble with Windows Hello face recognition? Try a Jedi mind trick!

Raymond Chen

This is the user you are looking for.