<Compile Include="$(CommonPath)\Interop\Windows\Ole32\Interop.CoGetStandardMarshal.cs">
<Link>Common\Interop\Windows\Ole32\Interop.CoGetStandardMarshal.cs</Link>
</Compile>
- <Compile Include="System\Runtime\CompilerServices\Attributes.cs" />
- <Compile Include="System\Runtime\InteropServices\Attributes.cs" />
- <Compile Include="System\Runtime\InteropServices\ComAwareEventInfo.cs" />
- <Compile Include="System\Runtime\InteropServices\HandleCollector.cs" Condition="'$(TargetsAOT)' != 'true'" />
- <Compile Include="System\Runtime\InteropServices\IMarshal.cs" />
- <Compile Include="System\Runtime\InteropServices\RuntimeEnvironment.cs" />
- <Compile Include="System\Runtime\InteropServices\ComTypes\advf.cs" Condition="'$(TargetsAOT)' != 'true'" />
- <Compile Include="System\Runtime\InteropServices\ComTypes\datadir.cs" Condition="'$(TargetsAOT)' != 'true'" />
- <Compile Include="System\Runtime\InteropServices\ComTypes\dvaspect.cs" Condition="'$(TargetsAOT)' != 'true'" />
- <Compile Include="System\Runtime\InteropServices\ComTypes\formatetc.cs" Condition="'$(TargetsAOT)' != 'true'" />
+ <Compile Include="System\Runtime\CompilerServices\IDispatchConstantAttribute.cs" />
+ <Compile Include="System\Runtime\CompilerServices\IUnknownConstantAttribute.cs" />
+ <Compile Include="System\Runtime\InteropServices\ComTypes\ADVF.cs" Condition="'$(TargetsAOT)' != 'true'" />
+ <Compile Include="System\Runtime\InteropServices\ComTypes\DATADIR.cs" Condition="'$(TargetsAOT)' != 'true'" />
+ <Compile Include="System\Runtime\InteropServices\ComTypes\DVASPECT.cs" Condition="'$(TargetsAOT)' != 'true'" />
+ <Compile Include="System\Runtime\InteropServices\ComTypes\FORMATETC.cs" Condition="'$(TargetsAOT)' != 'true'" />
<Compile Include="System\Runtime\InteropServices\ComTypes\IAdviseSink.cs" Condition="'$(TargetsAOT)' != 'true'" />
<Compile Include="System\Runtime\InteropServices\ComTypes\IDataObject.cs" />
<Compile Include="System\Runtime\InteropServices\ComTypes\IEnumFormatETC.cs" Condition="'$(TargetsAOT)' != 'true'" />
<Compile Include="System\Runtime\InteropServices\ComTypes\IEnumSTATDATA.cs" />
- <Compile Include="System\Runtime\InteropServices\ComTypes\statdata.cs" Condition="'$(TargetsAOT)' != 'true'" />
- <Compile Include="System\Runtime\InteropServices\ComTypes\stgmedium.cs" Condition="'$(TargetsAOT)' != 'true'" />
- <Compile Include="System\Runtime\InteropServices\ComTypes\tymed.cs" Condition="'$(TargetsAOT)' != 'true'" />
+ <Compile Include="System\Runtime\InteropServices\ComTypes\STATDATA.cs" Condition="'$(TargetsAOT)' != 'true'" />
+ <Compile Include="System\Runtime\InteropServices\ComTypes\STGMEDIUM.cs" Condition="'$(TargetsAOT)' != 'true'" />
+ <Compile Include="System\Runtime\InteropServices\ComTypes\TYMED.cs" Condition="'$(TargetsAOT)' != 'true'" />
<Compile Include="System\Runtime\InteropServices\AssemblyRegistrationFlags.cs" />
+ <Compile Include="System\Runtime\InteropServices\AutomationProxyAttribute.cs" />
+ <Compile Include="System\Runtime\InteropServices\ComAliasNameAttribute.cs" />
+ <Compile Include="System\Runtime\InteropServices\ComAwareEventInfo.cs" />
+ <Compile Include="System\Runtime\InteropServices\ComCompatibleVersionAttribute.cs" />
+ <Compile Include="System\Runtime\InteropServices\ComConversionLossAttribute.cs" />
+ <Compile Include="System\Runtime\InteropServices\ComRegisterFunctionAttribute.cs" />
+ <Compile Include="System\Runtime\InteropServices\ComUnregisterFunctionAttribute.cs" />
<Compile Include="System\Runtime\InteropServices\ExporterEventKind.cs" />
+ <Compile Include="System\Runtime\InteropServices\HandleCollector.cs" Condition="'$(TargetsAOT)' != 'true'" />
+ <Compile Include="System\Runtime\InteropServices\IDispatchImplAttribute.cs" />
+ <Compile Include="System\Runtime\InteropServices\IDispatchImplType.cs" />
+ <Compile Include="System\Runtime\InteropServices\IMarshal.cs" />
+ <Compile Include="System\Runtime\InteropServices\ImportedFromTypeLibAttribute.cs" />
+ <Compile Include="System\Runtime\InteropServices\ManagedToNativeComInteropStubAttribute.cs" />
+ <Compile Include="System\Runtime\InteropServices\PrimaryInteropAssemblyAttribute.cs" />
<Compile Include="System\Runtime\InteropServices\RegistrationClassContext.cs" />
<Compile Include="System\Runtime\InteropServices\RegistrationConnectionType.cs" />
+ <Compile Include="System\Runtime\InteropServices\RuntimeEnvironment.cs" />
<Compile Include="System\Runtime\InteropServices\StandardOleMarshalObject.cs" />
+ <Compile Include="System\Runtime\InteropServices\SetWin32ContextInIDispatchAttribute.cs" />
+ <Compile Include="System\Runtime\InteropServices\TypeLibFuncAttribute.cs" />
+ <Compile Include="System\Runtime\InteropServices\TypeLibFuncFlags.cs" />
+ <Compile Include="System\Runtime\InteropServices\TypeLibImportClassAttribute.cs" />
+ <Compile Include="System\Runtime\InteropServices\TypeLibTypeAttribute.cs" />
+ <Compile Include="System\Runtime\InteropServices\TypeLibTypeFlags.cs" />
+ <Compile Include="System\Runtime\InteropServices\TypeLibVarAttribute.cs" />
+ <Compile Include="System\Runtime\InteropServices\TypeLibVarFlags.cs" />
+ <Compile Include="System\Runtime\InteropServices\TypeLibVersionAttribute.cs" />
<Compile Include="System\Security\SecureStringMarshal.cs" />
</ItemGroup>
<ItemGroup>
namespace System.Runtime.CompilerServices
{
- [System.AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
- public sealed partial class IUnknownConstantAttribute : CustomConstantAttribute
- {
- public IUnknownConstantAttribute() { }
-
- public override object Value => new UnknownWrapper(null);
- }
-
- [System.AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
+ [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
public sealed partial class IDispatchConstantAttribute : CustomConstantAttribute
{
public IDispatchConstantAttribute() { }
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.InteropServices;
+
+namespace System.Runtime.CompilerServices
+{
+ [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
+ public sealed partial class IUnknownConstantAttribute : CustomConstantAttribute
+ {
+ public IUnknownConstantAttribute() { }
+
+ public override object Value => new UnknownWrapper(null);
+ }
+}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System;
-
namespace System.Runtime.InteropServices
{
[Flags]
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System.Runtime.InteropServices
-{
- [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Interface, Inherited = false)]
- public sealed class AutomationProxyAttribute : Attribute
- {
- public AutomationProxyAttribute(bool val) => Value = val;
-
- public bool Value { get; }
- }
-
- [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.ReturnValue, Inherited = false)]
- public sealed class ComAliasNameAttribute : Attribute
- {
- public ComAliasNameAttribute(string alias) => Value = alias;
-
- public string Value { get; }
- }
-
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
- public sealed class ComCompatibleVersionAttribute : Attribute
- {
- public ComCompatibleVersionAttribute(int major, int minor, int build, int revision)
- {
- MajorVersion = major;
- MinorVersion = minor;
- BuildNumber = build;
- RevisionNumber = revision;
- }
-
- public int MajorVersion { get; }
- public int MinorVersion { get; }
- public int BuildNumber { get; }
- public int RevisionNumber { get; }
- }
-
- [AttributeUsage(AttributeTargets.All, Inherited = false)]
- public sealed class ComConversionLossAttribute : Attribute
- {
- }
-
- [AttributeUsage(AttributeTargets.Method, Inherited = false)]
- public sealed class ComRegisterFunctionAttribute : Attribute
- {
- }
-
- [AttributeUsage(AttributeTargets.Method, Inherited = false)]
- public sealed class ComUnregisterFunctionAttribute : Attribute
- {
- }
-
- [AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly, Inherited = false)]
- [Obsolete("This attribute is deprecated and will be removed in a future version.", error: false)]
- public sealed class IDispatchImplAttribute : Attribute
- {
- public IDispatchImplAttribute(short implType) : this((IDispatchImplType)implType)
- {
- }
-
- public IDispatchImplAttribute(IDispatchImplType implType) => Value = implType;
-
- public IDispatchImplType Value { get; }
- }
-
- [Obsolete("The IDispatchImplAttribute is deprecated.", error: false)]
- public enum IDispatchImplType
- {
- CompatibleImpl = 2,
- InternalImpl = 1,
- SystemDefinedImpl = 0,
- }
-
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
- public sealed class ImportedFromTypeLibAttribute : Attribute
- {
- public ImportedFromTypeLibAttribute(string tlbFile) => Value = tlbFile;
-
- public string Value { get; }
- }
-
- [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
- public sealed class ManagedToNativeComInteropStubAttribute : Attribute
- {
- public ManagedToNativeComInteropStubAttribute(Type classType, string methodName)
- {
- ClassType = classType;
- MethodName = methodName;
- }
-
- public Type ClassType { get; }
- public string MethodName { get; }
- }
-
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = true)]
- public sealed class PrimaryInteropAssemblyAttribute : Attribute
- {
- public PrimaryInteropAssemblyAttribute(int major, int minor)
- {
- MajorVersion = major;
- MinorVersion = minor;
- }
-
- public int MajorVersion { get; }
- public int MinorVersion { get; }
- }
-
- [Obsolete("This attribute has been deprecated. Application Domains no longer respect Activation Context boundaries in IDispatch calls.", error: false)]
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
- public sealed class SetWin32ContextInIDispatchAttribute : Attribute
- {
- public SetWin32ContextInIDispatchAttribute()
- {
- }
- }
-
- [AttributeUsage(AttributeTargets.Interface, Inherited = false)]
- public sealed class TypeLibImportClassAttribute : Attribute
- {
- public TypeLibImportClassAttribute(Type importClass) => Value = importClass.ToString();
-
- public string Value { get; }
- }
-
- [Flags]
- public enum TypeLibTypeFlags
- {
- FAppObject = 0x0001,
- FCanCreate = 0x0002,
- FLicensed = 0x0004,
- FPreDeclId = 0x0008,
- FHidden = 0x0010,
- FControl = 0x0020,
- FDual = 0x0040,
- FNonExtensible = 0x0080,
- FOleAutomation = 0x0100,
- FRestricted = 0x0200,
- FAggregatable = 0x0400,
- FReplaceable = 0x0800,
- FDispatchable = 0x1000,
- FReverseBind = 0x2000,
- }
-
- [Flags]
- public enum TypeLibFuncFlags
- {
- FRestricted = 0x0001,
- FSource = 0x0002,
- FBindable = 0x0004,
- FRequestEdit = 0x0008,
- FDisplayBind = 0x0010,
- FDefaultBind = 0x0020,
- FHidden = 0x0040,
- FUsesGetLastError = 0x0080,
- FDefaultCollelem = 0x0100,
- FUiDefault = 0x0200,
- FNonBrowsable = 0x0400,
- FReplaceable = 0x0800,
- FImmediateBind = 0x1000,
- }
-
- [Flags]
- public enum TypeLibVarFlags
- {
- FReadOnly = 0x0001,
- FSource = 0x0002,
- FBindable = 0x0004,
- FRequestEdit = 0x0008,
- FDisplayBind = 0x0010,
- FDefaultBind = 0x0020,
- FHidden = 0x0040,
- FRestricted = 0x0080,
- FDefaultCollelem = 0x0100,
- FUiDefault = 0x0200,
- FNonBrowsable = 0x0400,
- FReplaceable = 0x0800,
- FImmediateBind = 0x1000,
- }
-
- [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Enum | AttributeTargets.Struct, Inherited = false)]
- public sealed class TypeLibTypeAttribute : Attribute
- {
- public TypeLibTypeAttribute(TypeLibTypeFlags flags)
- {
- Value = flags;
- }
-
- public TypeLibTypeAttribute(short flags)
- {
- Value = (TypeLibTypeFlags)flags;
- }
-
- public TypeLibTypeFlags Value { get; }
- }
-
- [AttributeUsage(AttributeTargets.Method, Inherited = false)]
- public sealed class TypeLibFuncAttribute : Attribute
- {
- public TypeLibFuncAttribute(TypeLibFuncFlags flags)
- {
- Value = flags;
- }
-
- public TypeLibFuncAttribute(short flags)
- {
- Value = (TypeLibFuncFlags)flags;
- }
-
- public TypeLibFuncFlags Value { get; }
- }
-
- [AttributeUsage(AttributeTargets.Field, Inherited = false)]
- public sealed class TypeLibVarAttribute : Attribute
- {
- public TypeLibVarAttribute(TypeLibVarFlags flags)
- {
- Value = flags;
- }
-
- public TypeLibVarAttribute(short flags)
- {
- Value = (TypeLibVarFlags)flags;
- }
-
- public TypeLibVarFlags Value { get; }
- }
-
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
- public sealed class TypeLibVersionAttribute : Attribute
- {
- public TypeLibVersionAttribute(int major, int minor)
- {
- MajorVersion = major;
- MinorVersion = minor;
- }
-
- public int MajorVersion { get; }
- public int MinorVersion { get; }
- }
-}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.InteropServices
+{
+ [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Interface, Inherited = false)]
+ public sealed class AutomationProxyAttribute : Attribute
+ {
+ public AutomationProxyAttribute(bool val) => Value = val;
+
+ public bool Value { get; }
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.InteropServices
+{
+ [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.ReturnValue, Inherited = false)]
+ public sealed class ComAliasNameAttribute : Attribute
+ {
+ public ComAliasNameAttribute(string alias) => Value = alias;
+
+ public string Value { get; }
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.InteropServices
+{
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
+ public sealed class ComCompatibleVersionAttribute : Attribute
+ {
+ public ComCompatibleVersionAttribute(int major, int minor, int build, int revision)
+ {
+ MajorVersion = major;
+ MinorVersion = minor;
+ BuildNumber = build;
+ RevisionNumber = revision;
+ }
+
+ public int MajorVersion { get; }
+ public int MinorVersion { get; }
+ public int BuildNumber { get; }
+ public int RevisionNumber { get; }
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.InteropServices
+{
+ [AttributeUsage(AttributeTargets.All, Inherited = false)]
+ public sealed class ComConversionLossAttribute : Attribute
+ {
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.InteropServices
+{
+ [AttributeUsage(AttributeTargets.Method, Inherited = false)]
+ public sealed class ComRegisterFunctionAttribute : Attribute
+ {
+ }
+}
namespace System.Runtime.InteropServices.ComTypes
{
+ /// <remarks>
+ /// Note: ADVF_ONLYONCE and ADVF_PRIMEFIRST values conform with objidl.dll but are backwards from
+ /// the Platform SDK documentation as of 07/21/2003.
+ /// https://docs.microsoft.com/en-us/windows/desktop/api/objidl/ne-objidl-tagadvf.
+ /// </remarks>
[Flags]
public enum ADVF
{
ADVFCACHE_FORCEBUILTIN = 16,
ADVFCACHE_ONSAVE = 32
}
- // Note: ADVF_ONLYONCE and ADVF_PRIMEFIRST values conform with objidl.dll but are backwards from
- // the Platform SDK documentation as of 07/21/2003.
- // https://docs.microsoft.com/en-us/windows/desktop/api/objidl/ne-objidl-tagadvf.
}
namespace System.Runtime.InteropServices.ComTypes
{
- /// <devdoc>
- /// The IAdviseSink interface enables containers and other objects to
- /// receive notifications of data changes, view changes, and compound-document
- /// changes occurring in objects of interest. Container applications, for
- /// example, require such notifications to keep cached presentations of their
- /// linked and embedded objects up-to-date. Calls to IAdviseSink methods are
- /// asynchronous, so the call is sent and then the next instruction is executed
- /// without waiting for the call's return.
- /// </devdoc>
+ /// <summary>
+ /// The IAdviseSink interface enables containers and other objects to
+ /// receive notifications of data changes, view changes, and compound-document
+ /// changes occurring in objects of interest. Container applications, for
+ /// example, require such notifications to keep cached presentations of their
+ /// linked and embedded objects up-to-date. Calls to IAdviseSink methods are
+ /// asynchronous, so the call is sent and then the next instruction is executed
+ /// without waiting for the call's return.
+ /// </summary>
[ComImport]
[Guid("0000010F-0000-0000-C000-000000000046")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
public interface IAdviseSink
{
- /// <devdoc>
- /// Called by the server to notify a data object's currently registered
- /// advise sinks that data in the object has changed.
- /// </devdoc>
+ /// <summary>
+ /// Called by the server to notify a data object's currently registered
+ /// advise sinks that data in the object has changed.
+ /// </summary>
[PreserveSig]
void OnDataChange([In] ref FORMATETC format, [In] ref STGMEDIUM stgmedium);
- /// <devdoc>
- /// Notifies an object's registered advise sinks that its view has changed.
- /// </devdoc>
+ /// <summary>
+ /// Notifies an object's registered advise sinks that its view has changed.
+ /// </summary>
[PreserveSig]
void OnViewChange(int aspect, int index);
- /// <devdoc>
- /// Called by the server to notify all registered advisory sinks that
- /// the object has been renamed.
- /// </devdoc>
+ /// <summary>
+ /// Called by the server to notify all registered advisory sinks that
+ /// the object has been renamed.
+ /// </summary>
[PreserveSig]
void OnRename(IMoniker moniker);
- /// <devdoc>
- /// Called by the server to notify all registered advisory sinks that
- /// the object has been saved.
- /// </devdoc>
+ /// <summary>
+ /// Called by the server to notify all registered advisory sinks that
+ /// the object has been saved.
+ /// </summary>
[PreserveSig]
void OnSave();
- /// <devdoc>
- /// Called by the server to notify all registered advisory sinks that the
- /// object has changed from the running to the loaded state.
- /// </devdoc>
+ /// <summary>
+ /// Called by the server to notify all registered advisory sinks that the
+ /// object has changed from the running to the loaded state.
+ /// </summary>
[PreserveSig]
void OnClose();
}
namespace System.Runtime.InteropServices.ComTypes
{
- /// <devdoc>
+ /// <summary>
/// The IDataObject interface specifies methods that enable data transfer
/// and notification of changes in data. Data transfer methods specify
/// the format of the transferred data along with the medium through
/// retrieving and storing data, the IDataObject interface specifies
/// methods for enumerating available formats and managing connections
/// to advisory sinks for handling change notifications.
- /// </devdoc>
+ /// </summary>
[CLSCompliant(false)]
[ComImport()]
[Guid("0000010E-0000-0000-C000-000000000046")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
public interface IDataObject {
- /// <devdoc>
+ /// <summary>
/// Called by a data consumer to obtain data from a source data object.
/// The GetData method renders the data described in the specified FORMATETC
/// structure and transfers it through the specified STGMEDIUM structure.
/// The caller then assumes responsibility for releasing the STGMEDIUM structure.
- /// </devdoc>
+ /// </summary>
void GetData([In] ref FORMATETC format, out STGMEDIUM medium);
- /// <devdoc>
+ /// <summary>
/// Called by a data consumer to obtain data from a source data object.
/// This method differs from the GetData method in that the caller must
/// allocate and free the specified storage medium.
- /// </devdoc>
+ /// </summary>
void GetDataHere([In] ref FORMATETC format, ref STGMEDIUM medium);
- /// <devdoc>
+ /// <summary>
/// Determines whether the data object is capable of rendering the data
/// described in the FORMATETC structure. Objects attempting a paste or
/// drop operation can call this method before calling IDataObject::GetData
/// to get an indication of whether the operation may be successful.
- /// </devdoc>
+ /// </summary>
[PreserveSig]
int QueryGetData([In] ref FORMATETC format);
- /// <devdoc>
+ /// <summary>
/// Provides a standard FORMATETC structure that is logically equivalent to one that is more
/// complex. You use this method to determine whether two different
/// FORMATETC structures would return the same data, removing the need
/// for duplicate rendering.
- /// </devdoc>
+ /// </summary>
[PreserveSig]
int GetCanonicalFormatEtc([In] ref FORMATETC formatIn, out FORMATETC formatOut);
- /// <devdoc>
+ /// <summary>
/// Called by an object containing a data source to transfer data to
/// the object that implements this method.
- /// </devdoc>
+ /// </summary>
void SetData([In] ref FORMATETC formatIn, [In] ref STGMEDIUM medium, [MarshalAs(UnmanagedType.Bool)] bool release);
- /// <devdoc>
+ /// <summary>
/// Creates an object for enumerating the FORMATETC structures for a
/// data object. These structures are used in calls to IDataObject::GetData
/// or IDataObject::SetData.
- /// </devdoc>
+ /// </summary>
IEnumFORMATETC EnumFormatEtc(DATADIR direction);
- /// <devdoc>
+ /// <summary>
/// Called by an object supporting an advise sink to create a connection between
/// a data object and the advise sink. This enables the advise sink to be
/// notified of changes in the data of the object.
- /// </devdoc>
+ /// </summary>
[PreserveSig]
int DAdvise([In] ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection);
- /// <devdoc>
+ /// <summary>
/// Destroys a notification connection that had been previously set up.
- /// </devdoc>
+ /// </summary>
void DUnadvise(int connection);
- /// <devdoc>
+ /// <summary>
/// Creates an object that can be used to enumerate the current advisory connections.
- /// </devdoc>
+ /// </summary>
[PreserveSig]
int EnumDAdvise(out IEnumSTATDATA enumAdvise);
}
namespace System.Runtime.InteropServices.ComTypes
{
- /// <devdoc>
+ /// <summary>
/// The IEnumFORMATETC interface is used to enumerate an array of FORMATETC
/// structures. IEnumFORMATETC has the same methods as all enumerator interfaces:
/// Next, Skip, Reset, and Clone.
- /// </devdoc>
+ /// </summary>
[ComImport()]
[Guid("00000103-0000-0000-C000-000000000046")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
public interface IEnumFORMATETC
{
- /// <devdoc>
+ /// <summary>
/// Retrieves the next celt items in the enumeration sequence. If there are
/// fewer than the requested number of elements left in the sequence, it
/// retrieves the remaining elements. The number of elements actually
/// retrieved is returned through pceltFetched (unless the caller passed
/// in NULL for that parameter).
- /// </devdoc>
+ /// </summary>
[PreserveSig]
int Next(int celt, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] FORMATETC[] rgelt, [Out, MarshalAs(UnmanagedType.LPArray)] int[] pceltFetched);
- /// <devdoc>
+ /// <summary>
/// Skips over the next specified number of elements in the enumeration sequence.
- /// </devdoc>
+ /// </summary>
[PreserveSig]
int Skip(int celt);
- /// <devdoc>
+ /// <summary>
/// Resets the enumeration sequence to the beginning.
- /// </devdoc>
+ /// </summary>
[PreserveSig]
int Reset();
- /// <devdoc>
+ /// <summary>
/// Creates another enumerator that contains the same enumeration state as
/// the current one. Using this function, a client can record a particular
/// point in the enumeration sequence and then return to that point at a
/// later time. The new enumerator supports the same interface as the original one.
- /// </devdoc>
+ /// </summary>
void Clone(out IEnumFORMATETC newEnum);
}
}
namespace System.Runtime.InteropServices.ComTypes
{
- /// <devdoc>
- /// The IEnumSTATDATA interface is used to enumerate through an array of
- /// STATDATA structures, which contain advisory connection information for
- /// a data object. IEnumSTATDATA has the same methods as all enumerator
- /// interfaces: Next, Skip, Reset, and Clone.
- /// </devdoc>
+ /// <summary>
+ /// The IEnumSTATDATA interface is used to enumerate through an array of
+ /// STATDATA structures, which contain advisory connection information for
+ /// a data object. IEnumSTATDATA has the same methods as all enumerator
+ /// interfaces: Next, Skip, Reset, and Clone.
+ /// </summary>
[ComImport()]
[Guid("00000103-0000-0000-C000-000000000046")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
public interface IEnumSTATDATA
{
- /// <devdoc>
- /// Retrieves the next celt items in the enumeration sequence. If there are
- /// fewer than the requested number of elements left in the sequence, it
- /// retrieves the remaining elements. The number of elements actually
- /// retrieved is returned through pceltFetched (unless the caller passed
- /// in NULL for that parameter).
- /// </devdoc>
+ /// <summary>
+ /// Retrieves the next celt items in the enumeration sequence. If there are
+ /// fewer than the requested number of elements left in the sequence, it
+ /// retrieves the remaining elements. The number of elements actually
+ /// retrieved is returned through pceltFetched (unless the caller passed
+ /// in NULL for that parameter).
+ /// </summary>
[PreserveSig]
int Next(int celt, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex=0)] STATDATA[] rgelt, [Out, MarshalAs(UnmanagedType.LPArray, SizeConst=1)] int[] pceltFetched);
- /// <devdoc>
- /// Skips over the next specified number of elements in the enumeration sequence.
- /// </devdoc>
+ /// <summary>
+ /// Skips over the next specified number of elements in the enumeration sequence.
+ /// </summary>
[PreserveSig]
int Skip(int celt);
- /// <devdoc>
- /// Resets the enumeration sequence to the beginning.
- /// </devdoc>
+ /// <summary>
+ /// Resets the enumeration sequence to the beginning.
+ /// </summary>
[PreserveSig]
int Reset();
- /// <devdoc>
- /// Creates another enumerator that contains the same enumeration state as
- /// the current one. Using this function, a client can record a particular
- /// point in the enumeration sequence and then return to that point at a
- /// later time. The new enumerator supports the same interface as the original one.
- /// </devdoc>
+ /// <summary>
+ /// Creates another enumerator that contains the same enumeration state as
+ /// the current one. Using this function, a client can record a particular
+ /// point in the enumeration sequence and then return to that point at a
+ /// later time. The new enumerator supports the same interface as the original one.
+ /// </summary>
void Clone(out IEnumSTATDATA newEnum);
}
}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.InteropServices
+{
+ [AttributeUsage(AttributeTargets.Method, Inherited = false)]
+ public sealed class ComUnregisterFunctionAttribute : Attribute
+ {
+ }
+}
{
public sealed class HandleCollector
{
- private const int DeltaPercent = 10; // this is used for increasing the threshold.
- private int _initialThreshold;
+ // Used for increasing the threshold.
+ private const int DeltaPercent = 10;
private int _threshold;
private int _handleCount;
- private int[] _gc_counts = new int[3];
- private int _gc_gen = 0;
+ private int[] _gcCounts = new int[3];
+ private int _gcGeneration = 0;
public HandleCollector(string name, int initialThreshold) :
this(name, initialThreshold, int.MaxValue)
{
if (initialThreshold < 0)
{
- throw new ArgumentOutOfRangeException(nameof(initialThreshold), SR.Arg_NeedNonNegNumRequired);
+ throw new ArgumentOutOfRangeException(nameof(initialThreshold), initialThreshold, SR.Arg_NeedNonNegNumRequired);
}
-
if (maximumThreshold < 0)
{
- throw new ArgumentOutOfRangeException(nameof(maximumThreshold), SR.Arg_NeedNonNegNumRequired);
+ throw new ArgumentOutOfRangeException(nameof(maximumThreshold), maximumThreshold, SR.Arg_NeedNonNegNumRequired);
}
-
if (initialThreshold > maximumThreshold)
{
- throw new ArgumentException(SR.Arg_InvalidThreshold);
+ throw new ArgumentException(SR.Arg_InvalidThreshold, nameof(initialThreshold));
}
Name = name ?? string.Empty;
- _initialThreshold = initialThreshold;
+ InitialThreshold = initialThreshold;
MaximumThreshold = maximumThreshold;
_threshold = initialThreshold;
_handleCount = 0;
public int Count => _handleCount;
- public int InitialThreshold => _initialThreshold;
+ public int InitialThreshold { get; }
public int MaximumThreshold { get; }
public void Add()
{
- int gen_collect = -1;
+ int collectionGeneration = -1;
Interlocked.Increment(ref _handleCount);
if (_handleCount < 0)
{
lock (this)
{
_threshold = _handleCount + (_handleCount / DeltaPercent);
- gen_collect = _gc_gen;
- if (_gc_gen < 2)
+ collectionGeneration = _gcGeneration;
+ if (_gcGeneration < 2)
{
- _gc_gen++;
+ _gcGeneration++;
}
}
}
- if ((gen_collect >= 0) &&
- ((gen_collect == 0) ||
- (_gc_counts[gen_collect] == GC.CollectionCount(gen_collect))))
+ if ((collectionGeneration >= 0) &&
+ ((collectionGeneration == 0) ||
+ (_gcCounts[collectionGeneration] == GC.CollectionCount(collectionGeneration))))
{
- GC.Collect(gen_collect);
- Thread.Sleep(10 * gen_collect);
+ GC.Collect(collectionGeneration);
+ Thread.Sleep(10 * collectionGeneration);
}
- //don't bother with gen0.
+ // Don't bother with gen0.
for (int i = 1; i < 3; i++)
{
- _gc_counts[i] = GC.CollectionCount(i);
+ _gcCounts[i] = GC.CollectionCount(i);
}
}
{
lock (this)
{
- if (newThreshold > _initialThreshold)
+ if (newThreshold > InitialThreshold)
{
_threshold = newThreshold;
}
else
{
- _threshold = _initialThreshold;
+ _threshold = InitialThreshold;
}
- _gc_gen = 0;
+ _gcGeneration = 0;
}
}
for (int i = 1; i < 3; i++)
{
- _gc_counts[i] = GC.CollectionCount(i);
+ _gcCounts[i] = GC.CollectionCount(i);
}
}
}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.InteropServices
+{
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly, Inherited = false)]
+ [Obsolete("This attribute is deprecated and will be removed in a future version.", error: false)]
+ public sealed class IDispatchImplAttribute : Attribute
+ {
+ public IDispatchImplAttribute(short implType) : this((IDispatchImplType)implType)
+ {
+ }
+
+ public IDispatchImplAttribute(IDispatchImplType implType) => Value = implType;
+
+ public IDispatchImplType Value { get; }
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.InteropServices
+{
+ [Obsolete("The IDispatchImplAttribute is deprecated.", error: false)]
+ public enum IDispatchImplType
+ {
+ CompatibleImpl = 2,
+ InternalImpl = 1,
+ SystemDefinedImpl = 0,
+ }
+}
namespace System.Runtime.InteropServices
{
- [ComImport, Guid("00000003-0000-0000-C000-000000000046"),
- InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ [ComImport]
+ [Guid("00000003-0000-0000-C000-000000000046")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
internal interface IMarshal
{
[PreserveSig]
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.InteropServices
+{
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
+ public sealed class ImportedFromTypeLibAttribute : Attribute
+ {
+ public ImportedFromTypeLibAttribute(string tlbFile) => Value = tlbFile;
+
+ public string Value { get; }
+ }
+}
--- /dev/null
+
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.InteropServices
+{
+ [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
+ public sealed class ManagedToNativeComInteropStubAttribute : Attribute
+ {
+ public ManagedToNativeComInteropStubAttribute(Type classType, string methodName)
+ {
+ ClassType = classType;
+ MethodName = methodName;
+ }
+
+ public Type ClassType { get; }
+ public string MethodName { get; }
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.InteropServices
+{
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = true)]
+ public sealed class PrimaryInteropAssemblyAttribute : Attribute
+ {
+ public PrimaryInteropAssemblyAttribute(int major, int minor)
+ {
+ MajorVersion = major;
+ MinorVersion = minor;
+ }
+
+ public int MajorVersion { get; }
+ public int MinorVersion { get; }
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.InteropServices
+{
+ [Obsolete("This attribute has been deprecated. Application Domains no longer respect Activation Context boundaries in IDispatch calls.", error: false)]
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
+ public sealed class SetWin32ContextInIDispatchAttribute : Attribute
+ {
+ public SetWin32ContextInIDispatchAttribute()
+ {
+ }
+ }
+}
private static readonly Guid CLSID_StdMarshal = new Guid("00000017-0000-0000-c000-000000000046");
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate int GetMarshalSizeMax_Delegate(IntPtr _this, ref Guid riid, IntPtr pv, int dwDestContext, IntPtr pvDestContext, int mshlflags, out int pSize);
+ private delegate int GetMarshalSizeMaxDelegate(IntPtr _this, ref Guid riid, IntPtr pv, int dwDestContext, IntPtr pvDestContext, int mshlflags, out int pSize);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate int MarshalInterface_Delegate(IntPtr _this, IntPtr pStm, ref Guid riid, IntPtr pv, int dwDestContext, IntPtr pvDestContext, int mshlflags);
+ private delegate int MarshalInterfaceDelegate(IntPtr _this, IntPtr pStm, ref Guid riid, IntPtr pv, int dwDestContext, IntPtr pvDestContext, int mshlflags);
- protected StandardOleMarshalObject() { }
+ protected StandardOleMarshalObject()
+ {
+ }
private IntPtr GetStdMarshaler(ref Guid riid, int dwDestContext, int mshlflags)
{
- IntPtr pStandardMarshal = IntPtr.Zero;
-
IntPtr pUnknown = Marshal.GetIUnknownForObject(this);
if (pUnknown != IntPtr.Zero)
{
try
{
- if (HResults.S_OK == Interop.Ole32.CoGetStandardMarshal(ref riid, pUnknown, dwDestContext, IntPtr.Zero, mshlflags, out pStandardMarshal))
+ IntPtr pStandardMarshal = IntPtr.Zero;
+ int hr = Interop.Ole32.CoGetStandardMarshal(ref riid, pUnknown, dwDestContext, IntPtr.Zero, mshlflags, out pStandardMarshal);
+ if (hr == HResults.S_OK)
{
Debug.Assert(pStandardMarshal != IntPtr.Zero, "Failed to get marshaler for interface '" + riid.ToString() + "', CoGetStandardMarshal returned S_OK");
return pStandardMarshal;
Marshal.Release(pUnknown);
}
}
- throw new InvalidOperationException(SR.Format(SR.StandardOleMarshalObjectGetMarshalerFailed, riid.ToString()));
+
+ throw new InvalidOperationException(SR.Format(SR.StandardOleMarshalObjectGetMarshalerFailed, riid));
}
int IMarshal.GetUnmarshalClass(ref Guid riid, IntPtr pv, int dwDestContext, IntPtr pvDestContext, int mshlflags, out Guid pCid)
try
{
- // we must not wrap pStandardMarshal with an RCW because that would trigger QIs for random IIDs and the marshaler
- // (aka stub manager object) does not really handle these well and we would risk triggering an AppVerifier break
+ // We must not wrap pStandardMarshal with an RCW because that
+ // would trigger QIs for random IIDs and the marshaler (aka stub
+ // manager object) does not really handle these well and we would
+ // risk triggering an AppVerifier break
IntPtr vtable = *(IntPtr*)pStandardMarshal.ToPointer();
- IntPtr method = *((IntPtr*)vtable.ToPointer() + 4); // GetMarshalSizeMax is 4th slot
+
+ // GetMarshalSizeMax is 4th slot
+ IntPtr method = *((IntPtr*)vtable.ToPointer() + 4);
- GetMarshalSizeMax_Delegate del = (GetMarshalSizeMax_Delegate)Marshal.GetDelegateForFunctionPointer(method, typeof(GetMarshalSizeMax_Delegate));
+ GetMarshalSizeMaxDelegate del = (GetMarshalSizeMaxDelegate)Marshal.GetDelegateForFunctionPointer(method, typeof(GetMarshalSizeMaxDelegate));
return del(pStandardMarshal, ref riid, pv, dwDestContext, pvDestContext, mshlflags, out pSize);
}
finally
try
{
- // we must not wrap pStandardMarshal with an RCW because that would trigger QIs for random IIDs and the marshaler
- // (aka stub manager object) does not really handle these well and we would risk triggering an AppVerifier break
+ // We must not wrap pStandardMarshal with an RCW because that
+ // would trigger QIs for random IIDs and the marshaler (aka stub
+ // manager object) does not really handle these well and we would
+ // risk triggering an AppVerifier break
IntPtr vtable = *(IntPtr*)pStandardMarshal.ToPointer();
IntPtr method = *((IntPtr*)vtable.ToPointer() + 5); // MarshalInterface is 5th slot
- MarshalInterface_Delegate del = (MarshalInterface_Delegate)Marshal.GetDelegateForFunctionPointer(method, typeof(MarshalInterface_Delegate));
+ MarshalInterfaceDelegate del = (MarshalInterfaceDelegate)Marshal.GetDelegateForFunctionPointer(method, typeof(MarshalInterfaceDelegate));
return del(pStandardMarshal, pStm, ref riid, pv, dwDestContext, pvDestContext, mshlflags);
}
finally
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.InteropServices
+{
+ [AttributeUsage(AttributeTargets.Method, Inherited = false)]
+ public sealed class TypeLibFuncAttribute : Attribute
+ {
+ public TypeLibFuncAttribute(TypeLibFuncFlags flags)
+ {
+ Value = flags;
+ }
+
+ public TypeLibFuncAttribute(short flags)
+ {
+ Value = (TypeLibFuncFlags)flags;
+ }
+
+ public TypeLibFuncFlags Value { get; }
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.InteropServices
+{
+ [Flags]
+ public enum TypeLibFuncFlags
+ {
+ FRestricted = 0x0001,
+ FSource = 0x0002,
+ FBindable = 0x0004,
+ FRequestEdit = 0x0008,
+ FDisplayBind = 0x0010,
+ FDefaultBind = 0x0020,
+ FHidden = 0x0040,
+ FUsesGetLastError = 0x0080,
+ FDefaultCollelem = 0x0100,
+ FUiDefault = 0x0200,
+ FNonBrowsable = 0x0400,
+ FReplaceable = 0x0800,
+ FImmediateBind = 0x1000,
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.InteropServices
+{
+ [AttributeUsage(AttributeTargets.Interface, Inherited = false)]
+ public sealed class TypeLibImportClassAttribute : Attribute
+ {
+ public TypeLibImportClassAttribute(Type importClass) => Value = importClass.ToString();
+
+ public string Value { get; }
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.InteropServices
+{
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Enum | AttributeTargets.Struct, Inherited = false)]
+ public sealed class TypeLibTypeAttribute : Attribute
+ {
+ public TypeLibTypeAttribute(TypeLibTypeFlags flags)
+ {
+ Value = flags;
+ }
+
+ public TypeLibTypeAttribute(short flags)
+ {
+ Value = (TypeLibTypeFlags)flags;
+ }
+
+ public TypeLibTypeFlags Value { get; }
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.InteropServices
+{
+ [Flags]
+ public enum TypeLibTypeFlags
+ {
+ FAppObject = 0x0001,
+ FCanCreate = 0x0002,
+ FLicensed = 0x0004,
+ FPreDeclId = 0x0008,
+ FHidden = 0x0010,
+ FControl = 0x0020,
+ FDual = 0x0040,
+ FNonExtensible = 0x0080,
+ FOleAutomation = 0x0100,
+ FRestricted = 0x0200,
+ FAggregatable = 0x0400,
+ FReplaceable = 0x0800,
+ FDispatchable = 0x1000,
+ FReverseBind = 0x2000,
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.InteropServices
+{
+ [AttributeUsage(AttributeTargets.Field, Inherited = false)]
+ public sealed class TypeLibVarAttribute : Attribute
+ {
+ public TypeLibVarAttribute(TypeLibVarFlags flags)
+ {
+ Value = flags;
+ }
+
+ public TypeLibVarAttribute(short flags)
+ {
+ Value = (TypeLibVarFlags)flags;
+ }
+
+ public TypeLibVarFlags Value { get; }
+ }
+}
--- /dev/null
+
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.InteropServices
+{
+ [Flags]
+ public enum TypeLibVarFlags
+ {
+ FReadOnly = 0x0001,
+ FSource = 0x0002,
+ FBindable = 0x0004,
+ FRequestEdit = 0x0008,
+ FDisplayBind = 0x0010,
+ FDefaultBind = 0x0020,
+ FHidden = 0x0040,
+ FRestricted = 0x0080,
+ FDefaultCollelem = 0x0100,
+ FUiDefault = 0x0200,
+ FNonBrowsable = 0x0400,
+ FReplaceable = 0x0800,
+ FImmediateBind = 0x1000,
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.InteropServices
+{
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
+ public sealed class TypeLibVersionAttribute : Attribute
+ {
+ public TypeLibVersionAttribute(int major, int minor)
+ {
+ MajorVersion = major;
+ MinorVersion = minor;
+ }
+
+ public int MajorVersion { get; }
+ public int MinorVersion { get; }
+ }
+}
[Fact]
public static void Ctor_InitialThresholdGreaterThanMaximumThreshold_ThrowsArgumentException()
{
- AssertExtensions.Throws<ArgumentException>(null, () => new HandleCollector("InitialGreaterThanMax", 100, 1));
+ AssertExtensions.Throws<ArgumentException>("initialThreshold", null, () => new HandleCollector("InitialGreaterThanMax", 100, 1));
}
[Fact]