Nikolay Sivov (@nsivov) commented about dlls/combase/roapi.c:
+ UINT32 flags, len_msg, len_desc; + WCHAR desc[512]; + + TRACE("%#lx, %u, %p\n", error, max_len, message); + + if (SUCCEEDED(error)) return FALSE; + RoGetErrorReportingFlags(&flags); /* RoGetErrorReportingFlags is infalliable with a valid-pointer. */ + /* RO_ERROR_REPORTING_SUPPRESSSETERRORINFO overrides RO_ERROR_REPORTING_USESETERRORINFO */ + set_error = flags & RO_ERROR_REPORTING_USESETERRORINFO && !(flags & RO_ERROR_REPORTING_SUPPRESSSETERRORINFO); + /* RO_ERROR_REPORTING_FORCEEXCEPTIONS overrides RO_ERROR_REPORTING_SUPPRESSEXCEPTIONS */ + raise_exception = (IsDebuggerPresent() && !(flags & RO_ERROR_REPORTING_SUPPRESSEXCEPTIONS)) || + (flags & RO_ERROR_REPORTING_FORCEEXCEPTIONS); + /* No need to do anything if: + * No debugger is attached, and no error reporting flags are set, or + * A debugger is attached, but SetErrorInfo and exceptions are disabled. */ + if (!set_error && !raise_exception) return TRUE; If this requires more comments than code lines, maybe it's possible to restructure it a bit, if it's not clear without comments.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/9332#note_120320