The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

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 0

What does it mean when the compiler tells me that promise_type: is not a member of coroutine_traits<void>?

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 1

How can I do the opposite of compare_exchange and exchange if the value is different?

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 0

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 0

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 0

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 0

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 2

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 0

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 2

I used FILE_FLAG_SEQUENTIAL_SCAN 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.