Skip to content

Commit

Permalink
Fix some Windows Runtime API fallback behavior to follow the previous…
Browse files Browse the repository at this point in the history
… C++/WinRT fallback implementations.
  • Loading branch information
MouriNaruto authored and mingkuang-Chuyu committed May 30, 2024
1 parent 9098fee commit b4e8ab7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
6 changes: 3 additions & 3 deletions ThunksList.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,16 @@
| RoActivateInstance | 不存在时,返回 E_NOTIMPL。
| RoRegisterActivationFactories | 不存在时,返回 E_NOTIMPL。
| RoRevokeActivationFactories | 不存在时,什么也不做。
| RoGetActivationFactory | 不存在时,返回 E_NOTIMPL。
| RoGetActivationFactory | 不存在时,返回 CLASS_E_CLASSNOTAVAILABLE
| RoRegisterForApartmentShutdown | 不存在时,返回 E_NOTIMPL。
| RoUnregisterForApartmentShutdown | 不存在时,返回 E_NOTIMPL。
| RoGetApartmentIdentifier | 不存在时,返回 E_NOTIMPL。

## api-ms-win-core-winrt-error-l1-1-0.dll
| 函数 | Fallback
| ---- | -----------
| RoOriginateError | 不存在时,返回 FALSE.
| RoOriginateErrorW | 不存在时,返回 FALSE.
| RoOriginateError | 不存在时,返回 TRUE.
| RoOriginateErrorW | 不存在时,返回 TRUE.

## api-ms-win-core-winrt-string-l1-1-0.dll
| 函数 | Fallback
Expand Down
12 changes: 9 additions & 3 deletions src/Thunks/api-ms-win-core-winrt-error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ namespace YY
return pRoOriginateError(error, message);
}

return FALSE;
// 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

Expand All @@ -50,8 +53,11 @@ namespace YY
return pRoOriginateErrorW(error, cchMax, message);
}

return FALSE;
// 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
}
}
}
7 changes: 4 additions & 3 deletions src/Thunks/api-ms-win-core-winrt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ namespace YY
if (factory)
*factory = nullptr;

return E_NOTIMPL;

// According to the C++/WinRT fallback implementation, we should
// return CLASS_E_CLASSNOTAVAILABLE.
return CLASS_E_CLASSNOTAVAILABLE;
}
#endif

Expand Down Expand Up @@ -234,4 +235,4 @@ namespace YY
}
#endif
}
}
}

0 comments on commit b4e8ab7

Please sign in to comment.