diff options
Diffstat (limited to 'src/System.Private.CoreLib/src/Interop/Interop.WinRT.cs')
-rw-r--r-- | src/System.Private.CoreLib/src/Interop/Interop.WinRT.cs | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/src/System.Private.CoreLib/src/Interop/Interop.WinRT.cs b/src/System.Private.CoreLib/src/Interop/Interop.WinRT.cs index 741ce4f21..0823dcffc 100644 --- a/src/System.Private.CoreLib/src/Interop/Interop.WinRT.cs +++ b/src/System.Private.CoreLib/src/Interop/Interop.WinRT.cs @@ -11,26 +11,13 @@ internal partial class Interop { private const string CORE_WINRT = "api-ms-win-core-winrt-l1-1-0.dll"; - private const int RPC_E_CHANGED_MODE = unchecked((int)0x80010106); + internal const uint RO_INIT_SINGLETHREADED = 0; + internal const uint RO_INIT_MULTITHREADED = 1; - private enum RO_INIT_TYPE : uint - { - RO_INIT_MULTITHREADED = 1 - } - - internal static void RoInitialize() - { - int hr = RoInitialize((uint)RO_INIT_TYPE.RO_INIT_MULTITHREADED); - - // RPC_E_CHANGED_MODE indicates this thread has been already initialized with a different - // concurrency model. That is fine; we just need to skip the RoUninitialize call on shutdown. - if ((hr < 0) && (hr != RPC_E_CHANGED_MODE)) - { - throw new OutOfMemoryException(); - } - } + [DllImport(CORE_WINRT, ExactSpelling = true)] + internal static extern int RoInitialize(uint initType); [DllImport(CORE_WINRT, ExactSpelling = true)] - private static extern int RoInitialize(uint initType); + internal static extern int RoUninitialize(); } } |