Closed merwaaan closed 4 years ago
Break it out into 2 lines.
auto err = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
if (FAILED(err) && err != RPC_E_CHANGED_MODE)
return {};
Probably something like that, to only explicitly white-list the RPC_E_CHANGED_MODE
error code.
Sure thing, I'll submit a PR.
Closed by #40.
Released in v0.4.3
.
Hi,
In our project, the
full_name
returned byiware::system::OS_info()
is empty on Windows.It seems to be related to this line where the query is aborted if some COM initialization fails.
In our case, the
CoInitializeEx
call returns a negative value because the library seems to be already loaded with another mode (actual return value:RPC_E_CHANGED_MODE
).We have no control over this because our product is an extension of another software that is responsible for the COM initialization.
Possible solution
However, simply removing the first
FAILED
check works fine and we end up with the correct full name. So it seems that gettingRPC_E_CHANGED_MODE
is not really an error case.I can submit a PR if this seems reasonnable to just remove the first
FAILED
check.