On Mon Feb 5 19:23:01 2024 +0000, Zebediah Figura wrote:
Maybe having CopyFile2 functionality but with `SetLastError`-style
error handling, and then write a wrapper over it for `CopyFile2` to convert to HRESULT? This sounds like what I'd do, at least.
Yes, HRESULT_CODE would work for now.
But if that changes in the future, it'll return random errors like ERROR_BAD_EXE_FORMAT. If you choose that approach, I vote check HRESULT_FACILITY(), and map everything that isn't FACILITY_WIN32 to some random hardcoded error (ERROR_CANNOT_COPY, for example).
Alternatively, do your proposal from yesterday. It sounds cleaner in the long run.