The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

The Gävle Goat (Gävlebocken) succumbs in 2025 to a new menace
Dec 29, 2025
Post comments count 2
Post likes count 1

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

Raymond Chen
Raymond Chen

You could blow me over.

How can I detect that the system is running low on memory? Or that my job is running low on memory?
Dec 29, 2025
Post comments count 0
Post likes count 1

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

Raymond Chen
Raymond Chen

You can register for a memory notification.

Why are we worried about memory access semantics? Full barriers should be enough for anybody
Dec 26, 2025
Post comments count 5
Post likes count 4

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

Raymond Chen
Raymond Chen

You have to find new ways of going faster.

Reading the fine print, episode 4: Holiday promotions
Dec 25, 2025
Post comments count 4
Post likes count 3

Reading the fine print, episode 4: Holiday promotions

Raymond Chen
Raymond Chen

Checking those validity dates.

Why is the last letter of my string not making it to the clipboard?
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
Raymond Chen

The struggle for null termination.

Why does my <KBD>Ctrl</KBD>+<KBD>M</KBD> accelerator key activate when I press the <KBD>Enter</KBD> key?
Dec 24, 2025
Post comments count 1
Post likes count 5

Why does my <KBD>Ctrl</KBD>+<KBD>M</KBD> accelerator key activate when I press the <KBD>Enter</KBD> key?

Raymond Chen
Raymond Chen

Understanding the difference between keys and characters for accelerators.

When irate product support customers demand to speak to Bill Gates
Dec 23, 2025
Post comments count 4
Post likes count 4

When irate product support customers demand to speak to Bill Gates

Raymond Chen
Raymond Chen

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

All the other cool languages have <CODE>try</CODE>…<CODE>finally</CODE>. C++ says “We have <CODE>try</CODE>…<CODE>finally</CODE> at home.”
Dec 22, 2025
Post comments count 26
Post likes count 8

All the other cool languages have <CODE>try</CODE>…<CODE>finally</CODE>. C++ says “We have <CODE>try</CODE>…<CODE>finally</CODE> at home.”

Raymond Chen
Raymond Chen

The destructor serves as the "finally".

A shortcut gives me a weird path for a program shortcut that doesn’t point to the executable, so what is it?
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
Raymond Chen

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

Concluding thoughts on our deep dive into Windows clipboard text conversion
Dec 18, 2025
Post comments count 10
Post likes count 4

Concluding thoughts on our deep dive into Windows clipboard text conversion

Raymond Chen
Raymond Chen

Stick to Unicode and you'll be fine.

Deducing the consequences of Windows clipboard text formats on UTF-8
Dec 17, 2025
Post comments count 3
Post likes count 4

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

Raymond Chen
Raymond Chen

Working out the implications.

Why is the Windows clipboard taking the scenic route when converting from <CODE>CF_<WBR>TEXT</CODE> to <CODE>CF_<WBR>OEM­TEXT</CODE>?
Dec 16, 2025
Post comments count 3
Post likes count 2

Why is the Windows clipboard taking the scenic route when converting from <CODE>CF_<WBR>TEXT</CODE> to <CODE>CF_<WBR>OEM­TEXT</CODE>?

Raymond Chen
Raymond Chen

Something is forcing it down an alternate path.

Misunderstanding what the Cricket Celebration Bowl is
Dec 15, 2025
Post comments count 3
Post likes count 1

Misunderstanding what the Cricket Celebration Bowl is

Raymond Chen
Raymond Chen

Apparently, not a bowl of crickets.

The Windows clipboard automatic text conversion algorithm is path-dependent
Dec 15, 2025
Post comments count 1
Post likes count 4

The Windows clipboard automatic text conversion algorithm is path-dependent

Raymond Chen
Raymond Chen

When the journey is not half of the fun.

Resolving an ambiguity in the Windows clipboard automated text conversion table
Dec 12, 2025
Post comments count 8
Post likes count 3

Resolving an ambiguity in the Windows clipboard automated text conversion table

Raymond Chen
Raymond Chen

Who goes first?

Studying the various locale mismatch scenarios in Windows clipboard text format synthesis
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
Raymond Chen

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

How does Windows synthesize the <CODE>CF_<WBR>LOCALE</CODE> clipboard format?
Dec 10, 2025
Post comments count 1
Post likes count 1

How does Windows synthesize the <CODE>CF_<WBR>LOCALE</CODE> clipboard format?

Raymond Chen
Raymond Chen

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

How does Windows synthesize <CODE>CF_<WBR>UNICODE­TEXT</CODE> from <CODE>CF_<WBR>TEXT</CODE> and vice versa?
Dec 9, 2025
Post comments count 2
Post likes count 2

How does Windows synthesize <CODE>CF_<WBR>UNICODE­TEXT</CODE> from <CODE>CF_<WBR>TEXT</CODE> and vice versa?

Raymond Chen
Raymond Chen

Let's ask the locale.

How does Windows synthesize <CODE>CF_<WBR>OEM­TEXT</CODE> from <CODE>CF_<WBR>TEXT</CODE> and vice versa?
Dec 8, 2025
Post comments count 11
Post likes count 3

How does Windows synthesize <CODE>CF_<WBR>OEM­TEXT</CODE> from <CODE>CF_<WBR>TEXT</CODE> and vice versa?

Raymond Chen
Raymond Chen

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

How can my process read its own standard output?
Dec 5, 2025
Post comments count 11
Post likes count 3

How can my process read its own standard output?

Raymond Chen
Raymond Chen

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

How can I read the standard output of an already-running process?
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
Raymond Chen

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

How do I check whether the user has permission to create files in a directory?
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
Raymond Chen

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

Microspeak: Big rocks
Dec 2, 2025
Post comments count 3
Post likes count 2

Microspeak: Big rocks

Raymond Chen
Raymond Chen

The large obstacles.

How do I get my edit control text to be autoselected when I choose it to be the default focus in my dialog?
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
Raymond Chen

Remembering some old APIs.

How can I have a Win32 drop-down combo box with a read-only edit control?
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
Raymond Chen

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

Message-only windows are for messaging, not as a convenient victim for hosting UI
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
Raymond Chen

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

At what point in the Windows development cycle is it too late to change the text of a translatable string?
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
Raymond Chen

The translation team sets the deadline.

The apocryphal origins of the Hot Dog Stand color scheme
Nov 25, 2025
Post comments count 7
Post likes count 5

The apocryphal origins of the Hot Dog Stand color scheme

Raymond Chen
Raymond Chen

Challenge accepted.

Why does XAML break down when I have an element that is half a billion pixels tall?
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
Raymond Chen

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

Maybe somebody can explain to me how weak references solve the ODR problem
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
Raymond Chen

I don't see it.

In the commit-on-demand pattern, what happens if an access violation straddles multiple pages?
Nov 20, 2025
Post comments count 11
Post likes count 2

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

Raymond Chen
Raymond Chen

The access violation exceptions will continue until commit improves.

Is <CODE>Write­Process­Memory</CODE> faster than shared memory for transferring data between two processes?
Nov 19, 2025
Post comments count 3
Post likes count 8

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

Raymond Chen
Raymond Chen

Shared memory is the copy-free solution.

Microspeak: Little-r
Nov 18, 2025
Post comments count 1
Post likes count 5

Microspeak: Little-r

Raymond Chen
Raymond Chen

Harkening back to a very old mail program.

How can I detect that Windows is running in S-Mode, redux
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
Raymond Chen

Doing it on hard mode.

I can use <CODE>WM_<WBR>COPY<WBR>DATA</CODE> to send a block of data to another window, but how does it send data back?
Nov 14, 2025
Post comments count 9
Post likes count 3

I can use <CODE>WM_<WBR>COPY<WBR>DATA</CODE> to send a block of data to another window, but how does it send data back?

Raymond Chen
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.

Could we use CTAD to simplify the use of WRL’s Callback function?
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
Raymond Chen

Not directly, but maybe indirectly.

Non-recursively deleting a binary tree in constant space: Rotating the tree
Nov 12, 2025
Post comments count 5
Post likes count 5

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

Raymond Chen
Raymond Chen

Preserving in-order while linearizing.

Behind the scenes on how Windows 95 application compatibility patched broken programs
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
Raymond Chen

Replacing bytes with the greatest of care.

How did Windows 3.1 distinguish two different programs that happened to share the same executable name?
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
Raymond Chen

The trouble with disambiguation.

Non-recursively deleting a binary tree in constant space: Restructuring the tree
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
Raymond Chen

Changing the tree structure to make it easier to delete.

Non-recursively deleting a binary tree in constant space: Synthesizing the parent pointer
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
Raymond Chen

Making one as you go.

Non-recursively deleting a binary tree in constant space: Traversal with parent pointers
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
Raymond Chen

First assume that you have a parent pointer.

The Microsoft SoftCard for the Apple II: Getting two processors to share the same memory
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
Raymond Chen

Reportedly Microsoft's first hardware product.

Why does <CODE>SHFormat­Date­Time</CODE> take an unaligned <CODE>FILETIME</CODE>?
Nov 3, 2025
Post comments count 3
Post likes count 2

Why does <CODE>SHFormat­Date­Time</CODE> take an unaligned <CODE>FILETIME</CODE>?

Raymond Chen
Raymond Chen

Designed for its original use case.

Microspeak: turn into a pumpkin
Oct 31, 2025
Post comments count 4
Post likes count 1

Microspeak: turn into a pumpkin

Raymond Chen
Raymond Chen

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

Trying to build a XAML tree in code throws a “No installed components were detected” exception
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
Raymond Chen

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

What to do when you have a crash in the runtime control flow guard check
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
Raymond Chen

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

How did the Windows 95 user interface code get brought to the Windows NT code base?
Oct 28, 2025
Post comments count 18
Post likes count 9

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

Raymond Chen
Raymond Chen

Ported bit by bit.

Dubious security vulnerability: Denial of service by loading a very large file
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
Raymond Chen

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

The early history of the Windows Runtime PropertyValue and why there is a PropertyType.Inspectable that is never used
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
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.

Windows Runtime design principle: Properties can be set in any order
Oct 23, 2025
Post comments count 0
Post likes count 3

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

Raymond Chen
Raymond Chen

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

What makes <CODE>cheap_<WBR>steady_<WBR>clock</CODE> faster than <CODE>std::<WBR>chrono::<WBR>high_<WBR>resolution_<WBR>clock</CODE>?
Oct 22, 2025
Post comments count 7
Post likes count 3

What makes <CODE>cheap_<WBR>steady_<WBR>clock</CODE> faster than <CODE>std::<WBR>chrono::<WBR>high_<WBR>resolution_<WBR>clock</CODE>?

Raymond Chen
Raymond Chen

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

Microspeak: The hockey stick on wheels
Oct 21, 2025
Post comments count 1
Post likes count 2

Microspeak: The hockey stick on wheels

Raymond Chen
Raymond Chen

You're always a year away.

What about the icons in pifmgr.dll?
Oct 20, 2025
Post comments count 15
Post likes count 6

What about the icons in pifmgr.dll?

Raymond Chen
Raymond Chen

Just for fun.

Using RAII to remedy a defect where not all code paths performed required exit actions, follow-up
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
Raymond Chen

If the callback requires copyability.

Using RAII to remedy a defect where not all code paths performed required exit actions
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
Raymond Chen

Passing the obligation onward.

Why can you increment a reference count with relaxed semantics, but you have to decrement with release semantics?
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
Raymond Chen

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

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?
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
Raymond Chen

You copied the green screen.

API design principle: Don’t tempt people to divide by zero
Oct 13, 2025
Post comments count 4
Post likes count 3

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

Raymond Chen
Raymond Chen

Remove it from the equation.

The self-assignment principle for Windows Runtime properties: Don’t change behavior based on whether a property has been written to
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
Raymond Chen

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

The self-assignment principle for Windows Runtime properties applies to default values
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
Raymond Chen

The default value must be legal.

Windows Runtime API design principles around read-write properties: Idempotence and self-assignment
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
Raymond Chen

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

Remembering the end of support for VRML in Internet Explorer
Oct 7, 2025
Post comments count 6
Post likes count 2

Remembering the end of support for VRML in Internet Explorer

Raymond Chen
Raymond Chen

No one left standing.

Code comments should apply to the state of the system at the point the comment “executes”
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
Raymond Chen

Putting them in the flow.

Can we get weak functions for static linking? The Visual C++ compiler says “We have weak functions at home”
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
Raymond Chen

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

The problem with inferring from a function call operator is that there may be more than one
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
Raymond Chen

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

How do I convert a <CODE>FILETIME</CODE> to a C++ clock like <CODE>std::system_clock</CODE> or <CODE>winrt::clock</CODE>?
Oct 1, 2025
Post comments count 1
Post likes count 3

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

Raymond Chen
Raymond Chen

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

Microspeak: Convicted
Sep 30, 2025
Post comments count 9
Post likes count 1

Microspeak: Convicted

Raymond Chen
Raymond Chen

False backformation.

How can I enumerate the overflow icons in the Notification Area without showing them?
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
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.

Why didn’t Windows 95 setup install a miniature Windows 95 so that it could be written as a 32-bit program?
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
Raymond Chen

Getting to the GUI quickly, and rebooting only once.

Samples note: Use comments to describe what code does, not what you wish the code would do
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
Raymond Chen

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

Why is Windows still tinkering with critical sections?
Sep 24, 2025
Post comments count 13
Post likes count 8

Why is Windows still tinkering with critical sections?

Raymond Chen
Raymond Chen

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

Another lesson learned from the Windows 98 on-stage USB blue screen
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
Raymond Chen

Test before using.

Why was Windows 3.0’s WinHelp called an online help system when it ran offline?
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
Raymond Chen

It was online in a different sense.

Learning to read C++ compiler errors: Not a legal base class
Sep 19, 2025
Post comments count 1
Post likes count 1

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

Raymond Chen
Raymond Chen

What would make it an illegal base class?

Can I close a duplicate handle while I’m waiting on the original?
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
Raymond Chen

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

How can I get my shell thumbnail extractors to run in the same process?
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
Raymond Chen

Adding another level of indirection.

Translating the <CODE>STATUS_<WBR>STACK_<WBR>BUFFER_<WBR>OVERRUN</CODE> status code into customer-ready text
Sep 16, 2025
Post comments count 7
Post likes count 3

Translating the <CODE>STATUS_<WBR>STACK_<WBR>BUFFER_<WBR>OVERRUN</CODE> status code into customer-ready text

Raymond Chen
Raymond Chen

Reducing the level of alarm.

Why is the name of the Microsoft Wireless Notebook Presenter Mouse 8000 hard-coded into the Bluetooth drivers?
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
Raymond Chen

Is it some sort of favoritism?

How can I convert a third party in-process server so it runs in the COM surrogate?
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
Raymond Chen

You can put your own object in the surrogate first.

Why can’t <CODE>std::apply</CODE> figure out which overload I intend to use? Only one of then will work!
Sep 11, 2025
Post comments count 4
Post likes count 1

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

Raymond Chen
Raymond Chen

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

The documentation says that CompanyName version information is required, but my program seems to work without it, so how required is it?
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
Raymond Chen

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

A suggestion to people who assign nicknames to meeting rooms
Sep 9, 2025
Post comments count 11
Post likes count 3

A suggestion to people who assign nicknames to meeting rooms

Raymond Chen
Raymond Chen

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

Why didn’t Windows 95 simply special-case the laptops that locked up when it executed the <CODE>HLT</CODE> instruction?
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 <CODE>HLT</CODE> instruction?

Raymond Chen
Raymond Chen

The catastrophic risk of bricking a computer.

The case of the crash on a null pointer even though we checked it for null
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
Raymond Chen

Understanding what you're checking.

How can I write a C++/WinRT <CODE>IAsyncOperation<T></CODE> where <CODE>T</CODE> is not a Windows Runtime type?, part 2
Sep 4, 2025
Post comments count 1
Post likes count 3

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

Raymond Chen
Raymond Chen

Safer smuggling.

How can I write a C++/WinRT <CODE>IAsyncOperation<T></CODE> where <CODE>T</CODE> is not a Windows Runtime type?, part 1
Sep 3, 2025
Post comments count 1
Post likes count 3

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

Raymond Chen
Raymond Chen

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

Dubious security vulnerability: Remembering passwords for recently-opened ZIP files
Sep 2, 2025
Post comments count 7
Post likes count 1

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

Raymond Chen
Raymond Chen

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

Thoughts on creating a tracking pointer class, part 16: Second attempt to use a list
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
Raymond Chen

We can splice nodes to move them between lists.

Thoughts on creating a tracking pointer class, part 15: A custom shared pointer
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
Raymond Chen

Simplifying it for out limited use case.

Thoughts on creating a tracking pointer class, part 14: Nonthrowing moves with the shared tracking pointer
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
Raymond Chen

Moving the exception somewhere else.

Thoughts on creating a tracking pointer class, part 13: Restoring the strong exception guarantee
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
Raymond Chen

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

Thoughts on creating a tracking pointer class, part 12: A shared tracking pointer
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
Raymond Chen

Sharing a single tracking pointer among all instances.

Thoughts on creating a tracking pointer class, part 11: Repairing assignment
Aug 25, 2025
Post comments count 0
Post likes count 1

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

Raymond Chen
Raymond Chen

Restoring things that were automatically deleted.

Thoughts on creating a tracking pointer class, part 10: Proper conversion
Aug 22, 2025
Post comments count 0
Post likes count 1

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

Raymond Chen
Raymond Chen

Making sure you cannot remove qualifiers.

Thoughts on creating a tracking pointer class, part 9: Conversion
Aug 21, 2025
Post comments count 0
Post likes count 1

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

Raymond Chen
Raymond Chen

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

Thoughts on creating a tracking pointer class, part 8: Tracking const objects
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
Raymond Chen

Making tracking pointers to const objects.

Thoughts on creating a tracking pointer class, part 7: Non-modifying trackers, second try
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
Raymond Chen

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

Thoughts on creating a tracking pointer class, part 6: Non-modifying trackers
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
Raymond Chen

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

Thoughts on creating a tracking pointer class, part 5: Copying our tracking pointer
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
Raymond Chen

How to copy from a const tracking pointer.

Thoughts on creating a tracking pointer class, part 4: Using a circular doubly linked list
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
Raymond Chen

Building our own circular doubly-linked list.

Thoughts on creating a tracking pointer class, part 3: Using a <CODE>std::vector</CODE>
Aug 13, 2025
Post comments count 0
Post likes count 2

Thoughts on creating a tracking pointer class, part 3: Using a <CODE>std::vector</CODE>

Raymond Chen
Raymond Chen

Tracking your trackers with a vector.

Thoughts on creating a tracking pointer class, part 2: Using a <CODE>std::list</CODE>
Aug 12, 2025
Post comments count 3
Post likes count 2

Thoughts on creating a tracking pointer class, part 2: Using a <CODE>std::list</CODE>

Raymond Chen
Raymond Chen

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

Thoughts on creating a tracking pointer class, part 1: Concept art
Aug 11, 2025
Post comments count 1
Post likes count 3

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

Raymond Chen
Raymond Chen

Following an object as it moves.

Under what conditions could a <CODE>Read­File</CODE> or <CODE>Write­File</CODE> fail to transfer all of the bytes, and how do I detect that?
Aug 8, 2025
Post comments count 7
Post likes count 4

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

Raymond Chen
Raymond Chen

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

How can I detect that Windows is running in S-Mode?
Aug 7, 2025
Post comments count 11
Post likes count 4

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

Raymond Chen
Raymond Chen

Check the code integrity policy.

How do I disable pieces of the property sheet for a service in the Services MMC snap-in?
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
Raymond Chen

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

Why are Windows semiannual updates named H1 and H2?
Aug 5, 2025
Post comments count 24
Post likes count 5

Why are Windows semiannual updates named H1 and H2?

Raymond Chen
Raymond Chen

To address an unconscious bias.

How can I read more than 4GB of data from a file in a single call to <CODE>Read­File</CODE>?
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 <CODE>Read­File</CODE>?

Raymond Chen
Raymond Chen

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

Two related questions about keeping track of PIDs of IPC clients
Aug 1, 2025
Post comments count 2
Post likes count 1

Two related questions about keeping track of PIDs of IPC clients

Raymond Chen
Raymond Chen

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

A consequence of the weird <CODE>wReserved</CODE> value at the start of the <CODE>DECIMAL</CODE> structure
Jul 31, 2025
Post comments count 7
Post likes count 1

A consequence of the weird <CODE>wReserved</CODE> value at the start of the <CODE>DECIMAL</CODE> structure

Raymond Chen
Raymond Chen

It overwrites things by accident.

In C++/WinRT, how can I await multiple coroutines and capture the results?, part 0
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
Raymond Chen

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

Why is there a window with no name blocking Windows shutdown?
Jul 29, 2025
Post comments count 16
Post likes count 5

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

Raymond Chen
Raymond Chen

They never expected you to see it.

API design note: Don’t make up multiple names for the same thing
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
Raymond Chen

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

How can I confirm in the Windows debugger that I’m looking at a COMDAT-folded function?
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
Raymond Chen

Ask for all the names for an address.

How can I wait until a named object (say a mutex) is created?
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
Raymond Chen

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

Exploring possible solutions to the inconsistency in how Windows searches case-insensitively for named resources
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
Raymond Chen

Maintaining compatibility while addressing flaws.

Being more adamant about reporting that C++/WinRT was unable to resume execution on a dispatcher thread
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
Raymond Chen

Better versions in a different box.

What happens if C++/WinRT is unable to resume execution on a dispatcher thread?
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
Raymond Chen

What you get out of the box.

The case of the invalid instruction exception on an instruction that should never have executed
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
Raymond Chen

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

If the Window Runtime PropertyValue is for boxing non-inspectables, why is there a PropertyValue.CreateInspectable?
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
Raymond Chen

For completeness, but not for functionality.

The Fundamental Failure-Mode Theorem: Systems lie about their proper functioning
Jul 16, 2025
Post comments count 5
Post likes count 5

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

Raymond Chen
Raymond Chen

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

Perhaps not a recommended usage for an emergency power outlet
Jul 15, 2025
Post comments count 0
Post likes count 5

Perhaps not a recommended usage for an emergency power outlet

Raymond Chen
Raymond Chen

Maybe that's not a critical system.

There is a <CODE>std::<WBR>chrono::<WBR>high_<WBR>resolution_<WBR>clock</CODE>, but no <CODE>low_<WBR>resolution_<WBR>clock</CODE>
Jul 14, 2025
Post comments count 5
Post likes count 5

There is a <CODE>std::<WBR>chrono::<WBR>high_<WBR>resolution_<WBR>clock</CODE>, but no <CODE>low_<WBR>resolution_<WBR>clock</CODE>

Raymond Chen
Raymond Chen

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

Detecting and reporting all unhandled C++ exceptions as well as all unhandled structured exceptions
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
Raymond Chen

Closing another exit point.

Our first attempt to detect and report all unhandled C++ exceptions as well as all unhandled structured exceptions
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
Raymond Chen

Identifying and classifying the exit points.

When I install an unhandled structured exception filter, why doesn’t <CODE>std::<WBR>terminate</CODE> get called?
Jul 9, 2025
Post comments count 4
Post likes count 5

When I install an unhandled structured exception filter, why doesn’t <CODE>std::<WBR>terminate</CODE> get called?

Raymond Chen
Raymond Chen

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

A walkthrough of the original Microsoft Building 3
Jul 8, 2025
Post comments count 9
Post likes count 2

A walkthrough of the original Microsoft Building 3

Raymond Chen
Raymond Chen

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

Dubious security vulnerability: If I perform this complex series of manual steps, I can crash a program I am running
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
Raymond Chen

What security boundary did you cross?

Why doesn’t <CODE>LVIF_<WBR>INDENT</CODE> work without an image list?
Jul 4, 2025
Post comments count 4
Post likes count 1

Why doesn’t <CODE>LVIF_<WBR>INDENT</CODE> work without an image list?

Raymond Chen
Raymond Chen

Its original client had an image list.

German language cheat sheet: On changing quantities
Jul 3, 2025
Post comments count 13
Post likes count 0

German language cheat sheet: On changing quantities

Raymond Chen
Raymond Chen

How much there is, and how is it changing.

If the <CODE>Format­Message</CODE> function fails, and I requested that it allocate a buffer, do I have to free the buffer?
Jul 3, 2025
Post comments count 0
Post likes count 2

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

Raymond Chen
Raymond Chen

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

Unintended yet somehow entirely expected consequences of marking a COM interface as local
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
Raymond Chen

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

The sizzle reel that says things that nobody understands
Jul 1, 2025
Post comments count 0
Post likes count 1

The sizzle reel that says things that nobody understands

Raymond Chen
Raymond Chen

Failing to understand your audience.

2025 mid-year link clearance
Jun 30, 2025
Post comments count 1
Post likes count 2

2025 mid-year link clearance

Raymond Chen
Raymond Chen

Halfway there.

Embracing the power of the empty set in API design: Requesting zero items
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
Raymond Chen

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

Why do I get errors or warnings about some weird symbol called ?main@@YAHP$01E$AAV?$Array@PE$AAVString@Platform…, part 3
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
Raymond Chen

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

Why do I get errors about some weird symbol called ?main@@YAHP$01E$AAV?$Array@PE$AAVString@Platform…, part 2
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
Raymond Chen

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

Your information has been permanently deleted, for small values of permanently
Jun 25, 2025
Post comments count 8
Post likes count 4

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

Raymond Chen
Raymond Chen

Is it really gone?

Why do I get errors about some weird symbol called ?main@@YAHP$01E$AAV?$Array@PE$AAVString@Platform…, part 1
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
Raymond Chen

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

Abusing copyright strings to trick software into thinking it’s running on your competitor’s PC
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
Raymond Chen

I did technically cross my fingers.

The MIDL compiler still has trouble with double greater-than signs, sadly
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
Raymond Chen

Many have tried.

The case of the invalid handle error when a handle is closed while a thread is waiting on it
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
Raymond Chen

You are theorizing one race but experiencing another.

Learning to read C++ compiler errors: Ambiguous symbol errors after including a header file
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
Raymond Chen

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

You have to tell <CODE>Get-</CODE> and <CODE>Set­Security­Info</CODE> the object type, you can’t make it guess
Jun 18, 2025
Post comments count 0
Post likes count 1

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

Raymond Chen
Raymond Chen

It needs to know which provider to give it to.

Funding the Egghead store shopping spree took a little extra legwork
Jun 17, 2025
Post comments count 0
Post likes count 3

Funding the Egghead store shopping spree took a little extra legwork

Raymond Chen
Raymond Chen

Just ask the boss.

Writing a helper class for generating a particular category of C callback wrappers around C++ methods
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
Raymond Chen

Another exercise in C++ template programming.

Thread pool threads are like preschool: Leave things the way you found them
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
Raymond Chen

Your mother always told you to clean up behind yourself.

Why does Windows even have <CODE>Interlocked</CODE> functions when we have <CODE>std::atomic</CODE>?
Jun 12, 2025
Post comments count 7
Post likes count 1

Why does Windows even have <CODE>Interlocked</CODE> functions when we have <CODE>std::atomic</CODE>?

Raymond Chen
Raymond Chen

Well, you have to start somewhere.

Removing the <CODE>MAX_PATH</CODE> restriction on paths applies only to paths
Jun 11, 2025
Post comments count 7
Post likes count 4

Removing the <CODE>MAX_PATH</CODE> restriction on paths applies only to paths

Raymond Chen
Raymond Chen

The individual file names still retain their existing limits.

Application compatibility for Windows 95 crashed a cash register
Jun 10, 2025
Post comments count 6
Post likes count 5

Application compatibility for Windows 95 crashed a cash register

Raymond Chen
Raymond Chen

Exceeding all reasonable maximums.

Dubious security vulnerability: Tricking a program into running non-elevated
Jun 9, 2025
Post comments count 2
Post likes count 2

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

Raymond Chen
Raymond Chen

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

Why does C++ think my class is copy-constructible when it can’t be copy-constructed?
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
Raymond Chen

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

Why do some Windows functions fail if I pass an unaligned Unicode string?
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
Raymond Chen

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

Riffing on a typo in the name of the opera <I>Turandot</I>
Jun 4, 2025
Post comments count 2
Post likes count 3

Riffing on a typo in the name of the opera <I>Turandot</I>

Raymond Chen
Raymond Chen

On the dot.

How can I programmatically find the network path by which a folder has been shared?
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
Raymond Chen

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

The symbolism of the magnifying glass is not universal
Jun 3, 2025
Post comments count 8
Post likes count 6

The symbolism of the magnifying glass is not universal

Raymond Chen
Raymond Chen

Just making things bigger?

Stating the obvious about debugging an invalid parameter error when freeing memory
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
Raymond Chen

Writing it down for posterity.

Using an oracle to see where your code is producing the wrong output
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
Raymond Chen

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

The case of creating new instances when you wanted to use the same one
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
Raymond Chen

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

How do I convert a WIC bitmap back to a GDI <CODE>HBITMAP</CODE>?
May 28, 2025
Post comments count 1
Post likes count 3

How do I convert a WIC bitmap back to a GDI <CODE>HBITMAP</CODE>?

Raymond Chen
Raymond Chen

You can copy the bits into a DIB section.

What was origin of the code name Redpill for Windows 8 feature lockout?
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
Raymond Chen

Pretty obvious, actually.

Why does <CODE>Enum­Process­Modules</CODE> report no modules on a process that was created suspended?
May 26, 2025
Post comments count 2
Post likes count 1

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

Raymond Chen
Raymond Chen

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

How can I detect if one of my helper processes is launching child processes?
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
Raymond Chen

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

How can I create a window the size of the screen without it being treated as a fullscreen window?
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
Raymond Chen

You can declare that you aren't rude.

Silly parlor tricks: Promoting a 32-bit value to a 64-bit value when you don’t care about garbage in the upper bits
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
Raymond Chen

Inline assembly that doesn't do anything.

Why does Windows report my processor speed twice, with slightly different values?
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
Raymond Chen

One is calculated. The other is self-promotion.

Secret passages on Microsoft main campus, episode 3
May 19, 2025
Post comments count 1
Post likes count 2

Secret passages on Microsoft main campus, episode 3

Raymond Chen
Raymond Chen

Another covered passage between buildings.

What’s with the weird <CODE>wReserved</CODE> value at the start of the <CODE>DECIMAL</CODE> structure?
May 16, 2025
Post comments count 8
Post likes count 2

What’s with the weird <CODE>wReserved</CODE> value at the start of the <CODE>DECIMAL</CODE> structure?

Raymond Chen
Raymond Chen

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

How do I force RunOnce commands to run in a specific order?
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
Raymond Chen

Run them in the desired order yourself.

If I mark my thread pool callback as long-running, does it still count toward the thread pool thread limit?
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
Raymond Chen

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

What is the developer set-up for developing Windows for multiple processor architectures?
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
Raymond Chen

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

Dubious security vulnerability: A program does not run correctly if you run it the wrong way, redux
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
Raymond Chen

Trying to make the system run the program automatically.

How can I wait for Clipboard History to recognize a clipboard change before I change it again?
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
Raymond Chen

Listen for the change event.

Why doesn’t Clipboard History capture rapid changes to clipboard contents?
May 8, 2025
Post comments count 6
Post likes count 3

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

Raymond Chen
Raymond Chen

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

What were the MS-DOS programs that the <TT>moricons.dll</TT> icons were intended for?
May 7, 2025
Post comments count 14
Post likes count 7

What were the MS-DOS programs that the <TT>moricons.dll</TT> icons were intended for?

Raymond Chen
Raymond Chen

Tallying them up.

What were the MS-DOS programs that Windows used the <TT>progman.exe</TT> stock icons for?
May 6, 2025
Post comments count 7
Post likes count 6

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

Raymond Chen
Raymond Chen

Mostly generic-looking icons.

What were the intended uses of those icons in <TT>moricons.dll</TT>?
May 5, 2025
Post comments count 9
Post likes count 5

What were the intended uses of those icons in <TT>moricons.dll</TT>?

Raymond Chen
Raymond Chen

Icons for old MS-DOS apps.

Using type aliasing to avoid the ODR problem with conditional compilation, part 2
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
Raymond Chen

Ensuring that you pick a side.

Using C++ type aliasing to avoid the ODR problem with conditional compilation, part 1
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
Raymond Chen

Still one definition, but two types.

Why does Windows have trouble finding my Win32 resource if it contains an accented character?
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
Raymond Chen

Disagreements over the fine print.

Protecting Windows users from Janet Jackson’s <I>Rhythm Nation</I>
Apr 29, 2025
Post comments count 9
Post likes count 3

Protecting Windows users from Janet Jackson’s <I>Rhythm Nation</I>

Raymond Chen
Raymond Chen

Granting an exception to a system policy.

Why did Windows 7, for a few months, log on slower if you have a solid color background?
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
Raymond Chen

It's waiting for Godot and eventually gives up.

If we can have <CODE>std::atomic<std::shared_ptr></CODE>, why not <CODE>std::atomic<com_ptr></CODE>?
Apr 25, 2025
Post comments count 11
Post likes count 3

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

Raymond Chen
Raymond Chen

Controlling the reference count.

When I define a window class with no default cursor, what is the explanation for the cursors that appear in my client area?
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
Raymond Chen

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

What resource ID should I give my application’s main icon?
Apr 23, 2025
Post comments count 7
Post likes count 3

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

Raymond Chen
Raymond Chen

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

Microspeak: top of mind
Apr 22, 2025
Post comments count 6
Post likes count 1

Microspeak: top of mind

Raymond Chen
Raymond Chen

Things I'm thinking about.

The ongoing story of seconds on the taskbar
Apr 21, 2025
Post comments count 20
Post likes count 1

The ongoing story of seconds on the taskbar

Raymond Chen
Raymond Chen

The cost of ticking.

The case of the feature flag that didn’t stay on long enough, part 2
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
Raymond Chen

Leaving everything the way you found it.

The case of the feature flag that didn’t stay on long enough, part 1
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
Raymond Chen

Understanding scope and order of destruction.

Using the classical model for linking to provide unit test overrides
Apr 16, 2025
Post comments count 0
Post likes count 1

Using the classical model for linking to provide unit test overrides

Raymond Chen
Raymond Chen

Overriding a LIB with an OBJ for fun and profit.

There was a lot of imagined dropping tablets in swimming pools
Apr 15, 2025
Post comments count 16
Post likes count 2

There was a lot of imagined dropping tablets in swimming pools

Raymond Chen
Raymond Chen

The archetypical example of needing a replacement computer.

Dubious security vulnerability: Once I have tricked the user into running a malicious shortcut, I can install malware
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
Raymond Chen

Yes, that's sort of the point.

The case of the UI thread that hung in a kernel call
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
Raymond Chen

I did tell you not to do that.

Function overloading is more flexible (and more convenient) than template function specialization
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
Raymond Chen

You can change more things in an overload.

Why can’t I use <CODE>SEC_<WBR>LARGE_<WBR>PAGES</CODE> with a file-based file mapping?
Apr 9, 2025
Post comments count 5
Post likes count 1

Why can’t I use <CODE>SEC_<WBR>LARGE_<WBR>PAGES</CODE> with a file-based file mapping?

Raymond Chen
Raymond Chen

No paging, no crying.

The Goldilocks zone of software stability
Apr 8, 2025
Post comments count 10
Post likes count 2

The Goldilocks zone of software stability

Raymond Chen
Raymond Chen

Not too new, not too old.

On priority inversion in the use of a spinlock to ensure atomic access to a <CODE>shared_ptr</CODE>
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 <CODE>shared_ptr</CODE>

Raymond Chen
Raymond Chen

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

Adding delays to our task sequencer, part 3
Apr 4, 2025
Post comments count 5
Post likes count 2

Adding delays to our task sequencer, part 3

Raymond Chen
Raymond Chen

Waiting more cheaply.

Adding delays to our task sequencer, part 2
Apr 3, 2025
Post comments count 0
Post likes count 2

Adding delays to our task sequencer, part 2

Raymond Chen
Raymond Chen

Waiting the right amount of time.

Adding delays to our task sequencer, part 1
Apr 2, 2025
Post comments count 0
Post likes count 2

Adding delays to our task sequencer, part 1

Raymond Chen
Raymond Chen

Not so fast there.

The return of Building 7
Apr 1, 2025
Post comments count 1
Post likes count 3

The return of Building 7

Raymond Chen
Raymond Chen

Pranksters lose one of their longtime inside jokes.

If one program blocks shutdown, then <I>all</I> programs block shutdown, revisited
Mar 31, 2025
Post comments count 12
Post likes count 1

If one program blocks shutdown, then <I>all</I> programs block shutdown, revisited

Raymond Chen
Raymond Chen

No take-backs.

The 2025/2026 Seattle Symphony subscription season at a glance
Mar 28, 2025
Post comments count 1
Post likes count 3

The 2025/2026 Seattle Symphony subscription season at a glance

Raymond Chen
Raymond Chen

The pocket reference guide for 2025/2026.

Fixing exception safety in our <CODE>task_<WBR>sequencer</CODE>
Mar 28, 2025
Post comments count 3
Post likes count 2

Fixing exception safety in our <CODE>task_<WBR>sequencer</CODE>

Raymond Chen
Raymond Chen

Exception safety, the forgotten requirement.

On launching a dialog when a specific combo box item is selected
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
Raymond Chen

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

Why does <ODE>INVALID_<WBR>HANDLE_<WBR>VALUE</CODE> cast through a <CODE>LONG_PTR</CODE> first?
Mar 26, 2025
Post comments count 1
Post likes count 4

Why does <ODE>INVALID_<WBR>HANDLE_<WBR>VALUE</CODE> cast through a <CODE>LONG_PTR</CODE> first?

Raymond Chen
Raymond Chen

To ensure that the proper sign extension happens.

We’ll fly you to Atlanta, Texas, and getting to your hotel in Atlanta, Georgia is your problem
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
Raymond Chen

Reading the fine print.

A note on the USB-to-PS/2 mouse adapter that came with Microsoft mouse devices
Mar 25, 2025
Post comments count 7
Post likes count 3

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

Raymond Chen
Raymond Chen

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

On how different Windows ABIs choose how to pass 32-bit values in 64-bit registers
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
Raymond Chen

Surveying the options and looking for commonalities.

The case of the critical section that let multiple threads enter a block of code
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
Raymond Chen

It had one job.

What could cause a memory corruption bug to disappear in safe mode?
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
Raymond Chen

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

You can’t simulate keyboard input with PostMessage, revisited
Mar 19, 2025
Post comments count 9
Post likes count 7

You can’t simulate keyboard input with PostMessage, revisited

Raymond Chen
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.

Why didn’t Windows 95 setup use a miniature version of Windows 95 as its fallback GUI?
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
Raymond Chen

Avoiding an interim GUI environment.

Dubious security vulnerability: A program does not run correctly if you run it the wrong way
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
Raymond Chen

So what did you expect?

The case of COM failing to pump messages in a single-threaded COM apartment
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
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...

Making sure that a DLL loads only from your application directory
Mar 13, 2025
Post comments count 12
Post likes count 3

Making sure that a DLL loads only from your application directory

Raymond Chen
Raymond Chen

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

What are the thread safety requirements of <CODE>HSTRING</CODE> and <CODE>BSTR</CODE>?
Mar 12, 2025
Post comments count 2
Post likes count 4

What are the thread safety requirements of <CODE>HSTRING</CODE> and <CODE>BSTR</CODE>?

Raymond Chen
Raymond Chen

They do not have thread affinity.

What an insightful observation, you get to wear “the hat”
Mar 11, 2025
Post comments count 9
Post likes count 3

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

Raymond Chen
Raymond Chen

Maybe not so insightful.

How do I destroy an ABI pointer that I extracted from a C++/WinRT object?
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
Raymond Chen

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

To some people, time zones are just a fancy way of sounding important, episode 2
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
Raymond Chen

Words have meaning.

How can I choose a different C++ constructor at runtime?
Mar 6, 2025
Post comments count 6
Post likes count 6

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

Raymond Chen
Raymond Chen

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

I tried to subscribe to a C++/WinRT event, but my callback was never called
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
Raymond Chen

Check how you registered your event handler.

Microspeak: Respin
Mar 4, 2025
Post comments count 2
Post likes count 3

Microspeak: Respin

Raymond Chen
Raymond Chen

Spin it up again, baby.

Lexically scoped functions accessing parent locals: The display
Mar 3, 2025
Post comments count 1
Post likes count 3

Lexically scoped functions accessing parent locals: The display

Raymond Chen
Raymond Chen

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

C++/WinRT implementation inheritance: Notes on <CODE>winrt::implements</CODE>, part 8
Feb 28, 2025
Post comments count 1
Post likes count 2

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

Raymond Chen
Raymond Chen

Comparing the options.

C++/WinRT implementation inheritance: Notes on <CODE>winrt::implements</CODE>, part 7
Feb 27, 2025
Post comments count 0
Post likes count 2

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

Raymond Chen
Raymond Chen

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

C++/WinRT implementation inheritance: Notes on <CODE>winrt::implements</CODE>, part 6
Feb 26, 2025
Post comments count 0
Post likes count 1

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

Raymond Chen
Raymond Chen

Using CRTP to delegate the method.

C++/WinRT implementation inheritance: Notes on <CODE>winrt::implements</CODE>, part 5
Feb 25, 2025
Post comments count 0
Post likes count 1

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

Raymond Chen
Raymond Chen

When the base class isn't self-contained.

C++/WinRT implementation inheritance: Notes on <CODE>winrt::implements</CODE>, part 4
Feb 24, 2025
Post comments count 0
Post likes count 1

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

Raymond Chen
Raymond Chen

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

C++/WinRT implementation inheritance: Notes on <CODE>winrt::implements</CODE>, part 3
Feb 21, 2025
Post comments count 9
Post likes count 1

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

Raymond Chen
Raymond Chen

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

C++/WinRT implementation inheritance: Notes on <CODE>winrt::implements</CODE>, part 2
Feb 20, 2025
Post comments count 0
Post likes count 1

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

Raymond Chen
Raymond Chen

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

C++/WinRT implementation inheritance: Notes on <CODE>winrt::implements</CODE>, part 1
Feb 19, 2025
Post comments count 0
Post likes count 3

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

Raymond Chen
Raymond Chen

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

Your statement is now available, just two hidden flyouts and five clicks away
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
Raymond Chen

Beware of the leopard.

API design note: Beware of adding an “Other” enum value
Feb 17, 2025
Post comments count 7
Post likes count 7

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

Raymond Chen
Raymond Chen

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

Investigating an argument-dependent lookup issue and working around it
Feb 14, 2025
Post comments count 3
Post likes count 3

Investigating an argument-dependent lookup issue and working around it

Raymond Chen
Raymond Chen

Picking apart the language specification.

A sample implementation of the weak reference pattern for COM callbacks
Feb 13, 2025
Post comments count 1
Post likes count 3

A sample implementation of the weak reference pattern for COM callbacks

Raymond Chen
Raymond Chen

A forwarder through a weak reference.

Async-Async revisited: What about cancellation?
Feb 12, 2025
Post comments count 3
Post likes count 2

Async-Async revisited: What about cancellation?

Raymond Chen
Raymond Chen

Even the cancellation is async.

Did the Windows 95 setup team forget that MS-DOS can do graphics?
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
Raymond Chen

Oh look what you just made there.

How does Explorer find the “first” icon in a file
Feb 10, 2025
Post comments count 4
Post likes count 3

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

Raymond Chen
Raymond Chen

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

Using alternate locales to get more interesting case mapping than the C
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
Raymond Chen

Looking for something better.

The default C locale is not a very interesting one
Feb 6, 2025
Post comments count 7
Post likes count 1

The default C locale is not a very interesting one

Raymond Chen
Raymond Chen

It barely understands anything.

On exactly when XAML bindings are evaluated if an element is not yet loaded
Feb 5, 2025
Post comments count 7
Post likes count 0

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

Raymond Chen
Raymond Chen

It depends on which abstraction you prefer.

The original name for Flexible Single Master Operations in Active Directory
Feb 4, 2025
Post comments count 4
Post likes count 5

The original name for Flexible Single Master Operations in Active Directory

Raymond Chen
Raymond Chen

Not that kind of F-word.

On trying to log an exception as it leaves your scope
Feb 3, 2025
Post comments count 2
Post likes count 2

On trying to log an exception as it leaves your scope

Raymond Chen
Raymond Chen

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

Creating a generic insertion iterator, part 2
Jan 31, 2025
Post comments count 1
Post likes count 1

Creating a generic insertion iterator, part 2

Raymond Chen
Raymond Chen

Satisfying the iterator requirements, perhaps with a little cheating.

Creating a generic insertion iterator, part 1
Jan 30, 2025
Post comments count 0
Post likes count 1

Creating a generic insertion iterator, part 1

Raymond Chen
Raymond Chen

We provide the boilerplate; you provide the smarts.

How do I create an inserter iterator that does unhinted insertion into an associative container like <CODE>std::map</CODE>?
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 <CODE>std::map</CODE>?

Raymond Chen
Raymond Chen

Curiously missing from the standard library.

My electric toothbrush was acting up, so I tried to reboot it
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
Raymond Chen

It didn't help.

A pattern for obtaining a single value while holding a lock
Jan 27, 2025
Post comments count 9
Post likes count 3

A pattern for obtaining a single value while holding a lock

Raymond Chen
Raymond Chen

The immediately-invoked lambda that returns a value.

A brief and incomplete comparison of memory corruption detection tools
Jan 24, 2025
Post comments count 0
Post likes count 5

A brief and incomplete comparison of memory corruption detection tools

Raymond Chen
Raymond Chen

A short overview, definitely incomplete.

Memory corruption from outside the process looks like space aliens
Jan 23, 2025
Post comments count 0
Post likes count 3

Memory corruption from outside the process looks like space aliens

Raymond Chen
Raymond Chen

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

Be mindful of temporal terms in documents: What is the reference point in time?
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
Raymond Chen

What is your implied point in time for the reference?

Why is there a bulge on my bicycle tire when I inflate it?
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
Raymond Chen

Get the order of operations right.

Why doesn’t the Windows blue screen of death prominently identify the company that created the driver that crashed?
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
Raymond Chen

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

Reminder: When a C++ object fails to construct, the destructor does not run
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
Raymond Chen

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

The case of the crash when trying to erase an element from a <CODE>std::set</CODE>
Jan 17, 2025
Post comments count 6
Post likes count 3

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

Raymond Chen
Raymond Chen

Another kind of fiasco.

In a C++ class template specialization, how can I call the unspecialized version of a method?
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
Raymond Chen

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

How does <CODE>Get­User­Default­Geo­Name</CODE> choose between ISO 3166-1 and UN M.49 codes?
Jan 15, 2025
Post comments count 0
Post likes count 1

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

Raymond Chen
Raymond Chen

Clarifying the behavior.

Microspeak: The walk-on topic
Jan 14, 2025
Post comments count 5
Post likes count 2

Microspeak: The walk-on topic

Raymond Chen
Raymond Chen

Just walk on in with your topic.

A simplified overview of ways to add or update elements in a <CODE>std::map</CODE>
Jan 13, 2025
Post comments count 4
Post likes count 3

A simplified overview of ways to add or update elements in a <CODE>std::map</CODE>

Raymond Chen
Raymond Chen

And using it to find missing opportunities.

Why does inadvertently passing a <CODE>std::string</CODE> instead of a <CODE>char const*</CODE> to a variadic function crash on x86-32 but not x86-64?
Jan 10, 2025
Post comments count 2
Post likes count 1

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

Raymond Chen
Raymond Chen

Looking at the calling convention and the small string optimization.

Inside STL: Waiting for a <CODE>std::atomic<std::shared_ptr<T>></CODE> to change, part 2
Jan 9, 2025
Post comments count 0
Post likes count 4

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

Raymond Chen
Raymond Chen

Digging into the libstdc++ implementation.

Inside STL: Waiting for a <CODE>std::atomic<std::shared_ptr<T>></CODE> to change, part 1
Jan 8, 2025
Post comments count 1
Post likes count 2

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

Raymond Chen
Raymond Chen

Waiting on a single pointer, but checking for two.

Gesellschaft zur Stärkung der Verben: The German Society for the Irregularization of Verbs
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
Raymond Chen

Stand strong and proud.

Emergency power resets on Lenovo, HP, Dell, and Acer laptops
Jan 7, 2025
Post comments count 5
Post likes count 6

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

Raymond Chen
Raymond Chen

Looking for the magic button.

How can I tell whether a change to a control was due to the user or due to my program?
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
Raymond Chen

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

Forcing an <CODE>ERROR_<WBR>KEY_<WBR>DELETED</CODE> error when trying to open <CODE>HKEY_<WBR>CURRENT_<WBR>USER\<WBR>Software</CODE>
Jan 3, 2025
Post comments count 1
Post likes count 1

Forcing an <CODE>ERROR_<WBR>KEY_<WBR>DELETED</CODE> error when trying to open <CODE>HKEY_<WBR>CURRENT_<WBR>USER\<WBR>Software</CODE>

Raymond Chen
Raymond Chen

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

Could I be getting <CODE>ERROR_<WBR>KEY_<WBR>DELETED</CODE> for <CODE>HKEY_<WBR>CURRENT_<WBR>USER\<WBR>Software</CODE> when the user logs off?
Jan 2, 2025
Post comments count 1
Post likes count 1

Could I be getting <CODE>ERROR_<WBR>KEY_<WBR>DELETED</CODE> for <CODE>HKEY_<WBR>CURRENT_<WBR>USER\<WBR>Software</CODE> when the user logs off?

Raymond Chen
Raymond Chen

Probably not, but there are some edge cases.

How is it possible to get <CODE>ERROR_<WBR>KEY_<WBR>DELETED</CODE> when I’m <I>creating</I> a key?
Jan 1, 2025
Post comments count 1
Post likes count 1

How is it possible to get <CODE>ERROR_<WBR>KEY_<WBR>DELETED</CODE> when I’m <I>creating</I> a key?

Raymond Chen
Raymond Chen

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

2024 year-end link clearance
Dec 31, 2024
Post comments count 6
Post likes count 3

2024 year-end link clearance

Raymond Chen
Raymond Chen

The cycle completes.

Making sure the Microsoft Visual C++ compiler chooses the right source encoding
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
Raymond Chen

Making sure the file and settings are set correctly.

How various git diff viewers represent file encoding changes in pull requests
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
Raymond Chen

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

In C++, failure to meet the requirements does not always mean that you fail if you don’t meet the requirements
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
Raymond Chen

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

Why are Win32 resources strings bundled at all? And why bundles of 16?
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
Raymond Chen

Balancing multiple performance factors.

How can I check if two GUIDs are equal when they are provided as strings?
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
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...

A design flaw in the Windows 3D Pipes screen saver pointed out by a customer
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
Raymond Chen

Time-wasting.

A common proposed solution to certain categories of IFNDR: Getting the linker to verify identical functions
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
Raymond Chen

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

How do I register a file type for a scripting language so that users get a warning when they run an untrusted script?
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
Raymond Chen

Use the FTA_AlwaysUnsafe edit flag.

Inside STL: The atomic shared_ptr
Dec 19, 2024
Post comments count 7
Post likes count 5

Inside STL: The atomic shared_ptr

Raymond Chen
Raymond Chen

There's a lock hiding inside the pointer.

Is there a way to split the git history of a file or combine the histories of two files without a merge commit?
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
Raymond Chen

Studying how git recovers history.

Microspeak terms that didn’t take hold: airspace, synthetics, and AOI
Dec 17, 2024
Post comments count 6
Post likes count 3

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

Raymond Chen
Raymond Chen

Sometimes they don't stick.

Why do we have header files <CODE><pshpackN.h></CODE> and <CODE><poppack.h></CODE> instead of just issuing the pragma directly?
Dec 16, 2024
Post comments count 0
Post likes count 2

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

Raymond Chen
Raymond Chen

Because the pragma may not work everywhere.

Converting to a derived class from the future: How to cast from a base class to an incomplete derived class?
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
Raymond Chen

Deferring the definition until the class is complete.

API naming principles for conditional operations: On, When, and If
Dec 12, 2024
Post comments count 0
Post likes count 3

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

Raymond Chen
Raymond Chen

Describing when a condition is tested.

What is the <CODE>CONTINUE_IF_FAILED</CODE> equivalent of <CODE>RETURN_IF_FAILED</CODE>?
Dec 11, 2024
Post comments count 8
Post likes count 3

What is the <CODE>CONTINUE_IF_FAILED</CODE> equivalent of <CODE>RETURN_IF_FAILED</CODE>?

Raymond Chen
Raymond Chen

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

It rather involved being on the other side of this airtight hatchway: Disabling anti-malware scanning
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
Raymond Chen

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

Learning to read C++ compiler errors: Failing to create a <CODE>shared_ptr</CODE>
Dec 9, 2024
Post comments count 0
Post likes count 2

Learning to read C++ compiler errors: Failing to create a <CODE>shared_ptr</CODE>

Raymond Chen
Raymond Chen

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

Learning to read C++ compiler errors: Nonsensical errors from a function declaration
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
Raymond Chen

Look closely at what the error message is complaining about.

Won’t waiting for multiple threads one at a time introduce a severe performance issue?
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
Raymond Chen

It depends on how long you plan on waiting.

Why does my DLL reference count go up by one every time I create and exit a thread?
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
Raymond Chen

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

Tricks from product support: We’re not smart enough to debug the problem, can you help us?
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
Raymond Chen

It's not you, it's me.

News flash: Desire for loud cars correlates with psychopathy and sadism
Dec 2, 2024
Post comments count 1
Post likes count 4

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

Raymond Chen
Raymond Chen

More research into loud vehicles.

An analogy about register preservation rules in calling conventions
Dec 2, 2024
Post comments count 5
Post likes count 1

An analogy about register preservation rules in calling conventions

Raymond Chen
Raymond Chen

And tying it back to unwind codes.

Assessing the attack complexity of a race condition security vulnerability
Nov 29, 2024
Post comments count 1
Post likes count 1

Assessing the attack complexity of a race condition security vulnerability

Raymond Chen
Raymond Chen

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

Why does my program successfully take foreground only when running under the debugger?
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
Raymond Chen

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

Checking whether a URI refers to a Web site root
Nov 27, 2024
Post comments count 0
Post likes count 1

Checking whether a URI refers to a Web site root

Raymond Chen
Raymond Chen

Let somebody else do the parsing.

Microspeak: Real estate and Airspace
Nov 26, 2024
Post comments count 0
Post likes count 1

Microspeak: Real estate and Airspace

Raymond Chen
Raymond Chen

Space on the screen and negotiating control over it.

How can I know when a window has processed a message that I posted to 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
Raymond Chen

Best would be to have it tell you.

In C++, how can I make a default parameter be the this pointer of the caller?, revisited
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
Raymond Chen

Expanding on the previous pattern.

How can I detect which menu my item was invoked from?
Nov 21, 2024
Post comments count 1
Post likes count 2

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

Raymond Chen
Raymond Chen

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

How do I determine whether Explorer is showing or hiding file extensions?
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
Raymond Chen

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

A wrinkle in how Windows 95 setup bootstrapped its initial GUI step
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
Raymond Chen

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

The operations for reading and writing single elements for C++ standard library maps
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
Raymond Chen

Breaking down the options.

How do I put a non-copyable, non-movable, non-constructible object into a <CODE>std::optional</CODE>?
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 <CODE>std::optional</CODE>?

Raymond Chen
Raymond Chen

Taking advantage of the conversion operator.

Solving the puzzle of trying to put an object into a <CODE>std::optional</CODE>
Nov 14, 2024
Post comments count 0
Post likes count 3

Solving the puzzle of trying to put an object into a <CODE>std::optional</CODE>

Raymond Chen
Raymond Chen

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

The puzzle of trying to put an object into a <CODE>std::optional</CODE>
Nov 13, 2024
Post comments count 14
Post likes count 2

The puzzle of trying to put an object into a <CODE>std::optional</CODE>

Raymond Chen
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...

Why did Windows 95 setup use three operating systems?
Nov 12, 2024
Post comments count 6
Post likes count 11

Why did Windows 95 setup use three operating systems?

Raymond Chen
Raymond Chen

Simplifying the problem to an earlier problem.

Debugger breakpoints are usually implemented by patching the in-memory copy of the code
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
Raymond Chen

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

The case of a program that crashed on its first instruction
Nov 8, 2024
Post comments count 4
Post likes count 13

The case of a program that crashed on its first instruction

Raymond Chen
Raymond Chen

Didn't even make it out of the gate.

Why do I observe reads from a memory-mapped file when writing large blocks?
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
Raymond Chen

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

How do I declare an operator overload for my Windows Runtime class?
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
Raymond Chen

That's not something expressible in the Windows Runtime.

What’s the difference between Display size and Screen size in the Windows 95 display control panel?
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
Raymond Chen

No meaningful difference, though others have created a difference.

On the limits of time travel in the face of undefined behavior in C
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
Raymond Chen

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

On locale-aware substring matching, either case-sensitive or case-insensitive
Nov 1, 2024
Post comments count 9
Post likes count 6

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

Raymond Chen
Raymond Chen

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

What has case distinction but is neither uppercase nor lowercase?
Oct 31, 2024
Post comments count 23
Post likes count 10

What has case distinction but is neither uppercase nor lowercase?

Raymond Chen
Raymond Chen

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

I have enabled “take ownership” permission, but I still cannot obtain write access
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
Raymond Chen

Taking ownership is only one part of gaining write access.

Reverse-engineering what a “short” section is
Oct 29, 2024
Post comments count 0
Post likes count 2

Reverse-engineering what a “short” section is

Raymond Chen
Raymond Chen

The long and short of it all.

How useful is the hint passed to the <CODE>std::<WBR>unordered_…</CODE> collections?
Oct 28, 2024
Post comments count 1
Post likes count 2

How useful is the hint passed to the <CODE>std::<WBR>unordered_…</CODE> collections?

Raymond Chen
Raymond Chen

Only a little, or sometimes not at all.

How can I explicitly specialize a templated C++ constructor, follow-up notes
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
Raymond Chen

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

It rather involved being on the other side of the airtight hatchway: Defeating ASLR after you’ve gained RCE via ROP
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
Raymond Chen

If you defeat ASLR, then you can defeat ASLR.

How do I create a Windows Runtime <CODE>IRandom­Access­Stream</CODE> around a bunch of bytes or a classic COM <CODE>IStream</CODE>?
Oct 23, 2024
Post comments count 2
Post likes count 2

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

Raymond Chen
Raymond Chen

Another wrapper function.

Did Windows 95 shrink the default font size of windowed MS-DOS apps?
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
Raymond Chen

The effect was that it shrunk, but only sometimes.

Why does adding <CODE>WS_<WBR>MINIMIZE­BOX</CODE> change how my window behaves when the user presses <KBD>Win</KBD>+<KBD>D</KBD>?
Oct 21, 2024
Post comments count 10
Post likes count 2

Why does adding <CODE>WS_<WBR>MINIMIZE­BOX</CODE> change how my window behaves when the user presses <KBD>Win</KBD>+<KBD>D</KBD>?

Raymond Chen
Raymond Chen

It minimizes your window if it can.

Evaluating tail call elimination in the face of return address protection, part 2
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
Raymond Chen

Rewriting the activation frame.

Evaluating tail call elimination in the face of return address protection, part 1
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
Raymond Chen

Reusing the activation frame.

Effects of classic return address tricks on hardware-assisted return address protection
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
Raymond Chen

Return address manipulations that are possibly even more impermissible than they already were.

A quick introduction to return address protection technologies
Oct 15, 2024
Post comments count 4
Post likes count 2

A quick introduction to return address protection technologies

Raymond Chen
Raymond Chen

Detecting attempts to manipulate the return address.

On naming things: The tension between naming something for what it is, what it does, or how it is used
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
Raymond Chen

You are guaranteed to make someone upset.

How can I explicitly specialize a templated C++ constructor?
Oct 11, 2024
Post comments count 1
Post likes count 3

How can I explicitly specialize a templated C++ constructor?

Raymond Chen
Raymond Chen

Looking for a C++ tag type for representing another type.

A correction to the awaitable lock for C++ PPL tasks
Oct 10, 2024
Post comments count 2
Post likes count 3

A correction to the awaitable lock for C++ PPL tasks

Raymond Chen
Raymond Chen

Over-scoped lock.

If threads are created without a message queue, why can I post to them immediately upon creation?
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
Raymond Chen

Check who is doing the posting.

Microspeak: Run to ground
Oct 8, 2024
Post comments count 1
Post likes count 2

Microspeak: Run to ground

Raymond Chen
Raymond Chen

Come to a resolution.

A popular but wrong way to convert a string to uppercase or lowercase
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
Raymond Chen

Converting character by character isn't good enough any more.

How does the linker decide whether to call <CODE>WinMain</CODE> or <CODE>wWinMain</CODE>?
Oct 4, 2024
Post comments count 0
Post likes count 3

How does the linker decide whether to call <CODE>WinMain</CODE> or <CODE>wWinMain</CODE>?

Raymond Chen
Raymond Chen

If you don't tell it, it will try to figure it out.

How can I detect whether the user is running as an elevated administrator (as opposed to a natural administrator)?
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
Raymond Chen

You can ask for the elevation type.

A function for creating an absolute security descriptor from a self-relative one
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
Raymond Chen

Just wrap it up.

Misunderstanding the “Prevent access to registry editing tools” policy
Oct 1, 2024
Post comments count 5
Post likes count 5

Misunderstanding the “Prevent access to registry editing tools” policy

Raymond Chen
Raymond Chen

It prevents access to the tools, but not to the registry itself.

Pulling a single item from a C++ parameter pack by its index, remarks
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
Raymond Chen

Why such a complicated way to pull the type from the pack?

The case of the crash when destructing a <CODE>std::map</CODE>
Sep 27, 2024
Post comments count 3
Post likes count 5

The case of the crash when destructing a <CODE>std::map</CODE>

Raymond Chen
Raymond Chen

Who is corrupting the map?

If you’re going to specify the <CODE>LVS_SORTASCENDING</CODE> or <CODE>LVS_SORTDESCENDING</CODE> style, you had better be telling the truth
Sep 26, 2024
Post comments count 3
Post likes count 3

If you’re going to specify the <CODE>LVS_SORTASCENDING</CODE> or <CODE>LVS_SORTDESCENDING</CODE> style, you had better be telling the truth

Raymond Chen
Raymond Chen

Because the listview control uses it to optimize searching.

Another example of the Windows Runtime interop pattern: Using the UserConsentVerifier from a Win32 program
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
Raymond Chen

Following the standard pattern.

The UserConsentVerifier confirms that the user is there, but it doesn’t protect any data
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
Raymond Chen

Is that really you?

Going beyond the empty set: Embracing the power of other empty things
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
Raymond Chen

Just because there's nothing in it doesn't mean it's not valid.

How can I check that all the changes in a git branch have been cherry-picked or rebased into its upstream branch?
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
Raymond Chen

You can pretend to merge it and see if anything happens.

My window has the <CODE>WS_<WBR>EX_<WBR>NOACTIVATE</CODE> extended style, but it got activated anyway
Sep 19, 2024
Post comments count 0
Post likes count 5

My window has the <CODE>WS_<WBR>EX_<WBR>NOACTIVATE</CODE> extended style, but it got activated anyway

Raymond Chen
Raymond Chen

Well, at least it wasn't activated by a click.

More on the mysterious <CODE>[default_interface]</CODE> attribute in Windows Runtime classes
Sep 18, 2024
Post comments count 6
Post likes count 3

More on the mysterious <CODE>[default_interface]</CODE> attribute in Windows Runtime classes

Raymond Chen
Raymond Chen

Forcing you to make a choice.

It rather involved being on the other side of this airtight hatchway: Posting completions to somebody else’s I/O completion port
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
Raymond Chen

If you have gained access to it, then that was the problem.

Some notes on Win32 carets
Sep 16, 2024
Post comments count 5
Post likes count 6

Some notes on Win32 carets

Raymond Chen
Raymond Chen

Assorted notes and musings.

The case of the fail-fast crashes coming from the power management system
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
Raymond Chen

Understanding why it decided to fail fast.

How can I tell whether two programs will share drive letter mappings?
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
Raymond Chen

You can compare the authentication IDs.

The case of the string being copied from a mysterious pointer to invalid memory, revisited
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
Raymond Chen

Reflections on an older topic.

Does the Resource Compiler have a separate preprocessor or doesn’t it?
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
Raymond Chen

It did, but now it doesn't.

GitHub trick to find the commit that deleted a file
Sep 9, 2024
Post comments count 6
Post likes count 4

GitHub trick to find the commit that deleted a file

Raymond Chen
Raymond Chen

Ask for the history of the file.

The case of the image that came out horribly slanted: Negative stride
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
Raymond Chen

It's all topsy-turvy.

The case of the image that came out horribly slanted: Taking the pitch into account
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
Raymond Chen

Getting the pieces to line up.

The case of the image that came out horribly slanted: Diagnosis
Sep 4, 2024
Post comments count 4
Post likes count 3

The case of the image that came out horribly slanted: Diagnosis

Raymond Chen
Raymond Chen

Imperfect pitch.

Why did Windows 95 use blue screen error messages instead of hard error messages?
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
Raymond Chen

You may not able to get there from here.

The <CODE>Co­Initialize­Security</CODE> function demands an absolute security descriptor
Sep 2, 2024
Post comments count 10
Post likes count 3

The <CODE>Co­Initialize­Security</CODE> function demands an absolute security descriptor

Raymond Chen
Raymond Chen

Even though you usually have a self-relative one in hand.

In the Windows kernel, what is a LUID, and what makes it loo-ey?
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
Raymond Chen

It's a locally-unique ID, for a specific definition of "local".

How is the Windows.Foundation.Uri.Domain property different from Host?
Aug 29, 2024
Post comments count 7
Post likes count 3

How is the Windows.Foundation.Uri.Domain property different from Host?

Raymond Chen
Raymond Chen

It's an educated guess.

On the strange status of <CODE>wchar_t</CODE> in classic MIDL
Aug 28, 2024
Post comments count 0
Post likes count 2

On the strange status of <CODE>wchar_t</CODE> in classic MIDL

Raymond Chen
Raymond Chen

From the era before <CODE>wchar_t</CODE> was a standard type.

The Microsoft/IBM joint development was built on mutual respect, wait, is respect the right word?
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
Raymond Chen

Maybe it's some other word.

Thoughts on finding the essential elements of a set
Aug 26, 2024
Post comments count 9
Post likes count 3

Thoughts on finding the essential elements of a set

Raymond Chen
Raymond Chen

Another binary search, but searching a different way.

What if I need to wait for more than <CODE>MAXIMUM_<WBR>WAIT_<WBR>OBJECTS</CODE> threads?
Aug 23, 2024
Post comments count 7
Post likes count 5

What if I need to wait for more than <CODE>MAXIMUM_<WBR>WAIT_<WBR>OBJECTS</CODE> threads?

Raymond Chen
Raymond Chen

Studying your options, and the consequences of breaking things up.

The role of the activation factory in the Windows Runtime
Aug 22, 2024
Post comments count 3
Post likes count 1

The role of the activation factory in the Windows Runtime

Raymond Chen
Raymond Chen

The activation factory represents the class itself.

What does <CODE>ERROR_<WBR>KEY_<WBR>DELETED</CODE> mean?
Aug 21, 2024
Post comments count 1
Post likes count 4

What does <CODE>ERROR_<WBR>KEY_<WBR>DELETED</CODE> mean?

Raymond Chen
Raymond Chen

You now have a handle to a key that doesn't exist, and there's nothing you can do with it.

Another tribute to Microsoft history hiding in Building 41
Aug 20, 2024
Post comments count 1
Post likes count 4

Another tribute to Microsoft history hiding in Building 41

Raymond Chen
Raymond Chen

Logo touches.

Constructing nodes of a hand-made linked list, how hard can it be?
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
Raymond Chen

Trying to force copy elision.

The case of the missing ordinal 380
Aug 16, 2024
Post comments count 4
Post likes count 1

The case of the missing ordinal 380

Raymond Chen
Raymond Chen

Untangling the error message and developing a theory.

Instead of putting a hash in the Portable Executable timestamp field, why not create a separate field for the hash?
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
Raymond Chen

That would defeat the purpose.

Temporarily dropping a lock: The anti-lock pattern
Aug 14, 2024
Post comments count 13
Post likes count 3

Temporarily dropping a lock: The anti-lock pattern

Raymond Chen
Raymond Chen

It's not to prevent locking, but rather to counteract a lock.

A look back at one of the (many) projects code-named Highlander
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
Raymond Chen

The showdown that almost repeated.

Embracing the power of the empty set in API design (and applying this principle to selectors and filters)
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
Raymond Chen

You got plenty of nothing.

What does it even mean to Close a Windows Runtime asynchronous operation or action?
Aug 9, 2024
Post comments count 2
Post likes count 2

What does it even mean to Close a Windows Runtime asynchronous operation or action?

Raymond Chen
Raymond Chen

That's the end of the road.

Why do I get <CODE>E_<WBR>ACCESS­DENIED</CODE> when trying to access my brokered Windows Runtime object?COM is double-checking the trust level.
Aug 8, 2024
Post comments count 0
Post likes count 3

Why do I get <CODE>E_<WBR>ACCESS­DENIED</CODE> when trying to access my brokered Windows Runtime object?COM is double-checking the trust level.

Raymond Chen
Raymond Chen

COM is double-checking the trust level.

How do I know when the user has finished interacting with the <CODE>Accounts­Settings­Pane</CODE>?
Aug 7, 2024
Post comments count 1
Post likes count 1

How do I know when the user has finished interacting with the <CODE>Accounts­Settings­Pane</CODE>?

Raymond Chen
Raymond Chen

You can use the version that runs an asynchronous operation.

It rather involved being on the other side of the airtight hatchway: Disabling a security feature as an administrator
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
Raymond Chen

At least they don't beat around the bush.

What are the dire consequences of registering a RunOnce command from my RunOnce command?
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
Raymond Chen

The circle of life, or a perpetual motion machine.

The difference between undefined behavior and ill-formed C++ programs
Aug 2, 2024
Post comments count 3
Post likes count 3

The difference between undefined behavior and ill-formed C++ programs

Raymond Chen
Raymond Chen

They are two kinds of undefined-ness, one for runtime and one for compile-time.

What’s the difference between <CODE>Data­Package­View.<WBR>Get­Uri­Async</CODE> and <CODE>Data­Package­View.<WBR>Get­Web­Link­Async</CODE>?
Aug 1, 2024
Post comments count 2
Post likes count 1

What’s the difference between <CODE>Data­Package­View.<WBR>Get­Uri­Async</CODE> and <CODE>Data­Package­View.<WBR>Get­Web­Link­Async</CODE>?

Raymond Chen
Raymond Chen

Just improving on an ambiguous name.

How to compress out interior padding in a <CODE>std::pair</CODE> and why you don’t want to
Jul 31, 2024
Post comments count 1
Post likes count 3

How to compress out interior padding in a <CODE>std::pair</CODE> and why you don’t want to

Raymond Chen
Raymond Chen

Context-sensitive layout means you get a different structure each time you use it.

There is no mystery over who wrote the Blue Screen of Death, despite what some may want you to believe
Jul 30, 2024
Post comments count 8
Post likes count 4

There is no mystery over who wrote the Blue Screen of Death, despite what some may want you to believe

Raymond Chen
Raymond Chen

No real contradictions in anybody's story.

Why don’t Windows Imaging Component pixel format GUIDs continue their nice pattern?
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
Raymond Chen

Patterns are predictable, which is not always a good thing.

What can I do if IMlangConvertCharset is unable to convert from code page 28591 directly to UTF-8?
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
Raymond Chen

You can do the conversion in two steps using things you already have.

In my Visual Studio project, I set my Conformance mode to permissive, but it’s still not permissive
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
Raymond Chen

Digging into what the compiler sees.

API naming principle: If there is no direct object, then the direct object is the source object
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
Raymond Chen

If you don't know what it operates on or produces, then it operates on or produces itself.

Unquoted service paths: The new frontier in script kiddie security vulnerability reports
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
Raymond Chen

Usually not exploitable, but the script kiddies don't know that.

Organizing the five creation dispositions of the <CODE>Create­File</CODE> function
Jul 22, 2024
Post comments count 9
Post likes count 5

Organizing the five creation dispositions of the <CODE>Create­File</CODE> function

Raymond Chen
Raymond Chen

Six possibilities, but only five useful ones.

Creating an already-completed asynchronous activity in C++/WinRT, part 9
Jul 19, 2024
Post comments count 0
Post likes count 1

Creating an already-completed asynchronous activity in C++/WinRT, part 9

Raymond Chen
Raymond Chen

Cheating the delegates.

Creating an already-completed asynchronous activity in C++/WinRT, part 8
Jul 18, 2024
Post comments count 1
Post likes count 1

Creating an already-completed asynchronous activity in C++/WinRT, part 8

Raymond Chen
Raymond Chen

Generalizing the pattern.

Creating an already-completed asynchronous activity in C++/WinRT, part 7
Jul 17, 2024
Post comments count 2
Post likes count 1

Creating an already-completed asynchronous activity in C++/WinRT, part 7

Raymond Chen
Raymond Chen

Implementing the contract directly.

Creating an already-completed asynchronous activity in C++/WinRT, part 6
Jul 16, 2024
Post comments count 0
Post likes count 1

Creating an already-completed asynchronous activity in C++/WinRT, part 6

Raymond Chen
Raymond Chen

Let the conversion do the talking.

Creating an already-completed asynchronous activity in C++/WinRT, part 5
Jul 15, 2024
Post comments count 0
Post likes count 1

Creating an already-completed asynchronous activity in C++/WinRT, part 5

Raymond Chen
Raymond Chen

Trying to fail more correctly.

Creating an already-completed asynchronous activity in C++/WinRT, part 4
Jul 12, 2024
Post comments count 2
Post likes count 3

Creating an already-completed asynchronous activity in C++/WinRT, part 4

Raymond Chen
Raymond Chen

Failing is easy. Failing correctly is hard.

Creating an already-completed asynchronous activity in C++/WinRT, part 3
Jul 11, 2024
Post comments count 0
Post likes count 2

Creating an already-completed asynchronous activity in C++/WinRT, part 3

Raymond Chen
Raymond Chen

Generalizing to the four kinds of Windows Runtime asynchronous activities.

Creating an already-completed asynchronous activity in C++/WinRT, part 2
Jul 10, 2024
Post comments count 2
Post likes count 3

Creating an already-completed asynchronous activity in C++/WinRT, part 2

Raymond Chen
Raymond Chen

Making our function a coroutine.

Creating an already-completed asynchonous activity in C++/WinRT, part 1
Jul 9, 2024
Post comments count 2
Post likes count 2

Creating an already-completed asynchonous activity in C++/WinRT, part 1

Raymond Chen
Raymond Chen

The simplest version.

What’s the point of <CODE>std::<WBR>monostate</CODE>? You can’t do anything with it!
Jul 8, 2024
Post comments count 5
Post likes count 3

What’s the point of <CODE>std::<WBR>monostate</CODE>? You can’t do anything with it!

Raymond Chen
Raymond Chen

Not doing anything with it is exactly the point.

How do I produce a Windows Runtime asynchronous activity from C++/WinRT?
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
Raymond Chen

Somebody that deals with them natively.

How do I produce a Windows Runtime asynchronous activity from C#?
Jul 4, 2024
Post comments count 2
Post likes count 3

How do I produce a Windows Runtime asynchronous activity from C#?

Raymond Chen
Raymond Chen

The AsyncInfo helper class converts Tasks to Windows Runtime asynchronous activities.

How do I produce a Windows Runtime asynchronous activity from C++/CX?
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
Raymond Chen

The Parallel Patterns Library has special support for C++/CX.

The history of <KBD>Alt</KBD>+number sequences, and why <KBD>Alt</KBD>+<KBD>9731</KBD> sometimes gives you a heart and sometimes a snowman
Jul 2, 2024
Post comments count 22
Post likes count 5

The history of <KBD>Alt</KBD>+number sequences, and why <KBD>Alt</KBD>+<KBD>9731</KBD> sometimes gives you a heart and sometimes a snowman

Raymond Chen
Raymond Chen

Code pages and custom keyboard handling.

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?
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
Raymond Chen

Who forced you to register the same shell extension for both?

2024 mid-year link clearance
Jun 28, 2024
Post comments count 11
Post likes count 3

2024 mid-year link clearance

Raymond Chen
Raymond Chen

Emptying out the junk drawer.

Writing a <CODE>remove_all_pointers</CODE> type trait, part 2
Jun 28, 2024
Post comments count 2
Post likes count 3

Writing a <CODE>remove_all_pointers</CODE> type trait, part 2

Raymond Chen
Raymond Chen

Factoring out the type resolution to after the dangerous part.

Writing a <CODE>remove_all_pointers</CODE> type trait, part 1
Jun 27, 2024
Post comments count 3
Post likes count 3

Writing a <CODE>remove_all_pointers</CODE> type trait, part 1

Raymond Chen
Raymond Chen

Delaying the expansion to avoid infinite recursion.

Is there a built-in way in C++/WinRT to get the string name for a Windows Runtime enum?
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
Raymond Chen

No, and maybe you don't want to.

Microspeak: Fun fork
Jun 25, 2024
Post comments count 0
Post likes count 1

Microspeak: Fun fork

Raymond Chen
Raymond Chen

A place to party.

Finding a specific value in a sequence of integers that changes by at most 1
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
Raymond Chen

It's basically a discrete version of the intermediate value theorem.

The Windows Runtime <CODE>winrt::<WBR>hstring</CODE> and the C++ <CODE>std::<WBR>wstring</CODE> are inter-assignable
Jun 21, 2024
Post comments count 1
Post likes count 1

The Windows Runtime <CODE>winrt::<WBR>hstring</CODE> and the C++ <CODE>std::<WBR>wstring</CODE> are inter-assignable

Raymond Chen
Raymond Chen

Just assign them over, no cermony necessary.

How to convert between different types of counted-string string types
Jun 20, 2024
Post comments count 0
Post likes count 3

How to convert between different types of counted-string string types

Raymond Chen
Raymond Chen

Looking for constructors that take a character count.

On the sadness of treating counted strings as null-terminated strings
Jun 19, 2024
Post comments count 12
Post likes count 2

On the sadness of treating counted strings as null-terminated strings

Raymond Chen
Raymond Chen

You're throwing away perfectly good data, there.

The time smart quotes prevented the entire Office division from committing code
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
Raymond Chen

Breaking your tools with your tools.

How can I view the list of symbols available in a library?
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
Raymond Chen

A tool hiding inside another tool.

Lock-free reference-counting a TLS slot using atomics, part 3
Jun 14, 2024
Post comments count 3
Post likes count 1

Lock-free reference-counting a TLS slot using atomics, part 3

Raymond Chen
Raymond Chen

Keeping track of two things at once.

Lock-free reference-counting a TLS slot using atomics, part 2
Jun 13, 2024
Post comments count 2
Post likes count 2

Lock-free reference-counting a TLS slot using atomics, part 2

Raymond Chen
Raymond Chen

Getting it is easy. Getting rid of it is hard.

Lock-free reference-counting a TLS slot using atomics, part 1
Jun 12, 2024
Post comments count 6
Post likes count 1

Lock-free reference-counting a TLS slot using atomics, part 1

Raymond Chen
Raymond Chen

First, we do it with locks.

The origin story of the Windows 3D Pipes screen saver
Jun 11, 2024
Post comments count 19
Post likes count 7

The origin story of the Windows 3D Pipes screen saver

Raymond Chen
Raymond Chen

Looking for a place to show off.

How do I get the name of a SID, and what does it mean when the conversion fails?
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
Raymond Chen

Most places will do it for you, or at least try.

What’s the deal with <CODE>std::type_identity</CODE>?
Jun 7, 2024
Post comments count 4
Post likes count 2

What’s the deal with <CODE>std::type_identity</CODE>?

Raymond Chen
Raymond Chen

When you want to use a type without participating in type deduction.

Can INI files be Unicode? Yes, they can, but it has to be your idea
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
Raymond Chen

It'll only be Unicode if it's already Unicode.

How 16-bit Windows cached INI files for performance
Jun 5, 2024
Post comments count 0
Post likes count 3

How 16-bit Windows cached INI files for performance

Raymond Chen
Raymond Chen

Taking advantage of co-operative multitasking.

Why does <CODE>Global­Lock</CODE> max out at 255 locks?
Jun 4, 2024
Post comments count 3
Post likes count 1

Why does <CODE>Global­Lock</CODE> max out at 255 locks?

Raymond Chen
Raymond Chen

Because that's how many bits were available for reporting the lock count.

More on harmful overuse of <CODE>std::<WBR>move</CODE>
Jun 3, 2024
Post comments count 9
Post likes count 1

More on harmful overuse of <CODE>std::<WBR>move</CODE>

Raymond Chen
Raymond Chen

Could we expand copy elision to cover the harmful cases?

A graphical depiction of the steps in building a C++ executable, with XAML and packaging
May 31, 2024
Post comments count 4
Post likes count 5

A graphical depiction of the steps in building a C++ executable, with XAML and packaging

Raymond Chen
Raymond Chen

Fleshing out the diagram.

A graphical depiction of the steps in building a C++ executable, enhanced for classic Win32
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
Raymond Chen

Adding in Microsoft-specific tools.

A graphical depiction of the steps in building a C++ executable, basics
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
Raymond Chen

A high-level overview.

How can I force a DLL to register itself if it won’t respond to <CODE>regsvr32</CODE>?
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 <CODE>regsvr32</CODE>?

Raymond Chen
Raymond Chen

You can't force something that isn't there.

Is there any difference between <CODE>String­From­IID</CODE> and <CODE>String­From­CLSID</CODE>?
May 27, 2024
Post comments count 3
Post likes count 3

Is there any difference between <CODE>String­From­IID</CODE> and <CODE>String­From­CLSID</CODE>?

Raymond Chen
Raymond Chen

Not really.

Setting the contents of a Windows Runtime Vector from C++/WinRT in one call
May 24, 2024
Post comments count 0
Post likes count 1

Setting the contents of a Windows Runtime Vector from C++/WinRT in one call

Raymond Chen
Raymond Chen

The one-stop shop for updating a Windows Runtime Vector.

Creating a prepopulated Windows Runtime Vector from C++/WinRT without going through an explicit <CODE>std::<WBR>vector</CODE>
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 <CODE>std::<WBR>vector</CODE>

Raymond Chen
Raymond Chen

Creating the vector inline.

If you have to create a Windows Runtime Vector from C++/WinRT, do it as late as possible
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
Raymond Chen

Stay with the <CODE>std::vector</CODE> until you really need the Window Runtime Vector.

A blurry photo of the legendary USB Cart of Death
May 21, 2024
Post comments count 6
Post likes count 6

A blurry photo of the legendary USB Cart of Death

Raymond Chen
Raymond Chen

And some details about that infamous on-stage bluescreen.

If you know what interface you want, just pass it directly to CoCreateInstance
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
Raymond Chen

Avoiding a second round trip.

Why can’t I find the injected name of a templated class’s templated base class?
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
Raymond Chen

The compiler needs help finding it because it's not findable at the time the template is parsed.

Pulling a single item from a C++ parameter pack by its index
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
Raymond Chen

Combining a few tools to make a new tool.

Building the most efficient device selector query that selects no devices
May 15, 2024
Post comments count 9
Post likes count 2

Building the most efficient device selector query that selects no devices

Raymond Chen
Raymond Chen

Looking for the most efficient way of rejecting everything.

The confidential coffee maker was not the only source of shenanigans at the IBM Boca office
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
Raymond Chen

The culture (and weather) clash continues.

Before you try to change something, make sure you can change nothing
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
Raymond Chen

Nobody touch anything.

An informal comparison of the three major implementations of <CODE>std::string</CODE>
May 10, 2024
Post comments count 4
Post likes count 7

An informal comparison of the three major implementations of <CODE>std::string</CODE>

Raymond Chen
Raymond Chen

Pros and cons.

Asking for a DispatcherQueue from a GUI thread you created
May 9, 2024
Post comments count 0
Post likes count 1

Asking for a DispatcherQueue from a GUI thread you created

Raymond Chen
Raymond Chen

Grafting a DispatcherQueue onto an existing thread.

Awaiting a set of handles with a timeout, part 7: Just doing it one at a time
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
Raymond Chen

A simpler version with its own quirks.

Awaiting a set of handles with a timeout, part 6: Capturing the handles efficiently
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
Raymond Chen

SFINAE'ing the case of a random-access(ish) iterator.

Awaiting a set of handles with a timeout, part 5: Generalizing the awaiter
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
Raymond Chen

Fitting into existing patterns.

Awaiting a set of handles with a timeout, part 4: Building our own awaiter
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
Raymond Chen

To stop relying on unspecified behavior.

Awaiting a set of handles with a timeout, part 3: Going beyond two
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
Raymond Chen

Generalizing what we learned last time.

Awaiting a set of handles with a timeout, part 2: Continuing with two
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
Raymond Chen

Giving it another try.

Awaiting a set of handles with a timeout, part 1: Starting with two
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
Raymond Chen

Let's see by seeing if we can do it with just two.

Awaiting a set of handles in C++/WinRT
Apr 29, 2024
Post comments count 0
Post likes count 2

Awaiting a set of handles in C++/WinRT

Raymond Chen
Raymond Chen

It's easier thank you think.

Adding state to the update notification pattern, part 8
Apr 26, 2024
Post comments count 0
Post likes count 1

Adding state to the update notification pattern, part 8

Raymond Chen
Raymond Chen

Comparing the two algorithms.

Adding state to the update notification pattern, part 7
Apr 25, 2024
Post comments count 5
Post likes count 1

Adding state to the update notification pattern, part 7

Raymond Chen
Raymond Chen

Going free-threaded.

Adding state to the update notification pattern, part 6
Apr 24, 2024
Post comments count 0
Post likes count 2

Adding state to the update notification pattern, part 6

Raymond Chen
Raymond Chen

Using a change counter with coalescing.

Adding state to the update notification pattern, part 5
Apr 23, 2024
Post comments count 1
Post likes count 1

Adding state to the update notification pattern, part 5

Raymond Chen
Raymond Chen

Using a change counter.

Adding state to the update notification pattern, part 4
Apr 22, 2024
Post comments count 0
Post likes count 1

Adding state to the update notification pattern, part 4

Raymond Chen
Raymond Chen

What if the UI thread isn't there to save you?

Adding state to the update notification pattern, part 3
Apr 19, 2024
Post comments count 2
Post likes count 1

Adding state to the update notification pattern, part 3

Raymond Chen
Raymond Chen

Abandoning the background work if we know that it is pointless.

Adding state to the update notification pattern, part 2
Apr 18, 2024
Post comments count 2
Post likes count 1

Adding state to the update notification pattern, part 2

Raymond Chen
Raymond Chen

First attempt to try to fix the race condition.

Adding state to the update notification pattern, part 1
Apr 17, 2024
Post comments count 0
Post likes count 3

Adding state to the update notification pattern, part 1

Raymond Chen
Raymond Chen

Where each notification depends on some state information.

In search of the Ballmer Peak, and other results from SIGBOVIK 2024
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
Raymond Chen

Continuing studies in silliness.

Dubious security vulnerability: Program allows its output to be exfiltrated
Apr 16, 2024
Post comments count 2
Post likes count 2

Dubious security vulnerability: Program allows its output to be exfiltrated

Raymond Chen
Raymond Chen

Once the output is generated, the program can't control where it goes.

What were the tax consequences of letting Windows 95 team members keep a piece of software as long as they tested it?
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
Raymond Chen

It basically falls under the <I>de minimis</I> rule.

The case of the string being copied from a mysterious pointer to invalid memory
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
Raymond Chen

Using AppVerifier to deduce the heap allocation history.

Why do <CODE>STANDARD_<WBR>RIGHTS_<WBR>READ</CODE>, <CODE>STANDARD_<WBR>RIGHTS_<WBR>WRITE</CODE>, and <CODE>STANDARD_<WBR>RIGHTS_<WBR>EXECUTE</CODE> have the same values?
How can I find out which process has locked me out of the clipboard?
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
Raymond Chen

You can ask for the clipboard opener.

If I enumerate all the processes and add up all the <CODE>Get­Gui­Resources</CODE>, why doesn’t it match the <CODE>GR_<WBR>GLOBAL</CODE> value?
Apr 9, 2024
Post comments count 0
Post likes count 1

If I enumerate all the processes and add up all the <CODE>Get­Gui­Resources</CODE>, why doesn’t it match the <CODE>GR_<WBR>GLOBAL</CODE> value?

Raymond Chen
Raymond Chen

There are some things that aren't charged to processes.

How does the classic Win32 ListView handle incremental searching?
Apr 8, 2024
Post comments count 18
Post likes count 4

How does the classic Win32 ListView handle incremental searching?

Raymond Chen
Raymond Chen

Combining prefix search with repeated search, to accommodate multiple styles.

The case of the exception that a <CODE>catch (…)</CODE> didn’t catch
Apr 5, 2024
Post comments count 0
Post likes count 2

The case of the exception that a <CODE>catch (…)</CODE> didn’t catch

Raymond Chen
Raymond Chen

Reconstructing a false history.

It rather involved being on the other side of this airtight hatchway: System corruption caused by an administrator
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
Raymond Chen

If your goal was to corrupt the system, you sure are doing it the hard way.

Windows debugger trick: Breaking when a specific debugger message is printed
Apr 3, 2024
Post comments count 2
Post likes count 5

Windows debugger trick: Breaking when a specific debugger message is printed

Raymond Chen
Raymond Chen

A different kind of conditional breakpoint.

The history of computing, as told by the hallways of Microsoft Building 41
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
Raymond Chen

A walk through history, in the form of wall textures.

Subroutine calls in the ancient world, before computers had stacks or heaps
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
Raymond Chen

A lot of computing got done even before we had stacks and heaps.

How can I tell C++ that I want to discard a nodiscard value?
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
Raymond Chen

A variety of tricks, with different degrees of readability and legality.

I called <CODE>Create­Environment­Block</CODE> with a process’s token, but I didn’t get that process’s environment
Mar 28, 2024
Post comments count 8
Post likes count 3

I called <CODE>Create­Environment­Block</CODE> with a process’s token, but I didn’t get that process’s environment

Raymond Chen
Raymond Chen

That's not what the <CODE>Create­Environment­Block</CODE> function does.

Some choices for encrypting data so that it can be decrypted only by the same user or computer
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
Raymond Chen

There's your classic, and there's some newfangled stuff.

Dubious security vulnerability: Manual operations can cause a program to hang
Mar 26, 2024
Post comments count 2
Post likes count 4

Dubious security vulnerability: Manual operations can cause a program to hang

Raymond Chen
Raymond Chen

You did this to yourself.

Why isn’t C++ using my default parameter to deduce a template type?
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
Raymond Chen

Trying to have it both ways.

Why does my thread get a broken string as its initial parameter?
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
Raymond Chen

It got converted too late.

Using the <CODE>Display­Information</CODE> class from a desktop Win32 application, part 2
Mar 21, 2024
Post comments count 13
Post likes count 1

Using the <CODE>Display­Information</CODE> class from a desktop Win32 application, part 2

Raymond Chen
Raymond Chen

Completing the prerequisites.

Using the <CODE>Display­Information</CODE> class from a desktop Win32 application, part 1
Mar 20, 2024
Post comments count 3
Post likes count 2

Using the <CODE>Display­Information</CODE> class from a desktop Win32 application, part 1

Raymond Chen
Raymond Chen

A little interop music.

How well does C++/WinRT <CODE>com_ptr</CODE> support class template argument deduction (CTAD)?
Mar 19, 2024
Post comments count 0
Post likes count 1

How well does C++/WinRT <CODE>com_ptr</CODE> support class template argument deduction (CTAD)?

Raymond Chen
Raymond Chen

It doesn't even try, and probably doesn't want you to do it.

How well does wil <CODE>com_ptr</CODE> support class template argument deduction (CTAD)?
Mar 18, 2024
Post comments count 0
Post likes count 1

How well does wil <CODE>com_ptr</CODE> support class template argument deduction (CTAD)?

Raymond Chen
Raymond Chen

Falling into a hole in the C++ language, not filled in until C++20.

How well does WRL <CODE>ComPtr</CODE> support class template argument deduction (CTAD)?
Mar 15, 2024
Post comments count 4
Post likes count 1

How well does WRL <CODE>ComPtr</CODE> support class template argument deduction (CTAD)?

Raymond Chen
Raymond Chen

It tries too hard and accidentally breaks CTAD.

How well does ATL <CODE>CComPtr</CODE> support class template argument deduction (CTAD)?
Mar 14, 2024
Post comments count 1
Post likes count 1

How well does ATL <CODE>CComPtr</CODE> support class template argument deduction (CTAD)?

Raymond Chen
Raymond Chen

It actually works right out of the box.

How well does MFC <CODE>IPTR</CODE>/<CODE>CIP</CODE> support class template argument deduction (CTAD)?
Mar 13, 2024
Post comments count 1
Post likes count 1

How well does MFC <CODE>IPTR</CODE>/<CODE>CIP</CODE> support class template argument deduction (CTAD)?

Raymond Chen
Raymond Chen

Not very well, thanks to requiring the interface ID to be specified explicitly.

How well does <CODE>_com_ptr_t</CODE> support class template argument deduction (CTAD)?
Mar 12, 2024
Post comments count 0
Post likes count 2

How well does <CODE>_com_ptr_t</CODE> support class template argument deduction (CTAD)?

Raymond Chen
Raymond Chen

Not very well, thanks to storing the pointer and IID pair in a helper type.

Class template argument deduction (CTAD) and C++ COM wrappers: Initial explorations
Mar 11, 2024
Post comments count 3
Post likes count 3

Class template argument deduction (CTAD) and C++ COM wrappers: Initial explorations

Raymond Chen
Raymond Chen

How well do these libraries support a feature that likely didn't exist at the time they were written?

The 2024/2025 Seattle Symphony subscription season at a glance
Mar 8, 2024
Post comments count 0
Post likes count 0

The 2024/2025 Seattle Symphony subscription season at a glance

Raymond Chen
Raymond Chen

The pocket reference guide for 2024/2025.

How can I force a copy of a C++ value?
Mar 8, 2024
Post comments count 5
Post likes count 1

How can I force a copy of a C++ value?

Raymond Chen
Raymond Chen

Forcing a copy with a minimum of typing.

In C++/WinRT, you shouldn’t destroy an object while you’re <CODE>co_await</CODE>ing it
Mar 7, 2024
Post comments count 4
Post likes count 1

In C++/WinRT, you shouldn’t destroy an object while you’re <CODE>co_await</CODE>ing it

Raymond Chen
Raymond Chen

A generalization of the ground rules of programming.

How do I make an expression non-movable? What’s the opposite of <CODE>std::move</CODE>?
Mar 6, 2024
Post comments count 5
Post likes count 1

How do I make an expression non-movable? What’s the opposite of <CODE>std::move</CODE>?

Raymond Chen
Raymond Chen

You can turn it into a const thing so it's no longer movable, in a conventional sense.

In domain\user syntax, you can often use the period as an abbreviation for “this computer”
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
Raymond Chen

A bit of a typing saver, particularly with complex machine names.

Is shadowing a member variable from a base class a bad thing? Maybe, but maybe not.
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
Raymond Chen

It depends on the order in which things occurred.

C++/WinRT performance trap: Switching to Windows Runtime too soon
Mar 1, 2024
Post comments count 14
Post likes count 4

C++/WinRT performance trap: Switching to Windows Runtime too soon

Raymond Chen
Raymond Chen

Stay in the devirtualized world until you are forced to leave.

If a parameter isn’t used, what should I pass?
Feb 29, 2024
Post comments count 7
Post likes count 5

If a parameter isn’t used, what should I pass?

Raymond Chen
Raymond Chen

It doesn't matter what you pass, but if you have to ask, then just pass zero.

On the whole idea of giving away a reference to yourself at destruction
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
Raymond Chen

Hey, at least it's possible.

Mitigating attacks based on knowing the length of a Windows Hello PIN
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
Raymond Chen

Balancing convenience against security, and how you can tune the knobs toward more security.

A C# LINQ one-liner to check if exactly one of a set of conditions is met
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
Raymond Chen

Maybe not the most efficient, but it's easy to write.

Gotcha: Be careful how you shut down your dispatcher queues
Feb 23, 2024
Post comments count 4
Post likes count 4

Gotcha: Be careful how you shut down your dispatcher queues

Raymond Chen
Raymond Chen

The dispatcher queue thread isn't useful after it has shut down, so don't try anything.

Gotcha: Don’t forget to shut down your dispatcher queues
Feb 22, 2024
Post comments count 1
Post likes count 1

Gotcha: Don’t forget to shut down your dispatcher queues

Raymond Chen
Raymond Chen

Keep that dispatcher queue controller around, or you'll never be able to clean up.

Once your object reaches <CODE>final_release</CODE>, you are committed to destructing it (eventually)
Feb 21, 2024
Post comments count 1
Post likes count 1

Once your object reaches <CODE>final_release</CODE>, you are committed to destructing it (eventually)

Raymond Chen
Raymond Chen

Don't try to resurrect it.

Microspeak: Closing out, duping out
Feb 20, 2024
Post comments count 3
Post likes count 1

Microspeak: Closing out, duping out

Raymond Chen
Raymond Chen

Making work items no longer appear on a query.

Why can’t I trigger a manual blue screen crash by injecting the magic key sequence?
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
Raymond Chen

It has to come from the physical keyboard, because that's the code that detects the magic key sequence.

If you’re just going to sit there doing nothing, at least do nothing correctly
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
Raymond Chen

How to be inert.

Registered command lines are just command lines, not a programming language
Feb 15, 2024
Post comments count 3
Post likes count 8

Registered command lines are just command lines, not a programming language

Raymond Chen
Raymond Chen

If you want a programming language, you know where to find one.

Functions that return the size of a required buffer generally return upper bounds, not tight bounds
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
Raymond Chen

An over-estimate is better than an under-estimate.

It rather involved being on the other side of this airtight hatchway: Attacking a domain administrator from the local administrator
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
Raymond Chen

If you pwn the machine, then you pwn everyone on the machine.

How can I get the Windows Runtime HttpClient to display a basic authentication prompt?
Feb 12, 2024
Post comments count 1
Post likes count 2

How can I get the Windows Runtime HttpClient to display a basic authentication prompt?

Raymond Chen
Raymond Chen

You need to give it some help finding the right window.

On the virtues of the trailing comma
Feb 9, 2024
Post comments count 25
Post likes count 11

On the virtues of the trailing comma

Raymond Chen
Raymond Chen

A more uniform appearance comes with its own benefits beyond aesthetics.

How do I suppress the error box that appears when a <CODE>LoadLibrary</CODE> fails?
Feb 8, 2024
Post comments count 3
Post likes count 3

How do I suppress the error box that appears when a <CODE>LoadLibrary</CODE> fails?

Raymond Chen
Raymond Chen

They don't appear often, but they do appear occasionally.

Why doesn’t my program get fancy drag/drop effects in high contrast mode with <CODE>CLSID_<WBR>Drag­Drop­Helper</CODE>?
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 <CODE>CLSID_<WBR>Drag­Drop­Helper</CODE>?

Raymond Chen
Raymond Chen

You have to upgrade your manifest.

On using milliseconds as a measure of network latency
Feb 6, 2024
Post comments count 11
Post likes count 3

On using milliseconds as a measure of network latency

Raymond Chen
Raymond Chen

There's a limit to how much technology can improve.

How can I close a thread pool and cancel all work that had been queued to it?
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
Raymond Chen

You can put them in a group.

The case of the invalid parameter error from <CODE>Measure­Override</CODE>
Feb 2, 2024
Post comments count 4
Post likes count 1

The case of the invalid parameter error from <CODE>Measure­Override</CODE>

Raymond Chen
Raymond Chen

Chasing it back to its origin.

Using virtual memory placeholders to allocate contiguous address space for multiple purposes
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
Raymond Chen

Can you hold this for a second?

How can I add an environment variable to a process launched via <CODE>Shell­Execute­Ex</CODE> or <CODE>IContext­Menu</CODE>?
Jan 31, 2024
Post comments count 10
Post likes count 2

How can I add an environment variable to a process launched via <CODE>Shell­Execute­Ex</CODE> or <CODE>IContext­Menu</CODE>?

Raymond Chen
Raymond Chen

Hooking into the way the Windows shell launches processes.

Smoothing over the differences (and defects) in the various implementations of <CODE>IMemory­Buffer</CODE>
Jan 30, 2024
Post comments count 1
Post likes count 1

Smoothing over the differences (and defects) in the various implementations of <CODE>IMemory­Buffer</CODE>

Raymond Chen
Raymond Chen

Stick to the part that nobody messes up.

A comparison of various implementations of the Windows Runtime <CODE>IMemory­Buffer</CODE>
Jan 29, 2024
Post comments count 0
Post likes count 2

A comparison of various implementations of the Windows Runtime <CODE>IMemory­Buffer</CODE>

Raymond Chen
Raymond Chen

Every unhappy class is unhappy in its own way.

How can I expose a pre-existing block of memory as a Windows Runtime object without copying the data?
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
Raymond Chen

Assembling all the pieces.

How can I give away a COM reference just before my object destructs?
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
Raymond Chen

You have to do it before committing to destruction.

The dangerous implementations of the <CODE>IMemory­Buffer­Reference.Closed</CODE> event
Jan 24, 2024
Post comments count 2
Post likes count 2

The dangerous implementations of the <CODE>IMemory­Buffer­Reference.Closed</CODE> event

Raymond Chen
Raymond Chen

Mistakenly handing out COM references that don't work.

The useless <CODE>IMemory­Buffer­Reference.Closed</CODE> event
Jan 23, 2024
Post comments count 1
Post likes count 2

The useless <CODE>IMemory­Buffer­Reference.Closed</CODE> event

Raymond Chen
Raymond Chen

It tells you that you have already lost.

Accessing a block of memory represented by a Windows Runtime IMemoryBuffer
Jan 22, 2024
Post comments count 0
Post likes count 3

Accessing a block of memory represented by a Windows Runtime IMemoryBuffer

Raymond Chen
Raymond Chen

Through the currency known as an IMemoryBufferReference.

The case of the fail-fast trying to log a caught exception
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
Raymond Chen

What is being thrown and why can't we log it?

Implementing two-phase initialization with ATL
Jan 18, 2024
Post comments count 0
Post likes count 2

Implementing two-phase initialization with ATL

Raymond Chen
Raymond Chen

ATL looks like it supports two-phase initialization, but it doesn't.

Getting a strong reference from the <CODE>this</CODE> pointer too soon
Jan 17, 2024
Post comments count 1
Post likes count 2

Getting a strong reference from the <CODE>this</CODE> pointer too soon

Raymond Chen
Raymond Chen

Giving out strong references to an object before you can guarantee that it will work.

What is a hard error, and what makes it harder than an easy error?
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
Raymond Chen

A throwback to the early days of 16-bit Windows.

C++/WinRT gotcha: Not all exceptions derive from <CODE>hresult_error</CODE>
Jan 15, 2024
Post comments count 5
Post likes count 2

C++/WinRT gotcha: Not all exceptions derive from <CODE>hresult_error</CODE>

Raymond Chen
Raymond Chen

There are also C++ standard exceptions, particularly <CODE>std::bad_alloc</CODE>.

In C++/WinRT, how can I await multiple coroutines and capture the results?, part 3
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
Raymond Chen

Dealing with awaitables that return <CODE>void</CODE>, and questioning our life choices.

In C++/WinRT, how can I await multiple coroutines and capture the results?, part 2
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
Raymond Chen

Wrapping the results and returning them in a tuple.

In C++/WinRT, how can I await multiple coroutines and capture the results?, part 1
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
Raymond Chen

Using a custom awaiter to suppress the <CODE>GetResults()</CODE>.

After I accidentally denied access to everyone, how do I get access back?
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
Raymond Chen

Congratulations, you locked your keys in the car.

How do I prevent my C++/WinRT implementation class from participating in COM aggregation?
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
Raymond Chen

Looking for a clue.

The case of the vector with an impossibly large size
Jan 5, 2024
Post comments count 4
Post likes count 3

The case of the vector with an impossibly large size

Raymond Chen
Raymond Chen

Play threading games, win threading prizes.

How can I specify icons for my app to use on the Start menu in high contrast mode?
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
Raymond Chen

Put them in your manifest.

Why doesn’t my code compile when I change a <CODE>shared_ptr<T>(p)</CODE> to an equivalent <CODE>make_shared<T>(p)</CODE>?
Jan 3, 2024
Post comments count 1
Post likes count 2

Why doesn’t my code compile when I change a <CODE>shared_ptr<T>(p)</CODE> to an equivalent <CODE>make_shared<T>(p)</CODE>?

Raymond Chen
Raymond Chen

It depends on who is doing the parameter conversion.

It rather involved being on the other side of this airtight hatchway: Attacking another program by modifying its memory
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
Raymond Chen

If you assume the existence of a vulnerability, you can use that vulnerability to attack something.

How do I prevent my ATL class from participating in COM aggregation? <CODE>DECLARE_<WBR>NOT_<WBR>AGGREGATABLE</CODE> didn’t work
Jan 1, 2024
Post comments count 0
Post likes count 2

How do I prevent my ATL class from participating in COM aggregation? <CODE>DECLARE_<WBR>NOT_<WBR>AGGREGATABLE</CODE> didn’t work

Raymond Chen
Raymond Chen

That marker applies only to creation via the class factory.

2023 year-end link clearance
Dec 29, 2023
Post comments count 8
Post likes count 4

2023 year-end link clearance

Raymond Chen
Raymond Chen

Ringing out another year.

How to allocate address space with a custom alignment or in a custom address region
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
Raymond Chen

Some new powers to guide the allocation.

On calling <CODE>Afx­Connection­Advise</CODE> with <CODE>bAddRef</CODE> set to <CODE>FALSE</CODE>
Dec 28, 2023
Post comments count 1
Post likes count 4

On calling <CODE>Afx­Connection­Advise</CODE> with <CODE>bAddRef</CODE> set to <CODE>FALSE</CODE>

Raymond Chen
Raymond Chen

Playing fast and loose, and eventually you get burnt.

What does it mean when the compiler says that it can’t convert something to itself?
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
Raymond Chen

Why is it even thinking about a conversion?

Don’t keep state in your XAML item templates; put the state in the items
Dec 26, 2023
Post comments count 1
Post likes count 8

Don’t keep state in your XAML item templates; put the state in the items

Raymond Chen
Raymond Chen

Beware of temporary alliances.

That time the Word team sent presents to the children of WordPerfect’s executive vice president
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
Raymond Chen

No, it wasn't creepy.

If I don’t have any items, what error should my <CODE>IFolderView::Items</CODE> method return?
Dec 22, 2023
Post comments count 11
Post likes count 2

If I don’t have any items, what error should my <CODE>IFolderView::Items</CODE> method return?

Raymond Chen
Raymond Chen

It shouldn't return an error at all.

How do I get access to the <CODE>wParam</CODE> and <CODE>lParam</CODE> of the <CODE>WM_<WBR>QUERY­END­SESSION</CODE> method from my MFC message handler?
Dec 21, 2023
Post comments count 2
Post likes count 3

How do I get access to the <CODE>wParam</CODE> and <CODE>lParam</CODE> of the <CODE>WM_<WBR>QUERY­END­SESSION</CODE> method from my MFC message handler?

Raymond Chen
Raymond Chen

Don't be afraid to see how the macros are built.

It rather involved being on the other side of this airtight hatchway: Spoofing another program
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
Raymond Chen

You already had the power to do it yourself.

Microspeak: Locked and loaded
Dec 19, 2023
Post comments count 1
Post likes count 1

Microspeak: Locked and loaded

Raymond Chen
Raymond Chen

Armed and ready, with the suggestion that no further changes will be needed (or accepted).

In 2023, the Gävle Goat faces a new threat to its survival
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
Raymond Chen

It's bock.

If the RegisterClass function takes ownership of the custom background brush, why is it leaking?
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
Raymond Chen

It takes ownership only on success.

How do I specify an optional string parameter to a Windows Runtime method?
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
Raymond Chen

Strings are sort of reference but sort of values.

How do I specify an optional parameter to a Windows Runtime method?
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
Raymond Chen

There is no way to express explicit optionality, but there are implicit ways.

How can I work around the absence of default parameters in the Windows Runtime?
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
Raymond Chen

You can fake it with overloads.

What happens if I define one environment variable in terms of the value of another environment variable?
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
Raymond Chen

Only certain types of dependencies are supported.

The mysterious second parameter to the x86 <CODE>ENTER</CODE> instruction
Dec 11, 2023
Post comments count 12
Post likes count 6

The mysterious second parameter to the x86 <CODE>ENTER</CODE> instruction

Raymond Chen
Raymond Chen

For an ABI that probably nobody uses.

A simpler version of the task sequencer that doesn’t promise fairness
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
Raymond Chen

Just let a kernel object control the access.

In C++, how can I make a default parameter be the <CODE>this</CODE> pointer of the caller?
Dec 7, 2023
Post comments count 1
Post likes count 2

In C++, how can I make a default parameter be the <CODE>this</CODE> pointer of the caller?

Raymond Chen
Raymond Chen

Again, you can't, but you can fake it.

In C++, how can I make a member function default parameter depend on <CODE>this</CODE>?
Dec 6, 2023
Post comments count 2
Post likes count 4

In C++, how can I make a member function default parameter depend on <CODE>this</CODE>?

Raymond Chen
Raymond Chen

You can't, but you can fake it.

What was the code name for 64-bit Windows?
Dec 5, 2023
Post comments count 6
Post likes count 8

What was the code name for 64-bit Windows?

Raymond Chen
Raymond Chen

Sundown, which was a hidden jab at the competition.

What is a static chain pointer in the context of calling convention ABI?
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
Raymond Chen

Buried in the System V Application Binary Interface.

Why does the Windows Portable Executable (PE) format have both an import section and input directory?
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
Raymond Chen

They seem to be the same thing. Do we need both?

Why does the Windows Portable Executable (PE) format have separate tables for import names and import addresses?, part 2
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
Raymond Chen

Keeping read-only data separate from read-write data.

Why does the Windows Portable Executable (PE) format have separate tables for import names and import addresses?, part 1
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
Raymond Chen

Even though their lifetimes don't overlap, you sometimes need to go back in time.

A reported vulnerability about getting paid apps for free is really about paying for free apps
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
Raymond Chen

Try shopping around.

In Windows 3.1 and Windows 95, what is a “grabber”?
Nov 27, 2023
Post comments count 3
Post likes count 5

In Windows 3.1 and Windows 95, what is a “grabber”?

Raymond Chen
Raymond Chen

It grabbed your MS-DOS screen and put it into a window.

On harmful overuse of <CODE>std::move</CODE>
Nov 24, 2023
Post comments count 10
Post likes count 11

On harmful overuse of <CODE>std::move</CODE>

Raymond Chen
Raymond Chen

Initial excitement leads to overuse.

On the need to keep most event sources alive if you want them to raise events
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
Raymond Chen

You can't receive a notification from something that doesn't exist.

How can I convert a Windows Runtime <CODE>Software­Bitmap</CODE> to a WIC bitmap?
Nov 22, 2023
Post comments count 1
Post likes count 5

How can I convert a Windows Runtime <CODE>Software­Bitmap</CODE> to a WIC bitmap?

Raymond Chen
Raymond Chen

The reverse of <CODE>ISoftware­Bitmap­Native­Factory::<WBR>Create­From­WIC­Bitmap</CODE>.

Microspeak revisited: Line of sight
Nov 21, 2023
Post comments count 5
Post likes count 8

Microspeak revisited: Line of sight

Raymond Chen
Raymond Chen

A fancy way of saying unimpeded network connectivity.

If you’re going to crash on an unhandled exception, you may as well do it sooner rather than later
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
Raymond Chen

Avoiding the problem discovered by the case of the invalid argument exception from a method that takes no arguments.

The theory behind the IHttpFilter interface
Nov 17, 2023
Post comments count 0
Post likes count 3

The theory behind the IHttpFilter interface

Raymond Chen
Raymond Chen

Layering features on top of each other.

What happened to the custom exception description I threw from a C++/WinRT IAsyncAction?
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
Raymond Chen

The description is just a courtesy and is not part of the API contract.

Why does calling a coroutine allocate a lot of stack space even though the coroutine frame is on the heap?
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
Raymond Chen

Heap elision optimization kicks in, and doesn't kick out.

Starting on the other side of this airtight hatchway: Running a program that leaks memory
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
Raymond Chen

There are a lot of things you can do to consume memory.

What is the difference between UuidToString, StringFromCLSID, StringFromIID, and StringFromGUID2?
Nov 13, 2023
Post comments count 2
Post likes count 4

What is the difference between UuidToString, StringFromCLSID, StringFromIID, and StringFromGUID2?

Raymond Chen
Raymond Chen

Different ways of stringizing a GUID.

The case of the invalid argument exception from a method that takes no arguments
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
Raymond Chen

Where did the invalid argument come from?

A clarification on the multithreading constraints of the <CODE>Encrypt­Message</CODE> function
Nov 9, 2023
Post comments count 0
Post likes count 1

A clarification on the multithreading constraints of the <CODE>Encrypt­Message</CODE> function

Raymond Chen
Raymond Chen

Reading a sentence in the context of the whole paragraph.

How can I get information about media playing on the system, and optionally control their playback?
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
Raymond Chen

Going to the global system media transport controls world.

“Stop sharing this folder” is not the same as “Never share this folder”
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
Raymond Chen

It stops sharing the folder, but that doesn't prevent you from starting it again.

Why doesn’t reduction by modulo work for floating point values?
Nov 6, 2023
Post comments count 3
Post likes count 4

Why doesn’t reduction by modulo work for floating point values?

Raymond Chen
Raymond Chen

Working out why it works for integers and seeing what goes wrong.

Why does unsafe multithreaded use of an <CODE>std::<WBR>unordered_<WBR>map</CODE> crash more often than unsafe multithreaded use of a <CODE>std::<WBR>map</CODE>?
How come my custom exception message is lost when it is thrown from a <CODE>IAsyncAction^</CODE>?
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 <CODE>IAsyncAction^</CODE>?

Raymond Chen
Raymond Chen

Things that survive in the C++ world and things that are lost when you cross the ABI.

More notes on use of the <CODE>DS_<WBR>CONTROL</CODE> style
Nov 1, 2023
Post comments count 2
Post likes count 2

More notes on use of the <CODE>DS_<WBR>CONTROL</CODE> style

Raymond Chen
Raymond Chen

Styles that have to go in, and styles that have to come out. (And styles that you can choose.)

What is the thread reaper?
Oct 31, 2023
Post comments count 9
Post likes count 3

What is the thread reaper?

Raymond Chen
Raymond Chen

Should you fear the thread reaper?

What are the dire consequences of not removing all the properties that were set via <CODE>SetProp</CODE>?
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 <CODE>SetProp</CODE>?

Raymond Chen
Raymond Chen

Not so much any more, but it could be a sign that you forgot something.

How to support a COM interface conditionally in WRL
Oct 27, 2023
Post comments count 1
Post likes count 2

How to support a COM interface conditionally in WRL

Raymond Chen
Raymond Chen

Customizing the QueryInterface and GetIids methods.

How to support a COM interface conditionally in C++/WinRT
Oct 26, 2023
Post comments count 0
Post likes count 3

How to support a COM interface conditionally in C++/WinRT

Raymond Chen
Raymond Chen

Prevent <CODE>winrt::implements</CODE> from responding to it or reporting it.

The format of icon resources, revisited
Oct 25, 2023
Post comments count 5
Post likes count 6

The format of icon resources, revisited

Raymond Chen
Raymond Chen

Filling in some gaps.

Why is there a hash of a weak password in the Windows cryptographic libraries?
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
Raymond Chen

They're part of an internal self-test.

How do I add a non-copyable, non-movable object to a <CODE>std::map</CODE> or <CODE>std::unordered_map</CODE>?
Oct 23, 2023
Post comments count 2
Post likes count 4

How do I add a non-copyable, non-movable object to a <CODE>std::map</CODE> or <CODE>std::unordered_map</CODE>?

Raymond Chen
Raymond Chen

Fancy emplacement.

On the failed unrealized promise of <CODE>Reg­Override­Predef­Key</CODE>
Oct 20, 2023
Post comments count 0
Post likes count 1

On the failed unrealized promise of <CODE>Reg­Override­Predef­Key</CODE>

Raymond Chen
Raymond Chen

An early attempt to sandbox the registry for a process.

What’s the difference between setting a page’s protection to <CODE>PAGE_NOACCESS</CODE> and freeing it?
Oct 19, 2023
Post comments count 3
Post likes count 2

What’s the difference between setting a page’s protection to <CODE>PAGE_NOACCESS</CODE> and freeing it?

Raymond Chen
Raymond Chen

Nobody can access it, but it's still there.

How can I check if I’m on a DispatcherQueue’s thread if I can’t call HasThreadAccess?
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
Raymond Chen

Looking at the tools you have available.

Microspeak: The As-Appropriate (AA) interviewer
Oct 17, 2023
Post comments count 5
Post likes count 2

Microspeak: The As-Appropriate (AA) interviewer

Raymond Chen
Raymond Chen

So, how are things going so far?

API design principle: Reading a property or adding an event handler should not alter observable behavior
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
Raymond Chen

Don't punish people for looking.

On detecting improper use of <CODE>std::<WBR>enable_<WBR>shared_<WBR>from_<WBR>this</CODE>
Oct 13, 2023
Post comments count 0
Post likes count 2

On detecting improper use of <CODE>std::<WBR>enable_<WBR>shared_<WBR>from_<WBR>this</CODE>

Raymond Chen
Raymond Chen

Playing around with the standard library.

I created an overloaded operator for my C++/WinRT class, but it’s not working
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
Raymond Chen

Take a closer look at what you are overloading.

Why does <CODE>IFileDialog</CODE> still show non-filesystem folders when I pass <CODE>FOS_<WBR>FORCE­FILE­SYSTEM</CODE>?
Oct 11, 2023
Post comments count 13
Post likes count 3

Why does <CODE>IFileDialog</CODE> still show non-filesystem folders when I pass <CODE>FOS_<WBR>FORCE­FILE­SYSTEM</CODE>?

Raymond Chen
Raymond Chen

Because you need to pass through them to get there.

It rather required being on the other side of this airtight hatchway: Knowing the domain administrator password
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
Raymond Chen

If you give away the password, well, that's sort of on you.

Is there any performance advantage to marking a page read-only if I had no intention of writing to it anyway?
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
Raymond Chen

The CPU already figured it out.

A very belated improvement to the filtering of the Browse for Folder dialog so it shows only drive letters
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
Raymond Chen

The case of the very short UNC.

How can I get WideCharToMultiByte to convert strings encoded in UTF-16BE?
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
Raymond Chen

You first have to get it into a format the WideCharToMultiByte accepts.

On the confusing names for the Windows service SID types
Oct 4, 2023
Post comments count 3
Post likes count 2

On the confusing names for the Windows service SID types

Raymond Chen
Raymond Chen

Too much abbreviation.

A complaint about Links the Cat, the Office assistant
Oct 3, 2023
Post comments count 1
Post likes count 6

A complaint about Links the Cat, the Office assistant

Raymond Chen
Raymond Chen

Do all cats do that?

How do I manually update a remote tracking branch, say, to undo a fetch?
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
Raymond Chen

Updating refs to point to whatever you like.

Template meta-programming: Avoiding saying a type before it is complete
Sep 29, 2023
Post comments count 0
Post likes count 1

Template meta-programming: Avoiding saying a type before it is complete

Raymond Chen
Raymond Chen

Deferring use until after the class is defined.

C++/WinRT gotcha: <CODE>get_strong()</CODE> will produce a broken strong reference if destruction has already begun
Sep 28, 2023
Post comments count 2
Post likes count 2

C++/WinRT gotcha: <CODE>get_strong()</CODE> will produce a broken strong reference if destruction has already begun

Raymond Chen
Raymond Chen

A strong reference to nothing.

The dangers of releasing the last strong reference from within its own callback
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
Raymond Chen

Deadlocking with yourself.

Why is kernel32.dll running in user mode and not kernel mode, like its name implies?
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
Raymond Chen

It's just a name, and it comes from the days before user-mode/kernel-mode separation.

GetQueueStatus and the queue state
Sep 25, 2023
Post comments count 1
Post likes count 3

GetQueueStatus and the queue state

Raymond Chen
Raymond Chen

There's stuff going on that's hiding behind the innocuous-looking name.

When I try to call an exported function, the target crashes when it tries to call any Windows function
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
Raymond Chen

Using what you know about how functions are imported to construct a theory that matches the evidence.

How does Explorer calculate the “Date” of a file?
Sep 21, 2023
Post comments count 9
Post likes count 8

How does Explorer calculate the “Date” of a file?

Raymond Chen
Raymond Chen

Mapping the generic concept to specific file types.

Why does my C++/WinRT project get unresolved externals for constructors?
Sep 20, 2023
Post comments count 1
Post likes count 1

Why does my C++/WinRT project get unresolved externals for constructors?

Raymond Chen
Raymond Chen

You forgot to include the namespace header file, didn't you.

Why did the 16-bit _lopen and _lcreat function return -1 on failure instead of 0?
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
Raymond Chen

Trying to look like somebody else.

When looking to free up disk space, don’t forget your symbol file caches
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
Raymond Chen

They go all over the place.

How can I prevent myself from using a parameter after I’ve extracted all value from it?
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
Raymond Chen

You can shadow it with something useless.

I accidentally performed an operation on <CODE>INVALID_<WBR>HANDLE_<WBR>VALUE</CODE>, and it worked: What just happened?
Sep 14, 2023
Post comments count 7
Post likes count 3

I accidentally performed an operation on <CODE>INVALID_<WBR>HANDLE_<WBR>VALUE</CODE>, and it worked: What just happened?

Raymond Chen
Raymond Chen

Coincidentally valid, but not what you think.

How do I perform a case-insensitive comparison of two strings in the Deseret script?
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
Raymond Chen

It sort of depends on why you're comparing them.

The odd cadence of narrative engineering design documents
Sep 12, 2023
Post comments count 4
Post likes count 3

The odd cadence of narrative engineering design documents

Raymond Chen
Raymond Chen

Following the rubric off a cliff.

Any sufficiently advanced uninstaller is indistinguishable from malware
Sep 11, 2023
Post comments count 27
Post likes count 8

Any sufficiently advanced uninstaller is indistinguishable from malware

Raymond Chen
Raymond Chen

The common pattern of trying to delete yourself.

On transferring or copying ABI pointers between smart pointers
Sep 8, 2023
Post comments count 3
Post likes count 4

On transferring or copying ABI pointers between smart pointers

Raymond Chen
Raymond Chen

Keep track of who owns the reference.

A freestanding JavaScript function that uses <CODE>this</CODE> is easily mistaken for a constructor
Sep 7, 2023
Post comments count 1
Post likes count 1

A freestanding JavaScript function that uses <CODE>this</CODE> is easily mistaken for a constructor

Raymond Chen
Raymond Chen

Because that's what constructors look like.

Detecting whether a tree-like data structure contains a cycle
Sep 6, 2023
Post comments count 2
Post likes count 2

Detecting whether a tree-like data structure contains a cycle

Raymond Chen
Raymond Chen

Combining two things we already know.

When documentation cautions that something may not happen, that suggests that it normally does happen
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
Raymond Chen

Reading between the lines.

Just for fun: What happens when you shift a register by more than the register size?
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
Raymond Chen

A comparative study of processor architectures.

How do I find out more about the fail-fast exception that occurs when an exception in a PPL task goes unobserved?
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
Raymond Chen

Digging into the internals.

Diagnosing a crash when trying to call <CODE>ReadFile</CODE> via language interop
Aug 31, 2023
Post comments count 0
Post likes count 3

Diagnosing a crash when trying to call <CODE>ReadFile</CODE> via language interop

Raymond Chen
Raymond Chen

Checking the signatures and inferring what could have gone wrong.

How can I programmatically obtain the value of the “Make text bigger” slider?
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
Raymond Chen

The text scale factor property.

The popularity of DOS/4GW made Windows 95 game compatibility a little easier, but with higher stakes
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
Raymond Chen

A popular path to protected mode.

Just for fun: Which processors prefer sign-extended loads, and which prefer zero-extended loads?
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
Raymond Chen

Another pointless chart.

On writing loops in continuation-passing style, part 4
Aug 25, 2023
Post comments count 3
Post likes count 2

On writing loops in continuation-passing style, part 4

Raymond Chen
Raymond Chen

Equivalents in C# and JavaScript.

On writing loops in PPL and continuation-passing style, part 3
Aug 24, 2023
Post comments count 0
Post likes count 2

On writing loops in PPL and continuation-passing style, part 3

Raymond Chen
Raymond Chen

Explicit shared state.

On writing loops in PPL and continuation-passing style, part 2
Aug 23, 2023
Post comments count 0
Post likes count 2

On writing loops in PPL and continuation-passing style, part 2

Raymond Chen
Raymond Chen

Recursion comes back.

On writing loops in PPL and continuation-passing style, part 1
Aug 22, 2023
Post comments count 0
Post likes count 2

On writing loops in PPL and continuation-passing style, part 1

Raymond Chen
Raymond Chen

Keeping track of what to do next.

Inside STL: The different types of shared pointer control blocks
Aug 21, 2023
Post comments count 7
Post likes count 3

Inside STL: The different types of shared pointer control blocks

Raymond Chen
Raymond Chen

Well, some of them, at least.

Phantom and indulgent shared pointers
Aug 18, 2023
Post comments count 1
Post likes count 2

Phantom and indulgent shared pointers

Raymond Chen
Raymond Chen

The phantom controls something yet holds nothing. The indulgent holds something but controls nothing.

What it means when you convert between different <CODE>shared_ptr</CODE>s
Aug 17, 2023
Post comments count 1
Post likes count 2

What it means when you convert between different <CODE>shared_ptr</CODE>s

Raymond Chen
Raymond Chen

Changing the pointer while controlling the same object.

Inside STL: The <CODE>shared_ptr</CODE> constructor and <CODE>enable_shared_from_this</CODE>
Aug 16, 2023
Post comments count 1
Post likes count 4

Inside STL: The <CODE>shared_ptr</CODE> constructor and <CODE>enable_shared_from_this</CODE>

Raymond Chen
Raymond Chen

Working together through a secret signal.

Inside STL: The <CODE>shared_ptr</CODE> constructor vs <CODE>make_shared</CODE>
Aug 15, 2023
Post comments count 7
Post likes count 2

Inside STL: The <CODE>shared_ptr</CODE> constructor vs <CODE>make_shared</CODE>

Raymond Chen
Raymond Chen

Where to hide the control block.

Inside STL: Smart pointers
Aug 14, 2023
Post comments count 4
Post likes count 6

Inside STL: Smart pointers

Raymond Chen
Raymond Chen

Simple pointers or more complicated pointers.

Inside STL: The array
Aug 11, 2023
Post comments count 0
Post likes count 5

Inside STL: The array

Raymond Chen
Raymond Chen

It's just an array.

Inside STL: The deque, implementation
Aug 10, 2023
Post comments count 3
Post likes count 5

Inside STL: The deque, implementation

Raymond Chen
Raymond Chen

An array of (pointers to) arrays.

Inside STL: The deque, design
Aug 9, 2023
Post comments count 2
Post likes count 7

Inside STL: The deque, design

Raymond Chen
Raymond Chen

An array of (pointers to) arrays.

Inside STL: The unordered_map, unordered_set, unordered_multimap, and unordered_multiset
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
Raymond Chen

A hash table.

Inside STL: The map, set, multimap, and multiset
Aug 7, 2023
Post comments count 6
Post likes count 5

Inside STL: The map, set, multimap, and multiset

Raymond Chen
Raymond Chen

A red-black tree.

Inside STL: The lists
Aug 4, 2023
Post comments count 3
Post likes count 7

Inside STL: The lists

Raymond Chen
Raymond Chen

Your traditional singly- or doubly-linked list.

Inside STL: The string
Aug 3, 2023
Post comments count 6
Post likes count 9

Inside STL: The string

Raymond Chen
Raymond Chen

An allocation, with a twist.

Inside STL: The vector
Aug 2, 2023
Post comments count 6
Post likes count 7

Inside STL: The vector

Raymond Chen
Raymond Chen

A contiguous memory block, reallocated as necessary.

Inside STL: The pair and the compressed pair
Aug 1, 2023
Post comments count 7
Post likes count 8

Inside STL: The pair and the compressed pair

Raymond Chen
Raymond Chen

Two fields in one object, how hard can it be?

Misinterpreting the misleadingly-named <CODE>STATUS_<WBR>STACK_<WBR>BUFFER_<WBR>OVERRUN</CODE>
Jul 31, 2023
Post comments count 4
Post likes count 4

Misinterpreting the misleadingly-named <CODE>STATUS_<WBR>STACK_<WBR>BUFFER_<WBR>OVERRUN</CODE>

Raymond Chen
Raymond Chen

The subcode tells you why we stopped executing, and it's rarely because of a stack buffer overflow.

How to split off an older copy of a file while preserving git line history
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
Raymond Chen

Variation on a theme.

Perfect forwarding forwards objects, not braced things that are trying to become objects
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
Raymond Chen

Before you can forward something, it needs to be a something.

On the various ways of creating Windows Runtime delegates in C++/WinRT and C++/CX
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
Raymond Chen

Comparing and contrasting.

Before you try to do something, make sure you can do nothing
Jul 25, 2023
Post comments count 7
Post likes count 33

Before you try to do something, make sure you can do nothing

Raymond Chen
Raymond Chen

If you can't do nothing, then don't expect to be able to do something.

Why does <CODE>IAsyncAction</CODE> or <CODE>IAsyncOperation.<WBR>GetResults()</CODE> produce a <CODE>E_<WBR>ILLEGAL_<WBR>METHOD_<WBR>CALL</CODE> exception?
How to clone a Windows Runtime map in the face of possible concurrent modification, part 3
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
Raymond Chen

Doing it one more time, for C++/CX.

How to clone a Windows Runtime map in the face of possible concurrent modification, part 2
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
Raymond Chen

Applying what we learned about vectors.

How to clone a Windows Runtime map in the face of possible concurrent modification, part 1
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
Raymond Chen

Applying what we learned about vectors.

How to clone a Windows Runtime vector in the face of possible concurrent modification, part 4
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
Raymond Chen

Translating to C++/CX and dealing with some quirks of that language.

Cloning a Windows Runtime vector in the face of possible concurrent modification, denial of service?
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
Raymond Chen

Can you get sent into an infinite loop?

How to clone a Windows Runtime vector in the face of possible concurrent modification, part 3
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
Raymond Chen

Dealing with the pesky <CODE>std::vector<bool></CODE>.

How to clone a Windows Runtime vector in the face of possible concurrent modification, part 2
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
Raymond Chen

Trying to make a generic solution.

How to clone a Windows Runtime vector in the face of possible concurrent modification, part 1
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
Raymond Chen

Backing off and retrying, but the detection is the tricky part.

Why does the compiler complain about a missing constructor when I’m just resizing my <CODE>std::vector</CODE> to a smaller size?
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 <CODE>std::vector</CODE> to a smaller size?

Raymond Chen
Raymond Chen

The compiler doesn't know that you're shrinking.

How to wait for multiple C++ coroutines to complete before propagating failure, concluding remarks
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
Raymond Chen

The things that could go wrong before you even start.

How to wait for multiple C++ coroutines to complete before propagating failure, finding the awaiter
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
Raymond Chen

Making sure to wrap the right thing.

How to wait for multiple C++ coroutines to complete before propagating failure, wrapping the awaitable
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
Raymond Chen

Intercepting the exception on the front side.

How to wait for multiple C++ coroutines to complete before propagating failure, preallocating the coroutine frame
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
Raymond Chen

Avoiding dynamic memory allocation.

How to wait for multiple C++ coroutines to complete before propagating failure, memory allocation failure
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
Raymond Chen

There's no good way to report the failure, so we just have to give up.

How to wait for multiple C++ coroutines to complete before propagating failure, symmetric transfer
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
Raymond Chen

Avoiding stack build-up.

2023 mid-year link clearance
Jun 30, 2023
Post comments count 3
Post likes count 3

2023 mid-year link clearance

Raymond Chen
Raymond Chen

The tradition continues.

How to wait for multiple C++ coroutines to complete before propagating failure, custom promise
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
Raymond Chen

Taking things into our own hands.

How to wait for multiple C++ coroutines to complete before propagating failure, peeling away at a tuple
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
Raymond Chen

Iterating over a tuple recursively.

How to wait for multiple C++ coroutines to complete before propagating failure, false hope
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
Raymond Chen

Trying to iterate over a pack.

How to wait for multiple C++ coroutines to complete before propagating failure, unhelpful lambda
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
Raymond Chen

The usual trick doesn't work.

How to wait for multiple C++ coroutines to complete before propagating failure, initial plunge
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
Raymond Chen

Remembering the exception while finishing the other work.

What can go wrong if you release an SRWLock from a thread different from the one that acquired it?
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
Raymond Chen

It's not a supported scenario, so anything can happen.

How can I find out the last time a user logged on from C++?
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
Raymond Chen

The information is in the historically-named LANMAN APIs.

The case of the <CODE>make_shared</CODE> on a C++/WinRT type
Jun 21, 2023
Post comments count 0
Post likes count 3

The case of the <CODE>make_shared</CODE> on a C++/WinRT type

Raymond Chen
Raymond Chen

Now you can't tell who's in charge.

Why is Windows using only even-numbered processors?
Jun 20, 2023
Post comments count 2
Post likes count 2

Why is Windows using only even-numbered processors?

Raymond Chen
Raymond Chen

Spreading out the load over cores.

Why am I being told about a signed/unsigned comparison, and why only sometimes, and how can I fix it?
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
Raymond Chen

How the compiler back-end can influence warnings.

The case of the invalid handle despite being managed by an RAII type, part 2
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
Raymond Chen

Avoiding using an object after is has destructed, and maybe using a less-well-known corner of the C++ language.

The case of the invalid handle despite being managed by an RAII type
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
Raymond Chen

The handle remains valid for the object's lifetime, but what is the object's lifetime?

How expensive is it to create a Windows performance counter?
Jun 14, 2023
Post comments count 3
Post likes count 1

How expensive is it to create a Windows performance counter?

Raymond Chen
Raymond Chen

The cost depends on the performance counter.

SIDs are really just another a fancy way of creating unique IDs in a decentralized way
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
Raymond Chen

Keeping them from colliding with each other.

The move constructor that you have to declare, even though you don’t want anyone to actually call it
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
Raymond Chen

Forcing named return value optimization.

Reordering C++ template type parameters for usability purposes, and type deduction from the future
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
Raymond Chen

You want them to go first, but you also want to deduce them.

How can I register a program to auto-relaunch if it crashes or is terminated?, redux
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
Raymond Chen

You can get a little bit of the way there.

Pulling sleight of hand tricks in a security vulnerability report, episode 2
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
Raymond Chen

I see what you did there.

How can I make WiFi passwords per-user rather than per-system?
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
Raymond Chen

A little-known system configuration setting.

It’s great that you provide operator overloads, but it’s also nice to have names
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
Raymond Chen

Avoiding the need to invoke the operator explicitly as a specialized template, among other things.

C++/WinRT event handlers that are lambdas with weak pointers to the parent class, part 3
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
Raymond Chen

Extending to <CODE>std::weak_ptr</CODE>.

C++/WinRT event handlers that are lambdas with weak pointers to the parent class, part 2
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
Raymond Chen

Working out the boilerplate.

C++/WinRT event handlers that are lambdas with weak pointers to the parent class, part 1
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
Raymond Chen

Assessing the state of affairs.

How do I change the directory Windows uses for user profiles? revisited
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
Raymond Chen

You can still do it, but it's not really supported.

On writing functions that accept any specialization of a C++ template type
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
Raymond Chen

There are the obvious arguments, the non-obvious arguments, and the invisible arguments.

Getting a strong reference from the <CODE>this</CODE> pointer too late
May 26, 2023
Post comments count 3
Post likes count 1

Getting a strong reference from the <CODE>this</CODE> pointer too late

Raymond Chen
Raymond Chen

Once destruction begins, strong references mean nothing.

How can I trigger a recalc of the mouse cursor after I changed some of my internal application state?, follow-up
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
Raymond Chen

You still need to filter to your window, so you don't mess up another window on the same thread.

Don’t name your header file <CODE>security.h</CODE> either
May 24, 2023
Post comments count 4
Post likes count 4

Don’t name your header file <CODE>security.h</CODE> either

Raymond Chen
Raymond Chen

You may be overriding an SDK header by mistake.

On creating (and using) a transforming iterator
May 23, 2023
Post comments count 4
Post likes count 4

On creating (and using) a transforming iterator

Raymond Chen
Raymond Chen

It lets you change the thing being iterated over, on the fly.

Speeding up the insertion of a sorted (or mostly-sorted) key list into a <CODE>std::map</CODE> or other ordered associative container
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 <CODE>std::map</CODE> or other ordered associative container

Raymond Chen
Raymond Chen

Provide a hint for the location of the next item.

On catching exceptions in PPL tasks
May 19, 2023
Post comments count 0
Post likes count 1

On catching exceptions in PPL tasks

Raymond Chen
Raymond Chen

You also have to catch the exception when it comes out the end of the task chain.

What is the opposite of <CODE>LVM_SORTITEMS</CODE>?
May 18, 2023
Post comments count 3
Post likes count 2

What is the opposite of <CODE>LVM_SORTITEMS</CODE>?

Raymond Chen
Raymond Chen

How can you unring the bell?

How do I free the pointers returned by functions like <CODE>Get­Token­Information</CODE>?
May 17, 2023
Post comments count 2
Post likes count 2

How do I free the pointers returned by functions like <CODE>Get­Token­Information</CODE>?

Raymond Chen
Raymond Chen

They are all pointers back into the main memory block.

It appears that I’ve never made a complete visit to the Pacific Northwest
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
Raymond Chen

If the marketing department is to be believed.

Summary of the duck-typing requirements of C++ COM wrappers
May 16, 2023
Post comments count 3
Post likes count 4

Summary of the duck-typing requirements of C++ COM wrappers

Raymond Chen
Raymond Chen

Wrapping up and comparing.

What are the duck-typing requirements of C++/WinRT <CODE>com_ptr</CODE>?
May 15, 2023
Post comments count 1
Post likes count 2

What are the duck-typing requirements of C++/WinRT <CODE>com_ptr</CODE>?

Raymond Chen
Raymond Chen

The experiments conclude.

What are the duck-typing requirements of wil <CODE>com_ptr</CODE>?
May 12, 2023
Post comments count 0
Post likes count 2

What are the duck-typing requirements of wil <CODE>com_ptr</CODE>?

Raymond Chen
Raymond Chen

The experiments continue.

What are the duck-typing requirements of WRL <CODE>ComPtr</CODE>?
May 11, 2023
Post comments count 0
Post likes count 2

What are the duck-typing requirements of WRL <CODE>ComPtr</CODE>?

Raymond Chen
Raymond Chen

Another round of experimentation.

What are the duck-typing requirements of ATL <CODE>CComPtr</CODE>?
May 10, 2023
Post comments count 1
Post likes count 1

What are the duck-typing requirements of ATL <CODE>CComPtr</CODE>?

Raymond Chen
Raymond Chen

Looking for the minimum requirements.

What are the duck-typing requirements of MFC <CODE>IPTR</CODE>?
May 9, 2023
Post comments count 0
Post likes count 1

What are the duck-typing requirements of MFC <CODE>IPTR</CODE>?

Raymond Chen
Raymond Chen

Seeing what goes wrong and trying to fix it.

What are the duck-typing requirements of <CODE>_com_ptr_t</CODE>?
May 8, 2023
Post comments count 1
Post likes count 2

What are the duck-typing requirements of <CODE>_com_ptr_t</CODE>?

Raymond Chen
Raymond Chen

As long as you fulfill the contract, based on method names.

The case of the crash in a C++/WinRT coroutine: Unpeeling the onion
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
Raymond Chen

Digging deeper and deeper.

Why does XAML complain that none of the overloads of <CODE>winrt::to_hstring</CODE> could be used?
May 4, 2023
Post comments count 0
Post likes count 1

Why does XAML complain that none of the overloads of <CODE>winrt::to_hstring</CODE> could be used?

Raymond Chen
Raymond Chen

Look at what you are converting from and converting to.

What can I do if I don’t want my file version number to be a sequence of four integers?
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
Raymond Chen

The format is enforced by the Windows file format, but you can present the information in a custom way.

Why does Task Manager disappear briefly when you switch it into or out of <I>Always on top</I>?
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 <I>Always on top</I>?

Raymond Chen
Raymond Chen

Ascending to another plane of existence.

How is it even possible to cheat on a musical performance practical exam?
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
Raymond Chen

Nature finds a way.

A quick note about WRL’s <CODE>Chain­Interfaces</CODE> template class
May 1, 2023
Post comments count 2
Post likes count 2

A quick note about WRL’s <CODE>Chain­Interfaces</CODE> template class

Raymond Chen
Raymond Chen

For interfaces which extend each other.

On the finer points of cancelling timers and wait objects in Windows thread pool
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
Raymond Chen

Assorted little details.

What’s up with this new <CODE>memory_<WBR>order_<WBR>consume</CODE> memory order?
Apr 27, 2023
Post comments count 2
Post likes count 3

What’s up with this new <CODE>memory_<WBR>order_<WBR>consume</CODE> memory order?

Raymond Chen
Raymond Chen

A weaker variation of acquire.

One way to defer work when a re-entrant call is detected
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
Raymond Chen

Tying a string on your finger, as a reminder to yourself.

A code comment noting the steps to take when a 256th enum field is added
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
Raymond Chen

A note for my future self.

Why is <CODE>std::hardware_destructive_interference_size</CODE> a compile-time constant instead of a run-time value?
Apr 24, 2023
Post comments count 2
Post likes count 3

Why is <CODE>std::hardware_destructive_interference_size</CODE> a compile-time constant instead of a run-time value?

Raymond Chen
Raymond Chen

The compiler is already making compile-time assumptions about the processor; you just don't realize it.

Protecting a broker from a failing delegate
Apr 21, 2023
Post comments count 1
Post likes count 1

Protecting a broker from a failing delegate

Raymond Chen
Raymond Chen

Catching them in a different way.

Protecting a broker from a failing event handler
Apr 20, 2023
Post comments count 0
Post likes count 2

Protecting a broker from a failing event handler

Raymond Chen
Raymond Chen

Gotta catch them all.

The case of the unhandled exception in a brokered Windows Runtime component
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
Raymond Chen

Digging into the event dispatch code.

No, it is not a security vulnerability that there is no certificate of appreciation for reporting a bug
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
Raymond Chen

It wasn't even a bug report.

How can I find the invalid class when C++/WinRT tells me that the class may not be final?
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
Raymond Chen

It's in the error details.

How can I convert a WIC bitmap to a Windows Runtime SoftwareBitmap? part 4: Handing it over
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
Raymond Chen

Just take the whole thing.

How can I convert a WIC bitmap to a Windows Runtime SoftwareBitmap? part 3: Filling the SoftwareBitmap directly
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
Raymond Chen

Avoiding the intermediate buffer.

How can I convert a WIC bitmap to a Windows Runtime SoftwareBitmap? part 2: Via a 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
Raymond Chen

Passing raw pixels across.

How can I convert a WIC bitmap to a Windows Runtime SoftwareBitmap? part 1: Via an encoded stream
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
Raymond Chen

We'll start with the hard way, but it gets easier.

Why is there a large gap between some of the Windows system metrics indices?
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
Raymond Chen

An artifact of the internal implementation.

The case of the PasswordVault.Add call that the customer thinks was hung
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
Raymond Chen

But was it really hung? Or did it just look that way.

An ignored exception can be misinterpreted as a hang, particularly in coroutines
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
Raymond Chen

I mean, execution seems to have stopped.

How do I modify the contents of a boxed Windows Runtime value?
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
Raymond Chen

Once it's in the box, you can't change it.

What is the maximum size of a process environment block?
Apr 4, 2023
Post comments count 4
Post likes count 2

What is the maximum size of a process environment block?

Raymond Chen
Raymond Chen

There's no hard-coded limit in Windows, but maybe somebody else has a limit.

C++17 creates a practical use of the backward array index operator
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
Raymond Chen

Possibly more than just a curiosity.

What is this <CODE>[uuid(…)]</CODE> in front of my C++ class declaration?
Mar 31, 2023
Post comments count 4
Post likes count 3

What is this <CODE>[uuid(…)]</CODE> in front of my C++ class declaration?

Raymond Chen
Raymond Chen

It's an old nonstandard syntax that you should try to move away from.

If you want to watch games on your tractor, please use your own iPad
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
Raymond Chen

Not an approved use of the embedded system.

How can I box a <CODE>std::optional</CODE> into a C++/WinRT <CODE>IInspectable</CODE>?
Mar 30, 2023
Post comments count 0
Post likes count 2

How can I box a <CODE>std::optional</CODE> into a C++/WinRT <CODE>IInspectable</CODE>?

Raymond Chen
Raymond Chen

There's a handy conversion for that, but you have to know where to look.

The <CODE>WM_GETDLGCODE</CODE> message is a query message and should not modify state
Mar 29, 2023
Post comments count 2
Post likes count 3

The <CODE>WM_GETDLGCODE</CODE> message is a query message and should not modify state

Raymond Chen
Raymond Chen

Wait until you actually get the message.

How can I try to escape the disease-ridden hot-tubs known as the TEMP and Downloads directories?
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
Raymond Chen

You can ask that dependent DLLs be loaded from the System32 directory.

Using the contents of a file to define an MSBuild property
Mar 27, 2023
Post comments count 2
Post likes count 2

Using the contents of a file to define an MSBuild property

Raymond Chen
Raymond Chen

A little trick that maybe should be better known.

Adventures in application compatibility: The case of the jump into the middle of an instruction from nowhere
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
Raymond Chen

Another rogue patcher.

How unique must the <CODE>uIdSubclass</CODE> parameter be when I call <CODE>Set­Window­Subclass</CODE>?
Mar 23, 2023
Post comments count 0
Post likes count 3

How unique must the <CODE>uIdSubclass</CODE> parameter be when I call <CODE>Set­Window­Subclass</CODE>?

Raymond Chen
Raymond Chen

Each one identifies an instance of the subclass for the window.

Why am I getting a weird error about <CODE>promise_type</CODE> when I try to write a coroutine? part 2
Mar 22, 2023
Post comments count 0
Post likes count 1

Why am I getting a weird error about <CODE>promise_type</CODE> when I try to write a coroutine? part 2

Raymond Chen
Raymond Chen

Are you even writing a coroutine?

Why does the usage of the initial registers of a Win32 process depend on whether it is a 32-bit or 64-bit process?
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
Raymond Chen

Well, I mean, it's a different processor.

On the proper care and feeding of the enigmatic <CODE>Get­Distance­Of­Closest­Language­In­List</CODE> function
Mar 20, 2023
Post comments count 0
Post likes count 2

On the proper care and feeding of the enigmatic <CODE>Get­Distance­Of­Closest­Language­In­List</CODE> function

Raymond Chen
Raymond Chen

Thinking about how this could be used.

Exploiting C++/WinRT CRTP: Property and event declarations
Mar 17, 2023
Post comments count 2
Post likes count 3

Exploiting C++/WinRT CRTP: Property and event declarations

Raymond Chen
Raymond Chen

They don't have to be methods; they just have to look like methods.

Mind your C++/WinRT namespaces
Mar 16, 2023
Post comments count 0
Post likes count 2

Mind your C++/WinRT namespaces

Raymond Chen
Raymond Chen

What you say changes meaning depending on where you are.

How can I create a git feature branch that can merge into multiple other branches?
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
Raymond Chen

Just work in your patch branch.

Did Vienna ever exist or was it just misinformation?
Mar 14, 2023
Post comments count 4
Post likes count 2

Did Vienna ever exist or was it just misinformation?

Raymond Chen
Raymond Chen

It could be neither.

The 2023/2024 Seattle Symphony subscription season at a glance
Mar 13, 2023
Post comments count 1
Post likes count 2

The 2023/2024 Seattle Symphony subscription season at a glance

Raymond Chen
Raymond Chen

The pocket reference guide for 2023/2024.

What is the expression language used by the Resource Compiler for non-preprocessor expressions?
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
Raymond Chen

Oddly different for a different audience.

When should I use <CODE>CS_GLOBALCLASS</CODE>?
Mar 10, 2023
Post comments count 7
Post likes count 2

When should I use <CODE>CS_GLOBALCLASS</CODE>?

Raymond Chen
Raymond Chen

When you want to be summoned from anywhere.

From a Windows app, how can I check whether there is an app installed that implements a particular URI scheme?, part 2
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
Raymond Chen

Alternatives that work for unpackaged apps.

From a Windows app, how can I check whether there is an app installed that implements a particular URI scheme?
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
Raymond Chen

Additional function to let you see what is available.

Microspeak: Baseball card
Mar 7, 2023
Post comments count 0
Post likes count 1

Microspeak: Baseball card

Raymond Chen
Raymond Chen

A one-page summary, and this time we mean it.

I can create a read-only page, but why not a write-only page?
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
Raymond Chen

At the end of the day, it comes down to processor support.

Enumerating Windows clipboard history in PowerShell
Mar 3, 2023
Post comments count 10
Post likes count 6

Enumerating Windows clipboard history in PowerShell

Raymond Chen
Raymond Chen

Doing Windows Runtime things from PowerShell.

Enumerating Windows clipboard history in C++/WinRT and C#
Mar 2, 2023
Post comments count 2
Post likes count 2

Enumerating Windows clipboard history in C++/WinRT and C#

Raymond Chen
Raymond Chen

Exploring the clipboard history API.

If you want to sort a Windows Runtime collection, you may first want to capture it into something a bit easier to manipulate
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
Raymond Chen

Moving everything into the same universe.

Once you give away the farm, you can’t take it back: Recovering from a rogue administrator
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
Raymond Chen

Who knows what happened to it while you weren't looking.

The unintentionally-expanding scope of the <CODE>SEM_NOGPFAULTERRORBOX</CODE> flag
Feb 27, 2023
Post comments count 4
Post likes count 1

The unintentionally-expanding scope of the <CODE>SEM_NOGPFAULTERRORBOX</CODE> flag

Raymond Chen
Raymond Chen

Other suppressions caught in its net.

Understanding a mysterious <CODE>RPC_<WBR>E_<WBR>WRONG­THREAD</CODE> exception when we’re on the right thread
Feb 24, 2023
Post comments count 2
Post likes count 2

Understanding a mysterious <CODE>RPC_<WBR>E_<WBR>WRONG­THREAD</CODE> exception when we’re on the right thread

Raymond Chen
Raymond Chen

Things can go wrong in ways you may not have realized.

Why am I getting an unhandled exception from my C++ function that catches all exceptions?
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
Raymond Chen

Yes, you caught an exception. But that's not the one that went unhandled.

Avoiding the redundancy of adding the object files to both the primary project and its unit test
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
Raymond Chen

Adding another level of indirection.

Microspeak: Light reading (ironic)
Feb 21, 2023
Post comments count 2
Post likes count 3

Microspeak: Light reading (ironic)

Raymond Chen
Raymond Chen

Just a fun diversion.

The case of the mysterious "out of bounds" error from <CODE>CreateUri</CODE> and <CODE>memmove</CODE>
Feb 20, 2023
Post comments count 9
Post likes count 5

The case of the mysterious "out of bounds" error from <CODE>CreateUri</CODE> and <CODE>memmove</CODE>

Raymond Chen
Raymond Chen

Unfolding some COMDATs.

What happens if you co_await a std::future, and why is it a bad idea?
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
Raymond Chen

Just waiting for something to finish.

What does it mean when my cross-thread COM call fails with <CODE>RPC_<WBR>E_<WBR>SYS_<WBR>CALL_<WBR>FAILED</CODE>?
Feb 16, 2023
Post comments count 0
Post likes count 2

What does it mean when my cross-thread COM call fails with <CODE>RPC_<WBR>E_<WBR>SYS_<WBR>CALL_<WBR>FAILED</CODE>?

Raymond Chen
Raymond Chen

Look for an unresponsive recipient.

What are the potentially-erroneous results if you don’t pass NULL as the lpNumberOfBytesRead when issuing overlapped I/O?
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
Raymond Chen

It's to avoid a self-inflicted race condition.

Why are the Windows chassis hardware button hotkeys so strange?
Feb 14, 2023
Post comments count 4
Post likes count 2

Why are the Windows chassis hardware button hotkeys so strange?

Raymond Chen
Raymond Chen

Operating within the constraints of the system.

Adventures in application compatibility: The case of the display control panel crash on exit
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
Raymond Chen

When you get a 64-bit pointer, you probably should remember all 64 of the bits.

The case of the <CODE>RPC_<WBR>E_<WBR>DISCONNECTED</CODE> error thrown from <CODE>await_<WBR>resume</CODE>
Feb 10, 2023
Post comments count 4
Post likes count 4

The case of the <CODE>RPC_<WBR>E_<WBR>DISCONNECTED</CODE> error thrown from <CODE>await_<WBR>resume</CODE>

Raymond Chen
Raymond Chen

You can keep trying, but the result won't change.

A more direct and mistake-free way of creating a process in a job object
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
Raymond Chen

A new attribute for creating a process directly in a job object.

How can I get the original target of a shortcut without applying any 32-bit adjustments?
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
Raymond Chen

Disable the fancy tracking.

The frustration of finding a suitable time to hold a meeting when the participants are evenly spaced around the globe
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
Raymond Chen

Somebody has to suffer, but we try to make sure it's not the same person each time.

It rather involved being on the other side of this airtight hatchway: Reading the user’s saved passwords
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
Raymond Chen

Only the user can read their own saved passwords, so you must already have gained total control over the user.

Inside C++/WinRT: Coroutine completions: Cancellation propagation
Feb 3, 2023
Post comments count 0
Post likes count 2

Inside C++/WinRT: Coroutine completions: Cancellation propagation

Raymond Chen
Raymond Chen

Giving up.

Hyperlinking to Hutchison Whampoa Limited is still forbidden
Feb 2, 2023
Post comments count 6
Post likes count 1

Hyperlinking to Hutchison Whampoa Limited is still forbidden

Raymond Chen
Raymond Chen

Didn't make you look.

Inside C++/WinRT: Coroutine completions: Avoiding reentrant completion
Feb 2, 2023
Post comments count 0
Post likes count 1

Inside C++/WinRT: Coroutine completions: Avoiding reentrant completion

Raymond Chen
Raymond Chen

Resuming the coroutine directly, rather than consuming yet more stack.

Inside C++/WinRT: Coroutine completion handlers: Disconnection
Feb 1, 2023
Post comments count 0
Post likes count 1

Inside C++/WinRT: Coroutine completion handlers: Disconnection

Raymond Chen
Raymond Chen

When the other end hangs up without even saying good-bye.

Inside C++/WinRT: Apartment switching: Error reporting
Jan 31, 2023
Post comments count 0
Post likes count 2

Inside C++/WinRT: Apartment switching: Error reporting

Raymond Chen
Raymond Chen

If you can't get back to where you started, who you gonna call?

Inside C++/WinRT: Apartment switching: COM without COM
Jan 30, 2023
Post comments count 0
Post likes count 2

Inside C++/WinRT: Apartment switching: COM without COM

Raymond Chen
Raymond Chen

Also known as Nano-COM.

Inside C++/WinRT: Apartment switching: Unwinding the stack
Jan 27, 2023
Post comments count 0
Post likes count 1

Inside C++/WinRT: Apartment switching: Unwinding the stack

Raymond Chen
Raymond Chen

Reducing stack usage.

Inside C++/WinRT: Apartment switching: Bypassing the context callback
Jan 26, 2023
Post comments count 0
Post likes count 2

Inside C++/WinRT: Apartment switching: Bypassing the context callback

Raymond Chen
Raymond Chen

Reducing stack usage.

Inside C++/WinRT: Apartment switching: Unblocking the outgoing thread
Jan 25, 2023
Post comments count 1
Post likes count 2

Inside C++/WinRT: Apartment switching: Unblocking the outgoing thread

Raymond Chen
Raymond Chen

Avoiding the problem of the synchronous apartment-changing callback: Let the outgoing thread do whatever it wants to do next.

Inside C++/WinRT: Apartment switching: The basic idea
Jan 24, 2023
Post comments count 0
Post likes count 2

Inside C++/WinRT: Apartment switching: The basic idea

Raymond Chen
Raymond Chen

Getting back to where you started.

Inside C++/WinRT: Coroutine completions: The oversimplified version
Jan 23, 2023
Post comments count 3
Post likes count 3

Inside C++/WinRT: Coroutine completions: The oversimplified version

Raymond Chen
Raymond Chen

Resuming the coroutine when the asynchronous work completes.

How can I call a method on a derived class from a base class, say, to get a strong reference to the containing object?
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
Raymond Chen

A variety of patterns are available.

Windows Runtime asynchronous operations can fail in two different ways, so make sure you get them both
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
Raymond Chen

Fail me now or fail me later.

It rather involved being on the other side of this airtight hatchway: Attacking a user by modifying that user’s files
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
Raymond Chen

You're just attacking yourself.

A trio of dubious denial-of-service security vulnerability reports which are just style points piled on top of nothing
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
Raymond Chen

You could have accomplished the same thing with a garbage file.

Making C++ primitive types meaningfully movable when they have sentinel values
Jan 16, 2023
Post comments count 0
Post likes count 1

Making C++ primitive types meaningfully movable when they have sentinel values

Raymond Chen
Raymond Chen

The value actually moves now.

Adventures in application compatibility: Querying for an internal interface
Jan 13, 2023
Post comments count 18
Post likes count 4

Adventures in application compatibility: Querying for an internal interface

Raymond Chen
Raymond Chen

Reaching in and fiddling the internal knobs.

How should I interpret the various values of <CODE>NLM_CONNECTIVITY</CODE>?
Jan 12, 2023
Post comments count 5
Post likes count 2

How should I interpret the various values of <CODE>NLM_CONNECTIVITY</CODE>?

Raymond Chen
Raymond Chen

Different levels of connectedness.

What does it mean when I get a mismatch from MSVC for <CODE>_COROUTINE_ABI</CODE>?
Jan 11, 2023
Post comments count 0
Post likes count 3

What does it mean when I get a mismatch from MSVC for <CODE>_COROUTINE_ABI</CODE>?

Raymond Chen
Raymond Chen

The two different kinds of coroutine interfaces shouldn't be mixed and matched.

It rather involved being on the other side of this airtight hatchway: Administrator attacking a domain account on the local system
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
Raymond Chen

You don't gain control over any other systems.

On leading underscores and names reserved by the C and C++ languages
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
Raymond Chen

The rules laid out.

Dubious security vulnerability: Granting access to SIDs that don’t exist yet
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
Raymond Chen

You can put anyone you like on your guest list, even if they don't exist.

How can I force a user to have a specific SID prefix, so that they go into a particular group?
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
Raymond Chen

The prefix doesn't define group membership.

Using perfect (and imperfect) forwarding to simplify C++ wrapper classes
Jan 4, 2023
Post comments count 11
Post likes count 3

Using perfect (and imperfect) forwarding to simplify C++ wrapper classes

Raymond Chen
Raymond Chen

Just call that other thing the same way you called this thing.

It rather involved being on the other side of this airtight hatchway: Gaining code execution from a Trojan horse
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
Raymond Chen

You already have code execution, so it's not surprising that you can gain code execution.

Opinionated notes on the Windows.Data.Json namespace
Jan 2, 2023
Post comments count 8
Post likes count 3

Opinionated notes on the Windows.Data.Json namespace

Raymond Chen
Raymond Chen

It's available if you need it, but there are some tricks and pitfalls, and you may very well have better options.

2022 year-end link clearance
Dec 30, 2022
Post comments count 1
Post likes count 4

2022 year-end link clearance

Raymond Chen
Raymond Chen

Closing the book on another year.

When I create a waitable timer with a callback, do I have to wait alertably on that specific timer before the callback will run?
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
Raymond Chen

Any alertable wait will do.

How can I detect programmatically whether Windows is an N or KN version?
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
Raymond Chen

Don't check the version, just check the feature.

After importing a TLB, how do I convert from one type of <CODE>_com_ptr_t</CODE> to another?
Dec 28, 2022
Post comments count 3
Post likes count 2

After importing a TLB, how do I convert from one type of <CODE>_com_ptr_t</CODE> to another?

Raymond Chen
Raymond Chen

Digging into the source code.

Why can’t I print when I boot Windows into audit mode?
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
Raymond Chen

It's not all there.

The worst-selling Microsoft software product of all time: OS/2 for the Mach 20
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
Raymond Chen

Count 'em on one hand.

The case of the recursively hung <CODE>WM_DRAW­CLIPBOARD</CODE> message
Dec 23, 2022
Post comments count 4
Post likes count 2

The case of the recursively hung <CODE>WM_DRAW­CLIPBOARD</CODE> message

Raymond Chen
Raymond Chen

Understanding why it's happening and how you can avoid it.

Is there a fixed virtual address that the system promises never to use for anything, so I can use 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
Raymond Chen

Everything is up for grabs.

Running some UI code on a timer at a higher priority than your usual timer messages, or without coalescing
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
Raymond Chen

You can build your own timer system.

Why doesn’t the BitLocker wizard let me save the BitLocker key on an encrypted drive?
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
Raymond Chen

Don't lock your keys in the car.

On the large number of ways of expressing Microsoft Visual C++ compiler versions
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
Raymond Chen

So many version numbers.

Why doesn’t Windows use the 64-bit virtual address space below <CODE>0x00000000`7ffe0000</CODE>?
Dec 16, 2022
Post comments count 7
Post likes count 6

Why doesn’t Windows use the 64-bit virtual address space below <CODE>0x00000000`7ffe0000</CODE>?

Raymond Chen
Raymond Chen

It does use it, although it doesn't look like it.

Inside C++/WinRT: <CODE>IReference<T></CODE>
Dec 15, 2022
Post comments count 1
Post likes count 1

Inside C++/WinRT: <CODE>IReference<T></CODE>

Raymond Chen
Raymond Chen

Reverse-engineering the usages from the code.

In C++/WinRT, how do I create or consume an <CODE>IReference<T></CODE> that wraps a particular value?
Dec 14, 2022
Post comments count 0
Post likes count 1

In C++/WinRT, how do I create or consume an <CODE>IReference<T></CODE> that wraps a particular value?

Raymond Chen
Raymond Chen

Conversions to and from <CODE>IReference</CODE>.

Thank you for conference announcement, but it would help if you told me what your conference was about
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
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 ...

What does it mean when the compiler tells me that <CODE>promise_type</CODE>: is not a member of <CODE>coroutine_traits<void></CODE>?
Dec 12, 2022
Post comments count 0
Post likes count 1

What does it mean when the compiler tells me that <CODE>promise_type</CODE>: is not a member of <CODE>coroutine_traits<void></CODE>?

Raymond Chen
Raymond Chen

Applying your understanding of the coroutine transformation.

How can I do the opposite of <CODE>compare_exchange</CODE> and exchange if the value is <I>different</I>?
Dec 9, 2022
Post comments count 0
Post likes count 2

How can I do the opposite of <CODE>compare_exchange</CODE> and exchange if the value is <I>different</I>?

Raymond Chen
Raymond Chen

An exchange with itself has no effect on the value.

If you’re going to wrap a Windows Runtime event, you may as well let the wrapped event source manage the token
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
Raymond Chen

It keeps the original object in control.

Reminder: If you intend to use a C++/WinRT namespace, you must include that namespace’s header file
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
Raymond Chen

Various errors that can be traced back to breaking that one rule.

Trouble connecting to Web sites and services because of certificate errors? Check if you’re being held captive
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
Raymond Chen

There's a man in the middle.

Instead of a C++ template parlor trick, why not just add support based on whether the header file has already been included?
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
Raymond Chen

Header file inclusion order dependencies.

C++ template parlor tricks: Using a type before it is defined
Dec 2, 2022
Post comments count 10
Post likes count 3

C++ template parlor tricks: Using a type before it is defined

Raymond Chen
Raymond Chen

You can talk about hypothetical things, hoping that a real thing shows up later.

Not even trying to cross an airtight hatchway: Calling a function in your own process by synthesizing a function pointer
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
Raymond Chen

You can already attack yourself in far more interesting ways.

I used <CODE>FILE_FLAG_SEQUENTIAL_SCAN</CODE> but it didn’t seem to speed up my sequential scanning
Nov 30, 2022
Post comments count 1
Post likes count 3

I used <CODE>FILE_FLAG_SEQUENTIAL_SCAN</CODE> but it didn’t seem to speed up my sequential scanning

Raymond Chen
Raymond Chen

It triggers prefetching, but your usage pattern may mean that prefetch doesn't mean much.

Dubious security vulnerability: Reading the files in the WindowsApps folder
Nov 29, 2022
Post comments count 2
Post likes count 1

Dubious security vulnerability: Reading the files in the WindowsApps folder

Raymond Chen
Raymond Chen

You already had access to those files, by virtue of the fact that they ran in the first place.

What kind of caller diagnostic information can I get from exceptions thrown by C++/WinRT and wil?, C++20 edition
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
Raymond Chen

The state of the art has moved forward slightly.

The case of the application that used thread local storage it never allocated
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
Raymond Chen

Of course it's there, isn't it? I mean, it's always been there.

How do I pass a raw pointer to a Windows Runtime function?
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
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.

How does JavaScript represent output parameters in the Windows Runtime?
Nov 24, 2022
Post comments count 12
Post likes count 1

How does JavaScript represent output parameters in the Windows Runtime?

Raymond Chen
Raymond Chen

It has to fake it.

Sometimes perfect forwarding can be too perfect: Lazy conversion is lazy
Nov 23, 2022
Post comments count 4
Post likes count 1

Sometimes perfect forwarding can be too perfect: Lazy conversion is lazy

Raymond Chen
Raymond Chen

Lazy conversion is too lazy.

Microspeak: Breaking into jail
Nov 22, 2022
Post comments count 2
Post likes count 1

Microspeak: Breaking into jail

Raymond Chen
Raymond Chen

Just asking for trouble.

What kind of caller diagnostic information can I get from exceptions thrown by C++/WinRT and wil?
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
Raymond Chen

A survey of the current state of the art.

On Windows Runtime asynchronous operations with critical progress reports
Nov 18, 2022
Post comments count 0
Post likes count 2

On Windows Runtime asynchronous operations with critical progress reports

Raymond Chen
Raymond Chen

Make the caller provide the progress handler up front.

How soon is too soon to report progress from a C++/WinRT coroutine that implements a Windows Runtime asynchronous operation with progress?
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
Raymond Chen

If a progress is sent to a forest but there's no one there to hear it.

Why won’t C++/WinRT let me <CODE>co_await</CODE> a <CODE>CoreDispatcher</CODE> or <CODE>DispatcherQueue</CODE>?
Nov 16, 2022
Post comments count 0
Post likes count 1

Why won’t C++/WinRT let me <CODE>co_await</CODE> a <CODE>CoreDispatcher</CODE> or <CODE>DispatcherQueue</CODE>?

Raymond Chen
Raymond Chen

Making sure you meet the usual prerequisites.

It’s important to get the most difficult part out of the way by putting it in the title
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
Raymond Chen

It does much less harm there than in the body.

How does Windows decide whether your computer has limited or full Internet access?
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
Raymond Chen

Looking for special servers.

C++ constexpr parlor tricks: How can I obtain the length of a string at compile time?
Nov 14, 2022
Post comments count 7
Post likes count 5

C++ constexpr parlor tricks: How can I obtain the length of a string at compile time?

Raymond Chen
Raymond Chen

The <CODE>constexpr</CODE>'ification of <CODE>strlen</CODE>.

If I issue multiple overlapped I/O requests against the same region of a file, will they execute in the order I issued them?
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
Raymond Chen

Overlapped I/O refers to temporal overlap, and that includes completion out of order.

On the dangers of giving a product feature the name “new”
Nov 10, 2022
Post comments count 24
Post likes count 3

On the dangers of giving a product feature the name “new”

Raymond Chen
Raymond Chen

It may be new today, but it won't be new tomorrow.

Why don’t Windows functions begin with a pointless MOV EDI,EDI instruction on x86-64?
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
Raymond Chen

Applying the hot-patch in a different way.

Why is there a system sound called Asterisk? What sound does an Asterisk make anyway?
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
Raymond Chen

It's to accompany the asterisk, back when we had an asterisk.

My niece is just here for the food
Nov 7, 2022
Post comments count 1
Post likes count 1

My niece is just here for the food

Raymond Chen
Raymond Chen

The important part of the trip.

In the debugger, how can I get from a projected type back to the C++/WinRT implementation?
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
Raymond Chen

Look behind you.

Why am I getting a <CODE>RPC_E_WRONG_THREAD</CODE> exception when I’m on the right thread?
Nov 4, 2022
Post comments count 1
Post likes count 2

Why am I getting a <CODE>RPC_E_WRONG_THREAD</CODE> exception when I’m on the right thread?

Raymond Chen
Raymond Chen

It's the wrong thread from XAML's point of view.

How does the dialog manager calculate the average width of a character?
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
Raymond Chen

It's a simple formula, perhaps too simple.

A history of the <CODE>fd_set</CODE>, <CODE>FD_SETSIZE</CODE>, and how it relates to WinSock
Nov 2, 2022
Post comments count 5
Post likes count 6

A history of the <CODE>fd_set</CODE>, <CODE>FD_SETSIZE</CODE>, and how it relates to WinSock

Raymond Chen
Raymond Chen

The <CODE>fd_set</CODE> started out as just a bitmap.

What is a “Select Administrator”? Is that some special elite kind of administrator?
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
Raymond Chen

It's two different messages that combine in an interesting way.

How can I test my geolocation code on a system without a GPS?
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
Raymond Chen

You can use the Windows Device Portal to create a synthetic GPS.

Setting properties in C++/WinRT is done by a function call, but you need to call the function the right way
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
Raymond Chen

The new value is the function parameter.

Why am I seeing two WRITE requests at the same offset from a single call to WriteFile?
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
Raymond Chen

It started as one write, but turned into a lot of other things.

What can or should I do with the cursor handle returned by <CODE>SetCursor</CODE>?
Oct 26, 2022
Post comments count 3
Post likes count 3

What can or should I do with the cursor handle returned by <CODE>SetCursor</CODE>?

Raymond Chen
Raymond Chen

You can put it back, but sometimes you need to make sure you do it before anybody else can see the change.

Why are many Windows user interface elements positioned at multiples of 4 or 8 pixels?
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
Raymond Chen

It depends on whose pixels you're talking about.

Why can’t I programmatically inspect the check boxes in the Security property sheet any more?
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
Raymond Chen

Abusing the <CODE>ISecurity­Information::<WBR>Property­Sheet­Page­Callback</CODE> method.

What happens if my C++ exception handler itself raises an exception?
Oct 21, 2022
Post comments count 1
Post likes count 3

What happens if my C++ exception handler itself raises an exception?

Raymond Chen
Raymond Chen

And comparing to the handling of structured exceptions.

Is it true that raising a structured exception from a structured exception handler terminates the process?
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
Raymond Chen

Untangling the myth.

Why is there a <CODE>make_unique</CODE>? Why not just overload the <CODE>unique_ptr</CODE> constructor?
Oct 19, 2022
Post comments count 1
Post likes count 4

Why is there a <CODE>make_unique</CODE>? Why not just overload the <CODE>unique_ptr</CODE> constructor?

Raymond Chen
Raymond Chen

You'll have to resolve the ambiguity, so you're still typing a lot.

Why is there a <CODE>passwords.txt</CODE> file on my system that’s filled with somebody else’s passwords?
Oct 18, 2022
Post comments count 10
Post likes count 7

Why is there a <CODE>passwords.txt</CODE> file on my system that’s filled with somebody else’s passwords?

Raymond Chen
Raymond Chen

It's part of an open-source password strength package.

How can I check the integrity level of my process?
Oct 17, 2022
Post comments count 11
Post likes count 3

How can I check the integrity level of my process?

Raymond Chen
Raymond Chen

A series of range checks.

The case of the memory corruption from a coroutine that already finished
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
Raymond Chen

The zombie coroutine.

How can I check whether the user’s network connection is roaming or metered?
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
Raymond Chen

The classic way and the Windows Runtime way.

One possible reason why your program crashes when submitted to the Microsoft Store, but it runs fine on your machine
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
Raymond Chen

Check your minimum requirements.

Clicking past the warning that you are about to cross the airtight hatchway: Vulnerable file type that you are warned about
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
Raymond Chen

Acknowledging the danger but complaining about it anyway.

On the overloading of the address-of operator <CODE>&</CODE> in smart pointer classes
Oct 10, 2022
Post comments count 5
Post likes count 2

On the overloading of the address-of operator <CODE>&</CODE> in smart pointer classes

Raymond Chen
Raymond Chen

Different patterns, which means you're never sure what you're going to get.

How can I perform a CopyFile, but also flush the file buffers before the destination handle is closed?
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
Raymond Chen

Your callback function can do things with the handle, even extend their lifetime.

The Import Address Table is now write-protected, and what that means for rogue patching
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
Raymond Chen

Making a potential attack vector less attractive.

The gotcha of the C++ temporaries that don’t destruct as eagerly as you thought
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
Raymond Chen

You have to look for the end of the full expression.

Starting on the other side of this airtight hatchway: Overwhelming the system
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
Raymond Chen

It'll take time for things to drain out.

Feel free to stop using IMultiLanguage2::DetectInputCodepage
Oct 3, 2022
Post comments count 0
Post likes count 1

Feel free to stop using IMultiLanguage2::DetectInputCodepage

Raymond Chen
Raymond Chen

You should have been keeping your eye on the code page all along.

Debugging coroutine handles: Looking for the source of a one-byte memory corruption
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
Raymond Chen

Applying what we know about coroutines.

I did that merge-as-cherry-pick thing, but my change still didn’t merge correctly
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
Raymond Chen

A case study of what goes wrong.

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?
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
Raymond Chen

Oh, it does pick a side. It's just that some dashes are missing.

Microspeak: Break glass
Sep 27, 2022
Post comments count 1
Post likes count 2

Microspeak: Break glass

Raymond Chen
Raymond Chen

Metaphorically breaking the glass in case of emergency.

What does the C++ error “A pointer to a bound function may only be used to call the function” mean?
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
Raymond Chen

You got all set to call a function but forgot to call it.

Why am I receiving <CODE>SHCNE_<WBR>UPDATE­DIR</CODE> notifications that my code never generates?
Sep 23, 2022
Post comments count 1
Post likes count 1

Why am I receiving <CODE>SHCNE_<WBR>UPDATE­DIR</CODE> notifications that my code never generates?

Raymond Chen
Raymond Chen

You did generate them, indirectly.

How can I get WRL to link my object into its activation factory?
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
Raymond Chen

More magic macros.

How can I trigger a recalc of the mouse cursor after I changed some of my internal application state?
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
Raymond Chen

Go through the standard process one more time.

Janet Jackson had the power to crash laptop computers, follow-up
Sep 20, 2022
Post comments count 8
Post likes count 2

Janet Jackson had the power to crash laptop computers, follow-up

Raymond Chen
Raymond Chen

Deeper speculation by others.

Why load fs:[0x18] into a register and then dereference that, instead of just going for fs:[n] directly?
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
Raymond Chen

Simplifying the compiler.

Serializing asynchronous operations in C++/WinRT, gotchas and final assembly
Sep 16, 2022
Post comments count 0
Post likes count 4

Serializing asynchronous operations in C++/WinRT, gotchas and final assembly

Raymond Chen
Raymond Chen

Cancellation and abandonment.

Serializing asynchronous operations in C++/WinRT
Sep 15, 2022
Post comments count 0
Post likes count 4

Serializing asynchronous operations in C++/WinRT

Raymond Chen
Raymond Chen

Making them run one after the other.

Creating a lazy-start C++/WinRT coroutine from an eager-start one, part 2
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
Raymond Chen

Keeping a turkey in suspense.

Creating a manual-start C++/WinRT coroutine from an eager-start one, part 1
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
Raymond Chen

Ready, wait for it.

Serializing asynchronous operations in C#
Sep 12, 2022
Post comments count 5
Post likes count 0

Serializing asynchronous operations in C#

Raymond Chen
Raymond Chen

Making them run one after the other.

The case of the APC that never arrives
Sep 9, 2022
Post comments count 18
Post likes count 3

The case of the APC that never arrives

Raymond Chen
Raymond Chen

Or maybe it did?

How do I consume raw COM interfaces from a Windows Runtime metadata file?
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
Raymond Chen

There's a handy tool for generating raw COM interfaces.

It rather involved being on the other side of this airtight hatchway: Replacing a service binary
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
Raymond Chen

Looking for misconfigured services.

Commonly-supported Windows shortcuts for pasting without formatting
Sep 6, 2022
Post comments count 21
Post likes count 7

Commonly-supported Windows shortcuts for pasting without formatting

Raymond Chen
Raymond Chen

Variations on a paste theme.

Is there any meaningful way to compare two Time Travel Debugging positions?
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
Raymond Chen

They are basically in chronological order, subject to the uncertainty of multiprocessing.

The case of the recursively-acquired non-recursive lock, and how to avoid the unintentional reentrancy
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
Raymond Chen

Watch what you do when you hold a lock.

Why am I getting a null pointer crash when trying to call a method on my C++/WinRT object?
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
Raymond Chen

Requirements weren't met.

The x86-64 processor (aka amd64, x64): Whirlwind tour
Aug 31, 2022
Post comments count 27
Post likes count 3

The x86-64 processor (aka amd64, x64): Whirlwind tour

Raymond Chen
Raymond Chen

Pretty much a 64-bit-ification of the i386.

The AArch64 processor (aka arm64), part 25: The ARM64EC ABI
Aug 30, 2022
Post comments count 0
Post likes count 2

The AArch64 processor (aka arm64), part 25: The ARM64EC ABI

Raymond Chen
Raymond Chen

Aligning with the x86-64 calling convention.

The AArch64 processor (aka arm64), part 24: Code walkthrough
Aug 29, 2022
Post comments count 1
Post likes count 0

The AArch64 processor (aka arm64), part 24: Code walkthrough

Raymond Chen
Raymond Chen

Putting theory into practice.

The AArch64 processor (aka arm64), part 23: Common patterns
Aug 26, 2022
Post comments count 1
Post likes count 0

The AArch64 processor (aka arm64), part 23: Common patterns

Raymond Chen
Raymond Chen

Learning to recognize various code generation patterns.

The AArch64 processor (aka arm64), part 22: Other kinds of classic prologues and epilogues
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
Raymond Chen

Taking shortcuts, or maybe adding steps.

The AArch64 processor (aka arm64), part 21: Classic function prologues and epilogues
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
Raymond Chen

Implementing the ABI.

The AArch64 processor (aka arm64), part 20: The classic calling convention
Aug 23, 2022
Post comments count 2
Post likes count 1

The AArch64 processor (aka arm64), part 20: The classic calling convention

Raymond Chen
Raymond Chen

How parameters are passed.

The AArch64 processor (aka arm64), part 19: Miscellaneous instructions
Aug 22, 2022
Post comments count 4
Post likes count 2

The AArch64 processor (aka arm64), part 19: Miscellaneous instructions

Raymond Chen
Raymond Chen

Sweeping up the crumbs.

The AArch64 processor (aka arm64), part 18: Return address protection
Aug 19, 2022
Post comments count 3
Post likes count 3

The AArch64 processor (aka arm64), part 18: Return address protection

Raymond Chen
Raymond Chen

Making it even harder to smash the return address.

The AArch64 processor (aka arm64), part 17: Manipulating flags
Aug 18, 2022
Post comments count 0
Post likes count 2

The AArch64 processor (aka arm64), part 17: Manipulating flags

Raymond Chen
Raymond Chen

Trying to twiddle the knobs directly.

The AArch64 processor (aka arm64), part 16: Conditional execution
Aug 17, 2022
Post comments count 2
Post likes count 2

The AArch64 processor (aka arm64), part 16: Conditional execution

Raymond Chen
Raymond Chen

Making decisions.

Janet Jackson had the power to crash laptop computers
Aug 16, 2022
Post comments count 24
Post likes count 30

Janet Jackson had the power to crash laptop computers

Raymond Chen
Raymond Chen

Not an artistic judgement. Just a technical one.

The AArch64 processor (aka arm64), part 15: Control transfer
Aug 15, 2022
Post comments count 0
Post likes count 4

The AArch64 processor (aka arm64), part 15: Control transfer

Raymond Chen
Raymond Chen

We're going places.

The AArch64 processor (aka arm64), part 14: Barriers
Aug 12, 2022
Post comments count 0
Post likes count 5

The AArch64 processor (aka arm64), part 14: Barriers

Raymond Chen
Raymond Chen

Keeping things in the right order.

The AArch64 processor (aka arm64), part 13: Atomic access
Aug 11, 2022
Post comments count 3
Post likes count 1

The AArch64 processor (aka arm64), part 13: Atomic access

Raymond Chen
Raymond Chen

Don't let someone else get a word in edgewise.

The AArch64 processor (aka arm64), part 12: Memory access and alignment
Aug 10, 2022
Post comments count 0
Post likes count 2

The AArch64 processor (aka arm64), part 12: Memory access and alignment

Raymond Chen
Raymond Chen

The load and store part of the load/store architecture.

The AArch64 processor (aka arm64), part 11: Loading addresses
Aug 9, 2022
Post comments count 0
Post likes count 1

The AArch64 processor (aka arm64), part 11: Loading addresses

Raymond Chen
Raymond Chen

Finding a needle in the haystack of the 64-bit address space.

The AArch64 processor (aka arm64), part 10: Loading constants
Aug 8, 2022
Post comments count 0
Post likes count 2

The AArch64 processor (aka arm64), part 10: Loading constants

Raymond Chen
Raymond Chen

Getting them into a register.

The AArch64 processor (aka arm64), part 9: Sign and zero extension
Aug 5, 2022
Post comments count 0
Post likes count 1

The AArch64 processor (aka arm64), part 9: Sign and zero extension

Raymond Chen
Raymond Chen

Nothing new here, but old things being used in clever ways.

The AArch64 processor (aka arm64), part 8: Bit shifting and rotation
Aug 4, 2022
Post comments count 4
Post likes count 3

The AArch64 processor (aka arm64), part 8: Bit shifting and rotation

Raymond Chen
Raymond Chen

Sliding around.

The AArch64 processor (aka arm64), part 7: Bitfield manipulation
Aug 3, 2022
Post comments count 0
Post likes count 3

The AArch64 processor (aka arm64), part 7: Bitfield manipulation

Raymond Chen
Raymond Chen

Peeking inside the words.

The AArch64 processor (aka arm64), part 6: Bitwise operations
Aug 2, 2022
Post comments count 0
Post likes count 1

The AArch64 processor (aka arm64), part 6: Bitwise operations

Raymond Chen
Raymond Chen

And their very strange immediates.

The AArch64 processor (aka arm64), part 5: Multiplication and division
Aug 1, 2022
Post comments count 1
Post likes count 1

The AArch64 processor (aka arm64), part 5: Multiplication and division

Raymond Chen
Raymond Chen

Arithmetic gets harder.

The AArch64 processor (aka arm64), part 4: Addition and subtraction
Jul 29, 2022
Post comments count 0
Post likes count 1

The AArch64 processor (aka arm64), part 4: Addition and subtraction

Raymond Chen
Raymond Chen

Starting with the basic arithmetic.

The AArch64 processor (aka arm64), part 3: Addressing modes
Jul 28, 2022
Post comments count 0
Post likes count 4

The AArch64 processor (aka arm64), part 3: Addressing modes

Raymond Chen
Raymond Chen

The ways of accessing memory.

The AArch64 processor (aka arm64), part 2: Extended register operations
Jul 27, 2022
Post comments count 3
Post likes count 2

The AArch64 processor (aka arm64), part 2: Extended register operations

Raymond Chen
Raymond Chen

The weird ways of transforming the value in a register.

The AArch64 processor (aka arm64), part 1: Introduction
Jul 26, 2022
Post comments count 4
Post likes count 9

The AArch64 processor (aka arm64), part 1: Introduction

Raymond Chen
Raymond Chen

Make it a double.

Yes, the 8086 wanted to be mechanically translatable from the 8080, but why not add the ability to indirect through AX, CX and DX?
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
Raymond Chen

So many addressing modes, so little space.

Using C++/WinRT’s <CODE>final_release</CODE> to control which thread destructs your object
Jul 22, 2022
Post comments count 2
Post likes count 2

Using C++/WinRT’s <CODE>final_release</CODE> to control which thread destructs your object

Raymond Chen
Raymond Chen

Once it's yours, you can take it wherever you like.

Making sure that people use <CODE>make_unique</CODE> and <CODE>make_shared</CODE> to make your object
Jul 21, 2022
Post comments count 3
Post likes count 3

Making sure that people use <CODE>make_unique</CODE> and <CODE>make_shared</CODE> to make your object

Raymond Chen
Raymond Chen

Using a secret signal in what is required to be a public constructor.

My class derives from <CODE>std::enable_<WBR>shared_<WBR>from_<WBR>this</CODE>, but <CODE>shared_<WBR>from_<WBR>this()</CODE> doesn’t work
Jul 20, 2022
Post comments count 0
Post likes count 2

My class derives from <CODE>std::enable_<WBR>shared_<WBR>from_<WBR>this</CODE>, but <CODE>shared_<WBR>from_<WBR>this()</CODE> doesn’t work

Raymond Chen
Raymond Chen

Various cases where your enabled <CODE>shared_<WBR>from_<WBR>this</cODE> doesn't work.

Microspeak: The one-pager
Jul 19, 2022
Post comments count 4
Post likes count 2

Microspeak: The one-pager

Raymond Chen
Raymond Chen

Rarely ever one page long.

C++ coroutine gotcha: Falling off the end of a function-level catch
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
Raymond Chen

You still have to return something, but today's compilers don't warn you.

Processing a ValueSet or PropertySet even in the face of possible mutation, part 4
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
Raymond Chen

Processing the result differently.

Processing a ValueSet or PropertySet even in the face of possible mutation, part 3
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
Raymond Chen

Applying and adapting the pattern.

Processing a ValueSet or PropertySet even in the face of possible mutation, part 2
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
Raymond Chen

The first one there has to stay there until the work is done.

Processing a ValueSet or PropertySet even in the face of possible mutation, part 1
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
Raymond Chen

Watching out for iterator invalidation.

How can I provide a Windows Runtime ValueSet or PropertySet while non-intrusively monitoring changes to it?
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
Raymond Chen

Use the right kind of observer.

Windows Runtime observable collections don’t mix well with multithreading
Jul 8, 2022
Post comments count 2
Post likes count 1

Windows Runtime observable collections don’t mix well with multithreading

Raymond Chen
Raymond Chen

Concurrent observation and mutation is a bit of a mess.

How can I write a coroutine that produces a result but keeps on running?
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
Raymond Chen

Returning without returning.

The empty Windows Runtime string is not just a pretty face
Jul 6, 2022
Post comments count 8
Post likes count 1

The empty Windows Runtime string is not just a pretty face

Raymond Chen
Raymond Chen

It really is an empty string.

How to write like Raymond: Intentional typographical errors, part 2
Jul 5, 2022
Post comments count 0
Post likes count 1

How to write like Raymond: Intentional typographical errors, part 2

Raymond Chen
Raymond Chen

I can take you there, but you'll have to fix one tiny typo. Let's see if you can do that.

The case of the constructor that was being ignored
Jul 4, 2022
Post comments count 0
Post likes count 1

The case of the constructor that was being ignored

Raymond Chen
Raymond Chen

Retracing the compiler's steps.

Under what conditions can I modify the memory that I received in the form a <CODE>STGMEDIUM</CODE>?
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 <CODE>STGMEDIUM</CODE>?

Raymond Chen
Raymond Chen

If you own it, then it's yours to do with as you wish.

2022 mid-year link clearance
Jun 30, 2022
Post comments count 5
Post likes count 1

2022 mid-year link clearance

Raymond Chen
Raymond Chen

Another accumulation of stuff.

How can I build a URL query string in the Windows Runtime?
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
Raymond Chen

Pretend you're submitting a form.

How can I parse URL query string in the Windows Runtime?
Jun 29, 2022
Post comments count 2
Post likes count 1

How can I parse URL query string in the Windows Runtime?

Raymond Chen
Raymond Chen

There's a query parser built in, but it's a little cantankerous.

Microspeak: Inside baseball
Jun 28, 2022
Post comments count 7
Post likes count 1

Microspeak: Inside baseball

Raymond Chen
Raymond Chen

Specialized jargon comprehensible only to a select few.

Starting on the other side of the airtight hatchway: Attacking the batch file parser
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
Raymond Chen

Why stop at denial of service when you have remote code execution?

The case of the mysterious over-release from deep inside the marshaling infrastructure
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
Raymond Chen

The tedium of monitoring reference counts.

Writing a marshal-by-value marshaler, part 2
Jun 23, 2022
Post comments count 0
Post likes count 0

Writing a marshal-by-value marshaler, part 2

Raymond Chen
Raymond Chen

Maybe you don't need a copy on the other side.

Understanding the marshaling flags: The free-threaded marshaler
Jun 22, 2022
Post comments count 5
Post likes count 0

Understanding the marshaling flags: The free-threaded marshaler

Raymond Chen
Raymond Chen

Keeping your eye on the reference count.

Writing a compound marshaler
Jun 21, 2022
Post comments count 1
Post likes count 0

Writing a compound marshaler

Raymond Chen
Raymond Chen

On the nature of streams.

On the importance of managing the stream pointer when manipulating marshal data
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
Raymond Chen

Making sure things are ready for the person who comes after you.

Writing a marshal-by-value marshaler, part 1
Jun 17, 2022
Post comments count 1
Post likes count 0

Writing a marshal-by-value marshaler, part 1

Raymond Chen
Raymond Chen

Creating an identical object on the other side.

The skeleton marshaler that does default marshaling
Jun 16, 2022
Post comments count 1
Post likes count 0

The skeleton marshaler that does default marshaling

Raymond Chen
Raymond Chen

Starting with a marshaler that has no special features.

An initial look at the mechanics of how COM marshaling is performed
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
Raymond Chen

Pretend you're an oracle.

What are the various usage patterns for manually-marshaled interfaces?
Jun 14, 2022
Post comments count 4
Post likes count 1

What are the various usage patterns for manually-marshaled interfaces?

Raymond Chen
Raymond Chen

The outermost simple layer, and the more complex inner layer.

Adventures in application compatibility: The case of the PC-relative indirect jump that reads from nowhere
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
Raymond Chen

A little too much copy/pasta.

How do I retrieve an extremely large range of cells from Excel if the clipboard functions all time out?
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
Raymond Chen

Maybe you shouldn't be using the clipboard.

How can I wait more than 30 seconds for a delay-rendered clipboard format to become rendered?
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
Raymond Chen

Provide your own delay.

Is there a maximum size for Windows clipboard data? Because I’m getting null for something I know should be there
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
Raymond Chen

There is no pre-set maximum size, but that null might be coming from somewhere else.

How to write like Raymond: Contacting another team for the first time
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
Raymond Chen

Flattery will get you in the door.

An opinionated comparison of C++ frameworks for consuming and implementing Windows Runtime types
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
Raymond Chen

The three leading contenders.

Assessing a read-after free for security implications: The string comparison
Jun 3, 2022
Post comments count 11
Post likes count 1

Assessing a read-after free for security implications: The string comparison

Raymond Chen
Raymond Chen

Can you get elevation? What are you disclosing?

Converting between Windows <CODE>FILETIME</CODE> and Unix <CODE>time_t</CODE> without having to type the magic number 116444736000000000
Jun 2, 2022
Post comments count 1
Post likes count 1

Converting between Windows <CODE>FILETIME</CODE> and Unix <CODE>time_t</CODE> without having to type the magic number 116444736000000000

Raymond Chen
Raymond Chen

It's not exactly a number that you can rattle off the top of your head.

The case of the COM reference that suddenly went bad in the middle of a coroutine
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
Raymond Chen

Is the coroutine really to blame?

The <CODE>activeCodePage</CODE> manifest element can be used for more than just setting UTF-8 as the active code page
May 31, 2022
Post comments count 4
Post likes count 4

The <CODE>activeCodePage</CODE> manifest element can be used for more than just setting UTF-8 as the active code page

Raymond Chen
Raymond Chen

AppLocale grows up.

On passing iterables of iterables in the Windows Runtime
May 30, 2022
Post comments count 4
Post likes count 1

On passing iterables of iterables in the Windows Runtime

Raymond Chen
Raymond Chen

Different projections help you out in different ways, some more than others.

Why do rescued stack traces often have instability at the start?
May 27, 2022
Post comments count 0
Post likes count 1

Why do rescued stack traces often have instability at the start?

Raymond Chen
Raymond Chen

Trying to pick up the scent.

Rescuing a stack trace the lazy way on x86-64 (aka amd64) after the debugger gave up
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
Raymond Chen

Looking for a good frame to start from.

How can I get my <CODE>FileSavePicker</CODE> to open in the same folder that was picked by the <CODE>FileOpenPicker</CODE> or <CODE>FolderPicker</CODE>?
May 25, 2022
Post comments count 4
Post likes count 1

How can I get my <CODE>FileSavePicker</CODE> to open in the same folder that was picked by the <CODE>FileOpenPicker</CODE> or <CODE>FolderPicker</CODE>?

Raymond Chen
Raymond Chen

Make them all share the same settings identifier.

What is the CreateExplorerShellUnelevatedTask scheduled task?
May 24, 2022
Post comments count 14
Post likes count 4

What is the CreateExplorerShellUnelevatedTask scheduled task?

Raymond Chen
Raymond Chen

To keep Explorer running unelevated.

How does Windows decide whether a newly-created window should use LTR or RTL layout?
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
Raymond Chen

Gathering the algorithmic details scattered throughout the documentation into one place.

Writing a sort comparison function, part 4: descending sort
May 20, 2022
Post comments count 4
Post likes count 1

Writing a sort comparison function, part 4: descending sort

Raymond Chen
Raymond Chen

Flipping the script.

Writing a sort comparison function, part 3: spaceships
May 19, 2022
Post comments count 3
Post likes count 1

Writing a sort comparison function, part 3: spaceships

Raymond Chen
Raymond Chen

Sprinkling some C++20 magic.

Writing a sort comparison function, part 2: avoid unnecessary expense
May 18, 2022
Post comments count 5
Post likes count 1

Writing a sort comparison function, part 2: avoid unnecessary expense

Raymond Chen
Raymond Chen

Avoid doing the work until needed.

Writing a sort comparison function, part 1: basics
May 17, 2022
Post comments count 8
Post likes count 1

Writing a sort comparison function, part 1: basics

Raymond Chen
Raymond Chen

Trying to avoid the pitfalls.

How can I synthesize a C++20 three-way comparison from two-way comparisons?
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
Raymond Chen

Multiple ways of synthesizing a comparison.

Should I pay attention to the warning that I’m <CODE>std::move</CODE>‘ing from a trivial type? Part 2
May 13, 2022
Post comments count 5
Post likes count 1

Should I pay attention to the warning that I’m <CODE>std::move</CODE>‘ing from a trivial type? Part 2

Raymond Chen
Raymond Chen

It's not about the journey. It's about the destination.

Should I pay attention to the warning that I’m <CODE>std::move</CODE>‘ing from a trivial type? Part 1
May 12, 2022
Post comments count 0
Post likes count 1

Should I pay attention to the warning that I’m <CODE>std::move</CODE>‘ing from a trivial type? Part 1

Raymond Chen
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.

On ways of finding out when a C++/WinRT IAsyncAction has run to completion
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
Raymond Chen

Just some noodling on ideas.

A brief summary of the various versions of the Security Descriptor Definition Language (SDDL)
May 10, 2022
Post comments count 5
Post likes count 1

A brief summary of the various versions of the Security Descriptor Definition Language (SDDL)

Raymond Chen
Raymond Chen

Things come, and rarely go.

Why does my overridable Windows Runtime method turn into a protected method, and how can I work around it?
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
Raymond Chen

Just an odd rule, but it's there for a reason.

On awaiting a task with a timeout in C++/WinRT
May 6, 2022
Post comments count 3
Post likes count 1

On awaiting a task with a timeout in C++/WinRT

Raymond Chen
Raymond Chen

Doing the same thing, just in another language.

On awaiting a task with a timeout in C#
May 5, 2022
Post comments count 4
Post likes count 1

On awaiting a task with a timeout in C#

Raymond Chen
Raymond Chen

Putting something together from pieces you already have.

Producing an empty Windows Runtime type in C++/WinRT
May 4, 2022
Post comments count 0
Post likes count 1

Producing an empty Windows Runtime type in C++/WinRT

Raymond Chen
Raymond Chen

How to say that you don't have anything.

What are these SIDs of the form S-1-15-3-xxx?
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
Raymond Chen

They are app capability SIDs.

What are these SIDs of the form S-1-15-2-xxx?
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
Raymond Chen

They are app container SIDs.

The case of the failed exchange of the vtable slot
Apr 29, 2022
Post comments count 4
Post likes count 1

The case of the failed exchange of the vtable slot

Raymond Chen
Raymond Chen

Another application compatibility case.

What’s up with <CODE>std::piecewise_construct</CODE> and <CODE>std::forward_as_tuple</CODE>?
Apr 28, 2022
Post comments count 2
Post likes count 5

What’s up with <CODE>std::piecewise_construct</CODE> and <CODE>std::forward_as_tuple</CODE>?

Raymond Chen
Raymond Chen

When you need to pass two sets of variadic parameters, and to work around other extremely weird edge cases.

How do I decode a <CODE>#pragma detect_mismatch</CODE> error?
Apr 27, 2022
Post comments count 0
Post likes count 1

How do I decode a <CODE>#pragma detect_mismatch</CODE> error?

Raymond Chen
Raymond Chen

The linker tells you a bunch of stuff. Here's what it means.

Be careful with that thing, it’s a confidential coffee maker
Apr 26, 2022
Post comments count 9
Post likes count 5

Be careful with that thing, it’s a confidential coffee maker

Raymond Chen
Raymond Chen

Just keep it under wraps.

How can I force a <CODE>WriteFile</CODE> or <CODE>ReadFile</CODE> to complete synchronously or hang, in order to test something?
Apr 25, 2022
Post comments count 0
Post likes count 1

How can I force a <CODE>WriteFile</CODE> or <CODE>ReadFile</CODE> to complete synchronously or hang, in order to test something?

Raymond Chen
Raymond Chen

You can use a named pipe.

Trying to create a factory that remembers the parameters to pass to another method
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
Raymond Chen

Lost in a twisty maze of universal references.

How do I access and customize the IInspectable methods of a Windows Runtime class written in C++/WinRT?
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
Raymond Chen

Special access methods, but normal overrides.

Class template argument deduction may be the new hotness, but we’ll always have maker functions
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
Raymond Chen

It's all or nothing, and sometimes you don't have all.

The Applesoft Compiler (TASC): We have the source code, in a sense
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
Raymond Chen

The desperation of programming under tight memory constraints.

The x86 architecture is the weirdo, part 2
Apr 18, 2022
Post comments count 2
Post likes count 1

The x86 architecture is the weirdo, part 2

Raymond Chen
Raymond Chen

It does everything differently, because of course it does.

How can I <CODE>co_await</CODE> on a Windows Runtime async action or operation with a timeout?
Apr 15, 2022
Post comments count 3
Post likes count 1

How can I <CODE>co_await</CODE> on a Windows Runtime async action or operation with a timeout?

Raymond Chen
Raymond Chen

You can combine it with a timeout.

How can I tell the WIL <CODE>RETURN_<WBR>IF_<WBR>FAILED</CODE> macro that some errors are ignorable?
Apr 14, 2022
Post comments count 1
Post likes count 1

How can I tell the WIL <CODE>RETURN_<WBR>IF_<WBR>FAILED</CODE> macro that some errors are ignorable?

Raymond Chen
Raymond Chen

You can create a custom filter using things you already know how to do.

A survey of how implementations of Windows Runtime events deal with errors
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
Raymond Chen

All happy event delegates are alike; each unhappy event delegate is unhappy in its own way.

Notes on BitLocker and the TPM and the pre-boot password or PIN
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
Raymond Chen

How to get BitLocker and the TPM to play friendly.

Now that computers have more than 4MB of memory, can we get seconds on the taskbar?
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
Raymond Chen

Letting the CPU go to sleep.

Please repeat yourself: The <CODE>noexcept(noexcept(…))</CODE> idiom
Apr 8, 2022
Post comments count 5
Post likes count 1

Please repeat yourself: The <CODE>noexcept(noexcept(…))</CODE> idiom

Raymond Chen
Raymond Chen

Each time you say it, it means something different.

If I am getting a DllNotFoundException from Windows 10 N, how do I get the missing DLLs?
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
Raymond Chen

Enter the Media Feature Pack.

All Windows threadpool waits can now be handled by a single thread
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
Raymond Chen

Come in and join the thread, the water's fine.

Adventures in application compatibility: The case of the RAII type that failed to run its destructor
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
Raymond Chen

Breaking all the rules and getting away with it.

How are Windows Runtime GUIDs represented in JavaScript?
Apr 4, 2022
Post comments count 0
Post likes count 1

How are Windows Runtime GUIDs represented in JavaScript?

Raymond Chen
Raymond Chen

They're strings, in various formats.

The <CODE>std::invoke</CODE> function does more than invoke functions
Apr 1, 2022
Post comments count 3
Post likes count 2

The <CODE>std::invoke</CODE> function does more than invoke functions

Raymond Chen
Raymond Chen

Inspiring a new level of code obfuscation.

Should I translate my window class names?
Mar 31, 2022
Post comments count 8
Post likes count 1

Should I translate my window class names?

Raymond Chen
Raymond Chen

Who's going to read it?

Why am I getting the error message “This is only for weak ref support” when I try to create a C++/WinRT weak reference?
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
Raymond Chen

Reverse-engineering the error message.

How to become a Senior Detective, according to Murderville
Mar 29, 2022
Post comments count 3
Post likes count 1

How to become a Senior Detective, according to Murderville

Raymond Chen
Raymond Chen

A little copy pasta will take you far.

Why are there separate Program Files and Program Files (x86) directories?
Mar 29, 2022
Post comments count 29
Post likes count 2

Why are there separate Program Files and Program Files (x86) directories?

Raymond Chen
Raymond Chen

Why can't we just combine them?

Why is every other line of my file mysteriously changed to nonsense Chinese characters?
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
Raymond Chen

Decoding another type of mojibake.

The 2022/2023 Seattle Symphony subscription season at a glance
Mar 25, 2022
Post comments count 0
Post likes count 0

The 2022/2023 Seattle Symphony subscription season at a glance

Raymond Chen
Raymond Chen

The pocket reference guide for 2022/2023.

Behind C++/WinRT: How does C++/WinRT get the list of implemented interfaces?
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
Raymond Chen

Doing some template metaprogramming reverse engineering.

Behind C++/WinRT: How does C++/WinRT decide which interfaces are implemented?
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
Raymond Chen

Finding the code that does the interface detection.

Why does C++/WinRT say that <CODE>first_interface</CODE> is not a member of <CODE>winrt::impl::interface_list<></CODE>?
Mar 23, 2022
Post comments count 0
Post likes count 1

Why does C++/WinRT say that <CODE>first_interface</CODE> is not a member of <CODE>winrt::impl::interface_list<></CODE>?

Raymond Chen
Raymond Chen

An empty list has no first element, but why is the list empty?

A hypothetical magical musical power: The one-piece wonder
Mar 22, 2022
Post comments count 6
Post likes count 1

A hypothetical magical musical power: The one-piece wonder

Raymond Chen
Raymond Chen

You can play one thing well, but only one.

How do I un-ignore an Outlook email thread, and how does it work?
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
Raymond Chen

A peek under the covers.

Injected class names: The C++ feature you didn’t even realize that you were using
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
Raymond Chen

Simplifying the name of what you are.

Making our multiple-interface query more C++-like, part 2
Mar 18, 2022
Post comments count 1
Post likes count 1

Making our multiple-interface query more C++-like, part 2

Raymond Chen
Raymond Chen

Letting you specify which interfaces are required and which are optional.

Making our multiple-interface query more C++-like, part 1
Mar 17, 2022
Post comments count 1
Post likes count 1

Making our multiple-interface query more C++-like, part 1

Raymond Chen
Raymond Chen

Maybe we can write a nice wrapper.

Reducing chattiness by querying for multiple interfaces at once, part 2
Mar 16, 2022
Post comments count 0
Post likes count 1

Reducing chattiness by querying for multiple interfaces at once, part 2

Raymond Chen
Raymond Chen

You can just load them into the cache.

Reducing chattiness by querying for multiple interfaces at once, part 1
Mar 15, 2022
Post comments count 1
Post likes count 1

Reducing chattiness by querying for multiple interfaces at once, part 1

Raymond Chen
Raymond Chen

The multiple-query alternatives.

How expensive is PssCaptureSnapshot? How fast is it? How much memory does it consume?
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
Raymond Chen

Think of it as a copy-on-write copy, like the Volume Snapshot Service.

Optimizing code to darken a bitmap, part 5
Mar 11, 2022
Post comments count 7
Post likes count 1

Optimizing code to darken a bitmap, part 5

Raymond Chen
Raymond Chen

Once more, with ARM feeling.

Optimizing code to darken a bitmap, part 4
Mar 10, 2022
Post comments count 9
Post likes count 1

Optimizing code to darken a bitmap, part 4

Raymond Chen
Raymond Chen

Bringing out the big SIMD guns, for x86 at least.

Optimizing code to darken a bitmap, part 3
Mar 9, 2022
Post comments count 10
Post likes count 1

Optimizing code to darken a bitmap, part 3

Raymond Chen
Raymond Chen

Jumpless conditionals via masking.

Optimizing code to darken a bitmap, part 2
Mar 8, 2022
Post comments count 11
Post likes count 1

Optimizing code to darken a bitmap, part 2

Raymond Chen
Raymond Chen

Exploiting parallel arithmetic.

Optimizing code to darken a bitmap, part 1
Mar 7, 2022
Post comments count 15
Post likes count 1

Optimizing code to darken a bitmap, part 1

Raymond Chen
Raymond Chen

Starting with the basics.

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?
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
Raymond Chen

No, but you sort of knew that deep down.

Filtering out fake keyboards from the GetRawInputDeviceList function
Mar 3, 2022
Post comments count 1
Post likes count 1

Filtering out fake keyboards from the GetRawInputDeviceList function

Raymond Chen
Raymond Chen

Maybe look to see if it has any keys.

How can I detect whether the system has a keyboard attached? On the GetRawInputDeviceList function
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
Raymond Chen

You can enumerate the input devices and see if there's a keyboard.

How does Windows decide what instructions to provide for unlocking the PC?
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
Raymond Chen

It sniffs around at your hardware capabilities.

Zero-cost exceptions aren’t actually zero cost
Feb 28, 2022
Post comments count 15
Post likes count 2

Zero-cost exceptions aren’t actually zero cost

Raymond Chen
Raymond Chen

Shifting the cost to the exceptional path.

How can I monitor changes to the reference count of a C++/WinRT object?
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
Raymond Chen

A little cookbook.

COM asynchronous interfaces, part 9: Asynchronous release, assembling a solution
Feb 24, 2022
Post comments count 2
Post likes count 1

COM asynchronous interfaces, part 9: Asynchronous release, assembling a solution

Raymond Chen
Raymond Chen

Juggling the references in the right way.

COM asynchronous interfaces, part 8: Asynchronous release, the problems
Feb 23, 2022
Post comments count 0
Post likes count 1

COM asynchronous interfaces, part 8: Asynchronous release, the problems

Raymond Chen
Raymond Chen

If you don't need something any more, then you usually don't really care when it gets taken away.

COM asynchronous interfaces, part 7: Being called directly when the operation completes
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
Raymond Chen

Becoming part of the system.

COM asynchronous interfaces, part 6: Learning about completion without polling
Feb 21, 2022
Post comments count 4
Post likes count 1

COM asynchronous interfaces, part 6: Learning about completion without polling

Raymond Chen
Raymond Chen

You can peek at the handle hiding inside the synchronization interface.

COM asynchronous interfaces, part 5: The unreliable server
Feb 18, 2022
Post comments count 0
Post likes count 1

COM asynchronous interfaces, part 5: The unreliable server

Raymond Chen
Raymond Chen

Trying not to hang when the server is hung.

COM asynchronous interfaces, part 4: Doing work while waiting for the asynchronous operation
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
Raymond Chen

Just checking in on how things are going.

COM asynchronous interfaces, part 3: Abandoning the operation after a timeout
Feb 16, 2022
Post comments count 0
Post likes count 1

COM asynchronous interfaces, part 3: Abandoning the operation after a timeout

Raymond Chen
Raymond Chen

Waiting a little while, but not forever.

COM asynchronous interfaces, part 2: Abandoning the operation
Feb 15, 2022
Post comments count 1
Post likes count 1

COM asynchronous interfaces, part 2: Abandoning the operation

Raymond Chen
Raymond Chen

Simply losing interest.

COM asynchronous interfaces, part 1: The basic pattern
Feb 14, 2022
Post comments count 3
Post likes count 1

COM asynchronous interfaces, part 1: The basic pattern

Raymond Chen
Raymond Chen

Letting things run on their own, and then coming back for the answer later.

Notes on COM aggregation: How do you implement tear-offs in an aggregated object?
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
Raymond Chen

Keeping the controlling unknown in the know.

Notes on COM aggregation: Obtaining a pointer to your aggregated partner without introducing a reference cycle
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
Raymond Chen

Putting your thumb on the scale.

How can I find out which processor architectures are supported via emulation by the current system?
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
Raymond Chen

Fortunately, there's a special function for that, or at least for enough of that to serve your needs.

The cats sitting on a fence in early builds of Windows 8
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
Raymond Chen

Something to look at when all is lost.

On finding the average of two unsigned integers without overflow
Feb 7, 2022
Post comments count 11
Post likes count 1

On finding the average of two unsigned integers without overflow

Raymond Chen
Raymond Chen

Another code golfing adventure.

The case of the stack overflow exception when the stack is nowhere near overflowing
Feb 4, 2022
Post comments count 3
Post likes count 1

The case of the stack overflow exception when the stack is nowhere near overflowing

Raymond Chen
Raymond Chen

There's a problem with the stack that prevents it from growing, so you could consider than an overflow.

A closer look at the stack guard page
Feb 3, 2022
Post comments count 10
Post likes count 3

A closer look at the stack guard page

Raymond Chen
Raymond Chen

It is there to detect stack growth, but only if the stack grows into it.

Gotcha: C++/WinRT weak_ref.get() doesn’t get the weak reference; it gets the strong reference
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
Raymond Chen

What traditionally goes by the name <CODE>lock()</CODE>.

How do I customize the color of the Windows blue screen?
Feb 1, 2022
Post comments count 7
Post likes count 1

How do I customize the color of the Windows blue screen?

Raymond Chen
Raymond Chen

It's hard-coded now, sorry.

Why does the Windows debugger engine show a bunch of hex digits after one of the DLL names?
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
Raymond Chen

It's trying to disambiguate name collisions.

How can I recognize whether two handles refer to the same underlying file?
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
Raymond Chen

Exploring several avenues, hoping one of them leads somewhere.

How can I recognize file systems that don’t support 64-bit unique file identifiers?
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
Raymond Chen

It's buried somewhere in the specification.

What are these weird internal Visual C++ runtime functions named NLG?
Jan 26, 2022
Post comments count 0
Post likes count 1

What are these weird internal Visual C++ runtime functions named NLG?

Raymond Chen
Raymond Chen

They are part of exception handling.

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
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
Raymond Chen

The file is circling the drain, but it's not gone yet.

The MainWindowHandle property is just a guess based on heuristics
Jan 24, 2022
Post comments count 7
Post likes count 1

The MainWindowHandle property is just a guess based on heuristics

Raymond Chen
Raymond Chen

If you really need to find your main window, you'll have to come up with something more determinstic.

Fixing the crash that seems to be on a <CODE>std::move</CODE> operation
Jan 21, 2022
Post comments count 2
Post likes count 1

Fixing the crash that seems to be on a <CODE>std::move</CODE> operation

Raymond Chen
Raymond Chen

Getting the order of evaluation to be what you want.

The mystery of the crash that seems to be on a <CODE>std::move</CODE> operation
Jan 20, 2022
Post comments count 0
Post likes count 1

The mystery of the crash that seems to be on a <CODE>std::move</CODE> operation

Raymond Chen
Raymond Chen

But is that really what's happening?

The error code you get might not be the one you want
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
Raymond Chen

Some error codes are contractual, but most aren't.

How to write like Raymond: The typing-saver
Jan 18, 2022
Post comments count 1
Post likes count 1

How to write like Raymond: The typing-saver

Raymond Chen
Raymond Chen

One of my little catch phrases.

C# and C++ type aliases and their consequences
Jan 17, 2022
Post comments count 4
Post likes count 1

C# and C++ type aliases and their consequences

Raymond Chen
Raymond Chen

Just some idle thoughts, and what it means for debugging.

Resolving confusion over how to return from a C++ coroutine
Jan 14, 2022
Post comments count 5
Post likes count 2

Resolving confusion over how to return from a C++ coroutine

Raymond Chen
Raymond Chen

You have a few options, but you have to stay with it.

The oracle always tells the truth, even when it is wrong: COM method calls with a user-defined type as a return value
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
Raymond Chen

What you ship becomes the truth.

Standing on the shoulders of giants: Let the compiler tell you what the ABI is
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
Raymond Chen

Consult the oracle.

Jumping into the middle of an instruction is not as strange as it sounds
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
Raymond Chen

It's just another trick for saving space.

How can I detect that a thread pool work item is taking too long?
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
Raymond Chen

Call in a watchdog.

How do I upgrade a 32-bit tick count to a 64-bit one?
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
Raymond Chen

Fortunately, there's a 64-bit one sitting nearby.

Filling in some gaps in the story of Space Cadet Pinball on 64-bit Windows
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
Raymond Chen

The story as I experienced it.

How do I prevent folder verbs intended for file system directories from showing up in my shell extension’s virtual folder’s context menu?
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
Raymond Chen

They shouldn't be there in the first place.

My Excel spreadsheet doesn’t scroll even though I can use the arrows to move around
Jan 4, 2022
Post comments count 4
Post likes count 13

My Excel spreadsheet doesn’t scroll even though I can use the arrows to move around

Raymond Chen
Raymond Chen

Freeze, and put your hands up!

Speculation on the design decisions that led to the common ABI for C++ coroutines
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
Raymond Chen

Considering some alternatives.

2021 year-end link clearance
Dec 31, 2021
Post comments count 8
Post likes count 1

2021 year-end link clearance

Raymond Chen
Raymond Chen

Another trip around the sun.

The case of the programs that were launched with impossible command line options
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
Raymond Chen

Death and resurrection, unsuccessfully.

The C++/CX <CODE>String^</CODE> is not an object, even though it wears a hat
Dec 30, 2021
Post comments count 5
Post likes count 1

The C++/CX <CODE>String^</CODE> is not an object, even though it wears a hat

Raymond Chen
Raymond Chen

A strange beast that thing is.

You can’t copy code with memcpy; code is more complicated than that
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
Raymond Chen

There's more to code than just instructions.

A rejected attempt to inject pseudo-physics into Windows 8 toast notifications
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
Raymond Chen

Like a mischievous rubber band flung across the screen.

How do I add custom controls to the common file open or file save dialogs?
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
Raymond Chen

A survey of the history of customization, leading to the present.

The Thanksgiving to Christmas sales nationwide of the VIS could be tabulated in an unsigned char
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
Raymond Chen

One of the great duds of console gaming history.

It’s easy to get data into the GPU, but harder to get it out
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
Raymond Chen

The continuing evolution of graphics memory.

How do I programmatically reposition monitors in a multiple-monitor system?
Dec 22, 2021
Post comments count 1
Post likes count 2

How do I programmatically reposition monitors in a multiple-monitor system?

Raymond Chen
Raymond Chen

The magic phrase is <CODE>DM_POSITION</CODE>.

You thought Windows drivers from 2006 were old, wait’ll you see the Intel drivers from 1968!
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
Raymond Chen

It's the same driver date hack, just even more extreme.

Why do I have to add one when setting a class background brush to a system color?
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
Raymond Chen

To make sure it's not null.

Why is the stack overflow exception raised before the stack has overflowed?
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
Raymond Chen

You need some stack to deal with the exception.

Why does the precise point at which I get a stack overflow exception change from run to run?
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
Raymond Chen

The system is trying to introduce some unpredictability.

What does “Do not launch, but debug my code when it launches” mean?
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
Raymond Chen

Don't launch my code when it launches? Does that even make sense?

Embarrassing product names created: Windows CE
Dec 14, 2021
Post comments count 5
Post likes count 1

Embarrassing product names created: Windows CE

Raymond Chen
Raymond Chen

You do all you can, but at the end of the day, it's not yours to control.

Dubious security vulnerability: Accessing information across accounts after changing email address
Dec 13, 2021
Post comments count 0
Post likes count 1

Dubious security vulnerability: Accessing information across accounts after changing email address

Raymond Chen
Raymond Chen

It's still you, just with a different online façade.

It’s okay to be contrary, but you need to be consistently contrary: Going against the ambient character set
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
Raymond Chen

Code different.

If you’re going to configure a header file, you have to do it before you include the header file
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
Raymond Chen

It sounds obvious, but you can be faked out.

Using CRTP to your advantage: Simplifying overloaded Windows Runtime method projections in C++/WinRT
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
Raymond Chen

As long as the wrapper can call it, you can implement it any way you like.

What happens when a hot air balloon lands in your yard?
Dec 7, 2021
Post comments count 2
Post likes count 1

What happens when a hot air balloon lands in your yard?

Raymond Chen
Raymond Chen

Break out the bubbly.

It rather involved being on the other side of this airtight hatchway: Producing malicious data in a kernel driver
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
Raymond Chen

Sure, you can fool other people, but you can do far more than that already.

Compiler error message metaprogramming: Helping to find the conflicting macro definition
Dec 6, 2021
Post comments count 7
Post likes count 1

Compiler error message metaprogramming: Helping to find the conflicting macro definition

Raymond Chen
Raymond Chen

Shaping the code so a required diagnostic will be useful.

How can I produce a C-style array from a Windows Runtime asynchronous operation?
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
Raymond Chen

No good solutions, but some workarounds.

How do I receive ownership of a C-style array in a Windows Runtime component?
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
Raymond Chen

The implementation side of the role reversal.

How can I transfer ownership of a C-style array to a Windows Runtime component?
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
Raymond Chen

Survey the options and realize that the only choice is to go backward.

How can my C++/WinRT component pass a <CODE>std::vector</CODE> back to the caller?
Nov 30, 2021
Post comments count 1
Post likes count 1

How can my C++/WinRT component pass a <CODE>std::vector</CODE> back to the caller?

Raymond Chen
Raymond Chen

Implementing the ReceiveArray pattern.

How did Windows 3.1’s virtual machine manager get the information to show in the text-mode <KBD>Alt</KBD>+<KBD>Tab</KBD> switcher?
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 <KBD>Alt</KBD>+<KBD>Tab</KBD> switcher?

Raymond Chen
Raymond Chen

Getting by with a little help from a friend.

The two products may be identical, but they are not the same
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
Raymond Chen

No price-matching for you.

I called AdjustTokenPrivileges, but I was still told that a necessary privilege was not held, redux
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
Raymond Chen

Did any privilege adjustment occur at all?

How do I pass an array of variable-sized <CODE>PROPSHEETPAGE</CODE> structures to <CODE>PropertySheet</CODE>?
Nov 25, 2021
Post comments count 4
Post likes count 1

How do I pass an array of variable-sized <CODE>PROPSHEETPAGE</CODE> structures to <CODE>PropertySheet</CODE>?

Raymond Chen
Raymond Chen

It's "just" an array of variable-sized structures.

Appending additional payload to a <CODE>PROPSHEETPAGE</CODE> structure
Nov 24, 2021
Post comments count 7
Post likes count 1

Appending additional payload to a <CODE>PROPSHEETPAGE</CODE> structure

Raymond Chen
Raymond Chen

Taking it along for the ride.

Every business process secretly wants to fail
Nov 23, 2021
Post comments count 10
Post likes count 1

Every business process secretly wants to fail

Raymond Chen
Raymond Chen

At least, that's how it looks from the outside.

A reminder about the correct way of accessing and manipulating the position of icons on the desktop
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
Raymond Chen

There's an interface for that. Please use it.

Why is my C++/CX ref class forbidden from having public methods that are templates or mention, say, std::vector?
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
Raymond Chen

C++/CX overloads the class member access control keywords to control metadata generation.

What does the CompileAsWinRT Visual Studio project option mean?
Nov 18, 2021
Post comments count 1
Post likes count 1

What does the CompileAsWinRT Visual Studio project option mean?

Raymond Chen
Raymond Chen

And why it's badly-named.

The mental model for StartThreadpoolIo
Nov 17, 2021
Post comments count 3
Post likes count 1

The mental model for StartThreadpoolIo

Raymond Chen
Raymond Chen

It's internally managing a reference count.

Microspeak: Righteous
Nov 16, 2021
Post comments count 6
Post likes count 1

Microspeak: Righteous

Raymond Chen
Raymond Chen

A colloqualism that has become a preferred adjective.

A practical use for <CODE>GetHGlobal­FromStream</CODE> when sharing was never your intention
Nov 15, 2021
Post comments count 0
Post likes count 1

A practical use for <CODE>GetHGlobal­FromStream</CODE> when sharing was never your intention

Raymond Chen
Raymond Chen

This may even have been its original purpose.

Another way of looking at C++ reverse iterators
Nov 12, 2021
Post comments count 7
Post likes count 1

Another way of looking at C++ reverse iterators

Raymond Chen
Raymond Chen

It's the same thing, just going in the opposite direction, right?

I sort of knew that I’m a bad flute player, but I guess this proves it
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
Raymond Chen

The fault is in ourselves, after all.

The inside story of the outside investigation of SoftRAM 95
Nov 11, 2021
Post comments count 20
Post likes count 2

The inside story of the outside investigation of SoftRAM 95

Raymond Chen
Raymond Chen

It had a plan, but didn't quite execute on it.

How am I supposed to create children of the Win32 tab control?
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
Raymond Chen

They look like children, but they're not.

If your domain name parser can’t handle internationalized domain names, then maybe that’s your parser’s problem
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
Raymond Chen

Don't blame someone else for letting strange domain names reach you.

Restoring support for pre-standardization coroutine free awaiters for even older code bases
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
Raymond Chen

Connecting the dots, and reaching back to an earlier time.

The case of the C++/WinRT cached factories that pointed into freed memory
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
Raymond Chen

Developing theories that match the evidence.

How can I prevent myself from accessing a lambda captured variable or a parameter after I’m done with it?
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
Raymond Chen

Name-hiding on purpose.

A capturing lambda can be a coroutine, but you have to save your captures while you still can
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
Raymond Chen

Save it all before it disappears.

The focus rectangle says, “I’m not orange. I’m just drawn that way.”
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
Raymond Chen

How does <CODE>Draw­Focus­Rect</CODE> draw the focus rectangle?

Why do all this coroutine stuff if you can just use <CODE>std::future</CODE>?
Nov 1, 2021
Post comments count 1
Post likes count 1

Why do all this coroutine stuff if you can just use <CODE>std::future</CODE>?

Raymond Chen
Raymond Chen

Escape from PPL.

Giving a single object multiple COM identities, part 4
Oct 29, 2021
Post comments count 0
Post likes count 1

Giving a single object multiple COM identities, part 4

Raymond Chen
Raymond Chen

Simplifying the pattern.

Giving a single object multiple COM identities, part 3
Oct 28, 2021
Post comments count 3
Post likes count 1

Giving a single object multiple COM identities, part 3

Raymond Chen
Raymond Chen

Returning to the scene of the crime.

Giving a single object multiple COM identities, part 2
Oct 27, 2021
Post comments count 1
Post likes count 1

Giving a single object multiple COM identities, part 2

Raymond Chen
Raymond Chen

Trying to develop a slightly more efficient multi-headed snake.

Giving a single object multiple COM identities, part 1
Oct 26, 2021
Post comments count 3
Post likes count 1

Giving a single object multiple COM identities, part 1

Raymond Chen
Raymond Chen

Like a multi-headed snake.

A very brief introduction to patterns for implementing a COM object that hands out references to itself
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
Raymond Chen

We'll look at many choices, but focus on one.

Renaming a file is a multi-step process, only one of which is changing the name of the file
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
Raymond Chen

If you're going to swoop in, make sure to swoop in carefully.

Why isn’t <CODE>MapDialogRect</CODE> mapping dialog rectangles?
Oct 21, 2021
Post comments count 3
Post likes count 1

Why isn’t <CODE>MapDialogRect</CODE> mapping dialog rectangles?

Raymond Chen
Raymond Chen

Maybe you don't have a dialog.

My code crashed when I asked WIL to convert an exception to an HRESULT, did I throw an improper exception type?
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
Raymond Chen

Digging into the failure more closely.

That time we had a network outage due to unexpected hunter activity
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
Raymond Chen

Watch where you're pointing that thing.

How can I get the screen reader to read out an error message that I displayed inline on a page?
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
Raymond Chen

Make it a live region.

What does the <CODE>SizeOfImage</CODE> mean in the <CODE>MODULEINFO</CODE> structure?
Oct 15, 2021
Post comments count 0
Post likes count 1

What does the <CODE>SizeOfImage</CODE> mean in the <CODE>MODULEINFO</CODE> structure?

Raymond Chen
Raymond Chen

It's the size in terms of mapped address space when loaded.

Why does GetModuleInfo fail to produce an entry point for executables?
Oct 14, 2021
Post comments count 1
Post likes count 1

Why does GetModuleInfo fail to produce an entry point for executables?

Raymond Chen
Raymond Chen

Because it's getting the information from the loader, who has no use for such things.

Local variables are different from parameters in C++ coroutines
Oct 13, 2021
Post comments count 3
Post likes count 1

Local variables are different from parameters in C++ coroutines

Raymond Chen
Raymond Chen

You tend to think of them the same, but they destruct differently.

The happy hand: A puzzle about odd names in Azure DevOps
Oct 12, 2021
Post comments count 2
Post likes count 1

The happy hand: A puzzle about odd names in Azure DevOps

Raymond Chen
Raymond Chen

Who's renaming everything into something cute?

Is there a way that my macro can detect that it’s running in a C++ coroutine?
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
Raymond Chen

You are part of the decision.

What can I do about timer build-up when waiting for COM outbound calls to complete?
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
Raymond Chen

You'll have to drain them out yourself.

Debugging coroutine handles: The Microsoft Visual C++ compiler, clang, and gcc
Oct 7, 2021
Post comments count 0
Post likes count 1

Debugging coroutine handles: The Microsoft Visual C++ compiler, clang, and gcc

Raymond Chen
Raymond Chen

Peeking behind the curtain.

Why is the <CODE>main()</CODE> function always at address 0x00401000 in a simple program?
Oct 6, 2021
Post comments count 4
Post likes count 1

Why is the <CODE>main()</CODE> function always at address 0x00401000 in a simple program?

Raymond Chen
Raymond Chen

When multiple technical decision add up, literally.

Not from inside the Redmond Reality Distortion Field: Microsoft Streets and Trips support for ferries
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
Raymond Chen

From somebody else's reality distortion field.

Some lesser-known powers of std::optional
Oct 4, 2021
Post comments count 6
Post likes count 4

Some lesser-known powers of std::optional

Raymond Chen
Raymond Chen

Things it does that you may not know about.

The subtleties of <CODE>Create­Stream­On­HGlobal</CODE>, part 4: Non-movable memory
Oct 1, 2021
Post comments count 2
Post likes count 1

The subtleties of <CODE>Create­Stream­On­HGlobal</CODE>, part 4: Non-movable memory

Raymond Chen
Raymond Chen

Fear and reallocation.

The subtleties of <CODE>Create­Stream­On­HGlobal</CODE>, part 3: Suppressing the deletion of a shared <CODE>HGLOBAL</CODE>
Sep 30, 2021
Post comments count 0
Post likes count 1

The subtleties of <CODE>Create­Stream­On­HGlobal</CODE>, part 3: Suppressing the deletion of a shared <CODE>HGLOBAL</CODE>

Raymond Chen
Raymond Chen

Trying to set up joint custody.

The subtleties of <CODE>Create­Stream­On­HGlobal</CODE>, part 2: Suppressing the deletion of an unknown <CODE>HGLOBAL</CODE>
Sep 29, 2021
Post comments count 5
Post likes count 1

The subtleties of <CODE>Create­Stream­On­HGlobal</CODE>, part 2: Suppressing the deletion of an unknown <CODE>HGLOBAL</CODE>

Raymond Chen
Raymond Chen

You don't know what it is, but you said you don't want it deleted automatically.

The subtleties of <CODE>Create­Stream­On­HGlobal</CODE>, part 1: Introduction and basic usage
Sep 28, 2021
Post comments count 0
Post likes count 1

The subtleties of <CODE>Create­Stream­On­HGlobal</CODE>, part 1: Introduction and basic usage

Raymond Chen
Raymond Chen

Developing the mental model.

Why am I getting an unresolved external from C++/WinRT if it is a header-only C++ library?
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
Raymond Chen

Maybe you didn't get all of the headers.

The case of the UWP application that crashes at launch on Windows 10X
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
Raymond Chen

Look before you leap.

Why is there trailing garbage when I try to decode the bytes of a HttpContent object?
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
Raymond Chen

You need to know when to stop.

Converting between UTF-8 strings and UTF-16 strings in C++/WinRT
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
Raymond Chen

A pair of conversion functions.

The CertUtil program will decode Windows error codes, and in a variety of formats
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
Raymond Chen

Even more versatile than <CODE>NET HELPMSG</CODE>.

What does this mean? The caller specified wait timed out before the operation completed because a host termination is in queued
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
Raymond Chen

An error message written with infrastructure-colored glasses.

Adventures in application compatibility: The case of the wild instruction pointer that, upon closer inspection, might not be so wild after all
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
Raymond Chen

The search for clues leads to an unexpected place.

The C++ implicit assignment operator is a non-ref-qualified member, even if the base class’s assignment has a ref-qualifier
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
Raymond Chen

Does that count as dis-qualification?

How do I set the alpha channel of a GDI bitmap to 255?
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
Raymond Chen

Most things destroy the alpha channel, but there's a way to bring it back, or at least make it opaque.

Microspeak: Persona
Sep 14, 2021
Post comments count 0
Post likes count 1

Microspeak: Persona

Raymond Chen
Raymond Chen

A template for a prototypical user.

The C++/WinRT <CODE>query_<WBR>interface_<WBR>tearoff</CODE> extension point, and using it for COM aggregation
Sep 13, 2021
Post comments count 1
Post likes count 1

The C++/WinRT <CODE>query_<WBR>interface_<WBR>tearoff</CODE> extension point, and using it for COM aggregation

Raymond Chen
Raymond Chen

For adding your own <CODE>QueryInterface</CODE> magic.

Ordering asynchronous updates with coroutines, part 5: Bowing out via cancellation
Sep 10, 2021
Post comments count 0
Post likes count 1

Ordering asynchronous updates with coroutines, part 5: Bowing out via cancellation

Raymond Chen
Raymond Chen

Using the built-in way of stopping a coroutine.

Ordering asynchronous updates with coroutines, part 4: Bowing out, explicit version
Sep 9, 2021
Post comments count 2
Post likes count 1

Ordering asynchronous updates with coroutines, part 4: Bowing out, explicit version

Raymond Chen
Raymond Chen

Realizing you're not the one.

Ordering asynchronous updates with coroutines, part 3: Let them all compete, but only one wins
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
Raymond Chen

Everybody tries, but only one wins.

Ordering asynchronous updates with coroutines, part 2: Restart with hand-off
Sep 7, 2021
Post comments count 1
Post likes count 1

Ordering asynchronous updates with coroutines, part 2: Restart with hand-off

Raymond Chen
Raymond Chen

Everybody just waits their turn.

Ordering asynchronous updates with coroutines, part 1: Mutual exclusion
Sep 6, 2021
Post comments count 1
Post likes count 1

Ordering asynchronous updates with coroutines, part 1: Mutual exclusion

Raymond Chen
Raymond Chen

Everybody just waits their turn.

I declared my Windows Runtime method as accepting an array by reference, but it always arrives empty
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
Raymond Chen

You were only meant to put things into the box, not look at what was already there.

Adventures in application compatibility: The cost of forgetting to specify a calling convention
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
Raymond Chen

Cleaning up behind mistakes of the past.

Looking at world through __stdcall-colored glasses
Sep 1, 2021
Post comments count 5
Post likes count 1

Looking at world through __stdcall-colored glasses

Raymond Chen
Raymond Chen

It's the default, or at least it's my default.

Notes on the Seattle Symphony’s expanded concert schedule for 2021–2022 season
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
Raymond Chen

More concerts, more options.

What are the consequences of increasing the per-process GDI handle limit?
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
Raymond Chen

Striking a balance.

The various ways of moving between C++/WinRT and classic COM
Aug 30, 2021
Post comments count 0
Post likes count 1

The various ways of moving between C++/WinRT and classic COM

Raymond Chen
Raymond Chen

Crossing to the other side.

How can I break down a shell item in the same way as the breadcrumb bar?
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
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.

In C#, how do I get the descriptive text for an HRESULT?
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
Raymond Chen

You can pretend it was an exception.

The Windows Runtime PassArray is a read-only array, even though it isn’t declared <CODE>const</CODE>
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 <CODE>const</CODE>

Raymond Chen
Raymond Chen

Because in most languages, there is no such thing as const.

How to sneak the Windows 95 credits screen into the build without anybody noticing
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
Raymond Chen

Write it in an obscure language.

C++/WinRT nasty gotcha: <CODE>winrt::param::hstring</CODE> constructed from <CODE>std::wstring_view</CODE> requires null termination
Aug 23, 2021
Post comments count 11
Post likes count 1

C++/WinRT nasty gotcha: <CODE>winrt::param::hstring</CODE> constructed from <CODE>std::wstring_view</CODE> requires null termination

Raymond Chen
Raymond Chen

An additional constraint not part of the rules.

How do I find out the size of the mouse cursor?
Aug 20, 2021
Post comments count 8
Post likes count 2

How do I find out the size of the mouse cursor?

Raymond Chen
Raymond Chen

Well, first you have to decide which one you want to measure.

How to pwn an unattended laptop, according to Humans
Aug 19, 2021
Post comments count 8
Post likes count 1

How to pwn an unattended laptop, according to Humans

Raymond Chen
Raymond Chen

According to television.

What is the deal with the SM_CXCURSOR system metric?
Aug 19, 2021
Post comments count 2
Post likes count 2

What is the deal with the SM_CXCURSOR system metric?

Raymond Chen
Raymond Chen

A metric from an earlier, simpler time.

What’s with all of the references to “dude” in the accessibility header files?
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
Raymond Chen

A catch phrase from long ago.

Is it expected that custom default pinned taskbar items via LayoutModification.xml keep coming back each time the user logs on?
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
Raymond Chen

Yes, so you need to plan accordingly.

What are these dire multithreading consequences that the GetFullPathName documentation is trying to warn me about?
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
Raymond Chen

The current directory is volatile, so plan accordingly.

Resolving the ambiguity when your C++ class inherits from multiple base classes that have the same method
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
Raymond Chen

Steer the compiler toward the method you want.

How can I find the heap that a memory block originally came from, so I can free it properly?
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
Raymond Chen

You'll have to keep track of it yourself.

How can I prevent my UWP app from showing up in the Start menu?
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
Raymond Chen

Deny its app list entry.

Why did the old RAID database use a signed 16-bit integer for its record count? Why not unsigned, or a 32-bit integer?
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
Raymond Chen

You have to understand decisions in context, and that includes knowing the problem it was trying to solve.

Why am I getting a weird error about <CODE>promise_<WBR>type</CODE> when I try to write a coroutine?
Aug 9, 2021
Post comments count 1
Post likes count 1

Why am I getting a weird error about <CODE>promise_<WBR>type</CODE> when I try to write a coroutine?

Raymond Chen
Raymond Chen

Digging into the coroutine infrastructure for the answer.

Using Windows Runtime interop methods from C++/WinRT: Some helper functions
Aug 6, 2021
Post comments count 0
Post likes count 1

Using Windows Runtime interop methods from C++/WinRT: Some helper functions

Raymond Chen
Raymond Chen

Getting the interface, and the capturing from it.

An example of using Windows Runtime interop methods from C++/WinRT: <CODE>Request­Token­For­Window­Async</CODE>
Aug 5, 2021
Post comments count 6
Post likes count 1

An example of using Windows Runtime interop methods from C++/WinRT: <CODE>Request­Token­For­Window­Async</CODE>

Raymond Chen
Raymond Chen

Understanding how the C++/WinRT interop pieces fit together.

What is a static Windows Runtime class, how should I express it, and when should I use it?
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
Raymond Chen

The underlying question is "Can you even make one?"

Why are all of the retail demo names male?
Aug 3, 2021
Post comments count 0
Post likes count 1

Why are all of the retail demo names male?

Raymond Chen
Raymond Chen

For localization consistency.

How can I figure out which object is being hosted in an instance of dllhost?
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
Raymond Chen

Finding the object.

Why doesn’t my asynchronous read operation complete when I close the handle?
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
Raymond Chen

Because the file isn't closed yet.

On the interaction between the <CODE>FILE_<WBR>FLAG_<WBR>NO_<WBR>BUFFERING</CODE> and <CODE>FILE_<WBR>FLAG_<WBR>WRITE_<WBR>THROUGH</CODE> flags
How can I prevent the mouse from moving in response to touch input?
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
Raymond Chen

You need to make your program pointer-aware.

Twitter misdetected the 2011 Build conference keynote as a denial-of-service attack
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
Raymond Chen

Just a lot of excited developers.

Diagnosing why your batch file prints a garbage character, one character, and nothing more
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
Raymond Chen

Following the clues you have.

The history of passing a null pointer as the key name to <CODE>Reg­Open­Key­Ex</CODE>
Jul 23, 2021
Post comments count 0
Post likes count 1

The history of passing a null pointer as the key name to <CODE>Reg­Open­Key­Ex</CODE>

Raymond Chen
Raymond Chen

It doesn't mean anything special any more, but it once did.

The case of the strange NT-style path that was discovered by SearchPath
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
Raymond Chen

Remember where it searches.

I know I can change the color of the DC pen, but what about the other attributes?
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
Raymond Chen

They're locked in, sorry.

Why does the New menu even exist for creating new empty files?
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
Raymond Chen

You have to open the file anyway to make it useful, so why not just open the program directly?

C++11 braced initialization made the impossible possible (and how to fix it so it stays impossible)
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
Raymond Chen

Braced initialization to the rescue, or denied.

What’s the difference between throwing a <CODE>winrt::hresult_error</CODE> and using <CODE>winrt::throw_hresult</CODE>?
Jul 16, 2021
Post comments count 4
Post likes count 1

What’s the difference between throwing a <CODE>winrt::hresult_error</CODE> and using <CODE>winrt::throw_hresult</CODE>?

Raymond Chen
Raymond Chen

It affects the error origination.

On proper handling of buffers in COM and RPC methods
Jul 15, 2021
Post comments count 0
Post likes count 1

On proper handling of buffers in COM and RPC methods

Raymond Chen
Raymond Chen

The RPC layer deals with most of the problems for you, assuming you're using the RPC layer.

How to perform more complicated search and replace-style renaming in a batch file
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
Raymond Chen

Try something other than wildcards.

How did copying and renaming with wildcards work in MS-DOS?
Jul 13, 2021
Post comments count 3
Post likes count 2

How did copying and renaming with wildcards work in MS-DOS?

Raymond Chen
Raymond Chen

By lining up two parallel arrays.

Why do smart pointers null out the wrapped pointer before destroying it?
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
Raymond Chen

It's not a race condition, but it's some condition.

On the perils of holding a lock across a coroutine suspension point, part 3: Solutions
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
Raymond Chen

How to avoid the trap.

On the perils of holding a lock across a coroutine suspension point, part 2: Nonrecursive mutexes
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
Raymond Chen

Another way things can go wrong.

On the perils of holding a lock across a coroutine suspension point, part 1: The set-up
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
Raymond Chen

One way things can go wrong.

How to act like you know Chinese even though you don’t, episode 2
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
Raymond Chen

Find the magic word.

What happens if I use a squash instead of a true merge when performing one of the git tricks?
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
Raymond Chen

In many cases, the merge is where the magic is.

How a basketball became a featured instrument in a Sting song
Jul 5, 2021
Post comments count 3
Post likes count 0

How a basketball became a featured instrument in a Sting song

Raymond Chen
Raymond Chen

It's all in the name.

Is it okay to call <CODE>Map­View­Of­File</CODE> on the same mapping handle simultaneously from different threads?
Jul 2, 2021
Post comments count 3
Post likes count 1

Is it okay to call <CODE>Map­View­Of­File</CODE> on the same mapping handle simultaneously from different threads?

Raymond Chen
Raymond Chen

Or do you have to enforce serialization to ensure both calls succeed?

Studying linker error messages to find the cause of the unresolved external: Character sets
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
Raymond Chen

Puzzling out why the symbols don't match exactly.

2021 mid-year link clearance
Jun 30, 2021
Post comments count 0
Post likes count 0

2021 mid-year link clearance

Raymond Chen
Raymond Chen

A collection of stuff that has accumulated.

What should the CPU usage be of a fully-loaded CPU that has been throttled?
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
Raymond Chen

A valid difference of opinion.

The initializing constructor looks like an assignment, but it isn’t
Jun 28, 2021
Post comments count 2
Post likes count 1

The initializing constructor looks like an assignment, but it isn’t

Raymond Chen
Raymond Chen

There is no assignment going on; it's just a quirk of syntax.

The ARM processor (Thumb-2), part 20: Code walkthrough
Jun 25, 2021
Post comments count 1
Post likes count 0

The ARM processor (Thumb-2), part 20: Code walkthrough

Raymond Chen
Raymond Chen

Putting together what we've learned, with a surprise.

The ARM processor (Thumb-2), part 19: Common patterns
Jun 24, 2021
Post comments count 1
Post likes count 0

The ARM processor (Thumb-2), part 19: Common patterns

Raymond Chen
Raymond Chen

Code sequences you will learn to recognize.

The ARM processor (Thumb-2), part 18: Other kinds of prologues and epilogues
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
Raymond Chen

Taking shortcuts and combining steps, or omitting them entirely.

The ARM processor (Thumb-2), part 17: Prologues and epilogues
Jun 22, 2021
Post comments count 3
Post likes count 0

The ARM processor (Thumb-2), part 17: Prologues and epilogues

Raymond Chen
Raymond Chen

Implementing the receiving end of the calling convention.

The ARM processor (Thumb-2), part 16: 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
Raymond Chen

Pretend it's on the stack, even if it isn't.

The ARM processor (Thumb-2), part 15: Miscellaneous instructions
Jun 18, 2021
Post comments count 5
Post likes count 0

The ARM processor (Thumb-2), part 15: Miscellaneous instructions

Raymond Chen
Raymond Chen

The stuff that didn't fit anywhere else.

The ARM processor (Thumb-2), part 14: Manipulating flags
Jun 17, 2021
Post comments count 1
Post likes count 0

The ARM processor (Thumb-2), part 14: Manipulating flags

Raymond Chen
Raymond Chen

Reaching in and flipping the switches.

The ARM processor (Thumb-2), part 13: Trampolines
Jun 16, 2021
Post comments count 10
Post likes count 0

The ARM processor (Thumb-2), part 13: Trampolines

Raymond Chen
Raymond Chen

The overly-uniform program counter register strikes again.

The ARM processor (Thumb-2), part 12: Control transfer
Jun 15, 2021
Post comments count 4
Post likes count 0

The ARM processor (Thumb-2), part 12: Control transfer

Raymond Chen
Raymond Chen

Let's go places.

The ARM processor (Thumb-2), part 11: Atomic access and barriers
Jun 14, 2021
Post comments count 3
Post likes count 0

The ARM processor (Thumb-2), part 11: Atomic access and barriers

Raymond Chen
Raymond Chen

Doing things one at a time.

The ARM processor (Thumb-2), part 10: Memory access and alignment
Jun 11, 2021
Post comments count 2
Post likes count 0

The ARM processor (Thumb-2), part 10: Memory access and alignment

Raymond Chen
Raymond Chen

It's just loads and stores.

The ARM processor (Thumb-2), part 9: Sign and zero extension
Jun 10, 2021
Post comments count 2
Post likes count 0

The ARM processor (Thumb-2), part 9: Sign and zero extension

Raymond Chen
Raymond Chen

Making small things bigger.

The ARM processor (Thumb-2), part 8: Bit shifting and bitfield access
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
Raymond Chen

That barrel shifter again.

The ARM processor (Thumb-2), part 7: Bitwise operations
Jun 8, 2021
Post comments count 3
Post likes count 0

The ARM processor (Thumb-2), part 7: Bitwise operations

Raymond Chen
Raymond Chen

Flip-flopping the bits.

The ARM processor (Thumb-2), part 6: The lie hiding inside the CMN instruction
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
Raymond Chen

Don't let the name fool you.

The ARM processor (Thumb-2), part 5: Arithmetic
Jun 4, 2021
Post comments count 2
Post likes count 0

The ARM processor (Thumb-2), part 5: Arithmetic

Raymond Chen
Raymond Chen

Starting with basic mathematics.

The ARM processor (Thumb-2), part 4: Single-instruction constants
Jun 3, 2021
Post comments count 0
Post likes count 0

The ARM processor (Thumb-2), part 4: Single-instruction constants

Raymond Chen
Raymond Chen

Flaunt your barrel shifter if you've got it.

The ARM processor (Thumb-2), part 3: Addressing modes
Jun 2, 2021
Post comments count 1
Post likes count 1

The ARM processor (Thumb-2), part 3: Addressing modes

Raymond Chen
Raymond Chen

It's a load-store architecture, but with rather fancy loads and stores.

The ARM processor (Thumb-2), part 2: Differences between classic ARM and Thumb-2
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
Raymond Chen

Squeezing into a 16-bit instruction size.

The ARM processor (Thumb-2), part 1: Introduction
May 31, 2021
Post comments count 6
Post likes count 1

The ARM processor (Thumb-2), part 1: Introduction

Raymond Chen
Raymond Chen

Moving into the present.

On the proper care and feeding of the default_overload Windows Runtime attribute
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
Raymond Chen

Generally avoid it, but if use it you must, at least follow these rules.

How can I convert between IANA time zones and Windows registry-based time zones?
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
Raymond Chen

ICU to the rescue.

How ownership of the Windows clipboard is tracked in Win32
May 26, 2021
Post comments count 8
Post likes count 2

How ownership of the Windows clipboard is tracked in Win32

Raymond Chen
Raymond Chen

A simple model, complicated by the reality of misuse.

Why are device-independent bitmaps upside down?
May 25, 2021
Post comments count 10
Post likes count 2

Why are device-independent bitmaps upside down?

Raymond Chen
Raymond Chen

Well, it depends on what you consider to be right-side up.

On static methods in the Windows Runtime and C++/WinRT
May 24, 2021
Post comments count 0
Post likes count 1

On static methods in the Windows Runtime and C++/WinRT

Raymond Chen
Raymond Chen

Transforming the ABI into a projection.

Obtaining attributed network usage information from the Windows Runtime
May 21, 2021
Post comments count 5
Post likes count 1

Obtaining attributed network usage information from the Windows Runtime

Raymond Chen
Raymond Chen

Breaking it down by application.

Obtaining network usage information from the Windows Runtime
May 20, 2021
Post comments count 4
Post likes count 1

Obtaining network usage information from the Windows Runtime

Raymond Chen
Raymond Chen

Getting your foot in the door with the NetworkInformation class.

Awaiting Windows Runtime asynchronous operations from C# desktop apps
May 19, 2021
Post comments count 0
Post likes count 1

Awaiting Windows Runtime asynchronous operations from C# desktop apps

Raymond Chen
Raymond Chen

Need to find the awaiter.

The blessing of the leading zero
May 18, 2021
Post comments count 2
Post likes count 1

The blessing of the leading zero

Raymond Chen
Raymond Chen

Sometimes it's not a curse.

Why did Windows 95 keep window coordinates at multiples of 8?
May 17, 2021
Post comments count 9
Post likes count 1

Why did Windows 95 keep window coordinates at multiples of 8?

Raymond Chen
Raymond Chen

Because sub-byte memory access is really annoying.

Why isn’t my shell namespace extension getting every single DragOver mouse message?
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
Raymond Chen

Trying to avoid too much chattiness for things that aren't important.

Drag/drop effects: The little drop information box
May 13, 2021
Post comments count 7
Post likes count 1

Drag/drop effects: The little drop information box

Raymond Chen
Raymond Chen

Updating the description.

Using Explorer’s fancy drag/drop effects in your own programs
May 12, 2021
Post comments count 4
Post likes count 1

Using Explorer’s fancy drag/drop effects in your own programs

Raymond Chen
Raymond Chen

Accessing those pre-made shell drop effects.

Why does the mouse cursor jump a few pixels if you right-click on the Start button?
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
Raymond Chen

To give you a head start.

What are the page sizes used by Windows on various processors?
May 10, 2021
Post comments count 7
Post likes count 1

What are the page sizes used by Windows on various processors?

Raymond Chen
Raymond Chen

Usually there was no choice, but sometimes there was.

A subtle way your await_suspend can access the coroutine frame when it shouldn’t
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
Raymond Chen

Hiding in the coroutine machinery.

Is std::exception_ptr nothrow constructible and assignable?
May 6, 2021
Post comments count 4
Post likes count 1

Is std::exception_ptr nothrow constructible and assignable?

Raymond Chen
Raymond Chen

Yes, buried in the fine print.

Why is coroutine_handle::resume() potentially-throwing?
May 5, 2021
Post comments count 3
Post likes count 1

Why is coroutine_handle::resume() potentially-throwing?

Raymond Chen
Raymond Chen

It enables a very specific usage scenario.

A map through the three major coroutine series
May 4, 2021
Post comments count 4
Post likes count 1

A map through the three major coroutine series

Raymond Chen
Raymond Chen

For your casual reading convenience.

C++ coroutines: Promise constructors
May 4, 2021
Post comments count 1
Post likes count 1

C++ coroutines: Promise constructors

Raymond Chen
Raymond Chen

Snooping on the coroutine parameters, with a gotcha.

C++ coroutines: Converting among tasks that use the same promise
May 3, 2021
Post comments count 0
Post likes count 1

C++ coroutines: Converting among tasks that use the same promise

Raymond Chen
Raymond Chen

Keeping the promise in the dark.

C++ coroutines: Waiting synchronously for our coroutine to complete
Apr 30, 2021
Post comments count 2
Post likes count 1

C++ coroutines: Waiting synchronously for our coroutine to complete

Raymond Chen
Raymond Chen

Using the extension point for another purpose.

C++ coroutines: Adding COM context support to our awaiter
Apr 29, 2021
Post comments count 0
Post likes count 1

C++ coroutines: Adding COM context support to our awaiter

Raymond Chen
Raymond Chen

Getting into the correct context on resume.

C++ coroutines: Snooping in on the coroutine body
Apr 28, 2021
Post comments count 0
Post likes count 1

C++ coroutines: Snooping in on the coroutine body

Raymond Chen
Raymond Chen

Transformers are robots in disguise.

C++ coroutines: How do I create a coroutine that terminates on an unhandled exception?
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
Raymond Chen

You need to get inside the coroutine.

C++ coroutines: What does it mean when I declare my coroutine as noexcept?
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
Raymond Chen

The noexcept keyword doesn't mean what you think.

C++ coroutines: Associating multiple task types with the same promise type
Apr 23, 2021
Post comments count 0
Post likes count 1

C++ coroutines: Associating multiple task types with the same promise type

Raymond Chen
Raymond Chen

Using the special initialization rule for <CODE>get_<WBR>return_<WBR>object</CODE>.

C++ coroutines: Improving cold-start coroutines which complete synchronously
Apr 22, 2021
Post comments count 3
Post likes count 1

C++ coroutines: Improving cold-start coroutines which complete synchronously

Raymond Chen
Raymond Chen

Avoiding stack build-up.

C++ coroutines: Cold-start coroutines
Apr 21, 2021
Post comments count 3
Post likes count 1

C++ coroutines: Cold-start coroutines

Raymond Chen
Raymond Chen

On your mark, get set, wait for it!

C++ coroutines: Getting rid of our atomic variant discriminator
Apr 20, 2021
Post comments count 1
Post likes count 1

C++ coroutines: Getting rid of our atomic variant discriminator

Raymond Chen
Raymond Chen

Don't look unless you know it's safe.

C++ coroutines: Allowing the awaiter to be destroyed while suspended
Apr 19, 2021
Post comments count 0
Post likes count 1

C++ coroutines: Allowing the awaiter to be destroyed while suspended

Raymond Chen
Raymond Chen

We were already there.

C++ coroutines: Getting rid of our reference count
Apr 16, 2021
Post comments count 0
Post likes count 1

C++ coroutines: Getting rid of our reference count

Raymond Chen
Raymond Chen

It never goes up. It only comes down.

C++ coroutines: Getting rid of our mutex
Apr 15, 2021
Post comments count 0
Post likes count 1

C++ coroutines: Getting rid of our mutex

Raymond Chen
Raymond Chen

We can capture the progress in a single value.

Pivot points and financial numerology
Apr 14, 2021
Post comments count 7
Post likes count 1

Pivot points and financial numerology

Raymond Chen
Raymond Chen

It will or it won't. That's the beauty of it.

C++ coroutines: Making it impossible to co_await a task twice
Apr 14, 2021
Post comments count 0
Post likes count 2

C++ coroutines: Making it impossible to co_await a task twice

Raymond Chen
Raymond Chen

Always keep moving: Make the <CODE>co_await</CODE> consume the task.

C++ coroutines: Tradeoffs of making the promise be the shared state
Apr 13, 2021
Post comments count 0
Post likes count 1

C++ coroutines: Tradeoffs of making the promise be the shared state

Raymond Chen
Raymond Chen

Are you meant to be ephemeral, or are you intended to be durable?

C++ coroutines: The lifetime of objects involved in the coroutine function
Apr 12, 2021
Post comments count 0
Post likes count 1

C++ coroutines: The lifetime of objects involved in the coroutine function

Raymond Chen
Raymond Chen

Follow them as they pop into existence and vanish.

C++ coroutines: Managing the reference count of the coroutine state
Apr 9, 2021
Post comments count 1
Post likes count 1

C++ coroutines: Managing the reference count of the coroutine state

Raymond Chen
Raymond Chen

Are we done yet?

C++ coroutines: Awaiting the simple_task
Apr 8, 2021
Post comments count 0
Post likes count 1

C++ coroutines: Awaiting the simple_task

Raymond Chen
Raymond Chen

Let me know when it's ready.

C++ coroutines: Accepting types via return_void and return_value
Apr 7, 2021
Post comments count 0
Post likes count 1

C++ coroutines: Accepting types via return_void and return_value

Raymond Chen
Raymond Chen

A little bit of SFINAE tweaking.

C++ coroutines: Building a result holder for movable types
Apr 6, 2021
Post comments count 0
Post likes count 1

C++ coroutines: Building a result holder for movable types

Raymond Chen
Raymond Chen

Not that kind of movable type.

C++ coroutines: Making the promise itself be the shared state, the outline
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
Raymond Chen

Now we do it.

C++ coroutines: Making the promise itself be the shared state, the inspiration
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
Raymond Chen

Just be it.

C++ coroutines: What happens if an exception occurs in my return_value?
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
Raymond Chen

What happens if you can't save the result?

C++ coroutines: The initial and final suspend, and improving our return_value method
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
Raymond Chen

Why would you stop before you start?

C++ coroutines: Basic implementation of a promise type
Mar 30, 2021
Post comments count 3
Post likes count 1

C++ coroutines: Basic implementation of a promise type

Raymond Chen
Raymond Chen

Filling in the diagram with code.

C++ coroutines: The mental model for coroutine promises
Mar 29, 2021
Post comments count 0
Post likes count 1

C++ coroutines: The mental model for coroutine promises

Raymond Chen
Raymond Chen

We start by drawing pictures.

Creating a task completion source for a C++ coroutine: Failing to produce a result
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
Raymond Chen

Stowing an exception.

Creating a task completion source for a C++ coroutine: Producing nothing
Mar 25, 2021
Post comments count 4
Post likes count 1

Creating a task completion source for a C++ coroutine: Producing nothing

Raymond Chen
Raymond Chen

Nothing is produced, but you still want to know that the production completed.

SEO spammers don’t really understand who they spammed
Mar 24, 2021
Post comments count 7
Post likes count 1

SEO spammers don’t really understand who they spammed

Raymond Chen
Raymond Chen

Maybe we can help you.

Creating a task completion source for a C++ coroutine: Producing a result with references
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
Raymond Chen

Carefully preserved to prevent decay.

The 2021/2022 Seattle Symphony subscription season at a glance
Mar 23, 2021
Post comments count 0
Post likes count 0

The 2021/2022 Seattle Symphony subscription season at a glance

Raymond Chen
Raymond Chen

The pocket reference guide for 2021/2022.

Creating a task completion source for a C++ coroutine: Producing a result
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
Raymond Chen

Let's call it a result holder.

Creating other types of synchronization objects that can be used with co_await, part 10: Wait for an event to clear
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
Raymond Chen

Something new.

Creating other types of synchronization objects that can be used with co_await, part 9: The shared mutex (continued)
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
Raymond Chen

Fixing some problems.

Creating other types of synchronization objects that can be used with co_await, part 8: The shared mutex
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
Raymond Chen

Two different kinds of waiting and releasing.

Creating other types of synchronization objects that can be used with co_await, part 7: The mutex and recursive
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
Raymond Chen

The mutex and recursive mutex as strange beasts in the world of coroutines.

Creating other types of synchronization objects that can be used with co_await, part 6: The semaphore
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
Raymond Chen

The asynchronous semaphore.

Creating other types of synchronization objects that can be used with co_await, part 5: The auto-reset event
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
Raymond Chen

The asynchronous auto-reset event.

Creating other types of synchronization objects that can be used with co_await, part 4: The manual-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
Raymond Chen

The asynchronous manual reset event.

Creating other types of synchronization objects that can be used with co_await, part 3: Parallel resumption
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
Raymond Chen

Resuming waiting coroutines in parallel on the thread pool.

Creating other types of synchronization objects that can be used with co_await, part 2: The basic library
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
Raymond Chen

Distilling the pattern to its essence, and the building back up.

Creating other types of synchronization objects that can be used with co_await, part 1: The one-shot event
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
Raymond Chen

First a little demonstration.

Creating a co_await awaitable signal that can be awaited multiple times, part 6
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
Raymond Chen

Looking back on what we've done.

Creating a co_await awaitable signal that can be awaited multiple times, part 5
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
Raymond Chen

Discussion of what we've done so far.

Creating a co_await awaitable signal that can be awaited multiple times, part 4
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
Raymond Chen

Why allocate memory when you can have it given to you?

Creating a co_await awaitable signal that can be awaited multiple times, part 3
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
Raymond Chen

Doing it all ourselves, without any need to go into kernel mode.

Creating a co_await awaitable signal that can be awaited multiple times, part 2
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
Raymond Chen

Because sharing is caring.

Creating a co_await awaitable signal that can be awaited multiple times, part 1
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
Raymond Chen

Sort of like an event.

What does error E_ILLEGAL_DELEGATE_ASSIGNMENT mean?
Feb 26, 2021
Post comments count 4
Post likes count 1

What does error E_ILLEGAL_DELEGATE_ASSIGNMENT mean?

Raymond Chen
Raymond Chen

A delegate was assigned when not allowed, but when is it allowed?

What does it mean when a call fails with 0x8000001F = RO_E_BLOCKED_CROSS_ASTA_CALL?
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
Raymond Chen

Waiting wouldn't have helped.

What is so special about the Application STA?
Feb 24, 2021
Post comments count 4
Post likes count 1

What is so special about the Application STA?

Raymond Chen
Raymond Chen

Basically, it blocks re-entrancy.

Why does Task Manager tell me that I have a Startup program named Program?
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
Raymond Chen

It's a program that didn't register itself properly.

French is a very fragile language, or at least it seems so from the stories I hear
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
Raymond Chen

The slightest variation renders it incomprehensible.

How do I reset my PIN complexity requirements after removing a work account from Windows 10?
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
Raymond Chen

You need to remove the PIN and add it back.

How can I prevent a Windows Runtime WebView from loading any content beyond the initial request and its redirects?
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
Raymond Chen

Follow the bouncing redirect.

How can I prevent a Windows Runtime WebView from loading any content beyond the initial request?
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
Raymond Chen

You can intercept every resource request.

How can I return custom content for specific URLs requested by a Windows Runtime WebView?
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
Raymond Chen

Intercepting the attempts to contact the outside world.

Hardware engineers solve a usability problem with the PS/2 connector, but inadvertently create a new one
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
Raymond Chen

What's the difference between a mouse and a keyboard?

The COM static store, part 6: Using C++ weak references
Feb 15, 2021
Post comments count 0
Post likes count 1

The COM static store, part 6: Using C++ weak references

Raymond Chen
Raymond Chen

A quicker way to get to what you have.

The COM static store, part 5: Using COM weak references
Feb 12, 2021
Post comments count 0
Post likes count 1

The COM static store, part 5: Using COM weak references

Raymond Chen
Raymond Chen

Avoiding having to go through the static store at all.

The COM static store, part 4: Aggregating into a single object
Feb 11, 2021
Post comments count 0
Post likes count 1

The COM static store, part 4: Aggregating into a single object

Raymond Chen
Raymond Chen

Batch all the things you need into a single object.

The COM static store, part 3: Avoiding creation of an expensive temporary when setting a singleton
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
Raymond Chen

Don't create one unless you really need one.

The COM static store, part 2: Race conditions in setting a singleton
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
Raymond Chen

There can be only one, so don't end up with two.

The COM static store, part 1: Introduction
Feb 8, 2021
Post comments count 4
Post likes count 1

The COM static store, part 1: Introduction

Raymond Chen
Raymond Chen

Communal storage for COM things.

How do I get a foothold in the neutral apartment?
Feb 5, 2021
Post comments count 1
Post likes count 1

How do I get a foothold in the neutral apartment?

Raymond Chen
Raymond Chen

You can explicit ask for its context.

Usage patterns for winrt::unbox_value_or
Feb 4, 2021
Post comments count 3
Post likes count 1

Usage patterns for winrt::unbox_value_or

Raymond Chen
Raymond Chen

Two templates, many patterns.

Why is there no useful information in the RetailInfo class?
Feb 3, 2021
Post comments count 0
Post likes count 1

Why is there no useful information in the RetailInfo class?

Raymond Chen
Raymond Chen

It's just marketing nonsense.

A metric that is consistently at 100% is probably broken
Feb 2, 2021
Post comments count 2
Post likes count 1

A metric that is consistently at 100% is probably broken

Raymond Chen
Raymond Chen

They say that you get what you measure.

Why am I being told my fire_and_forget coroutine is not returning a value?
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
Raymond Chen

Fire-and-forget coroutines don't return a value, do they?

Autoscrolling on drag, part 5: Adding wiggle-to-scroll to escape velocity
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
Raymond Chen

Reintroducing a bug that's now a feature.

Autoscrolling on drag, part 4: Dynamic autoscroll based on escape velocity
Jan 28, 2021
Post comments count 1
Post likes count 0

Autoscrolling on drag, part 4: Dynamic autoscroll based on escape velocity

Raymond Chen
Raymond Chen

Get a good running start.

Autoscrolling on drag, part 3: Dynamic autoscroll based on mouse position
Jan 27, 2021
Post comments count 5
Post likes count 0

Autoscrolling on drag, part 3: Dynamic autoscroll based on mouse position

Raymond Chen
Raymond Chen

Pull the rubber band more taut.

Autoscrolling on drag, part 2: Why does scrolling go faster if I wiggle the mouse?
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
Raymond Chen

You're tickling the adjustment code outside its normal cycle.

Autoscrolling on drag, part 1: Basic implementation
Jan 25, 2021
Post comments count 0
Post likes count 0

Autoscrolling on drag, part 1: Basic implementation

Raymond Chen
Raymond Chen

Setting the groundwork.

How do I protect myself against a COM call that can hang? I’m already running the server out-of-process.
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
Raymond Chen

You can cancel the call, and if the server ignores you, it's left working on a canceled operation.

What happens to the value returned from the function passed to Queue­User­Work­Item?
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
Raymond Chen

Nothing. Nothing at all.

How do I disassociate a thread from an I/O completion port?
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
Raymond Chen

Escaping the trap.

Why did I lose 3D display mode when I upgraded to the next version of Windows 10?
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
Raymond Chen

It's not the Windows version that lost it. It's your display driver that lost it.

How can I prevent another program from showing a thumbnail preview in the taskbar?
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
Raymond Chen

You can't, really. It's not your window.

The perils of the accidental C++ conversion constructor
Jan 15, 2021
Post comments count 6
Post likes count 1

The perils of the accidental C++ conversion constructor

Raymond Chen
Raymond Chen

Single-parameter constructors are also conversions.

How can I write a C++ class that iterates over its base classes?
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
Raymond Chen

Variadic templates to the rescue.

The misleading MIDL error message: MIDL5023: The arguments to the parameterized interface are not valid
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
Raymond Chen

They aren't valid, but then again, nothing would have been.

Why am I receiving SHCNE_UPDATEDIR notifications that my code never generates?
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
Raymond Chen

You did generate them, indirectly.

How did I find the old Windows binaries and compilers for the processor retrospective series?
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
Raymond Chen

Going through old virtual boxes of stuff.

The case of the crash during the release of an object from an unloaded DLL during apartment rundown
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
Raymond Chen

The great escape from the confines of the custom COM context.

What happens if I give contradictory values for the stack commit and stack reserve?
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
Raymond Chen

The system will try to massage the values into something less unreasonable.

How can I tell whether my process is running as SYSTEM?
Jan 6, 2021
Post comments count 6
Post likes count 1

How can I tell whether my process is running as SYSTEM?

Raymond Chen
Raymond Chen

Check your token.

Additional helpful pseudo-handles: The process token, the thread token, and the effective 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
Raymond Chen

For quick queries.

How can I write a program that monitors another window for a change in size or position?
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
Raymond Chen

Accessibility hooks come to the rescue once again.

I’d like an IUnknown, I know you have many, I’ll take any of them
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
Raymond Chen

Taking the first one is as good as any other.

How can I create a non-circular tab order, or some other type of custom ordering in my Win32 dialog?
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
Raymond Chen

Taking things into your own hands.

Why are the C and C++ compilers giving me error messages about int when my code doesn’t mention int?
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
Raymond Chen

It's a manufactured <CODE>int</CODE>.

What are these duplicate services whose names differ just by random characters at the end?
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
Raymond Chen

You get a service, and you get a service, everybody gets a service!

Why is the HSHELL_WINDOWDESTROYED notification raised when a window is hidden, even if it hasn’t been destroyed?
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
Raymond Chen

Taskbar-colored glasses.

How can I emulate the REG_NOTIFY_THREAD_AGNOSTIC flag on systems that don’t support it? part 5
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
Raymond Chen

Using the new thread pool functions.

How can I emulate the REG_NOTIFY_THREAD_AGNOSTIC flag on systems that don’t support it? part 4
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
Raymond Chen

Onward to coroutines.

How can I emulate the REG_NOTIFY_THREAD_AGNOSTIC flag on systems that don’t support it? part 3
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
Raymond Chen

Getting more asynchronous.

How can I emulate the REG_NOTIFY_THREAD_AGNOSTIC flag on systems that don’t support it? part 2
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
Raymond Chen

Asking the thread pool for help.

How can I emulate the REG_NOTIFY_THREAD_AGNOSTIC flag on systems that don’t support it? part 1
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
Raymond Chen

An exercise from long ago.

What should the state of a moved-from object be?
Dec 18, 2020
Post comments count 6
Post likes count 2

What should the state of a moved-from object be?

Raymond Chen
Raymond Chen

It's formally unspecified, but there may be informal expectations.

On the ways of finding a dispatcher for the current thread in the Windows Runtime
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
Raymond Chen

You have to look around, but be careful not to trip over anything.

Why does PF_VIRT_FIRMWARE_ENABLED return false even when virtualization is enabled in the firmware?
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
Raymond Chen

It may be enabled, but it's not enabled for <I>you</I>.

Lost Windows feature: The Horizon
Dec 15, 2020
Post comments count 8
Post likes count 1

Lost Windows feature: The Horizon

Raymond Chen
Raymond Chen

Unlike the real horizon, this one is up close.

How do I avoid race conditions in WaitOnAddress where the wake happens before I enter the blocking state?
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
Raymond Chen

You're waiting on it wrong.

Parsing ETL traces yourself, part 3: The TraceProcessor
Dec 11, 2020
Post comments count 1
Post likes count 0

Parsing ETL traces yourself, part 3: The TraceProcessor

Raymond Chen
Raymond Chen

Getting it from the same source as the Windows Performance Analyzer.

Parsing ETL traces yourself, part 2: The EventLogReader
Dec 10, 2020
Post comments count 0
Post likes count 0

Parsing ETL traces yourself, part 2: The EventLogReader

Raymond Chen
Raymond Chen

For true programmatic processing of classic ETL events.

Parsing ETL traces yourself, part 1: wpaexporter
Dec 9, 2020
Post comments count 0
Post likes count 1

Parsing ETL traces yourself, part 1: wpaexporter

Raymond Chen
Raymond Chen

A simple converter that spits out comma-separated values.

How did Windows open a portal to another dimension when reporting a program error?
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
Raymond Chen

A momentary tear in the space-time continuum.

Why does CreateWindowEx take the extended style parameter as its first parameter instead of its last?
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
Raymond Chen

It sure looks like a strange place to add a new parameter.

The humor hiding behind “JavaScript error: Semicolon expected”
Dec 4, 2020
Post comments count 3
Post likes count 1

The humor hiding behind “JavaScript error: Semicolon expected”

Raymond Chen
Raymond Chen

Apparently not automatic enough.

Additional notes on the various patterns for passing C-style arrays across the Windows Runtime boundary
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
Raymond Chen

Filling in some of the implicit details.

How can I check whether the user has disconnected from the session?
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
Raymond Chen

You'll have to ask Terminal Services.

Did Windows ever find solutions for programs that crashed?
Dec 1, 2020
Post comments count 11
Post likes count 1

Did Windows ever find solutions for programs that crashed?

Raymond Chen
Raymond Chen

It did on occasion.

What are the requirements for the built-in Windows 10 camera-based barcode scanner?
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
Raymond Chen

Basically, it needs to be able to get a good picture.

Disk and File I/O performance with ETW traces: Miscellany
Nov 27, 2020
Post comments count 7
Post likes count 1

Disk and File I/O performance with ETW traces: Miscellany

Raymond Chen
Raymond Chen

A few other columns.

Disk and File I/O performance with ETW traces: Why is System doing so much stuff?
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
Raymond Chen

The System does many things, or at least many things are blamed on it.

Preliminary notes on analyzing Disk and File I/O performance with ETW traces
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
Raymond Chen

Deciphering the numbers.

Why does the disk optimizer put boot files at low-numbered sectors?
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
Raymond Chen

Taking advantage of disk geometry.

Virtual desktops are an end-user window management feature, not a programmatic one
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
Raymond Chen

It's for users to organize their windows, not for programs to organize them.

How thread-safe is the Windows Runtime PropertySet object?
Nov 20, 2020
Post comments count 1
Post likes count 1

How thread-safe is the Windows Runtime PropertySet object?

Raymond Chen
Raymond Chen

It's thread-safe as far as it goes, but you may want to go further.

Other uses for the -library flag of the C++/WinRT compiler
Nov 19, 2020
Post comments count 0
Post likes count 1

Other uses for the -library flag of the C++/WinRT compiler

Raymond Chen
Raymond Chen

Injecting a little something extra.

On combining static libraries that implement C++/WinRT activatable objects
Nov 18, 2020
Post comments count 0
Post likes count 1

On combining static libraries that implement C++/WinRT activatable objects

Raymond Chen
Raymond Chen

Separating the shared names, so you can combine them yourself.

One senior executive’s warning about escalating conflicts to upper management
Nov 17, 2020
Post comments count 16
Post likes count 1

One senior executive’s warning about escalating conflicts to upper management

Raymond Chen
Raymond Chen

You're not gonna like what you get.

Why does my command line redirection echo with an extra 1? Who’s inserting these rogue 1s everywhere?
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
Raymond Chen

It just came out of nowhere, or did it?

The history of the EncodePointer function for obfuscating pointers
Nov 13, 2020
Post comments count 2
Post likes count 1

The history of the EncodePointer function for obfuscating pointers

Raymond Chen
Raymond Chen

Still useful, but less painful.

Destructing outside the lock when removing items from C++ standard containers
Nov 12, 2020
Post comments count 10
Post likes count 1

Destructing outside the lock when removing items from C++ standard containers

Raymond Chen
Raymond Chen

Managing the order of destruction.

My strategy for playing Settlers of Catan
Nov 11, 2020
Post comments count 7
Post likes count 0

My strategy for playing Settlers of Catan

Raymond Chen
Raymond Chen

It doesn't work, but I use it anyway.

The hidden callout: The destructor
Nov 11, 2020
Post comments count 6
Post likes count 1

The hidden callout: The destructor

Raymond Chen
Raymond Chen

You may not know where that's going to lead.

The prank cursor that resulted in an employee being fired before they even started
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
Raymond Chen

Don't try this at home.

Why aren’t my custom backgrounds, animations, and colors working, such as ApplicationViewTitleBar colors?
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
Raymond Chen

You're subject to user and system policy.

How do I save a C++/WinRT array_view as a com_array?
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
Raymond Chen

There's a not-entirely-obvious constructor for that.

What’s the point of APTTYPE_CURRENT? I mean, of course I’m current.
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
Raymond Chen

No matter where you go, there you are.

What is the format of the data in the AudioBuffer memory buffer, and how do I convert it to something else?
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
Raymond Chen

It's a bunch of floating point samples, in a particular order.

The Settings app lets me pick a custom color for my mouse pointer, how do I get in on that action?
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
Raymond Chen

You'll have to build a better mouse pointer.

How can I ask the networking stack whether the system has obtained network connectivity?
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
Raymond Chen

Depends what kind of connectivity you're looking for.

Why am I getting an access violation trying to access a method on my C++/WinRT object?
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
Raymond Chen

The method vanishes.

Do any Windows Runtime projections cache nondefault Windows Runtime interfaces?
Oct 29, 2020
Post comments count 2
Post likes count 1

Do any Windows Runtime projections cache nondefault Windows Runtime interfaces?

Raymond Chen
Raymond Chen

Possibly, but I know two that definitely don't.

Windows Runtime objects are represented by their default interface, so choose your default interface wisely
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
Raymond Chen

The choice is usually obvious, but on occasion, the non-obvious choice may be better.

The BurgerMaster segment may have been legendary, but some legends aren’t true
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
Raymond Chen

Just give them a call.

I told the Microsoft Visual C++ compiler not to generate AVX instructions, but it did it anyway!
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
Raymond Chen

Well, you explicitly generate them.

How can I tell whether a file is on an SSD?
Oct 23, 2020
Post comments count 7
Post likes count 1

How can I tell whether a file is on an SSD?

Raymond Chen
Raymond Chen

Putting the pieces together.

Taking a shortcut: You can query properties from a volume, and it will forward to the physical drive
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
Raymond Chen

Saving a little extra trip.

How do I get from a volume to the physical disk that holds it?
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
Raymond Chen

Another step down the hierarchy.

How do I get from a file path to the volume that holds it?
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
Raymond Chen

Walking down the topology, with a little backslash weirdness thrown in.

Mount points, volumes, and physical drives, oh my!
Oct 19, 2020
Post comments count 8
Post likes count 1

Mount points, volumes, and physical drives, oh my!

Raymond Chen
Raymond Chen

Navigating the storage topology.

Structured binding in C++/WinRT: The key-value pair
Oct 16, 2020
Post comments count 3
Post likes count 1

Structured binding in C++/WinRT: The key-value pair

Raymond Chen
Raymond Chen

Taking them apart in a simpler way.

How to add C++ structured binding support to your own types
Oct 15, 2020
Post comments count 3
Post likes count 2

How to add C++ structured binding support to your own types

Raymond Chen
Raymond Chen

Joining the cool kids.

A brief introduction to C++ structured binding
Oct 14, 2020
Post comments count 7
Post likes count 1

A brief introduction to C++ structured binding

Raymond Chen
Raymond Chen

Just learning the basics.

Just for fun: Retail demo user names in Windows 10
Oct 13, 2020
Post comments count 11
Post likes count 2

Just for fun: Retail demo user names in Windows 10

Raymond Chen
Raymond Chen

A bunch of plausible but fictitious names.

In 1979, some software company in Bellevue was hiring
Oct 12, 2020
Post comments count 11
Post likes count 1

In 1979, some software company in Bellevue was hiring

Raymond Chen
Raymond Chen

Digging through the archives.

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
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
Raymond Chen

To be a leader, others must follow.

An iterable of iterables: C# collections support covariance, but C++ collections do not
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
Raymond Chen

You have to say exactly what you want, which may not be exactly what you have.

Error C3867: non-standard syntax; use ‘&’ to create a pointer to member: What it means and how to fix it
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
Raymond Chen

The compiler is trying to guess what you are trying to do. It sometimes guesses wrong.

How to plug in your USB Type A connector correctly the first time
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
Raymond Chen

Mating rituals.

How can I bulk-revert a subdirectory of a repo to an earlier commit?
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
Raymond Chen

Read it into the index.

Little gotcha with C++/WinRT iterators: The case of the mutated temporary
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
Raymond Chen

You are operating on copies, not the originals.

Bonus operations for C++/WinRT iterators: The IIterable<T>, and C++/WinRT collections
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
Raymond Chen

Stepping through a collection.

Bonus operations for C++/WinRT iterators: The IIterator<T>
Sep 30, 2020
Post comments count 0
Post likes count 1

Bonus operations for C++/WinRT iterators: The IIterator<T>

Raymond Chen
Raymond Chen

The equivalent of an input iterator.

How did we end up parsing Savvyday 29 Oatmeal 94 as Saturday 29 October 1994?
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
Raymond Chen

Unsophisticated pattern matching.

git commit-tree parlor tricks, Part 9: How can I bulk-revert an entire repo to an earlier commit?
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
Raymond Chen

Take me back to a simpler time.

Structured binding may be the new hotness, but we’ll always have std::tie
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
Raymond Chen

Sometimes the old things are what you need.

Inside C++/WinRT: How does C++/WinRT represent ABI types?
Sep 24, 2020
Post comments count 2
Post likes count 1

Inside C++/WinRT: How does C++/WinRT represent ABI types?

Raymond Chen
Raymond Chen

Hiding in the internal <CODE>impl::abi</CODE> template.

How to get your C++/WinRT asynchronous operations to respond more quickly to cancellation, part 3
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
Raymond Chen

Automatic cancellation propagation is here.

Why does the Disk Cleanup tool’s Windows Update Cleanup take so long and consume so much CPU?
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
Raymond Chen

It's doing some real work.

Git commit-tree parlor tricks, Part 8: I just rebased my branch, but now I realize that I should have merged
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
Raymond Chen

You can rewrite the tree while preserving files.

I get a weird error about no matching function when I try to use winrt::capture
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
Raymond Chen

The confusing error message strikes again.

The C++/WinRT “capture” function helps you interoperate with the COM ABI world
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
Raymond Chen

Simplifying a common COM pattern.

Why did I lose the ability to co_await a std::future and concurrency::task?
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
Raymond Chen

Early moves in a direction that didn't pan out.

Embarrassing product names averted: Windows Embedded POS and Windows 10 for Advanced PCs
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
Raymond Chen

If you see something, say something.

What’s up with error C4838: a WinRT type cannot be a member of a union, and how can I work around it?
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
Raymond Chen

A restriction left over from C++03.

The macros for declaring COM interfaces, revisited: C++ implementation
Sep 11, 2020
Post comments count 6
Post likes count 1

The macros for declaring COM interfaces, revisited: C++ implementation

Raymond Chen
Raymond Chen

Now to make things concrete.

The macros for declaring COM interfaces, revisited: C++ version
Sep 10, 2020
Post comments count 4
Post likes count 2

The macros for declaring COM interfaces, revisited: C++ version

Raymond Chen
Raymond Chen

Apparently there's this new language people are using nowadays.

The macros for declaring COM interfaces, revisited: C version
Sep 9, 2020
Post comments count 3
Post likes count 2

The macros for declaring COM interfaces, revisited: C version

Raymond Chen
Raymond Chen

Following the expansion.

How is it possible to jam a virtual card reader?
Sep 8, 2020
Post comments count 20
Post likes count 1

How is it possible to jam a virtual card reader?

Raymond Chen
Raymond Chen

Did you feed it a bent virtual card?

This is definitely rare: It happens only ten times a month
Sep 7, 2020
Post comments count 6
Post likes count 1

This is definitely rare: It happens only ten times a month

Raymond Chen
Raymond Chen

Playing the bigger fool.

C++/WinRT injects additional constructors into each runtime class
Sep 7, 2020
Post comments count 1
Post likes count 1

C++/WinRT injects additional constructors into each runtime class

Raymond Chen
Raymond Chen

For dealing with the objects as the smart pointers they actually are.

Rough edges in the when_all coroutine, part 2: Overloaded comma operator
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
Raymond Chen

Shame on you.

Rough edges in the when_all coroutine, part 1: Empty parameter list
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
Raymond Chen

I've got plenty of nothing.

Synthesizing a when_all coroutine from pieces you already have
Sep 2, 2020
Post comments count 1
Post likes count 1

Synthesizing a when_all coroutine from pieces you already have

Raymond Chen
Raymond Chen

You just need to await on all of them.

More on trivial functions like CopyRect and EqualRect
Sep 1, 2020
Post comments count 7
Post likes count 1

More on trivial functions like CopyRect and EqualRect

Raymond Chen
Raymond Chen

Let's go code golfing.

Is there a code page that matches ASCII and can round trip arbitrary bytes through Unicode?
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
Raymond Chen

For round-tripping binary data.

How do I convert from the C++/WinRT projection type to the C++/WinRT implementation type?
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
Raymond Chen

You have to trust what's inside the box.

How do I convert from the C++/WinRT implementation type to the C++/WinRT projection type?
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
Raymond Chen

Fortunately, there's a conversion for that.

Why are some system functions exported as stubs instead as forwarders?
Aug 26, 2020
Post comments count 13
Post likes count 1

Why are some system functions exported as stubs instead as forwarders?

Raymond Chen
Raymond Chen

Compatibility, of course, at least for some of them.

That time Bill Gates went through a McDonalds drive-through with no cash
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
Raymond Chen

No special treatment, not even for the richest man in the world.

How can I get the number of processors in the system, when there are more than 64?
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
Raymond Chen

You can ask for the active processor count.

Recognizing different types of exception objects that Windows platform libraries can throw
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
Raymond Chen

Just a few of the more common ones.

Inside the Microsoft STL: The std::exception_ptr
Aug 20, 2020
Post comments count 1
Post likes count 1

Inside the Microsoft STL: The std::exception_ptr

Raymond Chen
Raymond Chen

Digging inside, for debugging purposes.

On using FILE_FLAG_WRITE_THROUGH and FILE_FLAG_NO_BUFFERING for memory-mapped files
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
Raymond Chen

You're trying to control I/O you didn't issue.

What are the possible Status values for Win32_ComputerSystem?
Aug 18, 2020
Post comments count 4
Post likes count 1

What are the possible Status values for Win32_ComputerSystem?

Raymond Chen
Raymond Chen

There's really only one possible status.

How WRL squeezes a weak reference and a reference count into a single integer
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
Raymond Chen

It's basically a union of a pointer and an integer.

The case of Explorer calling into an unloaded DLL while trying to run down a reference to it
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
Raymond Chen

Let's do some debugging.

Working around the requirement that Concurrency Runtime task results must be default-constructible and copyable
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
Raymond Chen

Applying tricks to avoid the pitfalls.

Hidden constraints on the result type in Concurrency Runtime tasks
Aug 12, 2020
Post comments count 3
Post likes count 1

Hidden constraints on the result type in Concurrency Runtime tasks

Raymond Chen
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...

Microspeak: Placemat
Aug 11, 2020
Post comments count 3
Post likes count 0

Microspeak: Placemat

Raymond Chen
Raymond Chen

Everything in its place.

How can I tell whether the user has disabled toast notifications for my app?
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
Raymond Chen

The ToastNotifier settings will tell you.

How do I make my accelerators apply only when used in the main window and not when the user is using a modeless dialog?
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
Raymond Chen

Sometimes you feel like an accelerator table, sometimes you don't.

What was so horrible about the FORMAT_MESSAGE_ALLOCATE_BUFFER flag that the Windows Store disallowed it for so long?
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
Raymond Chen

Letting in the riffraff.

What does it mean when it says that FORMAT_MESSAGE_ALLOCATE_BUFFER can be used in Store apps starting in Windows 10?
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
Raymond Chen

What happens if you use it anyway?

How can CharUpper and CharLower guarantee that the uppercase version of a string is the same length as the lowercase version?
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
Raymond Chen

Does it have a special under-the-table deal with the Unicode Consortium?

Peeking inside the implementation of AnsiUpper and AnsiLower in Windows 1.0
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
Raymond Chen

Some retro-reverse-engineering and the weird micro-optimizations.

What does the /ALTERNATENAME linker switch do?
Jul 31, 2020
Post comments count 7
Post likes count 2

What does the /ALTERNATENAME linker switch do?

Raymond Chen
Raymond Chen

In case of emergency, go look for something else.

What’s the deal with OLDNAMES.LIB?
Jul 30, 2020
Post comments count 4
Post likes count 1

What’s the deal with OLDNAMES.LIB?

Raymond Chen
Raymond Chen

For backward compatibility with pre-standard C.

C++/WinRT gotcha: Setting properties incorrectly
Jul 29, 2020
Post comments count 21
Post likes count 1

C++/WinRT gotcha: Setting properties incorrectly

Raymond Chen
Raymond Chen

A bit too much search/replace during porting.

A look back at memory models in 16-bit MS-DOS
Jul 28, 2020
Post comments count 16
Post likes count 2

A look back at memory models in 16-bit MS-DOS

Raymond Chen
Raymond Chen

Ways of dealing with the fractured address space.

How do I set multiple items to a Windows Runtime vector in a single call?
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
Raymond Chen

It depends on the language projection.

C++/WinRT doesn’t let your coroutine cheat death, but it does get to say good-bye
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
Raymond Chen

Some manual cleanup.

How to get your C++/WinRT asynchronous operations to respond more quickly to cancellation, part 2
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
Raymond Chen

You can also take more proactive steps.

How to get your C++/WinRT asynchronous operations to respond more quickly to cancellation, part 1
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
Raymond Chen

Well, one way is to poll for it.

Deconstructing function pointers in a C++ template, returning to enable_if
Jul 21, 2020
Post comments count 0
Post likes count 1

Deconstructing function pointers in a C++ template, returning to enable_if

Raymond Chen
Raymond Chen

Going back to the old standby to filter out unwanted specializations.

Deconstructing function pointers in a C++ template, addressing the calling convention conundrum
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
Raymond Chen

Finding a template metaprogramming trick that works.

Deconstructing function pointers in a C++ template, trying to address the calling convention conundrum
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
Raymond Chen

Hunting for the right template metaprogramming trick.

Deconstructing function pointers in a C++ template, the calling convention conundrum
Jul 16, 2020
Post comments count 0
Post likes count 1

Deconstructing function pointers in a C++ template, the calling convention conundrum

Raymond Chen
Raymond Chen

Teasing out the calling convention from a function pointer.

Deconstructing function pointers in a C++ template, vexing variadics
Jul 15, 2020
Post comments count 1
Post likes count 1

Deconstructing function pointers in a C++ template, vexing variadics

Raymond Chen
Raymond Chen

Yet another function signature to specialize.

Deconstructing function pointers in a C++ template, the noexcept complication
Jul 14, 2020
Post comments count 4
Post likes count 2

Deconstructing function pointers in a C++ template, the noexcept complication

Raymond Chen
Raymond Chen

Trying to infer the noexcept qualifier.

Deconstructing function pointers in a C++ template
Jul 13, 2020
Post comments count 4
Post likes count 3

Deconstructing function pointers in a C++ template

Raymond Chen
Raymond Chen

Learning the magic incantation.

Cancelling a Windows Runtime asynchronous operation, part 8: C++/WinRT, revised
Jul 10, 2020
Post comments count 0
Post likes count 1

Cancelling a Windows Runtime asynchronous operation, part 8: C++/WinRT, revised

Raymond Chen
Raymond Chen

Using the completion result.

Cancelling a Windows Runtime asynchronous operation, part 7: WRL-generated asynchronous operations
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
Raymond Chen

The library that came before.

Cancelling a Windows Runtime asynchronous operation, part 6: C++/WinRT-generated asynchronous operations
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
Raymond Chen

It came from inside the building.

Cancelling a Windows Runtime asynchronous operation, part 5: C++/WinRT
Jul 7, 2020
Post comments count 3
Post likes count 1

Cancelling a Windows Runtime asynchronous operation, part 5: C++/WinRT

Raymond Chen
Raymond Chen

Relying on the ABI result.

Cancelling a Windows Runtime asynchronous operation, part 4: C++/CX with PPL, coroutine style with raw IAsyncAction and IAsyncOperation
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
Raymond Chen

Looks the same, but actually tastes completely different.

Cancelling a Windows Runtime asynchronous operation, part 3: C++/CX with PPL, coroutine style
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
Raymond Chen

Same wrapper, different sugar.

Cancelling a Windows Runtime asynchronous operation, part 2: C++/CX with PPL, explicit continuation style
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
Raymond Chen

Going through a different wrapper.

Cancelling a Windows Runtime asynchronous operation, part 1: C#
Jul 1, 2020
Post comments count 4
Post likes count 1

Cancelling a Windows Runtime asynchronous operation, part 1: C#

Raymond Chen
Raymond Chen

How is the cancellation reported?

2020 mid-year link clearance
Jun 30, 2020
Post comments count 5
Post likes count 1

2020 mid-year link clearance

Raymond Chen
Raymond Chen

Another midpoint.

Mundane std::tuple tricks: Finding a type in a tuple
Jun 29, 2020
Post comments count 10
Post likes count 1

Mundane std::tuple tricks: Finding a type in a tuple

Raymond Chen
Raymond Chen

Inverting <CODE>tuple_element_t</CODE>.

Mundane std::tuple tricks: Creating more interesting index sequences
Jun 26, 2020
Post comments count 0
Post likes count 1

Mundane std::tuple tricks: Creating more interesting index sequences

Raymond Chen
Raymond Chen

Generalizing our manipulations so far.

Mundane std::tuple tricks: Creating interesting index sequences
Jun 25, 2020
Post comments count 0
Post likes count 2

Mundane std::tuple tricks: Creating interesting index sequences

Raymond Chen
Raymond Chen

Building our own little template language.

Mundane std::tuple tricks: Selecting via an index sequence, part 2
Jun 24, 2020
Post comments count 0
Post likes count 1

Mundane std::tuple tricks: Selecting via an index sequence, part 2

Raymond Chen
Raymond Chen

Preserving references.

Mundane std::tuple tricks: Selecting via an index sequence
Jun 23, 2020
Post comments count 3
Post likes count 1

Mundane std::tuple tricks: Selecting via an index sequence

Raymond Chen
Raymond Chen

It all comes down to the index sequence.

Mundane std::tuple tricks: Getting started
Jun 22, 2020
Post comments count 0
Post likes count 2

Mundane std::tuple tricks: Getting started

Raymond Chen
Raymond Chen

Concatenating tuples the hard way, and the easy way (or maybe it's the lazy way).

Understanding warning C4265: class has virtual functions, but destructor is not virtual, part 2
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
Raymond Chen

Applying what we've learned.

Understanding warning C4265: class has virtual functions, but destructor is not virtual, part 1
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
Raymond Chen

What's it trying to warn you about? Does it matter?

Blaming the operating system for allowing people to create files with unusual characters in their names
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
Raymond Chen

Four fingers pointing back at your self.

Excuse me, has anybody seen the FOCAL interpreter?
Jun 16, 2020
Post comments count 6
Post likes count 1

Excuse me, has anybody seen the FOCAL interpreter?

Raymond Chen
Raymond Chen

I thought <I>you</I> had it.

Error 0x80131040 “The located assembly’s manifest definition does not match the assembly reference” when I use a Windows Runtime class written in C# from my C++/WinRT project
Using fibers to expand a thread’s stack at runtime, part 6
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
Raymond Chen

Caching fibers to avoid bouncing.

Using fibers to expand a thread’s stack at runtime, part 5
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
Raymond Chen

Expanding only as needed.

Determining approximately how much stack space is available, part 2
Jun 10, 2020
Post comments count 6
Post likes count 1

Determining approximately how much stack space is available, part 2

Raymond Chen
Raymond Chen

Probing the stack limits.

Determining approximately how much stack space is available, part 1
Jun 9, 2020
Post comments count 9
Post likes count 1

Determining approximately how much stack space is available, part 1

Raymond Chen
Raymond Chen

Ask for the memory and give it back right away.

Comparing fibers to threads for the purpose of expanding a thread’s stack at runtime
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
Raymond Chen

Pros and cons.

Using fibers to expand a thread’s stack at runtime, part 4
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
Raymond Chen

Moving an exception from a fiber to the main thead.

Using fibers to expand a thread’s stack at runtime, part 3
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
Raymond Chen

Propagating additional thread state.

Using fibers to expand a thread’s stack at runtime, part 2
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
Raymond Chen

Reducing code size with type erasure.

Using fibers to expand a thread’s stack at runtime, part 1
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
Raymond Chen

The simple return value.

How can I expand my thread’s stack at runtime?
Jun 1, 2020
Post comments count 4
Post likes count 1

How can I expand my thread’s stack at runtime?

Raymond Chen
Raymond Chen

You can use fibers, but you need to use them carefully.

Hiding C++ template parameter packs in a tuple
May 29, 2020
Post comments count 2
Post likes count 2

Hiding C++ template parameter packs in a tuple

Raymond Chen
Raymond Chen

So you can pull them back out.

Template metaprogramming trick: Get the compiler to tell you what type you have
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
Raymond Chen

Let the error message tell you.

The SetClientGuid method of the common file and folder dialogs lets you give names to those dialogs, too
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
Raymond Chen

Sort of like Bob and Carol for Win32.

When programs assume that the system will never change, episode 1, redux
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
Raymond Chen

It was never yours to begin with.

The SettingsIdentifier property of the various file pickers lets you give names to your pickers
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
Raymond Chen

Like Bob or Carol?

On the various ways of constructing a C++/WinRT com_array
May 22, 2020
Post comments count 0
Post likes count 1

On the various ways of constructing a C++/WinRT com_array

Raymond Chen
Raymond Chen

Surveying the constructors.

A noinline inline function? What sorcery is this?
May 21, 2020
Post comments count 2
Post likes count 1

A noinline inline function? What sorcery is this?

Raymond Chen
Raymond Chen

Two different senses of the word inline.

The case of the <CODE>SHGet­Folder­Path(CSIDL_<WBR>COMMON_<WBR>DOCUMENTS)</CODE> that returned <CODE>ERROR_<WBR>PATH_<WBR>NOT_<WBR>FOUND</CODE>
May 20, 2020
Post comments count 25
Post likes count 1

The case of the <CODE>SHGet­Folder­Path(CSIDL_<WBR>COMMON_<WBR>DOCUMENTS)</CODE> that returned <CODE>ERROR_<WBR>PATH_<WBR>NOT_<WBR>FOUND</CODE>

Raymond Chen
Raymond Chen

Accidentally reconfiguring the system.

How can I view my devices based on how they are connected to each other?
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
Raymond Chen

You can view by connection.

Reporting on what you could do once you get to the other side of the airtight hatchway
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
Raymond Chen

Counting all those chickens.

Storing a non-capturing lambda in a generic object
May 15, 2020
Post comments count 2
Post likes count 1

Storing a non-capturing lambda in a generic object

Raymond Chen
Raymond Chen

Reimplementing a small corner of <CODE>std::function</CODE>.

Inside <CODE>std::function</CODE>, part 2: Storage optimization
May 14, 2020
Post comments count 8
Post likes count 1

Inside <CODE>std::function</CODE>, part 2: Storage optimization

Raymond Chen
Raymond Chen

Preallocating the storage yourself.

Inside <CODE>std::function</CODE>, part 1: The basic idea
May 13, 2020
Post comments count 3
Post likes count 2

Inside <CODE>std::function</CODE>, part 1: The basic idea

Raymond Chen
Raymond Chen

Holding all different kinds of things.

When you start getting in-page errors on your hard drive, it’s time to go shopping for a new hard drive, redux
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
Raymond Chen

The click-click-click of impending doom.

Peeking inside WRL weak references
May 11, 2020
Post comments count 4
Post likes count 1

Peeking inside WRL weak references

Raymond Chen
Raymond Chen

If you ever have to debug one of these things.

The C++ preprocessor doesn’t understand anything about C++, and certainly not templates
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
Raymond Chen

You need to help it along.

Why does <CODE>Reg­Notify­Change­Key­Value</CODE> stop notifying once the key is deleted?
May 7, 2020
Post comments count 5
Post likes count 1

Why does <CODE>Reg­Notify­Change­Key­Value</CODE> stop notifying once the key is deleted?

Raymond Chen
Raymond Chen

Because that's the last thing a key ever does.

How can I prevent the user from using Snip and Sketch to take screen shots?
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
Raymond Chen

Programs can already specify that their windows should not be captured.

Why did the message on the Start menu change from <I>Start</I> to <I>Ship It!</I> for one build?
May 5, 2020
Post comments count 1
Post likes count 1

Why did the message on the Start menu change from <I>Start</I> to <I>Ship It!</I> for one build?

Raymond Chen
Raymond Chen

A rogue expression of mixed encouragement and impatience.

Peeking inside C++/CX weak references
May 4, 2020
Post comments count 0
Post likes count 1

Peeking inside C++/CX weak references

Raymond Chen
Raymond Chen

If you ever have to debug one of these things.

Diagnosing a hang: Everybody stuck in <CODE>Win­Http­Get­Proxy­For­Url</CODE>
May 1, 2020
Post comments count 0
Post likes count 1

Diagnosing a hang: Everybody stuck in <CODE>Win­Http­Get­Proxy­For­Url</CODE>

Raymond Chen
Raymond Chen

Putting on your thinking cap.

COM in-process DLL unloaded while trying to clean up from the destruction of the last object
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
Raymond Chen

Choosing the right time to bid farewell.

How can I detect that the system is no longer showing a UAC prompt?
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
Raymond Chen

Let's try to understand the actual problem.

When you set Windows 10 to allow only Windows Store apps, it allows them to be installed by anyone, not just the Store app
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
Raymond Chen

It's about the source of the program, not the delivery mechanism.

The paradoxical sense of relief when instructions to solve the problem fail at the first step
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
Raymond Chen

Time saved.

How do I use C++/WinRT to implement a classic COM interface that derives from another classic COM interface?
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
Raymond Chen

You can specialize <CODE>guid_of</CODE>.

Why does the value of my XAML Slider change when I updated its range?
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
Raymond Chen

Releasing the spring.

What kind of apartment is the private apartment I created via <CODE>CLSID_<CODE></CODE>Context­Switcher</CODE>?
Apr 22, 2020
Post comments count 0
Post likes count 1

What kind of apartment is the private apartment I created via <CODE>CLSID_<CODE></CODE>Context­Switcher</CODE>?

Raymond Chen
Raymond Chen

It's where you are.

Virtual desktops are a window management feature, not a performance feature
Apr 21, 2020
Post comments count 6
Post likes count 4

Virtual desktops are a window management feature, not a performance feature

Raymond Chen
Raymond Chen

Everything runs the same as it did before.

It rather involved being on the other side of this airtight hatchway: Planting files onto a custom PATH
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
Raymond Chen

Adding a directory to the PATH comes with obligations.

What will be placed in the output parameter if the function fails?
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
Raymond Chen

Officially, it could be anything. In practice, though, there are some constraints.

Why can’t you return an <CODE>IAsync­Action</CODE> from a coroutine that also does a <CODE>co_await</CODE>?
Apr 16, 2020
Post comments count 2
Post likes count 1

Why can’t you return an <CODE>IAsync­Action</CODE> from a coroutine that also does a <CODE>co_await</CODE>?

Raymond Chen
Raymond Chen

You already returned. No take-backs.

When I ask the <CODE>GetIpAddrTable</CODE> function to sort the results, how are they sorted?
Apr 15, 2020
Post comments count 2
Post likes count 1

When I ask the <CODE>GetIpAddrTable</CODE> function to sort the results, how are they sorted?

Raymond Chen
Raymond Chen

Nothing particularly fancy. Just plain numerical order.

If one program blocks shutdown, then <I>all</I> programs block shutdown
Apr 14, 2020
Post comments count 21
Post likes count 1

If one program blocks shutdown, then <I>all</I> programs block shutdown

Raymond Chen
Raymond Chen

We're all in this together, as far as the Blocked Shutdown Resolver is concerned.

The type-dependent type or value that is independent of the type
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
Raymond Chen

To delay the evaluation until instantiation.

Creating a non-agile delegate in C++/WinRT, part 5: Waiting synchronously from a thread that may already be the right thread
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
Raymond Chen

You might already be there.

Creating a non-agile delegate in C++/WinRT, part 4: Waiting synchronously from a background thread
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
Raymond Chen

Using things you already have.

Creating a non-agile delegate in C++/WinRT, part 3: The other cases and why they aren’t interesting
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
Raymond Chen

We handled only one case, but that's the only one worth handling.

Creating a non-agile delegate in C++/WinRT, part 2: The synchronous coroutine
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
Raymond Chen

It awaits without waiting.

Creating a non-agile delegate in C++/WinRT, part 1: Initial plunge
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
Raymond Chen

Forcing the delegate to run in a specific apartment.

An observation about what people used iPads for in the early days
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
Raymond Chen

Does everything you need, if you also bring an assistant.

Error compiling C++/WinRT runtime class: function does not take N arguments
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
Raymond Chen

You need to cover all the overloads.

Pulling sleight of hand tricks in a security vulnerability report, or maybe it was a prank
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
Raymond Chen

Something up my sleeve.

Why am I ignoring my second monitor? A case study in working from home.
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
Raymond Chen

Settling into the new routine has its rough spots.

A sneaky way to make sure nobody assigns test failures to your team
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
Raymond Chen

Buffer overflow.

Are Windows Runtime asynchronous operations guaranteed to complete?
Mar 27, 2020
Post comments count 8
Post likes count 1

Are Windows Runtime asynchronous operations guaranteed to complete?

Raymond Chen
Raymond Chen

As much as anything is guaranteed to complete.

If you say that your minimum requirements are the Universal contract, then you need to probe for anything beyond that
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
Raymond Chen

Reaching beyond your declaration.

How can I check whether a Windows Runtime object supports a member before I try to use it?
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
Raymond Chen

You can sniff at the metadata.

Accessing a member of a Windows Runtime class raises an <CODE>Invalid­Cast­Exception</CODE> / throws a <CODE>hresult_</CODE><CODE>no_</CODE><CODE>interface</CODE>, what does this mean?
Why not just share a single event across all critical section?
Mar 23, 2020
Post comments count 7
Post likes count 1

Why not just share a single event across all critical section?

Raymond Chen
Raymond Chen

How will you know when the thundering herd has calmed down?

The security check happens at the acquisition of the handle
Mar 20, 2020
Post comments count 10
Post likes count 1

The security check happens at the acquisition of the handle

Raymond Chen
Raymond Chen

Once you buy a handle, it's yours to keep.

Further refinements to the attempt to create a type-dependent expression that is always false
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
Raymond Chen

It still falls down, but for stranger reasons.

It rather involved being on the other side of this airtight hatchway: Booting into another operating system
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
Raymond Chen

It's not your computer any more.

We called it RAID because it kills bugs dead
Mar 17, 2020
Post comments count 15
Post likes count 1

We called it RAID because it kills bugs dead

Raymond Chen
Raymond Chen

The history of defect tracking databases in Windows.

The Windows Runtime IDL compiler lets you abbreviate some interface names
Mar 16, 2020
Post comments count 3
Post likes count 1

The Windows Runtime IDL compiler lets you abbreviate some interface names

Raymond Chen
Raymond Chen

But only a few of them.

Providing a better error message when someone tries to use <CODE>std::vector<bool></CODE> as a buffer
Mar 13, 2020
Post comments count 0
Post likes count 1

Providing a better error message when someone tries to use <CODE>std::vector<bool></CODE> as a buffer

Raymond Chen
Raymond Chen

Defer the problem further.

Of what use is a type-dependent expression that is always false?
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
Raymond Chen

Deferring an assertion to instantiation.

How can I create a type-dependent expression that is always false?
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
Raymond Chen

Use information that you know to be true (or false).

The sad but short story of the <CODE>SM_AccessoriesName</CODE> registry value
Mar 10, 2020
Post comments count 10
Post likes count 1

The sad but short story of the <CODE>SM_AccessoriesName</CODE> registry value

Raymond Chen
Raymond Chen

Another victim of programs that reach into undocumented sections of the registry.

Why does MS-DOS put an <CODE>int 20h</CODE> at byte 0 of the COM file program segment?
Mar 9, 2020
Post comments count 13
Post likes count 1

Why does MS-DOS put an <CODE>int 20h</CODE> at byte 0 of the COM file program segment?

Raymond Chen
Raymond Chen

In case you end up there, but how?

Why do people take a lock around <CODE>CreateProcess</CODE> calls?
Mar 6, 2020
Post comments count 6
Post likes count 1

Why do people take a lock around <CODE>CreateProcess</CODE> calls?

Raymond Chen
Raymond Chen

Managing your inheritance.

Can I wait for a kernel event to become <I>unsignaled</I>?
Mar 5, 2020
Post comments count 0
Post likes count 1

Can I wait for a kernel event to become <I>unsignaled</I>?

Raymond Chen
Raymond Chen

Not directly, but maybe you can simulate it.

Meet me here on Savvyday 29 Oatmeal 94
Mar 4, 2020
Post comments count 16
Post likes count 1

Meet me here on Savvyday 29 Oatmeal 94

Raymond Chen
Raymond Chen

<CODE>Internet­Time­To­System­Time</CODE> tries really hard to make sense out of that sentence.

The only thing preventing them from going home was two AA batteries
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
Raymond Chen

I wonder where we can find them.

How can I detect that my window has been suppressed from the screen by the shell?
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
Raymond Chen

Cloak and dagger, without the dagger.

Should there be a standard C++ pattern for this? transform_to
Feb 28, 2020
Post comments count 11
Post likes count 1

Should there be a standard C++ pattern for this? transform_to

Raymond Chen
Raymond Chen

Or maybe you should expect to write it out the slow way.

How to save a lot of money on cable car tickets in San Francisco
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
Raymond Chen

Go downstairs and buy it from the machine.

How can I configure my Windows NT service to autostart when the system gains Internet access?
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
Raymond Chen

You can ask to be started when the system gets an IP address.

What’s up with the <CODE>CF_SYLK</CODE> and <CODE>CF_DIF</CODE> clipboard formats?
Feb 26, 2020
Post comments count 16
Post likes count 1

What’s up with the <CODE>CF_SYLK</CODE> and <CODE>CF_DIF</CODE> clipboard formats?

Raymond Chen
Raymond Chen

From a galaxy far, far away.

The custom-made computers powered by pepperoni pizza
Feb 25, 2020
Post comments count 13
Post likes count 1

The custom-made computers powered by pepperoni pizza

Raymond Chen
Raymond Chen

Once more for old time's sake.

The 2020/2021 Seattle Symphony subscription season at a glance
Feb 24, 2020
Post comments count 3
Post likes count 0

The 2020/2021 Seattle Symphony subscription season at a glance

Raymond Chen
Raymond Chen

The pocket reference guide for 2020/2021.

Why are there trivial functions like <CODE>Copy­Rect</CODE> and <CODE>Equal­Rect</CODE>?
Feb 24, 2020
Post comments count 13
Post likes count 1

Why are there trivial functions like <CODE>Copy­Rect</CODE> and <CODE>Equal­Rect</CODE>?

Raymond Chen
Raymond Chen

You could call them to save a dozen bytes!

Why you might need additional control over the secret event hiding inside the file object
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
Raymond Chen

Sometimes every little bit of contention means a lot.

If you’re not keeping the parameter, then you still want to have separate <CODE>T const&</CODE> and <CODE>T&&</CODE> overloads
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 <CODE>T const&</CODE> and <CODE>T&&</CODE> overloads

Raymond Chen
Raymond Chen

Forwarding it onward.

If you plan on keeping the parameter anyway, then there’s no need to have separate <CODE>T const&</CODE> and <CODE>T&&</CODE> overloads
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 <CODE>T const&</CODE> and <CODE>T&&</CODE> overloads

Raymond Chen
Raymond Chen

You can just take it by value and move it out.

Microspeak: Click stop
Feb 18, 2020
Post comments count 5
Post likes count 0

Microspeak: Click stop

Raymond Chen
Raymond Chen

A place to pause and refresh.

Gotcha: A threadpool periodic timer will not wait for the previous tick to complete
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
Raymond Chen

Don't be like Lucy in the chocolate factory.

Quality updates: Consequences for rogue-patched binaries
Feb 14, 2020
Post comments count 12
Post likes count 1

Quality updates: Consequences for rogue-patched binaries

Raymond Chen
Raymond Chen

You can't get back any more.

Survey of Windows update formats: The Quality update, which obsoletes all the others
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
Raymond Chen

Supports everything the others do, at a fraction of the price.

Survey of Windows update formats: The Express update
Feb 12, 2020
Post comments count 8
Post likes count 1

Survey of Windows update formats: The Express update

Raymond Chen
Raymond Chen

It's faster in some ways, slower in others.

Survey of Windows update formats: The Delta update
Feb 11, 2020
Post comments count 4
Post likes count 1

Survey of Windows update formats: The Delta update

Raymond Chen
Raymond Chen

Trying to do some trimming.

Survey of Windows update formats: The Full update
Feb 10, 2020
Post comments count 5
Post likes count 1

Survey of Windows update formats: The Full update

Raymond Chen
Raymond Chen

First we need to understand where we started.

Psychic debugging: Why does my app sometimes fail to change the display settings?
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
Raymond Chen

Maybe you're in the box.

Why does my C++/WinRT project get errors of the form “<CODE>abi<…>::…</CODE> is abstract see reference to <CODE>producer<…></CODE>“?
Feb 6, 2020
Post comments count 1
Post likes count 1

Why does my C++/WinRT project get errors of the form “<CODE>abi<…>::…</CODE> is abstract see reference to <CODE>producer<…></CODE>“?

Raymond Chen
Raymond Chen

Nobody said how to produce the interface.

The various patterns for passing C-style arrays across the Windows Runtime ABI boundary
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
Raymond Chen

It's not an object, but not a scalar either.

The legend of the library that caused Building 4 to sink
Feb 4, 2020
Post comments count 6
Post likes count 1

The legend of the library that caused Building 4 to sink

Raymond Chen
Raymond Chen

Are the rumors true? We'll let you decide.

It rather involved being on the other side of this airtight hatchway: Disclosure of information you already had access to
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
Raymond Chen

A peek behind your own curtain.

The XAML hat rule: Understanding how it works and why it doesn’t
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
Raymond Chen

Finding the point in the parsing where the rule kicks in.

Why am I getting an exception from the thread pool during process shutdown?
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
Raymond Chen

The thread pool is already gone. You can't schedule any work on it any more.

Crashing in COM after I call <CODE>CoUninitialize</CODE>, how can COM be running after it is uninitalized?
Jan 29, 2020
Post comments count 11
Post likes count 1

Crashing in COM after I call <CODE>CoUninitialize</CODE>, how can COM be running after it is uninitalized?

Raymond Chen
Raymond Chen

Mind your destructors.

You might call it a “cross”, but I’m still going to call it an “X”
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
Raymond Chen

Different usage on this side of the pond.

How do you pronounce WinDbg?
Jan 28, 2020
Post comments count 6
Post likes count 1

How do you pronounce WinDbg?

Raymond Chen
Raymond Chen

Just a lot of hot air.

Is there a difference between creating a null pen with <CODE>Create­Pen</CODE> and just using the stock null pen?
Jan 27, 2020
Post comments count 6
Post likes count 1

Is there a difference between creating a null pen with <CODE>Create­Pen</CODE> and just using the stock null pen?

Raymond Chen
Raymond Chen

All null pens are functionally equivalent, so why have more than one? Are some pens more null than others?

Peeking inside C++/CX delegates
Jan 24, 2020
Post comments count 3
Post likes count 1

Peeking inside C++/CX delegates

Raymond Chen
Raymond Chen

If you ever have to debug one of these things.

Windows Runtime delegates and object lifetime in C++/CX, redux
Jan 23, 2020
Post comments count 4
Post likes count 1

Windows Runtime delegates and object lifetime in C++/CX, redux

Raymond Chen
Raymond Chen

If you are the one calling the delegate, you have an extra thing to worry about.

Not even getting to the airtight hatchway: Creating a process with a different parent
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
Raymond Chen

Fiddling a knob that isn't connected to anything.

Microspeak: Bucket bugs, bucket spray, bug spray, and failure shift
Jan 21, 2020
Post comments count 3
Post likes count 1

Microspeak: Bucket bugs, bucket spray, bug spray, and failure shift

Raymond Chen
Raymond Chen

How failures in the wild get categorized by analysis.

Can shrinking a <CODE>std::string</CODE> throw an exception?
Jan 20, 2020
Post comments count 0
Post likes count 2

Can shrinking a <CODE>std::string</CODE> throw an exception?

Raymond Chen
Raymond Chen

It depends on how you shrink it.

How can I turn a structured exception into a C++ exception without having to use /EHa, if I can constrain exactly where the structured exception is coming from?
How can I handle both structured exceptions and C++ exceptions potentially coming from the same source?
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
Raymond Chen

Call for a translator.

Why can’t I use <CODE>SHSetKnownFolderPath</CODE> to change the location of <CODE>FOLDERID_LocalAppData</CODE>?
Jan 15, 2020
Post comments count 12
Post likes count 1

Why can’t I use <CODE>SHSetKnownFolderPath</CODE> to change the location of <CODE>FOLDERID_LocalAppData</CODE>?

Raymond Chen
Raymond Chen

A acknowledgement of the reality that it not only doesn't work, but leaves the user profile corrupted.

The historical significance of the Burgermaster drive-in restaurant
Jan 14, 2020
Post comments count 10
Post likes count 2

The historical significance of the Burgermaster drive-in restaurant

Raymond Chen
Raymond Chen

You can just phone it in.

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
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
Raymond Chen

Perhaps it's behind a sign that says <I>Beware of the Leopard</I>.

Over-documenting TTM_RELAYEVENT and why it results in a one-second periodic timer running as long as the tooltip is visible
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
Raymond Chen

Too much information leads to trouble.

Tree-walking algorithms: Incrementally performing an inorder walk of a binary tree
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
Raymond Chen

We need to keep track of where we came from.

Tree-walking algorithms: Incrementally performing a postorder walk of an N-ary tree
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
Raymond Chen

This time, we report on the way back up.

Tree-walking algorithms: Incrementally performing a preorder walk of an N-ary tree
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
Raymond Chen

Remembering whether you were moving down or up.

Tree-walking algorithms: Incrementally enumerating leaf nodes of an N-ary tree
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
Raymond Chen

Stop to rest when you turn.

Anybody who writes <CODE>#pragma pack(1)</CODE> may as well just wear a sign on their forehead that says “I hate RISC”
Jan 3, 2020
Post comments count 19
Post likes count 3

Anybody who writes <CODE>#pragma pack(1)</CODE> may as well just wear a sign on their forehead that says “I hate RISC”

Raymond Chen
Raymond Chen

Alignment as well as padding.

Why doesn’t <CODE>RegSetKeySecurity</CODE> propagate inheritable ACEs, but <CODE>SetSecurityInfo</CODE> does?
Jan 2, 2020
Post comments count 3
Post likes count 1

Why doesn’t <CODE>RegSetKeySecurity</CODE> propagate inheritable ACEs, but <CODE>SetSecurityInfo</CODE> does?

Raymond Chen
Raymond Chen

An artifact of the timeline.

Nasty gotcha: Positioning your window beneath a topmost window makes it topmost
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
Raymond Chen

Picking up properties unintentionally.

2019 year-end link clearance: The different kinds of DLL planting
Dec 31, 2019
Post comments count 18
Post likes count 1

2019 year-end link clearance: The different kinds of DLL planting

Raymond Chen
Raymond Chen

And why most of them aren't security vulnerabilities.

How do I make a clone of a Windows Runtime vector in C++/CX?
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
Raymond Chen

Taking shortcuts with special constructors.

Controversial extension methods: <CODE>CastTo<T></CODE> and <CODE>As<T></CODE>
Dec 27, 2019
Post comments count 17
Post likes count 1

Controversial extension methods: <CODE>CastTo<T></CODE> and <CODE>As<T></CODE>

Raymond Chen
Raymond Chen

Reduction in eye exercises.

C++ coroutines: The problem of the DispatcherQueue task that runs too soon, part 4
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
Raymond Chen

You can update it a different way.

C++ coroutines: The problem of the DispatcherQueue task that runs too soon, part 3
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
Raymond Chen

The storage was right in front of your nose.

C++ coroutines: The problem of the DispatcherQueue task that runs too soon, part 2
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
Raymond Chen

Hang on a little bit longer.

C++ coroutines: The problem of the DispatcherQueue task that runs too soon, part 1
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
Raymond Chen

Variables disappearing out from under you.

C++ coroutines: The problem of the synchronous apartment-changing callback
Dec 20, 2019
Post comments count 3
Post likes count 1

C++ coroutines: The problem of the synchronous apartment-changing callback

Raymond Chen
Raymond Chen

Holding the caller thread hostage.

C++ coroutines: The <CODE>co_await</CODE> operator and the function search algorithm
Dec 19, 2019
Post comments count 4
Post likes count 1

C++ coroutines: The <CODE>co_await</CODE> operator and the function search algorithm

Raymond Chen
Raymond Chen

At the confluence of multiple C++ features.

C++ coroutines: Defining the <CODE>co_await</CODE> operator
Dec 18, 2019
Post comments count 1
Post likes count 1

C++ coroutines: Defining the <CODE>co_await</CODE> operator

Raymond Chen
Raymond Chen

Converting an awaitable into an awaiter.

C++ coroutines: no callable ‘await_resume’ function found for type
Dec 17, 2019
Post comments count 0
Post likes count 1

C++ coroutines: no callable ‘await_resume’ function found for type

Raymond Chen
Raymond Chen

The thing you want isn't there.

C++ coroutines: Short-circuiting suspension, part 2
Dec 16, 2019
Post comments count 2
Post likes count 1

C++ coroutines: Short-circuiting suspension, part 2

Raymond Chen
Raymond Chen

Avoiding suspension entirely.

C++ coroutines: Short-circuiting suspension, part 1
Dec 13, 2019
Post comments count 1
Post likes count 1

C++ coroutines: Short-circuiting suspension, part 1

Raymond Chen
Raymond Chen

Avoiding needless stack buildup.

C++ coroutines: Awaiting an <CODE>IAsyncAction</CODE> without preserving thread context
Dec 12, 2019
Post comments count 4
Post likes count 1

C++ coroutines: Awaiting an <CODE>IAsyncAction</CODE> without preserving thread context

Raymond Chen
Raymond Chen

Another use for a custom awaiter.

C++ coroutines: Framework interop
Dec 11, 2019
Post comments count 1
Post likes count 1

C++ coroutines: Framework interop

Raymond Chen
Raymond Chen

Plays well with others.

C++ coroutines: Constructible awaitable or function returning awaitable?
Dec 10, 2019
Post comments count 1
Post likes count 1

C++ coroutines: Constructible awaitable or function returning awaitable?

Raymond Chen
Raymond Chen

Two common patterns for simple awaitable objects.

C++ coroutines: Getting started with awaitable objects
Dec 9, 2019
Post comments count 3
Post likes count 1

C++ coroutines: Getting started with awaitable objects

Raymond Chen
Raymond Chen

Starting our walk-around.

In C++/WinRT, what happens when I treat an <CODE>IInspectable</CODE> as or convert one to a <CODE>bool</CODE>
Dec 6, 2019
Post comments count 4
Post likes count 1

In C++/WinRT, what happens when I treat an <CODE>IInspectable</CODE> as or convert one to a <CODE>bool</CODE>

Raymond Chen
Raymond Chen

Much less weird than C++/CX.

In C++/CX, hat pointers are contextually convertible to <CODE>bool</CODE>, but you can’t always <CODE>static_cast</CODE> them to <CODE>bool</CODE>
Dec 5, 2019
Post comments count 4
Post likes count 1

In C++/CX, hat pointers are contextually convertible to <CODE>bool</CODE>, but you can’t always <CODE>static_cast</CODE> them to <CODE>bool</CODE>

Raymond Chen
Raymond Chen

Because C++/CX is weird like that.

Not actually crossing the airtight hatchway: Harmless out-of-bounds read that is never disclosed
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
Raymond Chen

There's no way to make anything bad happen, so is anything bad actually happening?

The automotive emergency kit is not a toy
Dec 3, 2019
Post comments count 6
Post likes count 1

The automotive emergency kit is not a toy

Raymond Chen
Raymond Chen

Please use it only for emergencies.

When should I use delayed-marshaling when creating an agile reference?
Dec 2, 2019
Post comments count 2
Post likes count 1

When should I use delayed-marshaling when creating an agile reference?

Raymond Chen
Raymond Chen

It's a balance between doing more work now in anticipation of saving work later.

My summer vacation: The Tower of London and Kensington Palace
Nov 29, 2019
Post comments count 5
Post likes count 0

My summer vacation: The Tower of London and Kensington Palace

Raymond Chen
Raymond Chen

Doing the admissions price math.

Using contexts to return to a COM apartment later
Nov 29, 2019
Post comments count 0
Post likes count 1

Using contexts to return to a COM apartment later

Raymond Chen
Raymond Chen

You can go back home again.

How do you get into a context via <CODE>IContext­Callback::</CODE><CODE>Context­Callback</CODE>?
Nov 28, 2019
Post comments count 0
Post likes count 1

How do you get into a context via <CODE>IContext­Callback::</CODE><CODE>Context­Callback</CODE>?

Raymond Chen
Raymond Chen

Piggybacking on the internal infrastructure.

Setting up private COM contexts to allow yourself to unload cleanly
Nov 27, 2019
Post comments count 0
Post likes count 1

Setting up private COM contexts to allow yourself to unload cleanly

Raymond Chen
Raymond Chen

Your private little enclave.

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
Nov 26, 2019
Post comments count 8
Post likes count 1

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
Raymond Chen

Or maybe this is subletting? Airbnb for COM apartments?

A slightly less brief introduction to COM apartments (but it’s still brief)
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
Raymond Chen

Managing the multithreading.

My summer vacation: Speaking German (wait, what?)
Nov 22, 2019
Post comments count 12
Post likes count 0

My summer vacation: Speaking German (wait, what?)

Raymond Chen
Raymond Chen

But you went to England and France.

How do I make a clone of a Windows Runtime vector in C++/WinRT?
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
Raymond Chen

You copy it into your own vector, but make sure you copy what you think you're copying.

Why does the Alpha AXP predict a coroutine transfer the way it does?
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
Raymond Chen

Working out the possibilities.

The case of the <CODE>Uuid­Create­Sequential</CODE> that didn’t use the MAC address
Nov 20, 2019
Post comments count 1
Post likes count 1

The case of the <CODE>Uuid­Create­Sequential</CODE> that didn’t use the MAC address

Raymond Chen
Raymond Chen

If you want to use it, make sure it's good.

The Magical Excel 97 Far East Language Build Screwdriver™
Nov 19, 2019
Post comments count 8
Post likes count 1

The Magical Excel 97 Far East Language Build Screwdriver™

Raymond Chen
Raymond Chen

For your magical build needs.

I set the same ACL with the GUI and with <CODE>icacls</CODE>, yet the results are different
Nov 18, 2019
Post comments count 10
Post likes count 1

I set the same ACL with the GUI and with <CODE>icacls</CODE>, yet the results are different

Raymond Chen
Raymond Chen

Sometimes your tools lie to you.

My summer vacation: The London Eye
Nov 15, 2019
Post comments count 9
Post likes count 0

My summer vacation: The London Eye

Raymond Chen
Raymond Chen

Round and round. We'll, really just round. No "and round".

Why does my single-threaded program have multiple threads?
Nov 15, 2019
Post comments count 2
Post likes count 1

Why does my single-threaded program have multiple threads?

Raymond Chen
Raymond Chen

They're not your threads, but they're in your process.

Can the MTA thread exit while keeping its COM class registrations alive?
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
Raymond Chen

You can keep the MTA alive without having to dedicate a thread.

Not even getting to the airtight hatchway: Planting files in world-writable directories
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
Raymond Chen

But who uses that world-writable directory?

How can I copy or move a group of files into a new folder from Explorer?
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
Raymond Chen

Putting together things you already have.

The curious pattern of pre-emptively rejecting the solution to your problem: Redrawing during resizing
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
Raymond Chen

You'll have to invalidate it, either the easy way or the hard way.

Can I force a <CODE>WM_</CODE><CODE>TIMER</CODE> message to be generated when the timer comes due, even if the message queue is not idle?
Nov 8, 2019
Post comments count 6
Post likes count 1

Can I force a <CODE>WM_</CODE><CODE>TIMER</CODE> message to be generated when the timer comes due, even if the message queue is not idle?

Raymond Chen
Raymond Chen

You can ask for it explicitly.

How can I give a C++ lambda expression more than one <CODE>operator()</CODE>?
Nov 7, 2019
Post comments count 9
Post likes count 1

How can I give a C++ lambda expression more than one <CODE>operator()</CODE>?

Raymond Chen
Raymond Chen

Wacky template games.

How can I have a C++ function that returns different types depending on what the caller wants?
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
Raymond Chen

Quantum superposition comes to C++.

The legend of Steve Ballmer’s rental car, the most diligent employee in the world
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
Raymond Chen

What a hardworking new employee that must be.

I tried to adjust the time on my alarm clock. I failed.
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
Raymond Chen

Now it's not even wrong twice a day.

What happened if you tried to access a network file bigger than 2GB from MS-DOS?
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
Raymond Chen

What a strange world you live in.

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?
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
Raymond Chen

But we care that it's still waiting.

For one internal build, Windows 95 contained an evil message
Oct 31, 2019
Post comments count 2
Post likes count 1

For one internal build, Windows 95 contained an evil message

Raymond Chen
Raymond Chen

Another prank from the user interface team.

The program “G” is preventing you from shutting down
Oct 30, 2019
Post comments count 12
Post likes count 1

The program “G” is preventing you from shutting down

Raymond Chen
Raymond Chen

Minding your character set.

If you suppress GDI+ background thread, then you are expected to pump messages yourself
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
Raymond Chen

That stuff is now happening on your thread.

Did you hear that story about Bill Gates?: A PR person’s view
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
Raymond Chen

They've heard them all.

Why does <CODE>Format­Message</CODE> say that <CODE>%0</CODE> terminates the message without a trailing newline? Is it secretly <I>adding</I> newlines?
Oct 25, 2019
Post comments count 0
Post likes count 1

Why does <CODE>Format­Message</CODE> say that <CODE>%0</CODE> terminates the message without a trailing newline? Is it secretly <I>adding</I> newlines?

Raymond Chen
Raymond Chen

Well, it's not <CODE>Format­Message</CODE> that's adding the newline.

If you want to terminate on an unexpected exception, then don’t sniff at every exception; just let the process terminate
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
Raymond Chen

Get the stack before it unwinds.

Why can’t I create a “Please wait” dialog from a background thread to inform the user that the main UI thread is busy?
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
Raymond Chen

Reversal of fortune.

What’s the difference between the hotkeys <KBD>F6</KBD> and <KBD>Alt</KBD>+<KBD>F6</KBD>?
Oct 22, 2019
Post comments count 5
Post likes count 1

What’s the difference between the hotkeys <KBD>F6</KBD> and <KBD>Alt</KBD>+<KBD>F6</KBD>?

Raymond Chen
Raymond Chen

Switching between things, but different things.

When I tell the file or folder picker that I want only file system files and folders, why does it still show virtual folders?
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
Raymond Chen

Because there might be a file hiding under it.

C++/WinRT implementation extension points: <CODE>abi_guard</CODE>, <CODE>abi_enter</CODE>, <CODE>abi_exit</CODE>, and <CODE>final_release</CODE>
Oct 18, 2019
Post comments count 0
Post likes count 1

C++/WinRT implementation extension points: <CODE>abi_guard</CODE>, <CODE>abi_enter</CODE>, <CODE>abi_exit</CODE>, and <CODE>final_release</CODE>

Raymond Chen
Raymond Chen

Coming in, going out, and going away.

By Grabthar’s Hammer, it’s a Galaxy Quest documentary
Oct 17, 2019
Post comments count 0
Post likes count 0

By Grabthar’s Hammer, it’s a Galaxy Quest documentary

Raymond Chen
Raymond Chen

The seventh best Star Trek movie.

How can I make a call into an elevated service without requiring an elevation prompt?
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
Raymond Chen

This is actually quite old technology.

Why do I get a <CODE>winrt::hresult_no_interface</CODE> exception when I try to register an auto-revoke event handler?
Oct 16, 2019
Post comments count 0
Post likes count 1

Why do I get a <CODE>winrt::hresult_no_interface</CODE> exception when I try to register an auto-revoke event handler?

Raymond Chen
Raymond Chen

The necessary infrastructure isn't there.

How should I create controls on my dialog box that has a tab control?
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
Raymond Chen

They are siblings of the tab control, not children.

Rugby: The rules for the casual viewer
Oct 14, 2019
Post comments count 4
Post likes count 0

Rugby: The rules for the casual viewer

Raymond Chen
Raymond Chen

What you need to know as an observer.

A common mistake when you try to create a C++ class that wraps a window procedure: Saving the window handle too late
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
Raymond Chen

You need it before then.

Fibers aren’t useful for much any more; there’s just one corner of it that remains useful for a reason unrelated to fibers
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
Raymond Chen

A better way to clean up.

My summer vacation: London public transportation
Oct 10, 2019
Post comments count 15
Post likes count 0

My summer vacation: London public transportation

Raymond Chen
Raymond Chen

It's easy until you try to leave town.

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?
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
Raymond Chen

Anywhere it's possible to put a pointer, somebody will try to put a pointer.

Kabaddi: The rules for the casual viewer
Oct 9, 2019
Post comments count 3
Post likes count 1

Kabaddi: The rules for the casual viewer

Raymond Chen
Raymond Chen

What you need to know as an observer.

A window can’t have two timers with the same ID, so how do I assign an ID that nobody else is using?
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
Raymond Chen

A pointer can be used like an ID.

Auctioning off the privilege of initiating the destruction of the Microsoft old campus
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
Raymond Chen

Emerging victorious in the bidding war.

Why does my string consist of this Korean character repeated over and over?
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
Raymond Chen

Decode that character to its code point.

My summer vacation: The Changing of the Guard at Buckingham Palace
Oct 4, 2019
Post comments count 3
Post likes count 0

My summer vacation: The Changing of the Guard at Buckingham Palace

Raymond Chen
Raymond Chen

Pomp and circumstance.

How do I define a UWP XAML dependency property that is a collection type?
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
Raymond Chen

Putting previous guidance into practice.

Odd things you find when you read the airplane safety information card
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
Raymond Chen

Will it float?

What if I want the default value for a XAML dependency property to be a mutable object?
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
Raymond Chen

Give it one, but save it for real.

My summer vacation: Watching a German movie on the plane and learning some language history
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
Raymond Chen

Trying to keep that part of my brain from disappearing.

The default value for a XAML dependency property should be immutable
Oct 2, 2019
Post comments count 2
Post likes count 2

The default value for a XAML dependency property should be immutable

Raymond Chen
Raymond Chen

Spooky action at a distance.

Reminiscences on 5.25″ floppy drives of the early 1980’s
Oct 1, 2019
Post comments count 14
Post likes count 1

Reminiscences on 5.25″ floppy drives of the early 1980’s

Raymond Chen
Raymond Chen

Because you may have forgotten, or perhaps never knew.

Where did DirectX code names come from?
Sep 30, 2019
Post comments count 2
Post likes count 1

Where did DirectX code names come from?

Raymond Chen
Raymond Chen

From too much pizza.

My summer vacation: Paris public transportation
Sep 27, 2019
Post comments count 2
Post likes count 0

My summer vacation: Paris public transportation

Raymond Chen
Raymond Chen

Getting around is easy. Paying for it is hard.

Why does the compiler refuse to let me export my class? If I don’t export it, then the class works fine.
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
Raymond Chen

You forced the compiler to try to compile it.

My summer vacation: Versailles
Sep 26, 2019
Post comments count 1
Post likes count 0

My summer vacation: Versailles

Raymond Chen
Raymond Chen

Ostentation fatigue is a real thing.

Why does <CODE>std::is_copy_constructible</CODE> report that a vector of move-only objects is copy constructible?
Sep 26, 2019
Post comments count 6
Post likes count 1

Why does <CODE>std::is_copy_constructible</CODE> report that a vector of move-only objects is copy constructible?

Raymond Chen
Raymond Chen

Because it has a copy constructor, says so on the tin, even though the constructor itself doesn't compile.

My summer vacation: The Louvre Museum
Sep 25, 2019
Post comments count 6
Post likes count 0

My summer vacation: The Louvre Museum

Raymond Chen
Raymond Chen

Don't waste your time queueing to see the Mona Lisa.

How do I create a Windows Runtime method that accepts a lambda?
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
Raymond Chen

You can use a delegate as a generalized lambda.

How did MS-DOS decide that two seconds was the amount of time to keep the floppy disk cache valid?
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
Raymond Chen

A stopwatch and a race against time.

Stop cherry-picking, start merging, Part 11: Chasing the commit by taking a train
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
Raymond Chen

Let the train carry you.

Why perform all these complex git machinations when you can just tweak the command line to get what you want?
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
Raymond Chen

Who controls the command line?

How to duplicate a file while preserving git line history
Sep 19, 2019
Post comments count 4
Post likes count 3

How to duplicate a file while preserving git line history

Raymond Chen
Raymond Chen

Synthesize it in a branch via a rename.

How to split out pieces of a file while preserving git line history: The easy way with misleading commits
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
Raymond Chen

Anticipating the octopus.

How to split out pieces of a file while preserving git line history: The hard way with commit-tree
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
Raymond Chen

More commit-tree tricks.

How do I split a file into two while preserving git line history?
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
Raymond Chen

The octopus delivers.

My summer vacation: The Eiffel Tower
Sep 13, 2019
Post comments count 7
Post likes count 0

My summer vacation: The Eiffel Tower

Raymond Chen
Raymond Chen

It's really tall, for one.

Another way to sort GUIDs: Java
Sep 13, 2019
Post comments count 11
Post likes count 2

Another way to sort GUIDs: Java

Raymond Chen
Raymond Chen

Because it's Java.

The Turkish lira’s currency code is an unexpected source of problems with computer programmers
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
Raymond Chen

Following the rules for currency codes leads to a collision with popular macro.

The sad history of the MFC <CODE>TRY</CODE>/<CODE>CATCH</CODE> macros
Sep 11, 2019
Post comments count 3
Post likes count 1

The sad history of the MFC <CODE>TRY</CODE>/<CODE>CATCH</CODE> macros

Raymond Chen
Raymond Chen

Because standard C++ exception handling didn't exist yet.

Trying to wrangle a site visit to Paul Allen’s superyacht “Octopus”
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
Raymond Chen

An unsuccessful play for a site visit.

PowerShell programming puzzle: Convert snake_case to PascalCase in one line
Sep 9, 2019
Post comments count 15
Post likes count 1

PowerShell programming puzzle: Convert snake_case to PascalCase in one line

Raymond Chen
Raymond Chen

Abusing linguistic helper functions for fun.

It rather involved being on the other side of this airtight hatchway: Guessing window procedure magic cookies
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
Raymond Chen

You created a very funny-looking function pointer.

Making the <CODE>COM_</CODE><CODE>INTERFACE_</CODE><CODE>ENTRY</CODE> macro better at detecting misuse
Sep 5, 2019
Post comments count 0
Post likes count 1

Making the <CODE>COM_</CODE><CODE>INTERFACE_</CODE><CODE>ENTRY</CODE> macro better at detecting misuse

Raymond Chen
Raymond Chen

Playing around with compile-time errors.

The <CODE>COM_</CODE><CODE>INTERFACE_</CODE><CODE>ENTRY</CODE> must be a COM interface, but nobody actually checks
Sep 4, 2019
Post comments count 2
Post likes count 1

The <CODE>COM_</CODE><CODE>INTERFACE_</CODE><CODE>ENTRY</CODE> must be a COM interface, but nobody actually checks

Raymond Chen
Raymond Chen

And if it isn't, bad things happen.

Any sufficiently advanced technology is indistinguishable from a bomb
Sep 3, 2019
Post comments count 15
Post likes count 1

Any sufficiently advanced technology is indistinguishable from a bomb

Raymond Chen
Raymond Chen

Even though it doesn't tick. Do bombs even tick?

Silly Alexa trick: Speaking French with a horrible American accent
Sep 2, 2019
Post comments count 3
Post likes count 0

Silly Alexa trick: Speaking French with a horrible American accent

Raymond Chen
Raymond Chen

Asking for a repeat, but in a different speech synthesizer.

If FlushInstructionCache doesn’t do anything, why do you have to call it, revisited
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
Raymond Chen

The elixir of forgetfulness.

The sad history of Unicode printf-style format specifiers in Visual C++
Aug 30, 2019
Post comments count 17
Post likes count 2

The sad history of Unicode printf-style format specifiers in Visual C++

Raymond Chen
Raymond Chen

Getting ahead of the standard, which went a different way.

What to do if you can’t get the stovetop in your London apartment to turn on
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
Raymond Chen

Look for an apparently-useless switch.

On resolving the type vs member conflict in C++, revisited
Aug 29, 2019
Post comments count 2
Post likes count 1

On resolving the type vs member conflict in C++, revisited

Raymond Chen
Raymond Chen

Filling in some gaps in the previous discussion.

The sad history of Visual Studio’s custom <CODE>__if_exists</CODE> keyword
Aug 28, 2019
Post comments count 4
Post likes count 2

The sad history of Visual Studio’s custom <CODE>__if_exists</CODE> keyword

Raymond Chen
Raymond Chen

When times were simpler and bytes were precious.

One byte used to cost a dollar
Aug 27, 2019
Post comments count 16
Post likes count 2

One byte used to cost a dollar

Raymond Chen
Raymond Chen

The cost of software distribution.

Custom-printing your own attendee pass to the Windows 95 launch
Aug 26, 2019
Post comments count 5
Post likes count 1

Custom-printing your own attendee pass to the Windows 95 launch

Raymond Chen
Raymond Chen

Only the highest quality forgeries will do.

The SuperH-3, part 15: Code walkthough
Aug 23, 2019
Post comments count 2
Post likes count 0

The SuperH-3, part 15: Code walkthough

Raymond Chen
Raymond Chen

Taking this thing for a spin.

The SuperH-3, part 14: Patterns for function calls
Aug 22, 2019
Post comments count 2
Post likes count 0

The SuperH-3, part 14: Patterns for function calls

Raymond Chen
Raymond Chen

Different ways of setting up a function call.

The SuperH-3, part 13: Misaligned data, and converting between signed vs unsigned values
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
Raymond Chen

Okay, now we're doing some programming.

The SuperH-3, part 12: Calling convention and function prologues/epilogues
Aug 20, 2019
Post comments count 0
Post likes count 0

The SuperH-3, part 12: Calling convention and function prologues/epilogues

Raymond Chen
Raymond Chen

A typical RISC pattern.

The SuperH-3, part 11: Atomic operations
Aug 19, 2019
Post comments count 1
Post likes count 0

The SuperH-3, part 11: Atomic operations

Raymond Chen
Raymond Chen

How do you create an atomic operation when the processor doesn't support them?

The SuperH-3, part 10: Control transfer
Aug 16, 2019
Post comments count 8
Post likes count 0

The SuperH-3, part 10: Control transfer

Raymond Chen
Raymond Chen

The return of the branch delay slot.

Why is there a huge spike in cruise ship width at 32 meters?
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
Raymond Chen

Squeezing through tight spaces.

The SuperH-3, part 9: Constants
Aug 15, 2019
Post comments count 0
Post likes count 0

The SuperH-3, part 9: Constants

Raymond Chen
Raymond Chen

Squeezing constants into a tiny instruction.

The SuperH-3, part 8: Bit shifting
Aug 14, 2019
Post comments count 2
Post likes count 0

The SuperH-3, part 8: Bit shifting

Raymond Chen
Raymond Chen

Sliding left and right.

The SuperH-3, part 7: Bitwise logical operations
Aug 13, 2019
Post comments count 2
Post likes count 0

The SuperH-3, part 7: Bitwise logical operations

Raymond Chen
Raymond Chen

Just the basic operations, not much fancy.

The SuperH-3, part 6: Division
Aug 12, 2019
Post comments count 4
Post likes count 0

The SuperH-3, part 6: Division

Raymond Chen
Raymond Chen

And you thought multiplication was complicated.

The SuperH-3, part 5: Multiplication
Aug 9, 2019
Post comments count 0
Post likes count 0

The SuperH-3, part 5: Multiplication

Raymond Chen
Raymond Chen

Now things get more complicated.

The SuperH-3, part 4: Basic arithmetic
Aug 8, 2019
Post comments count 6
Post likes count 0

The SuperH-3, part 4: Basic arithmetic

Raymond Chen
Raymond Chen

Basic elementary-school stuff.

How do I fill out the Canadian eTA if I have a green card with no expiration date?
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
Raymond Chen

Use your passport expiration date.

The SuperH-3, part 3: Status flags and miscellaneous instructions
Aug 7, 2019
Post comments count 0
Post likes count 0

The SuperH-3, part 3: Status flags and miscellaneous instructions

Raymond Chen
Raymond Chen

Basically, there's only one flag.

The SuperH-3, part 2: Addressing modes
Aug 6, 2019
Post comments count 4
Post likes count 0

The SuperH-3, part 2: Addressing modes

Raymond Chen
Raymond Chen

Quite a lot for a RISC.

The SuperH-3, part 1: Introduction
Aug 5, 2019
Post comments count 8
Post likes count 0

The SuperH-3, part 1: Introduction

Raymond Chen
Raymond Chen

Digging into the dusty boxes in the closet.

How can I extract the color from a solid color GDI brush?
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
Raymond Chen

You can ask for the object information.

Not actually crossing the airtight hatchway: Applying per-user overrides
Aug 1, 2019
Post comments count 7
Post likes count 1

Not actually crossing the airtight hatchway: Applying per-user overrides

Raymond Chen
Raymond Chen

The user is merely attacking himself.

What about USERSEEUSERDO and GDISEEGDIDO?
Jul 31, 2019
Post comments count 0
Post likes count 1

What about USERSEEUSERDO and GDISEEGDIDO?

Raymond Chen
Raymond Chen

Funny names for funny functions.

Why doesn’t the Programs and Features control panel show Last Used On information?
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
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.

Is it a good idea to let <CODE>WriteProcessMemory</CODE> manage the page protection for me?
Jul 29, 2019
Post comments count 1
Post likes count 1

Is it a good idea to let <CODE>WriteProcessMemory</CODE> manage the page protection for me?

Raymond Chen
Raymond Chen

It's a courtesy, not a contractual obligation.

When it absolutely, positively has to be there for the product demo overnight
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
Raymond Chen

We can make up the time in the air.

Why do pinned apps sometimes go to the end of the taskbar, rather than going into the “pinned apps” section of the taskbar?
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
Raymond Chen

That's not really a "pinned apps" section. It just looks like one.

Adventures in application compatibility: Calling an internal function
Jul 24, 2019
Post comments count 9
Post likes count 1

Adventures in application compatibility: Calling an internal function

Raymond Chen
Raymond Chen

Clearly wandering into unsupported implementation details.

How can I log users off after a period of inactivity, rather than merely locking the workstation? Is there a “logoff” screen saver?
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
Raymond Chen

Putting together some building blocks.

What was the code name for Windows 7?
Jul 22, 2019
Post comments count 13
Post likes count 2

What was the code name for Windows 7?

Raymond Chen
Raymond Chen

Windows 7.

Providing a small amount of additional control over what happens when an asynchronous I/O completes synchronously
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
Raymond Chen

An option named with kernel-colored glasses.

Brännboll: The rules for the casual viewer
Jul 18, 2019
Post comments count 3
Post likes count 1

Brännboll: The rules for the casual viewer

Raymond Chen
Raymond Chen

The minimum you need to know.

After I made my DLL delay-load another DLL, my DLL has started crashing in its process detach code
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
Raymond Chen

You started without it. You should be able to finish without it.

Apollo 11 in real time: Follow the lunar landing mission as it happened
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
Raymond Chen

A fifty-year-old replay.

Windows NT services are assigned a SID based on an SHA-1 hash, but what about the risk of collision?
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
Raymond Chen

Those collisions are going to be hard to manufacture.

That time Dana Carvey went off script at the Microsoft Company Meeting
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
Raymond Chen

Timing is important in investing as well as comedy.

Cricket: The practical exam for 2019
Jul 15, 2019
Post comments count 7
Post likes count 0

Cricket: The practical exam for 2019

Raymond Chen
Raymond Chen

How much did you understand the rules?

My initial confusion when encountering functions whose names begin with <CODE>Co</CODE>
Jul 15, 2019
Post comments count 2
Post likes count 1

My initial confusion when encountering functions whose names begin with <CODE>Co</CODE>

Raymond Chen
Raymond Chen

We aren't in the math department any more.

Detecting in C++ whether a type is defined, part 5: Augmenting the basic pattern
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
Raymond Chen

Making things more convenient for specific scenarios.

Pesäpallo: The rules for the casual viewer
Jul 11, 2019
Post comments count 6
Post likes count 0

Pesäpallo: The rules for the casual viewer

Raymond Chen
Raymond Chen

I wonder how much of this I got right.

Detecting in C++ whether a type is defined, part 4: Predeclaring things you want to probe
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
Raymond Chen

Declaring the thing whose definition you are looking for.

Detecting in C++ whether a type is defined, part 3: SFINAE and incomplete types
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
Raymond Chen

You can give something a name without saying what it is.

Detecting in C++ whether a type is defined, part 2: Giving it a special name
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
Raymond Chen

Maybe it's the real thing, makybe it's a fake.

A difference between cricket and baseball that most people don’t mention
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
Raymond Chen

The pitch invasion.

Detecting in C++ whether a type is defined, part 1: The initial plunge
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
Raymond Chen

Let's play games with unqualified name lookup.

I set the <CODE>OFN_NONETWORKBUTTON</CODE> option in the <CODE>OPENFILENAME</CODE> structure, but it has no effect on the network item in the navigation pane
Baseball: The rules for the casual viewer
Jul 4, 2019
Post comments count 12
Post likes count 0

Baseball: The rules for the casual viewer

Raymond Chen
Raymond Chen

The minimum you need to know.

Generating good error messages from code analysis tools is harder than it looks
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
Raymond Chen

Describing the problem accurately, with enough diagnostics to chase the problem

Why does my attempt to index a collection with the <CODE>x:Bind</CODE> markup extension keep telling me I have an invalid binding path due to an unexpected array indexer?
Cricket: The rules for the casual viewer
Jul 2, 2019
Post comments count 10
Post likes count 0

Cricket: The rules for the casual viewer

Raymond Chen
Raymond Chen

The minimum you need to know.

Microspeak: Ingestion
Jul 2, 2019
Post comments count 3
Post likes count 1

Microspeak: Ingestion

Raymond Chen
Raymond Chen

Let's hope it goes down easily.

A program to detect mojibake that results from a UTF-8-encoded file being misinterpreted as code page 1252
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
Raymond Chen

Because it happens.

2019 mid-year link clearance
Jun 28, 2019
Post comments count 2
Post likes count 1

2019 mid-year link clearance

Raymond Chen
Raymond Chen

Another checkpoint reached.

Why does the <CODE>Get­Version</CODE> function report the major version in the low-order byte, and the minor version in the high-order byte?
Jun 27, 2019
Post comments count 17
Post likes count 1

Why does the <CODE>Get­Version</CODE> function report the major version in the low-order byte, and the minor version in the high-order byte?

Raymond Chen
Raymond Chen

It seemed like a good idea at the time.

Why does Windows list my SSD system drive as removable?
Jun 26, 2019
Post comments count 8
Post likes count 1

Why does Windows list my SSD system drive as removable?

Raymond Chen
Raymond Chen

Because the driver said it was removable.

Why was Windows for Workgroups pejoratively nicknamed Windows for Warehouses?
Jun 25, 2019
Post comments count 16
Post likes count 1

Why was Windows for Workgroups pejoratively nicknamed Windows for Warehouses?

Raymond Chen
Raymond Chen

That's where most of the copies ended up, at least at first.

Detecting whether the <CODE>-opt</CODE> flag was passed to <CODE>cppwinrt.exe</CODE>: Using <CODE>__has_include</CODE>
Jun 24, 2019
Post comments count 0
Post likes count 1

Detecting whether the <CODE>-opt</CODE> flag was passed to <CODE>cppwinrt.exe</CODE>: Using <CODE>__has_include</CODE>

Raymond Chen
Raymond Chen

Looking in the cushions of the couch.

The 2019 Microsoft Giving Campaign Run/Walk comes with some ground rules
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
Raymond Chen

Each rule has a story.

Getting a value from a <CODE>std::variant</CODE> that matches the type fetched from another variant
Jun 20, 2019
Post comments count 3
Post likes count 1

Getting a value from a <CODE>std::variant</CODE> that matches the type fetched from another variant

Raymond Chen
Raymond Chen

A bunch of type fiddling, but you'll get there eventually.

How do I write a function that accepts any type of standard container?
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
Raymond Chen

There's the standard way, and then there's the generous way.

What is WofCompressedData? Does WOF mean that Windows is a dog?
Jun 18, 2019
Post comments count 0
Post likes count 2

What is WofCompressedData? Does WOF mean that Windows is a dog?

Raymond Chen
Raymond Chen

It stands for Windows Overlay Filter, but that name doesn't really tell you much.

A simple workaround for the fact that <CODE>std::equal</CODE> takes its predicate by value
Jun 17, 2019
Post comments count 6
Post likes count 1

A simple workaround for the fact that <CODE>std::equal</CODE> takes its predicate by value

Raymond Chen
Raymond Chen

Pass something else that is easy to copy.

Why does SetFocus fail without telling me why?
Jun 14, 2019
Post comments count 4
Post likes count 1

Why does SetFocus fail without telling me why?

Raymond Chen
Raymond Chen

If you're going to replace part of the operating system, you have to replace the side effects, too.

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?
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
Raymond Chen

They messed up, so make them suffer the consequences, but make the consequences diagnosable.

If you can use GUIDs to reference files, why not use them to remember “recently used” files so they can survive renames and moves?
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
Raymond Chen

Because the file that you think is the same file may not actually be the same file.

What order do the items in the “New” menu appear? It looks kind of random.
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
Raymond Chen

It's alphabetical order, but not in the obvious way.

How can I determine in a C++ header file whether C++/CX is enabled? How about C++/WinRT?
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
Raymond Chen

For conditionally enabling features, say.

The Resource Compiler defaults to CP_ACP, even in the face of subtle hints that the file is UTF-8
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
Raymond Chen

Subtlety is not its strong point.

Why does my C++/WinRT project get errors of the form "Unresolved external symbol <CODE>void* __cdecl winrt_<WBR>make_<WBR>YourNamespace_<WBR>YourClass(void)</CODE>"?
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 <CODE>void* __cdecl winrt_<WBR>make_<WBR>YourNamespace_<WBR>YourClass(void)</CODE>"?

Raymond Chen
Raymond Chen

You enabled optimizations, but there's some extra bookkeeping to support those optimizations.

Why does my C++/WinRT project get errors of the form ‘<CODE>winrt::</CODE><CODE>impl::</CODE><CODE>produce<D, I></CODE>‘: cannot instantiate abstract class, missing method <CODE>GetBindingConnector</CODE>
Jun 5, 2019
Post comments count 1
Post likes count 1

Why does my C++/WinRT project get errors of the form ‘<CODE>winrt::</CODE><CODE>impl::</CODE><CODE>produce<D, I></CODE>‘: cannot instantiate abstract class, missing method <CODE>GetBindingConnector</CODE>

Raymond Chen
Raymond Chen

The header file requirement was always present, but you often got away with omitting it. Not so much any more.

In the file copy conflict dialog, what happened to the option to copy the new file with a numeric suffix?
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
Raymond Chen

It's still there, but you have to dig a little deeper for it.

A bug so cool that the development team was reluctant to fix 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
Raymond Chen

A nice parlor trick, if you had the memory for it.

I called AdjustTokenPrivileges, but I was still told that a necessary privilege was not held
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
Raymond Chen

Which token did you adjust?

Why does my C++/WinRT project get errors of the form “consume_Something: function that returns ‘auto’ cannot be used before it is defined”?
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
Raymond Chen

Narrowing down the source of the missing header file.

Why does my C++/WinRT project get errors of the form “unresolved external symbol … consume_Something”?
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
Raymond Chen

Declared but not defined, but what exactly wasn't defined?

In times of uncertainty, take your cue from the janitor
May 28, 2019
Post comments count 16
Post likes count 1

In times of uncertainty, take your cue from the janitor

Raymond Chen
Raymond Chen

He's been there before.

Why does Explorer’s <I>New</I> menu take so long to appear the first time I open it?
May 28, 2019
Post comments count 13
Post likes count 1

Why does Explorer’s <I>New</I> menu take so long to appear the first time I open it?

Raymond Chen
Raymond Chen

It's trying to figure out what new things it can do.

Programming puzzle: Creating a map of command handlers given only the function pointer
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
Raymond Chen

Creating the magic decoder ring automatically.

Windows Runtime delegates and object lifetime in C++/WinRT
May 24, 2019
Post comments count 0
Post likes count 1

Windows Runtime delegates and object lifetime in C++/WinRT

Raymond Chen
Raymond Chen

So many choices.

Windows Runtime delegates and object lifetime in C++/CX
May 23, 2019
Post comments count 0
Post likes count 1

Windows Runtime delegates and object lifetime in C++/CX

Raymond Chen
Raymond Chen

You specify the lifetime rules, typically weak.

Windows Runtime delegates and object lifetime in C# and other GC languages
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
Raymond Chen

You've left the comfort of the CLR.

The secret signal that tells Windows Runtime events that the event recipient no longer exists
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
Raymond Chen

Watch out that you don't make the signal by mistake.

If each thread’s TEB is referenced by the fs selector, does that mean that the 80386 is limited to 1024 threads?
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
Raymond Chen

They don't all have to be different simultaneously.

When would CopyFile succeed but produce a file filled with zeroes?
May 17, 2019
Post comments count 10
Post likes count 1

When would CopyFile succeed but produce a file filled with zeroes?

Raymond Chen
Raymond Chen

Did the bytes actually make it to the disk?

Why are Bluetooth functions exported from the infrared control panel?
May 16, 2019
Post comments count 7
Post likes count 1

Why are Bluetooth functions exported from the infrared control panel?

Raymond Chen
Raymond Chen

Artifacts of service pack constraints from long ago.

Mundane git commit-tree tricks, Part 7: Combining more than two files into one while preserving line history, manual octopus merging
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
Raymond Chen

Sometimes you just have to take things into your own hands.

Mundane git tricks: Combining two files into one while preserving line history
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
Raymond Chen

Starting with the two-file case.

Mundane git commit-tree tricks, Part 6: Resetting by reusing an earlier tree
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
Raymond Chen

Just take me back.

Mundane git commit-tree tricks, Part 5: Squashing without git rebase
May 10, 2019
Post comments count 1
Post likes count 1

Mundane git commit-tree tricks, Part 5: Squashing without git rebase

Raymond Chen
Raymond Chen

Working completely from trees.

Mundane git commit-tree tricks, Part 4: Changing a squash to a merge
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
Raymond Chen

Retroactively removing a command line switch.

Mundane git commit-tree tricks, Part 3: Building a throwaway commit in order to perform a combined cherry-pick-squash
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
Raymond Chen

You can create a commit just so you can pick it.

Mundane git commit-tree tricks, Part 2: Building a merge commit manually out of a tree
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
Raymond Chen

A variation on a theme.

Mundane git commit-tree tricks, Part 1: Building a commit manually out of a tree
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
Raymond Chen

A little bit of plumbing.

Async-Async: Consequences for exceptions
May 3, 2019
Post comments count 6
Post likes count 1

Async-Async: Consequences for exceptions

Raymond Chen
Raymond Chen

The exception doesn't pop out until later.

Async-Async: Consequences for ordering of multiple calls in flight simultaneously
May 2, 2019
Post comments count 2
Post likes count 1

Async-Async: Consequences for ordering of multiple calls in flight simultaneously

Raymond Chen
Raymond Chen

You don't know when they'll reach the other side.

Async-Async: Consequences for parameters to parallel asynchronous calls
May 1, 2019
Post comments count 5
Post likes count 1

Async-Async: Consequences for parameters to parallel asynchronous calls

Raymond Chen
Raymond Chen

Keep those parameter stable.

Async-Async: Reducing the chattiness of cross-thread asynchronous operations
Apr 30, 2019
Post comments count 1
Post likes count 1

Async-Async: Reducing the chattiness of cross-thread asynchronous operations

Raymond Chen
Raymond Chen

Setting up fakes on both sides.

Spotting problems with destructors for C++ temporaries
Apr 29, 2019
Post comments count 5
Post likes count 1

Spotting problems with destructors for C++ temporaries

Raymond Chen
Raymond Chen

It's sometimes later than you want.

How many ways are there to sort GUIDs? How much time do you have?
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
Raymond Chen

Look at all the pretty snowflakes.

How can I launch an unelevated process from my elevated process, redux
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
Raymond Chen

You can ask to execute it as if had been executed by somebody else.

The administrative assistant who lasted only one day: A legendary prank from days of yore
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
Raymond Chen

When you need to execute a prank effectively, hire a professional.

Why was Texas Hold ‘Em Poker a Windows Ultimate Extra instead of a built-in game?
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
Raymond Chen

Cultural sensitivity.

A little program to look for files with inconsistent line endings
Apr 22, 2019
Post comments count 12
Post likes count 3

A little program to look for files with inconsistent line endings

Raymond Chen
Raymond Chen

Something I wrote.

On resolving the type vs member conflict in C++: The Color Color problem
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
Raymond Chen

You have to nudge the compiler in the right direction.

How arbitrary is the ArbitraryUserPointer in the TEB?
Apr 18, 2019
Post comments count 4
Post likes count 1

How arbitrary is the ArbitraryUserPointer in the TEB?

Raymond Chen
Raymond Chen

Another identifier defined with kernel-colored glasses.

What does this strange value for “Percent CPU” mean in Performance Monitor?
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
Raymond Chen

It's the percent CPU, but you have to undo the various adjustments you requested.

Microspeak: Occupant compression
Apr 16, 2019
Post comments count 10
Post likes count 0

Microspeak: Occupant compression

Raymond Chen
Raymond Chen

Ouch, it hurts when you squeeze me there.

Today is tax day, but it’s also division meeting day, so let’s get you some forms to fill out
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
Raymond Chen

Render unto Caesar, but ask for a little more time.

How can a desktop app use a Windows Runtime object that infers UI context from its thread? The IInitializeWithWindow pattern
Apr 12, 2019
Post comments count 8
Post likes count 1

How can a desktop app use a Windows Runtime object that infers UI context from its thread? The IInitializeWithWindow pattern

Raymond Chen
Raymond Chen

Explicitly associating with a window handle.

How can I determine the reason why my window is closing?
Apr 11, 2019
Post comments count 4
Post likes count 1

How can I determine the reason why my window is closing?

Raymond Chen
Raymond Chen

Listen for signals.

Even if you open a file with GUID, you can still get its name, or at least one of its names
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
Raymond Chen

GetFinalPathByHandle works even for files opened by ID.

When I select multiple files in the File Open dialog, why does the last item come first?
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
Raymond Chen

Because it's the focus.

Optimizing your cafeteria meal card stockpile
Apr 8, 2019
Post comments count 13
Post likes count 1

Optimizing your cafeteria meal card stockpile

Raymond Chen
Raymond Chen

What's the rate of return on Microsoft cafeteria meal cards?

What does it mean when my attempt to stop a Windows NT service fails with ERROR_BROKEN_PIPE?
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
Raymond Chen

The Service Control Manager lost contact with the service, but why?

Why do we need atomic operations on the 80386, if it doesn’t support symmetric multiprocessing anyway?
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
Raymond Chen

You might race with yourself.

Dubious security vulnerability: Code execution via LNK file
Apr 3, 2019
Post comments count 11
Post likes count 1

Dubious security vulnerability: Code execution via LNK file

Raymond Chen
Raymond Chen

The hard part is getting them to execute it in the first place.

On the bogosity of speculation: Guessing the price of the original Surface
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
Raymond Chen

Scraping the barrel.

Oh no, it’s inspection time again
Apr 1, 2019
Post comments count 10
Post likes count 1

Oh no, it’s inspection time again

Raymond Chen
Raymond Chen

Great moments in history.

C++/WinRT envy: Bringing thread switching tasks to C# (WPF and WinForms edition)
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
Raymond Chen

More magic tasks that break out of the thread configuration mold.

C++/WinRT envy: Bringing thread switching tasks to C# (UWP edition)
Mar 28, 2019
Post comments count 20
Post likes count 2

C++/WinRT envy: Bringing thread switching tasks to C# (UWP edition)

Raymond Chen
Raymond Chen

Magic tasks that break out of the thread configuration mold.

How do I wait for the completion of the delegate I passed to <CODE>Core­Dispatcher.</CODE><CODE>Run­Async</CODE> and <CODE>Thread­Pool.</CODE><CODE>Run­Async</CODE>?
When do <CODE>Core­Dispatcher.</CODE><CODE>Run­Async</CODE> and <CODE>Thread­Pool.</CODE><CODE>Run­Async</CODE> actions complete?
Mar 26, 2019
Post comments count 2
Post likes count 0

When do <CODE>Core­Dispatcher.</CODE><CODE>Run­Async</CODE> and <CODE>Thread­Pool.</CODE><CODE>Run­Async</CODE> actions complete?

Raymond Chen
Raymond Chen

When the delegate returns, not when it completes.

What does the N in nmake stand for?
Mar 25, 2019
Post comments count 6
Post likes count 1

What does the N in nmake stand for?

Raymond Chen
Raymond Chen

It's old now, but at the time, it was new.

Vintage Computer Festival Pacific Northwest 2019
Mar 22, 2019
Post comments count 0
Post likes count 0

Vintage Computer Festival Pacific Northwest 2019

Raymond Chen
Raymond Chen

For all your retro-computing gawking.

Turning anything into a fire-and-forget coroutine
Mar 22, 2019
Post comments count 3
Post likes count 1

Turning anything into a fire-and-forget coroutine

Raymond Chen
Raymond Chen

Turning on the metaprogramming.

Expressing fire-and-forget coroutines more explicitly, -or- How to turn any coroutine into fire-and-forget
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
Raymond Chen

Putting it at the call site instead of in the function itself.

<CODE>winrt::fire_and_forget</CODE> was too forgetful
Mar 20, 2019
Post comments count 3
Post likes count 1

<CODE>winrt::fire_and_forget</CODE> was too forgetful

Raymond Chen
Raymond Chen

Usually, you don't care when it finishes, as long as it does.

Why does my app’s uninstaller disappear from the Start menu?
Mar 19, 2019
Post comments count 19
Post likes count 1

Why does my app’s uninstaller disappear from the Start menu?

Raymond Chen
Raymond Chen

Keeping things tidy.

How do I design a class so that methods must be called in a certain order?
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
Raymond Chen

Consider it a chain of operation objects.

How can we use IsBadWritePtr to fix a buffer overflow, if IsBadWritePtr is itself bad?
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
Raymond Chen

Don't catch the overflow as it happens. Stop the overflow before it happens.

Resolving security issues sometimes involves its own degree of managing people’s egos
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
Raymond Chen

It's not purely technical. There's sociology here, too.

Welcome to my new home on the Microsoft Developer Tools and Services blog site
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
Raymond Chen

Pardon the dust.

Why is there a limit of 15 shell icon overlays?
Mar 13, 2019
Post comments count 14
Post likes count 1

Why is there a limit of 15 shell icon overlays?

Raymond Chen
Raymond Chen

Ran out of bits.

Asking for clear written documentation that “Require trusted path for credential entry” is no longer recommended
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
Raymond Chen

It was never recommended in the first place.

Precision questioning: The cynical description
Mar 11, 2019
Post comments count 0
Post likes count 1

Precision questioning: The cynical description

Raymond Chen
Raymond Chen

Just keep digging.

Even if your assembly language code doesn’t call any Windows APIs, you still have to follow the ABI
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
Raymond Chen

You're not off by yourself; you're part of a society.

What order are pages in a memory-mapped file flushed out to disk?
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
Raymond Chen

There isn't one.

How do I destruct an object that keeps a reference to itself, because that reference prevents the object from being destructed
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
Raymond Chen

Keep a reference to the right thing.

Predator-prey reversal: Rock lobsters vs whelks on Malgas Island and Marcus Island
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
Raymond Chen

Multiple stable configurations.

Alternate definitions for English words, as inferred from bug reports
Mar 5, 2019
Post comments count 0
Post likes count 1

Alternate definitions for English words, as inferred from bug reports

Raymond Chen
Raymond Chen

Lost in translation.

My initial frustration trying to configure our internal VoIP phones that were integrated with instant messaging
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
Raymond Chen

A combination of settings that the feature team considered nonsensical.

How to compare two packed bitfields without having to unpack each field
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
Raymond Chen

The magic carry-out vector.

How should I report errors from my Windows Runtime API?
Feb 28, 2019
Post comments count 0
Post likes count 1

How should I report errors from my Windows Runtime API?

Raymond Chen
Raymond Chen

It depends on what kind of error it is.

The std::map subscript operator is a convenience, but a potentially dangerous one
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
Raymond Chen

It makes code easy to read, but things happen behind the scenes you may not be expecting.

How to draw a nifty text box in your email message
Feb 26, 2019
Post comments count 0
Post likes count 1

How to draw a nifty text box in your email message

Raymond Chen
Raymond Chen

This one weird trick.

That time the CEO of a company complained to Congress about Windows file extensions
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
Raymond Chen

Four fingers pointing back.

The 2019/2020 Seattle Symphony subscription season at a glance
Feb 22, 2019
Post comments count 0
Post likes count 0

The 2019/2020 Seattle Symphony subscription season at a glance

Raymond Chen
Raymond Chen

The pocket reference guide for 2019/2020.

How do I permit a minus sign to be entered into my edit control, but only if it’s the first character?
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
Raymond Chen

Check the insertion point.

How do I allow negative numbers with the <CODE>ES_NUMBER</CODE> edit control style?
Feb 21, 2019
Post comments count 0
Post likes count 0

How do I allow negative numbers with the <CODE>ES_NUMBER</CODE> edit control style?

Raymond Chen
Raymond Chen

You'll have to roll your own.

The early history of the <CODE>ES_NUMBER</CODE> edit control style
Feb 20, 2019
Post comments count 0
Post likes count 1

The early history of the <CODE>ES_NUMBER</CODE> edit control style

Raymond Chen
Raymond Chen

It's just a little style bit.

How do I convert all these strange Unicode digits into the ones I remember from Sesame Street?
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
Raymond Chen

Know when to fold'em.

How can I check in Win32 whether a Unicode character is any kind of digit?
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
Raymond Chen

Ask for its character type.

Accidentally creating a choke point for what was supposed to hand work off quickly to a background task, part 3
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
Raymond Chen

Keeping the MTA alive without a thread.

Accidentally creating a choke point for what was supposed to hand work off quickly to a background task, part 2
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
Raymond Chen

Synchronizing on the thread pool makes you wait for the thread pool.

Accidentally creating a choke point for what was supposed to hand work off quickly to a background task, part 1
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
Raymond Chen

A few simple decisions accumulate and interact.

The Intel 80386, part 17: Future developments
Feb 12, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 17: Future developments

Raymond Chen
Raymond Chen

Where we went next.

The Intel 80386, part 16: Code walkthrough
Feb 10, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 16: Code walkthrough

Raymond Chen
Raymond Chen

Putting the information into practice.

The Intel 80386, part 15: Common compiler-generated code sequences
Feb 7, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 15: Common compiler-generated code sequences

Raymond Chen
Raymond Chen

Recognizing the patterns.

The Intel 80386, part 14: Rescuing a stack trace after the debugger gave up when it reached an FPO function
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
Raymond Chen

Pretend to be the computer.

The Intel 80386, part 13: Calling conventions
Feb 5, 2019
Post comments count 0
Post likes count 1

The Intel 80386, part 13: Calling conventions

Raymond Chen
Raymond Chen

A refresher course.

The Intel 80386, part 12: The stuff you don’t need to know
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
Raymond Chen

For completeness but not for usefulness.

The Intel 80386, part 11: The TEB
Feb 3, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 11: The TEB

Raymond Chen
Raymond Chen

I need another register, let's see what scraps I can find.

The Intel 80386, part 10: Atomic operations and memory alignment
Jan 31, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 10: Atomic operations and memory alignment

Raymond Chen
Raymond Chen

Not much to work from.

The Intel 80386, part 9: Stack frame instructions
Jan 30, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 9: Stack frame instructions

Raymond Chen
Raymond Chen

For creating and tearing down stack frames.

The Intel 80386, part 8: Block operations
Jan 29, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 8: Block operations

Raymond Chen
Raymond Chen

One of the highly specialized groups of instructions.

The Intel 80386, part 7: Conditional instructions and control transfer
Jan 28, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 7: Conditional instructions and control transfer

Raymond Chen
Raymond Chen

Maybe yes, maybe no.

The Intel 80386, part 6: Data transfer instructions
Jan 27, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 6: Data transfer instructions

Raymond Chen
Raymond Chen

Keeping things moving.

The Intel 80386, part 5: Logical operations
Jan 24, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 5: Logical operations

Raymond Chen
Raymond Chen

Fiddling with bits.

The Intel 80386, part 4: Arithmetic
Jan 23, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 4: Arithmetic

Raymond Chen
Raymond Chen

The things that computers do.

The Intel 80386, part 3: Flags and condition codes
Jan 22, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 3: Flags and condition codes

Raymond Chen
Raymond Chen

It's just a bunch of stuff that happened.

The Intel 80386, part 2: Memory addressing modes
Jan 21, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 2: Memory addressing modes

Raymond Chen
Raymond Chen

Thirteen different ways to access memory.

The Intel 80386, part 1: Introduction
Jan 20, 2019
Post comments count 0
Post likes count 0

The Intel 80386, part 1: Introduction

Raymond Chen
Raymond Chen

Hitting a bit closer to home.

How do I get the effect of C#’s async void in a C++ coroutine? Part 3: Simplifying the boilerplate
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
Raymond Chen

Factoring it out.

How do I get the effect of C#’s async void in a C++ coroutine? Part 2: Keeping track of the lifetimes
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
Raymond Chen

There are two types of lambdas you have to write, so why not write two lambdas?

How do I get the effect of C#’s <CODE>async void</CODE> in a C++ coroutine? Part 1: Why does the obvious solution crash?
Jan 16, 2019
Post comments count 0
Post likes count 2

How do I get the effect of C#’s <CODE>async void</CODE> in a C++ coroutine? Part 1: Why does the obvious solution crash?

Raymond Chen
Raymond Chen

Wrap it up, but watch out how you do it.

Don’t pass lambdas (or other multi-line entities) as parameters to macros
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
Raymond Chen

It makes debugging much more difficult.

Why would the incremental linker insert padding between section fragments?
Jan 14, 2019
Post comments count 0
Post likes count 1

Why would the incremental linker insert padding between section fragments?

Raymond Chen
Raymond Chen

So it can be incremental more easily.

Why do we even need to define a red zone? Can’t I just use my stack for anything?
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
Raymond Chen

I mean, it's my stack, isn't it?

Why am I getting mojibake when I try to create a window?
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
Raymond Chen

Look for the character set mismatch.

It rather involved being on the other side of this airtight hatchway: Messing with somebody’s registry
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
Raymond Chen

Getting to the other side is left as an exercise.

<CODE>STATUS_<WBR>STACK_<WBR>BUFFER_<WBR>OVERRUN</CODE> doesn’t mean that there was a stack buffer overrun
Jan 8, 2019
Post comments count 0
Post likes count 2

<CODE>STATUS_<WBR>STACK_<WBR>BUFFER_<WBR>OVERRUN</CODE> doesn’t mean that there was a stack buffer overrun

Raymond Chen
Raymond Chen

It used to mean that, but now it can mean other things, too.

The GetRegionData function fails if the buffer is allocated on the stack. Is it allergic to stack memory or something?
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
Raymond Chen

One of the lesser-known ground rules.

A trick for keeping an object alive in a C++ lambda while still being able to use the <CODE>this</CODE> keyword to refer to it
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 <CODE>this</CODE> keyword to refer to it

Raymond Chen
Raymond Chen

Capture it twice, once for the money, and once for the show.

Why am I getting mojibake when I try to create a shell link?
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
Raymond Chen

Make sure the thing you ask for is the thing you want.

How can I prevent a WebView control from opening a browser window?
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
Raymond Chen

It will check with you first, but you have to be listening.

Why does the elevation prompt have only the wallpaper as its background?
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
Raymond Chen

Caught unprepared.

2018 year-end link clearance
Dec 31, 2018
Post comments count 0
Post likes count 1

2018 year-end link clearance

Raymond Chen
Raymond Chen

We made it to the end!

The case of the orphaned critical section despite being managed by an RAII type
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
Raymond Chen

Rolling up the debugging sleeves.

<CODE>SHOpenRegStream</CODE> does not mix with smart pointers
Dec 27, 2018
Post comments count 0
Post likes count 1

<CODE>SHOpenRegStream</CODE> does not mix with smart pointers

Raymond Chen
Raymond Chen

Old school meets new school, again.

Don’t forget: std::pair does lexicographical ordering, so you don’t have to
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
Raymond Chen

Let it do the comparing.

How do I save the results of a file search in Explorer? Not the query itself, but the results
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
Raymond Chen

Copy them to the clipboard.

Random internal Windows terminology: IDW, Razzle, and their forgotten partners IDS and Dazzle
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
Raymond Chen

A peek behind the history of the terms.

On the attempts to resurrect Space Cadet Pinball
Dec 21, 2018
Post comments count 0
Post likes count 1

On the attempts to resurrect Space Cadet Pinball

Raymond Chen
Raymond Chen

Not many options remain.

In 16-bit Windows, some per-process data structures were really per-data segment
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
Raymond Chen

You just have to set up a private data segment.

It rather involved being on the other side of this airtight hatchway: Hanging the loader
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
Raymond Chen

You're already there. No need to brag.

How come Explorer reports higher disk space used on my volume than my third party disk space tool?
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
Raymond Chen

It's probably in a place your tool can't see.

Not getting past the title: This is not the bug you’re looking for
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
Raymond Chen

The title contains the same word, but that's about the only thing that's the same.

The case of the mysterious LoadLibrary error message after signing in
Dec 14, 2018
Post comments count 0
Post likes count 1

The case of the mysterious LoadLibrary error message after signing in

Raymond Chen
Raymond Chen

A little screen shot forensics.

How can I programmatically wait until the taskbar has finished booting completely before I create my notification icon?
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
Raymond Chen

It will let you know.

How can I programmatically wait until the system has finished booting completely before doing my own computations?
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
Raymond Chen

Your observation of the system mutates the system.

Why doesn’t my lock screen image change after I replace the image file?
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
Raymond Chen

It got captured when it was set.

When a customer asks for something unsupported, and they promise not to get upset when it stops working, don’t believe them
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
Raymond Chen

Because they'll be back.

The case of the buffer overflow vulnerability that was neither a buffer overflow nor a vulnerability
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
Raymond Chen

Not quite knowing how assembly language works, I guess.

Xformer 10: The Atari 800 emulator has gotten a huge update
Dec 6, 2018
Post comments count 0
Post likes count 0

Xformer 10: The Atari 800 emulator has gotten a huge update

Raymond Chen
Raymond Chen

It's over 30 years old, but can still be improved, and it sure did.

How is it that WriteProcessMemory succeeds in writing to read-only memory?
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
Raymond Chen

Because it tries really hard.

How can dereferencing the first character of a string take longer when the string is longer? I’m looking only at the first character, which should be constant time
The plural of Nexus is Nexūs, in case you cared (which you almost certainly don’t)
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
Raymond Chen

Only for Latin nerds.

Why can’t I close windows directly from the Alt+Tab interface in Windows Vista?
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
Raymond Chen

Elevation and interruption.

Choosing error codes based on a really nice <CODE>#define</CODE> doesn’t necessarily lead to a readable message to the user
Dec 3, 2018
Post comments count 0
Post likes count 1

Choosing error codes based on a really nice <CODE>#define</CODE> doesn’t necessarily lead to a readable message to the user

Raymond Chen
Raymond Chen

Device not ready? What device?

Why does Clipboard.SetData put extra junk in the clipboard data? And how can I get it to stop?
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
Raymond Chen

Strings and things, but you need the things.

Taking advantage of the ordering guarantees of the LINQ GroupBy method
Nov 29, 2018
Post comments count 0
Post likes count 1

Taking advantage of the ordering guarantees of the LINQ GroupBy method

Raymond Chen
Raymond Chen

Sorting and grouping in a particular way.

What happens if I mutate a string in a p/invoke?
Nov 28, 2018
Post comments count 0
Post likes count 1

What happens if I mutate a string in a p/invoke?

Raymond Chen
Raymond Chen

It seems to work, for specific meanings of "seems".

Nifty trick: Combining constructor with collection initializer
Nov 27, 2018
Post comments count 0
Post likes count 1

Nifty trick: Combining constructor with collection initializer

Raymond Chen
Raymond Chen

Two great tastes that work great together.

What’s up with Code Analysis rule CA2202: Do not dispose objects multiple times?
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
Raymond Chen

It's trying to get inside your head.

If activation of your gift card lasts more than four hours, consult a physician immediately
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
Raymond Chen

Is it ready yet?

The default number of threads in an I/O completion port is the number of processors, but is that logical or physical processors?
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
Raymond Chen

How much stuff can happen at once?

How can I make a dialog box right-to-left at runtime?
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
Raymond Chen

You'll have to get that style change in quickly.

Trying to allocate the same virtual address in multiple processes
Nov 21, 2018
Post comments count 0
Post likes count 1

Trying to allocate the same virtual address in multiple processes

Raymond Chen
Raymond Chen

But what are you going to put there?

For a brief period, the kernel tried to deal with gamma rays corrupting the processor cache
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
Raymond Chen

Not sure what good it does.

How do I suppress the “Did you mean to switch apps?” warning message from my XAML WebView control?
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
Raymond Chen

It will ask you what to do, and you can tell it to do nothing.

The Moncler 1 Pierpaolo Piccioli, your high fashion for the elegant parties that take place in a walk-in freezer
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
Raymond Chen

I'm sure it looks better after you unpack it from the bubble wrap.

Closing the race window between creating a suspended process and putting it in a job
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
Raymond Chen

Start it there from the beginning.

Songs with every other beat removed, how to make your own!
Nov 15, 2018
Post comments count 0
Post likes count 0

Songs with every other beat removed, how to make your own!

Raymond Chen
Raymond Chen

Sounds familiar, but oddly wrong.

How do I revert a control back to its default theme?
Nov 15, 2018
Post comments count 0
Post likes count 2

How do I revert a control back to its default theme?

Raymond Chen
Raymond Chen

The special signal.

What’s the point of passing a never-signaled event to MsgWaitForMultipleObjects?
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
Raymond Chen

It's a placeholder for something that didn't need a placeholder.

Saying good-bye to the original Microsoft Redmond campus
Nov 13, 2018
Post comments count 0
Post likes count 0

Saying good-bye to the original Microsoft Redmond campus

Raymond Chen
Raymond Chen

The home of many memories, perhaps not all good ones.

The case of the System process that consumed a lot of CPU
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
Raymond Chen

Let's look at the performance trace.

Gotchas when using linker sections to arrange data, part 2
Nov 9, 2018
Post comments count 0
Post likes count 1

Gotchas when using linker sections to arrange data, part 2

Raymond Chen
Raymond Chen

An unexpected null could throw the whole thing out of alignment.

Gotchas when using linker sections to arrange data, part 1
Nov 8, 2018
Post comments count 0
Post likes count 2

Gotchas when using linker sections to arrange data, part 1

Raymond Chen
Raymond Chen

Nulls can show up in unexpected places.

Using linker segments and __declspec(allocate(…)) to arrange data in a specific order
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
Raymond Chen

Getting the ducks in a row, in order.

Dubious security vulnerability: A program that adds a user to the Administrators group in the usual way
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
Raymond Chen

This is a perfectly legitimate program.

Sure, you can implement your own cryptographic service provider for a standard algorithm, but why would you?
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
Raymond Chen

You are signing up for a very big world of hurt.

Why does the MonthCalendar control show the wrong week numbers in Romania?
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
Raymond Chen

Wrong from whose point of view?

In the state of Washington, you are allowed to turn left on a red light onto a one-way street
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
Raymond Chen

And freeway onramps count as one-way streets.

If the prototypes of DispatchMessageA and DispatchMessageW are identical, why have both?
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
Raymond Chen

Because there's still a character set dependency.

Dulce et decorum est pro patria party
Oct 31, 2018
Post comments count 0
Post likes count 2

Dulce et decorum est pro patria party

Raymond Chen
Raymond Chen

Anyone up for a toga party?

What happened to the Arial Unicode MS font?
Oct 30, 2018
Post comments count 0
Post likes count 1

What happened to the Arial Unicode MS font?

Raymond Chen
Raymond Chen

It couldn't do what it was originally created to do.

The case of the oplock deadlock poppycock
Oct 29, 2018
Post comments count 0
Post likes count 1

The case of the oplock deadlock poppycock

Raymond Chen
Raymond Chen

Call Sherlock.

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
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
Raymond Chen

A little nudging here, a little nudging there.

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
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
Raymond Chen

Make <I>everything</I> a multiple of five.

Adding a Ctrl+arrow accelerator for moving the trackbar by just one unit, part 2: Second try
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
Raymond Chen

Intercepting the thumb motion.

Adding a Ctrl+arrow accelerator for moving the trackbar by just one unit, part 1: Initial plunge
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
Raymond Chen

The obvious thing starts to get out of hand.

Why does the Entry Point Not Found error dialog sometimes not include the name of the missing entry point?
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
Raymond Chen

Because the name is too long.

File-extending writes are not always synchronous, which is entirely within the contract
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
Raymond Chen

It is an option but not a requirement.

After reporting a non-responsive program to Windows Error Reporting, why does the process spawn a suspended child process?
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
Raymond Chen

That's just a ghost, a shadow of the original.

What does the “Ae” stand for in AeDebug?
Oct 17, 2018
Post comments count 0
Post likes count 2

What does the “Ae” stand for in AeDebug?

Raymond Chen
Raymond Chen

I'm not sure, but I think it's Application Error.

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?
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
Raymond Chen

It's just double-checking after the situation has changed.

How can I programmatically inspect and manipulate a registry hive file without mounting it?
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
Raymond Chen

Enter the offline registry library.

So, um, what are we looking at?
Oct 12, 2018
Post comments count 0
Post likes count 1

So, um, what are we looking at?

Raymond Chen
Raymond Chen

The wonders of nature, perhaps.

Why doesn’t GetTextExtentPoint return the correct extent for strings containing tabs?
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
Raymond Chen

It doesn't do carriage control.

How can I include/exclude specific memory blocks in user-mode crash dumps?
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
Raymond Chen

Add it to the inclusion or exclusion list.

Notes on DrawText and tab stops
Oct 10, 2018
Post comments count 0
Post likes count 2

Notes on DrawText and tab stops

Raymond Chen
Raymond Chen

You can ask, but then you can't ask for other things, unless you ask a different way.

The numerology of the sample directory listing in the Windows 95 font selector property sheet page
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
Raymond Chen

Leave a thumbprint.

When I call <CODE>Crypt­Protect­Data</CODE> with the same parameters, why aren’t the results identical?
Oct 8, 2018
Post comments count 0
Post likes count 1

When I call <CODE>Crypt­Protect­Data</CODE> with the same parameters, why aren’t the results identical?

Raymond Chen
Raymond Chen

A little added seasoning.

How can I use <CODE>WS_</CODE><CODE>CLIP­CHILDREN</CODE> and still be able to draw a control with a transparent background?
Oct 5, 2018
Post comments count 0
Post likes count 1

How can I use <CODE>WS_</CODE><CODE>CLIP­CHILDREN</CODE> and still be able to draw a control with a transparent background?

Raymond Chen
Raymond Chen

Removing all the barriers to painting, perhaps too many.

Can I be sure that turning on automatic generation of short file names will get me short file names?
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
Raymond Chen

You can try hard, but it may not succeed.

Practical example of why you need to leave room for German localization
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
Raymond Chen

Try to say it all in one breath.

All sorts of bad things happen when we disable the Task Scheduler service, is that bad?
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
Raymond Chen

Well, it sure doesn't sound good.

Generating a table with vertical text, like I did with the sad history of the C++ <CODE>throw(…)</CODE> exception specifier
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++ <CODE>throw(…)</CODE> exception specifier

Raymond Chen
Raymond Chen

Here's how I did it.

The sad history of the C++ <CODE>throw(…)</CODE> exception specifier
Sep 28, 2018
Post comments count 0
Post likes count 2

The sad history of the C++ <CODE>throw(…)</CODE> exception specifier

Raymond Chen
Raymond Chen

I promise not to throw, but who's going to check?

Can you wear wallpaper on your feet? You can if it’s a PARTY.BMP!
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
Raymond Chen

Wearing your history.

Considering the performance implications of converting recursion to an explicit stack
Sep 27, 2018
Post comments count 0
Post likes count 2

Considering the performance implications of converting recursion to an explicit stack

Raymond Chen
Raymond Chen

Another game of trade-offs and balances.

What does the thread parameter to <CODE>Set­Windows­Hook­Ex</CODE> actually mean?
Sep 26, 2018
Post comments count 0
Post likes count 1

What does the thread parameter to <CODE>Set­Windows­Hook­Ex</CODE> actually mean?

Raymond Chen
Raymond Chen

What does it mean to be "associated" with a thread?

How do I prevent my program’s temporary documents from appearing in Search?
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
Raymond Chen

Put them in the right place.

Why does the compiler turn my conditional loop into an infinite one?
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
Raymond Chen

It's all in the threading.

Why is <CODE>regsvr32</CODE> exiting with code 3?
Sep 21, 2018
Post comments count 0
Post likes count 1

Why is <CODE>regsvr32</CODE> exiting with code 3?

Raymond Chen
Raymond Chen

Coming up with theories and ways to test those theories.

What do the various <CODE>regsvr32</CODE> exit codes mean?
Sep 20, 2018
Post comments count 0
Post likes count 1

What do the various <CODE>regsvr32</CODE> exit codes mean?

Raymond Chen
Raymond Chen

Reporting which step the problem occurred at.

Why did every Windows 3.0 DLL have an exported function called WEP?
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
Raymond Chen

The Windows Exit Procedure.

Why is Alt+F4 the hotkey for closing a window? Why not Alt+F5 or Alt+F3?
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
Raymond Chen

It was the next one available.

A lack of species sensitivity when serving pizza to guests
Sep 17, 2018
Post comments count 0
Post likes count 1

A lack of species sensitivity when serving pizza to guests

Raymond Chen
Raymond Chen

This bacon thing is getting out of hand.

What defines an old-style common dialog?
Sep 17, 2018
Post comments count 0
Post likes count 1

What defines an old-style common dialog?

Raymond Chen
Raymond Chen

Going back into the Before Time.

Why does the Zune HD have the message “For our Princess” on the inside of the case, and why is she a princess?
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
Raymond Chen

A tribute to a team member who passed away.

Raising the colon off the ground
Sep 13, 2018
Post comments count 0
Post likes count 1

Raising the colon off the ground

Raymond Chen
Raymond Chen

Not something your gastroenterologist says, surprisingly.

Anything is a soldering kit if you’re brave enough: The MOnSter 6502
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
Raymond Chen

Are you nuts? Probably.

How do I get the system to run my program in this very special way?
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
Raymond Chen

You can set up the special way yourself.

Le Chatelier’s principle in action: Notifications
Sep 11, 2018
Post comments count 0
Post likes count 1

Le Chatelier’s principle in action: Notifications

Raymond Chen
Raymond Chen

Let me notify you about things you don't care about.

How can I conditionally compile based on a preprocessor macro value, while ensuring that the macro is correctly spelled?
Sep 10, 2018
Post comments count 0
Post likes count 1

How can I conditionally compile based on a preprocessor macro value, while ensuring that the macro is correctly spelled?

Raymond Chen
Raymond Chen

Another stupid preprocessor trick.

Removing the <CODE>Terminate­Thread</CODE> from a DLL that needs to shut down a helper thread at unload
Sep 7, 2018
Post comments count 0
Post likes count 1

Removing the <CODE>Terminate­Thread</CODE> from a DLL that needs to shut down a helper thread at unload

Raymond Chen
Raymond Chen

Designing it out again.

What does it mean for a window to be Unicode?
Sep 6, 2018
Post comments count 0
Post likes count 1

What does it mean for a window to be Unicode?

Raymond Chen
Raymond Chen

The expected character set of the current window procedure.

How do I request that my out-of-process COM server run unelevated?
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
Raymond Chen

Back to the interactive user.

Apparently they know more information about me than me, but dare I ask?
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
Raymond Chen

Blind content retweeting.

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
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
Raymond Chen

Well, we've got the nameplate at least.

Removing the <CODE>Terminate­Thread</CODE> from code that waits for a job object to empty
Aug 31, 2018
Post comments count 0
Post likes count 1

Removing the <CODE>Terminate­Thread</CODE> from code that waits for a job object to empty

Raymond Chen
Raymond Chen

Designing it out.

The early history of Windows file attributes, and why there is a gap between System and Directory
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
Raymond Chen

One, two, four, sixteen.

Obsolete Microspeak: TDBN and the six-pack
Aug 29, 2018
Post comments count 0
Post likes count 0

Obsolete Microspeak: TDBN and the six-pack

Raymond Chen
Raymond Chen

Old Windows 8 terminology.

The evolution of Windows 8 charms
Aug 28, 2018
Post comments count 0
Post likes count 1

The evolution of Windows 8 charms

Raymond Chen
Raymond Chen

For regaling people at your next cocktail party, perhaps.

How do I force the Task Manager window closed whenever it opens?
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
Raymond Chen

Um, that's not really your decision.

The Windows 95 team were proud slackers
Aug 24, 2018
Post comments count 0
Post likes count 1

The Windows 95 team were proud slackers

Raymond Chen
Raymond Chen

Another adopted slight.

The PowerPC 600 series, part 14: Code walkthrough
Aug 23, 2018
Post comments count 0
Post likes count 0

The PowerPC 600 series, part 14: Code walkthrough

Raymond Chen
Raymond Chen

Putting the theory into practice.

The PowerPC 600 series, part 13: Common patterns
Aug 22, 2018
Post comments count 0
Post likes count 0

The PowerPC 600 series, part 13: Common patterns

Raymond Chen
Raymond Chen

How to recognize different kinds of jumps and calls.

The PowerPC 600 series, part 12: Leaf functions
Aug 21, 2018
Post comments count 0
Post likes count 0

The PowerPC 600 series, part 12: Leaf functions

Raymond Chen
Raymond Chen

Making do with what you are given.

The PowerPC 600 series, part 11: Glue routines
Aug 20, 2018
Post comments count 0
Post likes count 0

The PowerPC 600 series, part 11: Glue routines

Raymond Chen
Raymond Chen

Binding the two sides together.

The PowerPC 600 series, part 10: Passing parameters, function prologues and epilogues
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
Raymond Chen

The most dangerous parts of flying a function are take-off and landing.

The PowerPC 600 series, part 9: The table of contents
Aug 16, 2018
Post comments count 0
Post likes count 0

The PowerPC 600 series, part 9: The table of contents

Raymond Chen
Raymond Chen

Finding your bearings.

The PowerPC 600 series, part 8: Control transfer
Aug 15, 2018
Post comments count 0
Post likes count 0

The PowerPC 600 series, part 8: Control transfer

Raymond Chen
Raymond Chen

Jump around.

The PowerPC 600 series, part 7: Atomic memory access and cache coherency
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
Raymond Chen

How to avoid a break-up.

The PowerPC 600 series, part 6: Memory access
Aug 13, 2018
Post comments count 0
Post likes count 0

The PowerPC 600 series, part 6: Memory access

Raymond Chen
Raymond Chen

Load 'em up.

The PowerPC 600 series, part 5: Rotates and shifts
Aug 10, 2018
Post comments count 0
Post likes count 1

The PowerPC 600 series, part 5: Rotates and shifts

Raymond Chen
Raymond Chen

Get out your Swiss army knife.

The PowerPC 600 series, part 4: Bitwise operations and constants
Aug 9, 2018
Post comments count 0
Post likes count 0

The PowerPC 600 series, part 4: Bitwise operations and constants

Raymond Chen
Raymond Chen

Twiddling around.

The PowerPC 600 series, part 3: Arithmetic
Aug 8, 2018
Post comments count 0
Post likes count 0

The PowerPC 600 series, part 3: Arithmetic

Raymond Chen
Raymond Chen

Who knew there were so many ways to add numbers.

The PowerPC 600 series, part 2: Condition registers and the integer exception register
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
Raymond Chen

Keeping track of things that happened.

The PowerPC 600 series, part 1: Introduction
Aug 6, 2018
Post comments count 0
Post likes count 0

The PowerPC 600 series, part 1: Introduction

Raymond Chen
Raymond Chen

Here we go again.

A puzzle aboard the Anacortes-Sidney ferry: How do the cars get off?
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
Raymond Chen

At an apparent impasse.

Creating an awaitable lock for WinJS and JavaScript Promises
Aug 3, 2018
Post comments count 0
Post likes count 1

Creating an awaitable lock for WinJS and JavaScript Promises

Raymond Chen
Raymond Chen

Rolling onward.

Creating an awaitable lock for C++ PPL tasks
Aug 2, 2018
Post comments count 0
Post likes count 1

Creating an awaitable lock for C++ PPL tasks

Raymond Chen
Raymond Chen

Rolling our own.

Creating an apartment-aware PPL task from nothing
Aug 1, 2018
Post comments count 0
Post likes count 1

Creating an apartment-aware PPL task from nothing

Raymond Chen
Raymond Chen

It says it has to be <CODE>IAsync­Action</CODE>- or <CODE>IAync­Operation<T></CODE>-derived, so let's do that.

Server names: One of the remaining places where IT managers can be a little silly
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
Raymond Chen

Usually by establishing a theme.

Dark Pattern: Opt-in above the fold, but opt-out below the fold
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
Raymond Chen

Don't stop yet. Read all the way to the end.

Is the <CODE>Terminate­Thread</CODE> function synchronous?
Jul 27, 2018
Post comments count 0
Post likes count 1

Is the <CODE>Terminate­Thread</CODE> function synchronous?

Raymond Chen
Raymond Chen

Nope. It merely starts the termination but does not wait for the termination to complete.

What happens to custom unhandled exception filters if a debugger is not running?
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
Raymond Chen

Nothing, that's what. Absolutely nothing.

Why are my file write operations synchronous, even though I opened the file as <CODE>FILE_<CODE></CODE>FLAG_<CODE></CODE>OVERLAPPED</CODE>?
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 <CODE>FILE_<CODE></CODE>FLAG_<CODE></CODE>OVERLAPPED</CODE>?

Raymond Chen
Raymond Chen

Extending the valid bytes is always synchronous.

Pushing the boundaries of cryptography in a security vulnerability report
Jul 24, 2018
Post comments count 0
Post likes count 1

Pushing the boundaries of cryptography in a security vulnerability report

Raymond Chen
Raymond Chen

If it's what you say, then you don't need a supercomputer.

The heavy metal umlaut reaches baked goods
Jul 23, 2018
Post comments count 0
Post likes count 1

The heavy metal umlaut reaches baked goods

Raymond Chen
Raymond Chen

For that extra Germanic oomph.

How do I trigger an EN_UPDATE notification for all of my edit controls when the user’s locale information changes?
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
Raymond Chen

It's your edit control, so you can do it yourself.

How can I get the actual window procedure address and not a thunk?
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
Raymond Chen

Match the character set of the top-level window procedure.

When is it appropriate to use the current processor number as an optimization hint?
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
Raymond Chen

Try not to let it slip out from under you.

Sure I can protect data with CryptProtectData, but how do I remove the ability to decrypt it?
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
Raymond Chen

You can put a secret in the nonce, though it's not really a secret by that point.

What is this vmmem program that is using up all my CPU and memory?
Jul 17, 2018
Post comments count 0
Post likes count 13

What is this vmmem program that is using up all my CPU and memory?

Raymond Chen
Raymond Chen

That's where your virtual machine resource usage goes.

Internal training video on expense reports contains inconsistency: Alert the media!
Jul 16, 2018
Post comments count 0
Post likes count 1

Internal training video on expense reports contains inconsistency: Alert the media!

Raymond Chen
Raymond Chen

Was this a test? I'm not sure.

Warning: Ruler is not to scale
Jul 13, 2018
Post comments count 0
Post likes count 1

Warning: Ruler is not to scale

Raymond Chen
Raymond Chen

Inches enlarged to show texture.

When generating a random password, the result must still be a valid string
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
Raymond Chen

Invalid strings can't round trip through multiple encodings.

Why does a non-recursive <CODE>Read­Directory­ChangesW</CODE> still report files created inside subdirectories?
Jul 12, 2018
Post comments count 0
Post likes count 1

Why does a non-recursive <CODE>Read­Directory­ChangesW</CODE> still report files created inside subdirectories?

Raymond Chen
Raymond Chen

Because they do affect the top-level directory.

Const methods don’t prevent a method from having side effects
Jul 11, 2018
Post comments count 0
Post likes count 1

Const methods don’t prevent a method from having side effects

Raymond Chen
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.

How do I change the password of another user without having to sign in as them?
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
Raymond Chen

You can do it from the password change screen.

Stop merging if you need to cherry-pick
Jul 9, 2018
Post comments count 0
Post likes count 1

Stop merging if you need to cherry-pick

Raymond Chen
Raymond Chen

An opposing view from the VSTS team.

The case of the very large memory blocks of the same size, mostly zero, but whose nonzero bytes follow a pattern
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
Raymond Chen

Some initial pattern recognition, followed by an ad-hoc tool.

How can I detect whether the user is logging off?
Jul 5, 2018
Post comments count 0
Post likes count 1

How can I detect whether the user is logging off?

Raymond Chen
Raymond Chen

It's hidden as a strange sort of system metric.

The Windows Calculator no longer generates tiny errors when calculating the square root of a perfect square
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
Raymond Chen

Tweaking the algorithm.

Did you happen to lose something in the Amstel River? Say within the past 500 years?
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
Raymond Chen

Maybe you can find it here.

How can I determine why the System process is listening on port 80?
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
Raymond Chen

netsh can tell you.

Consider the environment: Do you want a receipt?
Jul 2, 2018
Post comments count 0
Post likes count 1

Consider the environment: Do you want a receipt?

Raymond Chen
Raymond Chen

Actually, I don't really care whether you want one. The decision is foregone.

2018 mid-year link clearance
Jun 29, 2018
Post comments count 0
Post likes count 1

2018 mid-year link clearance

Raymond Chen
Raymond Chen

Reaching the halfway point.

How can I detect from the preprocessor what a macro’s definition is?
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
Raymond Chen

Evil preprocessor tricks.

Lock free many-producer/single-consumer patterns: A work queue of distinct events, order not important, follow-up question
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
Raymond Chen

We try to minimize spurious wake-ups, but eliminating them is probably not worth the effort.

Taking advantage of the asymmetry of offline compression
Jun 26, 2018
Post comments count 0
Post likes count 1

Taking advantage of the asymmetry of offline compression

Raymond Chen
Raymond Chen

You can spend a lot of time compressing, but decompression still needs to be fast.

The cost/benefit analysis of comparing before an assignment
Jun 25, 2018
Post comments count 0
Post likes count 1

The cost/benefit analysis of comparing before an assignment

Raymond Chen
Raymond Chen

Factors pull in both directions. The result is a balance.

How I learned to type
Jun 22, 2018
Post comments count 0
Post likes count 0

How I learned to type

Raymond Chen
Raymond Chen

On an old manual typewriter.

What can influence how much stack is consumed when sending a message?
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
Raymond Chen

Who wants to know? No really, that's the answer.

When I intentionally create a stack overflow with <CODE>SendMessage</CODE>, why do I sometimes not get a stack overflow?
Jun 20, 2018
Post comments count 0
Post likes count 1

When I intentionally create a stack overflow with <CODE>SendMessage</CODE>, why do I sometimes not get a stack overflow?

Raymond Chen
Raymond Chen

It depends on what overflows first.

Microspeak: knobs
Jun 19, 2018
Post comments count 0
Post likes count 0

Microspeak: knobs

Raymond Chen
Raymond Chen

Configuration settings, basically.

Woodworking, the opposite of software development
Jun 18, 2018
Post comments count 0
Post likes count 0

Woodworking, the opposite of software development

Raymond Chen
Raymond Chen

According to self-reported data from one person who could have just made it up.

Is there a problem with <CODE>Create­Remote­Thread</CODE> on 64-bit systems?
Jun 15, 2018
Post comments count 0
Post likes count 1

Is there a problem with <CODE>Create­Remote­Thread</CODE> on 64-bit systems?

Raymond Chen
Raymond Chen

There's more to injecting code than copying bytes.

How do I programmatically control the order of my program’s notification icons?
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
Raymond Chen

That's not something you can control programmatically.

Even though the brand is called One A Day, none of them actually should be taken one a day
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
Raymond Chen

For large values of one.

Why does the CREATOR_OWNER SID sometimes reset itself to the object’s current owner rather than its original owner?
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
Raymond Chen

It's a snapshot, but you can ask for a new snapshot.

Stupid <CODE>cmd.exe</CODE> tricks: Entering a directory that doesn’t exist, then immediately leaving
Jun 12, 2018
Post comments count 0
Post likes count 0

Stupid <CODE>cmd.exe</CODE> tricks: Entering a directory that doesn’t exist, then immediately leaving

Raymond Chen
Raymond Chen

It's as if it never existed. Oh wait, it never existed.

Where is the Seattle BoltBus stop?
Jun 11, 2018
Post comments count 0
Post likes count 0

Where is the Seattle BoltBus stop?

Raymond Chen
Raymond Chen

Adjacent to the Uwajimaya parking lot on 5th, at least as of this writing.

Pulling the rug out from under an internet protocol
Jun 11, 2018
Post comments count 0
Post likes count 0

Pulling the rug out from under an internet protocol

Raymond Chen
Raymond Chen

Extracting maximum value from licensing.

Unusual choice of units: 1.8 billion square millimeters
Jun 8, 2018
Post comments count 0
Post likes count 0

Unusual choice of units: 1.8 billion square millimeters

Raymond Chen
Raymond Chen

So many yet so small.

Why does GetServiceDisplayNameA report a larger required buffer size than actually necessary?
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
Raymond Chen

It's making a conservative guess.

What is this weird constructory syntax <CODE>C::C()</CODE>?
Jun 7, 2018
Post comments count 0
Post likes count 1

What is this weird constructory syntax <CODE>C::C()</CODE>?

Raymond Chen
Raymond Chen

An archaic syntax from ancient times.