On Sun Feb 4 19:50:38 2024 +0000, Alfred Agrell wrote:
SetLastError doesn't take a HRESULT. HRESULT to SetLastError feels like a function that should exist, but I can't find it; closest I can find is HRESULT_CODE, which will do something weird if CopyFile2 returns something other than S_OK or HRESULT_FROM_WIN32(something). Maybe another reviewer can enlighten us?
I discovered that through the failing tests as well. Turns out, [it's not straightforward (Raymond Chen's blog).](https://devblogs.microsoft.com/oldnewthing/20061103-07/?p=29133). Maybe having implementing the CopyFile2 functionality but with `SetLastError`-style error handling, and then write a wrapper over it for `CopyFile2` to convert to HRESULT?