diff --git a/ThunksList.md b/ThunksList.md index 657652d..81318d0 100644 --- a/ThunksList.md +++ b/ThunksList.md @@ -222,3 +222,6 @@ | [FlsFree](https://docs.microsoft.com/windows/win32/api/fibersapi/nf-fibersapi-flsfree) | 不存在时,使用Tls实现。警告,此函数请勿跨模块使用!!! | [FlsGetValue](https://docs.microsoft.com/windows/win32/api/fibersapi/nf-fibersapi-flsgetvalue) | 不存在时,使用Tls实现。警告,此函数请勿跨模块使用!!! | [FlsSetValue](https://docs.microsoft.com/windows/win32/api/fibersapi/nf-fibersapi-flssetvalue) | 不存在时,使用Tls实现。警告,此函数请勿跨模块使用!!! +| [RoInitialize](https://docs.microsoft.com/windows/win32/api/roapi/nf-roapi-roinitialize) | 不存在时,调用 CoInitializeEx。 +| [RoUninitialize](https://docs.microsoft.com/windows/win32/api/roapi/nf-roapi-rouninitialize) | 不存在时,调用 CoUninitialize。 + diff --git a/src/Thunks/api-ms-win-core-winrt-string.hpp b/src/Thunks/api-ms-win-core-winrt-string.hpp index fe35413..4096054 100644 --- a/src/Thunks/api-ms-win-core-winrt-string.hpp +++ b/src/Thunks/api-ms-win-core-winrt-string.hpp @@ -25,6 +25,9 @@ namespace YY return pWindowsCreateString(sourceString, length, string); } + if (string) + *string = nullptr; + return E_NOTIMPL; } #endif @@ -51,6 +54,9 @@ namespace YY return pWindowsCreateStringReference(sourceString, length, hstringHeader, string); } + if (string) + *string = nullptr; + return E_NOTIMPL; } #endif @@ -98,6 +104,10 @@ namespace YY return pWindowsDuplicateString(string, newString); } + + if (newString) + *newString = nullptr; + return E_NOTIMPL; } #endif @@ -145,6 +155,9 @@ namespace YY return pWindowsGetStringRawBuffer(string, length); } + if (length) + *length = 0; + return nullptr; } #endif diff --git a/src/Thunks/api-ms-win-core-winrt.hpp b/src/Thunks/api-ms-win-core-winrt.hpp index f521413..3683f66 100644 --- a/src/Thunks/api-ms-win-core-winrt.hpp +++ b/src/Thunks/api-ms-win-core-winrt.hpp @@ -24,7 +24,12 @@ namespace YY return pRoInitialize(initType); } - return E_NOTIMPL; + if ((unsigned)initType > (unsigned)RO_INIT_MULTITHREADED) + { + return E_INVALIDARG; + } + + return CoInitializeEx(nullptr, initType ? COINIT_MULTITHREADED : COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); } #endif @@ -44,6 +49,8 @@ namespace YY { return pRoUninitialize(); } + + CoUninitialize(); } #endif @@ -66,6 +73,9 @@ namespace YY return pRoActivateInstance(activatableClassId, instance); } + if (instance) + *instance = nullptr; + return E_NOTIMPL; } #endif @@ -91,6 +101,9 @@ namespace YY return pRoRegisterActivationFactories(activatableClassIds, activationFactoryCallbacks, count, cookie); } + if (cookie) + *cookie = nullptr; + return E_NOTIMPL; } #endif @@ -136,6 +149,9 @@ namespace YY return pRoGetActivationFactory(activatableClassId, iid, factory); } + if (factory) + *factory = nullptr; + return E_NOTIMPL; } @@ -162,6 +178,10 @@ namespace YY return pRoRegisterForApartmentShutdown(callbackObject, apartmentIdentifier, regCookie); } + if (regCookie) + *regCookie = nullptr; + + return E_NOTIMPL; }