-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fea #94, Fix some Windows Runtime API fallback behavior to follow the…
… previous C++/WinRT fallback implementations.
- Loading branch information
1 parent
9098fee
commit 6cc251b
Showing
3 changed files
with
222 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,59 @@ | ||
|
||
#include <roerrorapi.h> | ||
#include <roerrorapi.h> | ||
|
||
namespace YY | ||
namespace YY::Thunks | ||
{ | ||
namespace Thunks | ||
{ | ||
#if (YY_Thunks_Support_Version < NTDDI_WIN8) | ||
|
||
//Windows 8 [desktop apps | UWP apps] | ||
//Windows Server 2012 [desktop apps | UWP apps] | ||
__DEFINE_THUNK( | ||
api_ms_win_core_winrt_error_l1_1_0, | ||
8, | ||
BOOL, | ||
WINAPI, | ||
RoOriginateError, | ||
_In_ HRESULT error, | ||
_In_opt_ HSTRING message | ||
) | ||
//Windows 8 [desktop apps | UWP apps] | ||
//Windows Server 2012 [desktop apps | UWP apps] | ||
__DEFINE_THUNK( | ||
api_ms_win_core_winrt_error_l1_1_0, | ||
8, | ||
BOOL, | ||
WINAPI, | ||
RoOriginateError, | ||
_In_ HRESULT error, | ||
_In_opt_ HSTRING message | ||
) | ||
{ | ||
if (auto pRoOriginateError = try_get_RoOriginateError()) | ||
{ | ||
if (auto pRoOriginateError = try_get_RoOriginateError()) | ||
{ | ||
return pRoOriginateError(error, message); | ||
} | ||
|
||
return FALSE; | ||
return pRoOriginateError(error, message); | ||
} | ||
|
||
// According to the C++/WinRT fallback implementation, we should | ||
// return TRUE to tell the caller that the error message was | ||
// reported successfully. | ||
return TRUE; | ||
} | ||
#endif | ||
|
||
#if (YY_Thunks_Support_Version < NTDDI_WIN8) | ||
|
||
//Windows 8 [desktop apps | UWP apps] | ||
//Windows Server 2012 [desktop apps | UWP apps] | ||
__DEFINE_THUNK( | ||
api_ms_win_core_winrt_error_l1_1_0, | ||
12, | ||
BOOL, | ||
WINAPI, | ||
RoOriginateErrorW, | ||
_In_ HRESULT error, | ||
_In_ UINT cchMax, | ||
_When_(cchMax == 0, _In_reads_or_z_opt_(MAX_ERROR_MESSAGE_CHARS) ) | ||
_When_(cchMax > 0 && cchMax < MAX_ERROR_MESSAGE_CHARS, _In_reads_or_z_(cchMax) ) | ||
_When_(cchMax >= MAX_ERROR_MESSAGE_CHARS, _In_reads_or_z_(MAX_ERROR_MESSAGE_CHARS) ) PCWSTR message | ||
) | ||
//Windows 8 [desktop apps | UWP apps] | ||
//Windows Server 2012 [desktop apps | UWP apps] | ||
__DEFINE_THUNK( | ||
api_ms_win_core_winrt_error_l1_1_0, | ||
12, | ||
BOOL, | ||
WINAPI, | ||
RoOriginateErrorW, | ||
_In_ HRESULT error, | ||
_In_ UINT cchMax, | ||
_When_(cchMax == 0, _In_reads_or_z_opt_(MAX_ERROR_MESSAGE_CHARS) ) | ||
_When_(cchMax > 0 && cchMax < MAX_ERROR_MESSAGE_CHARS, _In_reads_or_z_(cchMax) ) | ||
_When_(cchMax >= MAX_ERROR_MESSAGE_CHARS, _In_reads_or_z_(MAX_ERROR_MESSAGE_CHARS) ) PCWSTR message | ||
) | ||
{ | ||
if (auto pRoOriginateErrorW = try_get_RoOriginateErrorW()) | ||
{ | ||
if (auto pRoOriginateErrorW = try_get_RoOriginateErrorW()) | ||
{ | ||
return pRoOriginateErrorW(error, cchMax, message); | ||
} | ||
|
||
return FALSE; | ||
return pRoOriginateErrorW(error, cchMax, message); | ||
} | ||
#endif | ||
|
||
// According to the C++/WinRT fallback implementation, we should | ||
// return TRUE to tell the caller that the error message was | ||
// reported successfully. | ||
return TRUE; | ||
} | ||
} | ||
#endif | ||
} |
Oops, something went wrong.