mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-01 05:38:50 +00:00
Common: Create HRWrap
HRWrap now allows HRESULT to be formatted, giving useful information beyond "it failed" or a hex code that isn't obvious to most users. This commit does not add any uses of it, though.
This commit is contained in:
parent
c296c34e00
commit
140c8217f6
4 changed files with 57 additions and 1 deletions
17
Source/Core/Common/HRWrap.cpp
Normal file
17
Source/Core/Common/HRWrap.cpp
Normal file
|
@ -0,0 +1,17 @@
|
|||
// Copyright 2021 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "HRWrap.h"
|
||||
|
||||
#include <comdef.h>
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
std::string GetHResultMessage(HRESULT hr)
|
||||
{
|
||||
// See https://stackoverflow.com/a/7008111
|
||||
_com_error err(hr);
|
||||
return TStrToUTF8(err.ErrorMessage());
|
||||
}
|
||||
} // namespace Common
|
Loading…
Add table
Add a link
Reference in a new issue