-//
+//
// ConditionalWeakTable.cs
//
// Author:
// Rodrigo Kumpera (rkumpera@novell.com)
+// Tautvydas Žilys <zilys@unity3d.com>
//
// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2016 Unity Technologies (https://unity3d.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
return res;
}
-
+
+ //--------------------------------------------------------------------------------------------
+ // Find a key that equals (value equality) with the given key - don't use in perf critical path
+ // Note that it calls out to Object.Equals which may calls the override version of Equals
+ // and that may take locks and leads to deadlock
+ // Currently it is only used by WinRT event code and you should only use this function
+ // if you know for sure that either you won't run into dead locks or you need to live with the
+ // possiblity
+ //--------------------------------------------------------------------------------------------
+ [System.Security.SecuritySafeCritical]
+ [FriendAccessAllowed]
+ internal TKey FindEquivalentKeyUnsafe(TKey key, out TValue value)
+ {
+ lock (_lock)
+ {
+ for (int i = 0; i < data.Length; ++i)
+ {
+ var item = data[i];
+ if (Object.Equals(item.key, key))
+ {
+ value = (TValue)item.value;
+ return (TKey)item.key;
+ }
+ }
+ }
+
+ value = default(TValue);
+ return null;
+ }
+
+ //--------------------------------------------------------------------------------------------
+ // Clear all the key/value pairs
+ //--------------------------------------------------------------------------------------------
+ [System.Security.SecuritySafeCritical]
+ internal void Clear()
+ {
+ lock (_lock)
+ {
+ for (int i = 0; i < data.Length; i++)
+ {
+ data[i].key = GC.EPHEMERON_TOMBSTONE;
+ data[i].value = null;
+ }
+
+ size = 0;
+ }
+ }
+
// extracted from ../../../../external/referencesource/mscorlib/system/runtime/compilerservices/
internal ICollection<TKey> Keys
{
[System.Security.SecuritySafeCritical]
get
{
+ var tombstone = GC.EPHEMERON_TOMBSTONE;
List<TKey> list = new List<TKey>(data.Length);
lock (_lock)
{
for (int i = 0; i < data.Length; ++i)
{
TKey key = (TKey) data [i].key;
- if (key != null)
+ if (key != null && key != tombstone)
list.Add (key);
}
}
return list;
}
}
+
+ internal ICollection<TValue> Values
+ {
+ [System.Security.SecuritySafeCritical]
+ get
+ {
+ var tombstone = GC.EPHEMERON_TOMBSTONE;
+ List<TValue> list = new List<TValue>(data.Length);
+ lock (_lock)
+ {
+ for (int i = 0; i < data.Length; ++i)
+ {
+ var item = data[i];
+ if (item.key != null && item.key != tombstone)
+ list.Add((TValue)item.value);
+ }
+ }
+
+ return list;
+ }
+ }
}
}
+++ /dev/null
-//
-// DefaultInterfaceAttribute.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Runtime.CompilerServices;
-
-namespace System.Runtime.InteropServices.WindowsRuntime
-{
- [AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]
- public sealed class DefaultInterfaceAttribute : Attribute
- {
- public Type DefaultInterface {
- get;
- private set;
- }
-
- public DefaultInterfaceAttribute (Type defaultInterface)
- {
- DefaultInterface = defaultInterface;
- }
- }
-}
+++ /dev/null
-//
-// EventRegistrationToken.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Runtime.CompilerServices;
-
-namespace System.Runtime.InteropServices.WindowsRuntime
-{
- public struct EventRegistrationToken
- {
-#pragma warning disable 0649
- long value;
-#pragma warning restore 0649
-
- public static bool operator == (EventRegistrationToken left, EventRegistrationToken right)
- {
- return left.value == right.value;
- }
-
- public static bool operator != (EventRegistrationToken left, EventRegistrationToken right)
- {
- return left.value != right.value;
- }
-
- public override bool Equals (object obj)
- {
- return ((EventRegistrationToken)obj).value == value;
- }
-
- public override int GetHashCode ()
- {
- return unchecked ((int)value);
- }
- }
-}
+++ /dev/null
-//
-// EventRegistrationTokenTable.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Runtime.CompilerServices;
-
-namespace System.Runtime.InteropServices.WindowsRuntime
-{
- [MonoTODO]
- public sealed class EventRegistrationTokenTable<T>
- where T : class
- {
- public EventRegistrationTokenTable ()
- {
- throw new NotImplementedException ();
- }
-
- public T InvocationList {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
- }
-
- public EventRegistrationToken AddEventHandler (T handler)
- {
- throw new NotImplementedException ();
- }
-
- public static EventRegistrationTokenTable<T> GetOrCreateEventRegistrationTokenTable(ref EventRegistrationTokenTable<T> refEventTable)
- {
- throw new NotImplementedException ();
- }
-
- public void RemoveEventHandler (T handler)
- {
- throw new NotImplementedException ();
- }
-
- public void RemoveEventHandler (EventRegistrationToken token)
- {
- throw new NotImplementedException ();
- }
- }
-}
-
+++ /dev/null
-//
-// IActivationFactory.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Runtime.CompilerServices;
-
-namespace System.Runtime.InteropServices.WindowsRuntime
-{
- [Guid("00000035-0000-0000-C000-000000000046")]
- public interface IActivationFactory
- {
- object ActivateInstance ();
- }
-}
+++ /dev/null
-//
-// InterfaceImplementedInVersionAttribute.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System.Runtime.CompilerServices;
-
-namespace System.Runtime.InteropServices.WindowsRuntime
-{
- [AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
- public sealed class InterfaceImplementedInVersionAttribute : Attribute
- {
- public InterfaceImplementedInVersionAttribute (Type interfaceType, byte majorVersion, byte minorVersion,
- byte buildVersion, byte revisionVersion)
- {
- InterfaceType = interfaceType;
- MajorVersion = majorVersion;
- MinorVersion = minorVersion;
- BuildVersion = buildVersion;
- RevisionVersion = revisionVersion;
- }
-
- public byte BuildVersion {
- get;
- private set;
- }
-
- public Type InterfaceType {
- get;
- private set;
- }
-
- public byte MajorVersion {
- get;
- private set;
- }
-
- public byte MinorVersion {
- get;
- private set;
- }
-
- public byte RevisionVersion {
- get;
- private set;
- }
- }
-}
+++ /dev/null
-//
-// ReadOnlyArrayAttribute.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Runtime.CompilerServices;
-
-namespace System.Runtime.InteropServices.WindowsRuntime
-{
- [AttributeUsageAttribute(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)]
- public sealed class ReadOnlyArrayAttribute : Attribute
- {
- }
-}
+++ /dev/null
-//
-// ReturnValueNameAttribute.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Runtime.CompilerServices;
-
-namespace System.Runtime.InteropServices.WindowsRuntime
-{
- [AttributeUsageAttribute(AttributeTargets.Delegate|AttributeTargets.ReturnValue, AllowMultiple = false, Inherited = false)]
- public sealed class ReturnValueNameAttribute : Attribute
- {
- public ReturnValueNameAttribute (string name)
- {
- Name = name;
- }
-
- public string Name {
- get;
- private set;
- }
- }
-}
--- /dev/null
+//
+// UnsafeNativeMethods.cs
+//
+// Author:
+// Tautvydas Žilys <zilys@unity3d.com>
+//
+// Copyright (c) 2016 Unity Technologies (https://www.unity3d.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System.Runtime.CompilerServices;
+
+namespace System.Runtime.InteropServices.WindowsRuntime
+{
+ internal unsafe static class UnsafeNativeMethods
+ {
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern int WindowsCreateString(string sourceString, int length, IntPtr* hstring);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern int WindowsDeleteString(IntPtr hstring);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern char* WindowsGetStringRawBuffer(IntPtr hstring, uint* length);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern bool RoOriginateLanguageException(int error, string message, IntPtr languageException);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern void RoReportUnhandledError(IRestrictedErrorInfo error);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern IRestrictedErrorInfo GetRestrictedErrorInfo();
+ }
+}
\ No newline at end of file
+++ /dev/null
-//
-// WindowsRuntimeMarshal.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Runtime.CompilerServices;
-
-namespace System.Runtime.InteropServices.WindowsRuntime
-{
- [MonoTODO]
- public static class WindowsRuntimeMarshal
- {
- public static void AddEventHandler<T> ( Func<T, EventRegistrationToken> addMethod, Action<EventRegistrationToken> removeMethod, T handler)
- {
- throw new NotImplementedException ();
- }
-
- public static void FreeHString (IntPtr ptr)
- {
- throw new NotImplementedException ();
- }
-
- public static IActivationFactory GetActivationFactory (Type type)
- {
- throw new NotImplementedException ();
- }
-
- public static string PtrToStringHString (IntPtr ptr)
- {
- throw new NotImplementedException ();
- }
-
- public static void RemoveAllEventHandlers(Action<EventRegistrationToken> removeMethod)
- {
- throw new NotImplementedException ();
- }
-
- public static void RemoveEventHandler<T> (Action<EventRegistrationToken> removeMethod, T handler)
- {
- throw new NotImplementedException ();
- }
-
- public static IntPtr StringToHString (string s)
- {
- throw new NotImplementedException ();
- }
-
- internal static bool ReportUnhandledError (Exception e)
- {
- return false;
- }
- }
-}
-
+++ /dev/null
-//
-// WriteOnlyArrayAttribute.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-using System.Runtime.CompilerServices;
-
-namespace System.Runtime.InteropServices.WindowsRuntime
-{
- [AttributeUsageAttribute(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)]
- public sealed class WriteOnlyArrayAttribute : Attribute
- {
- }
-}
internal static void SetLastWin32Error (int error)
{
}
+
+ // Copied from referencesource/mscorlib/system/runtime/interopservices/marshal.cs
+ //====================================================================
+ // return the raw IUnknown* for a COM Object not related to current
+ // context
+ // Does not call AddRef
+ //====================================================================
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern IntPtr /* IUnknown* */ GetRawIUnknownForComObjectNoAddRef(Object o);
+
+ // Copied from referencesource/mscorlib/system/runtime/interopservices/marshal.cs
+ //====================================================================
+ // Converts the CLR exception to an HRESULT. This function also sets
+ // up an IErrorInfo for the exception.
+ // This function is only used in WinRT and converts ObjectDisposedException
+ // to RO_E_CLOSED
+ //====================================================================
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern int GetHRForException_WinRT(Exception e);
+
+ // Copied from referencesource/mscorlib/system/runtime/interopservices/marshal.cs
+ //========================================================================
+ // Create activation factory and wraps it with a unique RCW
+ //========================================================================
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern object GetNativeActivationFactory(Type type);
}
}
// Do not include a trailing newline for backwards compatibility
return st.ToString( System.Diagnostics.StackTrace.TraceFormat.Normal );
}
+
+ // Copied from referencesource Environment
+ internal static bool IsWinRTSupported
+ {
+ get
+ {
+ return true;
+ }
+ }
}
}
System.Runtime.InteropServices/ComAwareEventInfo.cs
System.Runtime.InteropServices/ComEventsHelper.cs
-System.Runtime.InteropServices.WindowsRuntime/DefaultInterfaceAttribute.cs
System.Runtime.InteropServices.WindowsRuntime/DesignerNamespaceResolveEventArgs.cs
-System.Runtime.InteropServices.WindowsRuntime/EventRegistrationToken.cs
-System.Runtime.InteropServices.WindowsRuntime/EventRegistrationTokenTable.cs
-System.Runtime.InteropServices.WindowsRuntime/IActivationFactory.cs
-System.Runtime.InteropServices.WindowsRuntime/InterfaceImplementedInVersionAttribute.cs
System.Runtime.InteropServices.WindowsRuntime/NamespaceResolveEventArgs.cs
-System.Runtime.InteropServices.WindowsRuntime/ReadOnlyArrayAttribute.cs
-System.Runtime.InteropServices.WindowsRuntime/ReturnValueNameAttribute.cs
-System.Runtime.InteropServices.WindowsRuntime/WindowsRuntimeMarshal.cs
+System.Runtime.InteropServices.WindowsRuntime/UnsafeNativeMethods.cs
System.Runtime.InteropServices.WindowsRuntime/WindowsRuntimeMetadata.cs
-System.Runtime.InteropServices.WindowsRuntime/WriteOnlyArrayAttribute.cs
System.Runtime.Remoting/ActivatedClientTypeEntry.cs
System.Runtime.Remoting/ActivatedServiceTypeEntry.cs
System.Runtime.Remoting/CustomErrorsModes.cs
../referencesource/mscorlib/system/runtime/interopservices/expando/iexpando.cs
+../referencesource/mscorlib/system/runtime/interopservices/windowsruntime/attributes.cs
+../referencesource/mscorlib/system/runtime/interopservices/windowsruntime/eventregistrationtoken.cs
+../referencesource/mscorlib/system/runtime/interopservices/windowsruntime/eventregistrationtokentable.cs
+../referencesource/mscorlib/system/runtime/interopservices/windowsruntime/iactivationfactory.cs
+../referencesource/mscorlib/system/runtime/interopservices/windowsruntime/irestrictederrorinfo.cs
+../referencesource/mscorlib/system/runtime/interopservices/windowsruntime/windowsruntimemarshal.cs
+
../referencesource/mscorlib//system/runtime/reliability/criticalfinalizerobject.cs
../referencesource/mscorlib//system/runtime/reliability/prepreparemethodattribute.cs
../referencesource/mscorlib//system/runtime/reliability/reliabilitycontractattribute.cs
if (type == null)
throw new ArgumentNullException("type");
+#if FEATURE_COMINTEROP || MONO_COM
if (type.IsWindowsRuntimeObject && type.IsImport)
{
return (IActivationFactory)Marshal.GetNativeActivationFactory(type);
}
else
+#endif
{
#if FEATURE_COMINTEROP_WINRT_MANAGED_ACTIVATION
return GetManagedActivationFactory(type);
ICALL(MARSHAL_9, "GetDelegateForFunctionPointerInternal", ves_icall_System_Runtime_InteropServices_Marshal_GetDelegateForFunctionPointerInternal)
ICALL(MARSHAL_10, "GetFunctionPointerForDelegateInternal", ves_icall_System_Runtime_InteropServices_Marshal_GetFunctionPointerForDelegateInternal)
#ifndef DISABLE_COM
+ICALL(MARSHAL_52, "GetHRForException_WinRT", ves_icall_System_Runtime_InteropServices_Marshal_GetHRForException_WinRT)
ICALL(MARSHAL_45, "GetIDispatchForObjectInternal", ves_icall_System_Runtime_InteropServices_Marshal_GetIDispatchForObjectInternal)
ICALL(MARSHAL_46, "GetIUnknownForObjectInternal", ves_icall_System_Runtime_InteropServices_Marshal_GetIUnknownForObjectInternal)
#endif
ICALL(MARSHAL_11, "GetLastWin32Error", ves_icall_System_Runtime_InteropServices_Marshal_GetLastWin32Error)
#ifndef DISABLE_COM
+ICALL(MARSHAL_53, "GetNativeActivationFactory", ves_icall_System_Runtime_InteropServices_Marshal_GetNativeActivationFactory)
ICALL(MARSHAL_47, "GetObjectForCCW", ves_icall_System_Runtime_InteropServices_Marshal_GetObjectForCCW)
+ICALL(MARSHAL_54, "GetRawIUnknownForComObjectNoAddRef", ves_icall_System_Runtime_InteropServices_Marshal_GetRawIUnknownForComObjectNoAddRef)
ICALL(MARSHAL_48, "IsComObject", ves_icall_System_Runtime_InteropServices_Marshal_IsComObject)
#endif
ICALL(MARSHAL_12, "OffsetOf", ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf)
ICALL(MARSHAL_41, "copy_from_unmanaged", ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged)
ICALL(MARSHAL_42, "copy_to_unmanaged", ves_icall_System_Runtime_InteropServices_Marshal_copy_to_unmanaged)
+#ifndef DISABLE_COM
+ICALL_TYPE(WINDOWSRUNTIME_UNM, "System.Runtime.InteropServices.WindowsRuntime.UnsafeNativeMethods", WINDOWSRUNTIME_UNM_0)
+ICALL(WINDOWSRUNTIME_UNM_0, "GetRestrictedErrorInfo", ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_GetRestrictedErrorInfo)
+ICALL(WINDOWSRUNTIME_UNM_1, "RoOriginateLanguageException", ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_RoOriginateLanguageException)
+ICALL(WINDOWSRUNTIME_UNM_2, "RoReportUnhandledError", ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_RoReportUnhandledError)
+ICALL(WINDOWSRUNTIME_UNM_3, "WindowsCreateString", ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_WindowsCreateString)
+ICALL(WINDOWSRUNTIME_UNM_4, "WindowsDeleteString", ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_WindowsDeleteString)
+ICALL(WINDOWSRUNTIME_UNM_5, "WindowsGetStringRawBuffer", ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_WindowsGetStringRawBuffer)
+#endif
+
ICALL_TYPE(ACTS, "System.Runtime.Remoting.Activation.ActivationServices", ACTS_1)
ICALL(ACTS_1, "AllocateUninitializedClassInstance", ves_icall_System_Runtime_Activation_ActivationServices_AllocateUninitializedClassInstance)
ICALL(ACTS_2, "EnableProxyActivation", ves_icall_System_Runtime_Activation_ActivationServices_EnableProxyActivation)
#endif
}
+#ifndef DISABLE_COM
+
+ICALL_EXPORT int
+ves_icall_System_Runtime_InteropServices_Marshal_GetHRForException_WinRT(MonoException* ex)
+{
+ mono_set_pending_exception(mono_get_exception_not_implemented("System.Runtime.InteropServices.Marshal.GetHRForException_WinRT internal call is not implemented."));
+ return 0;
+}
+
+ICALL_EXPORT MonoObject*
+ves_icall_System_Runtime_InteropServices_Marshal_GetNativeActivationFactory(MonoObject* type)
+{
+ mono_set_pending_exception(mono_get_exception_not_implemented("System.Runtime.InteropServices.Marshal.GetNativeActivationFactory internal call is not implemented."));
+ return NULL;
+}
+
+ICALL_EXPORT void*
+ves_icall_System_Runtime_InteropServices_Marshal_GetRawIUnknownForComObjectNoAddRef(MonoObject* obj)
+{
+ mono_set_pending_exception(mono_get_exception_not_implemented("System.Runtime.InteropServices.Marshal.GetRawIUnknownForComObjectNoAddRef internal call is not implemented."));
+ return NULL;
+}
+
+ICALL_EXPORT MonoObject*
+ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_GetRestrictedErrorInfo()
+{
+ mono_set_pending_exception(mono_get_exception_not_implemented("System.Runtime.InteropServices.WindowsRuntime.UnsafeNativeMethods.GetRestrictedErrorInfo internal call is not implemented."));
+ return NULL;
+}
+
+ICALL_EXPORT MonoBoolean
+ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_RoOriginateLanguageException(int error, MonoString* message, void* languageException)
+{
+ mono_set_pending_exception(mono_get_exception_not_implemented("System.Runtime.InteropServices.WindowsRuntime.UnsafeNativeMethods.RoOriginateLanguageException internal call is not implemented."));
+ return FALSE;
+}
+
+ICALL_EXPORT void
+ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_RoReportUnhandledError(MonoObject* error)
+{
+ mono_set_pending_exception(mono_get_exception_not_implemented("System.Runtime.InteropServices.WindowsRuntime.UnsafeNativeMethods.RoReportUnhandledError internal call is not implemented."));
+}
+
+ICALL_EXPORT int
+ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_WindowsCreateString(MonoString* sourceString, int length, void** hstring)
+{
+ mono_set_pending_exception(mono_get_exception_not_implemented("System.Runtime.InteropServices.WindowsRuntime.UnsafeNativeMethods.WindowsCreateString internal call is not implemented."));
+ return 0;
+}
+
+ICALL_EXPORT int
+ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_WindowsDeleteString(void* hstring)
+{
+ mono_set_pending_exception(mono_get_exception_not_implemented("System.Runtime.InteropServices.WindowsRuntime.UnsafeNativeMethods.WindowsDeleteString internal call is not implemented."));
+ return 0;
+}
+
+ICALL_EXPORT mono_unichar2*
+ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_WindowsGetStringRawBuffer(void* hstring, unsigned* length)
+{
+ mono_set_pending_exception(mono_get_exception_not_implemented("System.Runtime.InteropServices.WindowsRuntime.UnsafeNativeMethods.WindowsGetStringRawBuffer internal call is not implemented."));
+ return NULL;
+}
+
+#endif
+
+
#ifndef DISABLE_ICALL_TABLES
#define ICALL_TYPE(id,name,first)