Vibhav Pant (@vibhavp) commented about dlls/vccorlib140/except.c:
+ name##Exception_hstring_ctor(ret, msg); \ + break; + + switch (code) + { + WINRT_EXCEPTIONS; +#undef WINRT_EXCEPTION + default: + COMException_hstring_ctor(ret, code, msg); + break; + } + + return ret; +} + +struct Exception *__cdecl CreateException(HRESULT hr) Do we not need to wrap this and `CreateExceptionWithMessage` inside a `__FINALLY_CTX` to clean up any partial allocations in case of an exception being thrown? For instance, `CreateExcception(S_OK)` throws an `InvalidArgumentException` from the constructor, wouldn't that leak the allocation from `AllocateExceptionWithWeakRef`?
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/9209#note_120502