C++ coroutines: The problem of the DispatcherQueue task that runs too soon,...
I was experiencing occasional crashes in C++/WinRT’s resume_foreground function when it tries to resume execution on a dispatcher queue. Here’s a simplified version of that function: auto...
View ArticleC++ coroutines: The problem of the DispatcherQueue task that runs too soon,...
Last time, we discovered a race condition in C++/WinRT’s resume_foreground(DispatcherQueue) function when it tries to resume execution on a dispatcher queue. Let’s try to fix it. As a reminder,...
View ArticleC++ coroutines: The problem of the DispatcherQueue task that runs too soon,...
Last time, we fixed a race condition in C++/WinRT’s resume_foreground(DispatcherQueue) function when it tries to resume execution on a dispatcher queue. We did this by having the queued task wait...
View ArticleC++ coroutines: The problem of the DispatcherQueue task that runs too soon,...
Last time, we made another attempt to fix a race condition in C++/WinRT’s resume_foreground(DispatcherQueue) function when it tries to resume execution on a dispatcher queue. We did this by having...
View ArticleControversial extension methods: CastTo and As
You’ve probably had to do this in C#. You get an object, you need to cast it to some type T and then fetch a property that is returned as an object, so you have to cast that to some other type U, so...
View ArticleHow do I make a clone of a Windows Runtime vector in C++/CX?
There are still some people maintaining code bases written in C++/CX, even though C++/WinRT is the new hotness. Suppose you have a reference to a Windows Runtime vector in C++/CX, either an...
View Article2019 year-end link clearance: The different kinds of DLL planting
This time, the link clearance is just one link: Triaging a DLL planting vulnerability. That link summarizes various causes of alleged DLL planting vulnerabilities and how the Microsoft Security...
View ArticleNasty gotcha: Positioning your window beneath a topmost window makes it topmost
There’s a nasty gotcha with the DeferWindowPos function, and therefore any functions built on top of it, such as SetWindowPos: If you specify a hwndInsertAfter, and the insert-after window is...
View ArticleWhy doesn’t RegSetKeySecurity propagate inheritable ACEs, but SetSecurityInfo...
A customer was updating some code that manipulated registry key security. The old code used the SetSecurityInfo function to update the security, and they observed that the function propagates...
View ArticleAnybody who writes #pragma pack(1) may as well just wear a sign on their...
When you use #pragma pack(1), this changes the default structure packing to byte packing, removing all padding bytes normally inserted to preserve alignment. Consider these two structures: // no...
View Article