Browse Source

Moves ComTypes to shared partition (dotnet/coreclr#21861)

Signed-off-by: dotnet-bot <[email protected]>
Marek Safar 7 years ago
parent
commit
84d992cfd7
19 changed files with 828 additions and 0 deletions
  1. 20 0
      netcore/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems
  2. 33 0
      netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IBindCtx.cs
  3. 18 0
      netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IConnectionPoint.cs
  4. 15 0
      netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IConnectionPointContainer.cs
  5. 19 0
      netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IEnumConnectionPoints.cs
  6. 27 0
      netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IEnumConnections.cs
  7. 19 0
      netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IEnumMoniker.cs
  8. 19 0
      netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IEnumString.cs
  9. 23 0
      netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IEnumVARIANT.cs
  10. 22 0
      netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IEnumerable.cs
  11. 49 0
      netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IMoniker.cs
  12. 23 0
      netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IPersistFile.cs
  13. 23 0
      netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IRunningObjectTable.cs
  14. 43 0
      netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IStream.cs
  15. 36 0
      netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/ITypeComp.cs
  16. 303 0
      netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/ITypeInfo.cs
  17. 51 0
      netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/ITypeInfo2.cs
  18. 54 0
      netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/ITypeLib.cs
  19. 31 0
      netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/ITypeLib2.cs

+ 20 - 0
netcore/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems

@@ -942,6 +942,26 @@
     <Compile Include="$(MSBuildThisFileDirectory)System\IO\FileStream.Win32.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\TimeZoneInfo.Win32.cs" />
   </ItemGroup>
+  <ItemGroup Condition="'$(IsProjectNLibrary)' != 'true'">
+    <Compile Include="$(MSBuildThisFileDirectory)\System\Runtime\InteropServices\ComTypes\IBindCtx.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)\System\Runtime\InteropServices\ComTypes\IConnectionPoint.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)\System\Runtime\InteropServices\ComTypes\IConnectionPointContainer.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)\System\Runtime\InteropServices\ComTypes\IEnumConnectionPoints.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)\System\Runtime\InteropServices\ComTypes\IEnumConnections.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)\System\Runtime\InteropServices\ComTypes\IEnumerable.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)\System\Runtime\InteropServices\ComTypes\IEnumMoniker.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)\System\Runtime\InteropServices\ComTypes\IEnumString.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)\System\Runtime\InteropServices\ComTypes\IEnumVARIANT.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)\System\Runtime\InteropServices\ComTypes\IMoniker.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)\System\Runtime\InteropServices\ComTypes\IPersistFile.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)\System\Runtime\InteropServices\ComTypes\IRunningObjectTable.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)\System\Runtime\InteropServices\ComTypes\IStream.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)\System\Runtime\InteropServices\ComTypes\ITypeComp.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)\System\Runtime\InteropServices\ComTypes\ITypeInfo.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)\System\Runtime\InteropServices\ComTypes\ITypeInfo2.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)\System\Runtime\InteropServices\ComTypes\ITypeLib.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)\System\Runtime\InteropServices\ComTypes\ITypeLib2.cs" />
+  </ItemGroup>
   <ItemGroup Condition="$(TargetsWindows) and '$(EnableWinRT)' == 'true'">
     <Compile Include="$(MSBuildThisFileDirectory)System\IO\FileStream.WinRT.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.CreateFile2.cs" />

+ 33 - 0
netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IBindCtx.cs

@@ -0,0 +1,33 @@
+// 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.ComTypes
+{
+    [StructLayout(LayoutKind.Sequential)]
+    public struct BIND_OPTS
+    {
+        public int cbStruct;
+        public int grfFlags;
+        public int grfMode;
+        public int dwTickCountDeadline;
+    }
+
+    [Guid("0000000e-0000-0000-C000-000000000046")]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    [ComImport]
+    public interface IBindCtx
+    {
+        void RegisterObjectBound([MarshalAs(UnmanagedType.Interface)] object punk);
+        void RevokeObjectBound([MarshalAs(UnmanagedType.Interface)] object punk);
+        void ReleaseBoundObjects();
+        void SetBindOptions([In()] ref BIND_OPTS pbindopts);
+        void GetBindOptions(ref BIND_OPTS pbindopts);
+        void GetRunningObjectTable(out IRunningObjectTable pprot);
+        void RegisterObjectParam([MarshalAs(UnmanagedType.LPWStr)] string pszKey, [MarshalAs(UnmanagedType.Interface)] object punk);
+        void GetObjectParam([MarshalAs(UnmanagedType.LPWStr)] string pszKey, [MarshalAs(UnmanagedType.Interface)] out object ppunk);
+        void EnumObjectParam(out IEnumString ppenum);
+        [PreserveSig]
+        int RevokeObjectParam([MarshalAs(UnmanagedType.LPWStr)] string pszKey);
+    }
+}

+ 18 - 0
netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IConnectionPoint.cs

@@ -0,0 +1,18 @@
+// 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.ComTypes
+{
+    [Guid("B196B286-BAB4-101A-B69C-00AA00341D07")]
+    [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
+    [ComImport]
+    public interface IConnectionPoint
+    {
+        void GetConnectionInterface(out Guid pIID);
+        void GetConnectionPointContainer(out IConnectionPointContainer ppCPC);
+        void Advise([MarshalAs(UnmanagedType.Interface)] object pUnkSink, out int pdwCookie);
+        void Unadvise(int dwCookie);
+        void EnumConnections(out IEnumConnections ppEnum);
+    }
+}

+ 15 - 0
netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IConnectionPointContainer.cs

@@ -0,0 +1,15 @@
+// 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.ComTypes
+{
+    [Guid("B196B284-BAB4-101A-B69C-00AA00341D07")]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    [ComImport]
+    public interface IConnectionPointContainer
+    {
+        void EnumConnectionPoints(out IEnumConnectionPoints ppEnum);
+        void FindConnectionPoint([In] ref Guid riid, out IConnectionPoint ppCP);
+    }
+}

+ 19 - 0
netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IEnumConnectionPoints.cs

@@ -0,0 +1,19 @@
+// 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.ComTypes
+{
+    [Guid("B196B285-BAB4-101A-B69C-00AA00341D07")]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    [ComImport]
+    public interface IEnumConnectionPoints
+    {
+        [PreserveSig]
+        int Next(int celt, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0), Out] IConnectionPoint[] rgelt, IntPtr pceltFetched);
+        [PreserveSig]
+        int Skip(int celt);
+        void Reset();
+        void Clone(out IEnumConnectionPoints ppenum);
+    }
+}

+ 27 - 0
netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IEnumConnections.cs

@@ -0,0 +1,27 @@
+// 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.ComTypes
+{
+    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+    public struct CONNECTDATA
+    {
+        [MarshalAs(UnmanagedType.Interface)]
+        public object pUnk;
+        public int dwCookie;
+    }
+
+    [Guid("B196B287-BAB4-101A-B69C-00AA00341D07")]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    [ComImport]
+    public interface IEnumConnections
+    {
+        [PreserveSig]
+        int Next(int celt, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0), Out] CONNECTDATA[] rgelt, IntPtr pceltFetched);
+        [PreserveSig]
+        int Skip(int celt);
+        void Reset();
+        void Clone(out IEnumConnections ppenum);
+    }
+}

+ 19 - 0
netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IEnumMoniker.cs

@@ -0,0 +1,19 @@
+// 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.ComTypes
+{
+    [Guid("00000102-0000-0000-C000-000000000046")]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    [ComImport]
+    public interface IEnumMoniker
+    {
+        [PreserveSig]
+        int Next(int celt, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0), Out] IMoniker[] rgelt, IntPtr pceltFetched);
+        [PreserveSig]
+        int Skip(int celt);
+        void Reset();
+        void Clone(out IEnumMoniker ppenum);
+    }
+}

+ 19 - 0
netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IEnumString.cs

@@ -0,0 +1,19 @@
+// 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.ComTypes
+{
+    [Guid("00000101-0000-0000-C000-000000000046")]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    [ComImport]
+    public interface IEnumString
+    {
+        [PreserveSig]
+        int Next(int celt, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 0), Out] string[] rgelt, IntPtr pceltFetched);
+        [PreserveSig]
+        int Skip(int celt);
+        void Reset();
+        void Clone(out IEnumString ppenum);
+    }
+}

+ 23 - 0
netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IEnumVARIANT.cs

@@ -0,0 +1,23 @@
+// 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.ComTypes
+{
+    [Guid("00020404-0000-0000-C000-000000000046")]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    [ComImport]
+    public interface IEnumVARIANT
+    {
+        [PreserveSig]
+        int Next(int celt, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0), Out] object[] rgVar, IntPtr pceltFetched);
+
+        [PreserveSig]
+        int Skip(int celt);
+
+        [PreserveSig]
+        int Reset();
+
+        IEnumVARIANT Clone();
+    }
+}

+ 22 - 0
netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IEnumerable.cs

@@ -0,0 +1,22 @@
+// 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;
+namespace System.Runtime.InteropServices.ComTypes
+{
+    /*==========================================================================
+    ** Interface: IEnumerable
+    ** Purpose:
+    ** This interface is redefined here since the original IEnumerable interface
+    ** has all its methods marked as ecall's since it is a managed standard
+    ** interface. This interface is used from within the runtime to make a call
+    ** on the COM server directly when it implements the IEnumerable interface.
+    ==========================================================================*/
+    [Guid("496B0ABE-CDEE-11d3-88E8-00902754C43A")]
+    internal interface IEnumerable
+    {
+        [DispId(-4)]
+        System.Collections.IEnumerator GetEnumerator();
+    }
+}

+ 49 - 0
netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IMoniker.cs

@@ -0,0 +1,49 @@
+// 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.ComTypes
+{
+    [StructLayout(LayoutKind.Sequential)]
+    public struct FILETIME
+    {
+        public int dwLowDateTime;
+        public int dwHighDateTime;
+    }
+
+    [Guid("0000000f-0000-0000-C000-000000000046")]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    [ComImport]
+    public interface IMoniker
+    {
+        // IPersist portion
+        void GetClassID(out Guid pClassID);
+
+        // IPersistStream portion
+        [PreserveSig]
+        int IsDirty();
+        void Load(IStream pStm);
+        void Save(IStream pStm, [MarshalAs(UnmanagedType.Bool)] bool fClearDirty);
+        void GetSizeMax(out long pcbSize);
+
+        // IMoniker portion
+        void BindToObject(IBindCtx pbc, IMoniker pmkToLeft, [In()] ref Guid riidResult, [MarshalAs(UnmanagedType.Interface)] out object ppvResult);
+        void BindToStorage(IBindCtx pbc, IMoniker pmkToLeft, [In()] ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppvObj);
+        void Reduce(IBindCtx pbc, int dwReduceHowFar, ref IMoniker ppmkToLeft, out IMoniker ppmkReduced);
+        void ComposeWith(IMoniker pmkRight, [MarshalAs(UnmanagedType.Bool)] bool fOnlyIfNotGeneric, out IMoniker ppmkComposite);
+        void Enum([MarshalAs(UnmanagedType.Bool)] bool fForward, out IEnumMoniker ppenumMoniker);
+        [PreserveSig]
+        int IsEqual(IMoniker pmkOtherMoniker);
+        void Hash(out int pdwHash);
+        [PreserveSig]
+        int IsRunning(IBindCtx pbc, IMoniker pmkToLeft, IMoniker pmkNewlyRunning);
+        void GetTimeOfLastChange(IBindCtx pbc, IMoniker pmkToLeft, out FILETIME pFileTime);
+        void Inverse(out IMoniker ppmk);
+        void CommonPrefixWith(IMoniker pmkOther, out IMoniker ppmkPrefix);
+        void RelativePathTo(IMoniker pmkOther, out IMoniker ppmkRelPath);
+        void GetDisplayName(IBindCtx pbc, IMoniker pmkToLeft, [MarshalAs(UnmanagedType.LPWStr)] out string ppszDisplayName);
+        void ParseDisplayName(IBindCtx pbc, IMoniker pmkToLeft, [MarshalAs(UnmanagedType.LPWStr)] string pszDisplayName, out int pchEaten, out IMoniker ppmkOut);
+        [PreserveSig]
+        int IsSystemMoniker(out int pdwMksys);
+    }
+}

+ 23 - 0
netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IPersistFile.cs

@@ -0,0 +1,23 @@
+// 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.ComTypes
+{
+    [Guid("0000010b-0000-0000-C000-000000000046")]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    [ComImport]
+    public interface IPersistFile
+    {
+        // IPersist portion
+        void GetClassID(out Guid pClassID);
+
+        // IPersistFile portion
+        [PreserveSig]
+        int IsDirty();
+        void Load([MarshalAs(UnmanagedType.LPWStr)] string pszFileName, int dwMode);
+        void Save([MarshalAs(UnmanagedType.LPWStr)] string pszFileName, [MarshalAs(UnmanagedType.Bool)] bool fRemember);
+        void SaveCompleted([MarshalAs(UnmanagedType.LPWStr)] string pszFileName);
+        void GetCurFile([MarshalAs(UnmanagedType.LPWStr)] out string ppszFileName);
+    }
+}

+ 23 - 0
netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IRunningObjectTable.cs

@@ -0,0 +1,23 @@
+// 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.ComTypes
+{
+    [Guid("00000010-0000-0000-C000-000000000046")]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    [ComImport]
+    public interface IRunningObjectTable
+    {
+        int Register(int grfFlags, [MarshalAs(UnmanagedType.Interface)] object punkObject, IMoniker pmkObjectName);
+        void Revoke(int dwRegister);
+        [PreserveSig]
+        int IsRunning(IMoniker pmkObjectName);
+        [PreserveSig]
+        int GetObject(IMoniker pmkObjectName, [MarshalAs(UnmanagedType.Interface)] out object ppunkObject);
+        void NoteChangeTime(int dwRegister, ref FILETIME pfiletime);
+        [PreserveSig]
+        int GetTimeOfLastChange(IMoniker pmkObjectName, out FILETIME pfiletime);
+        void EnumRunning(out IEnumMoniker ppenumMoniker);
+    }
+}

+ 43 - 0
netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/IStream.cs

@@ -0,0 +1,43 @@
+// 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.ComTypes
+{
+    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+    public struct STATSTG
+    {
+        public string pwcsName;
+        public int type;
+        public long cbSize;
+        public FILETIME mtime;
+        public FILETIME ctime;
+        public FILETIME atime;
+        public int grfMode;
+        public int grfLocksSupported;
+        public Guid clsid;
+        public int grfStateBits;
+        public int reserved;
+    }
+
+    [Guid("0000000c-0000-0000-C000-000000000046")]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    [ComImport]
+    public interface IStream
+    {
+        // ISequentialStream portion
+        void Read([MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1), Out] byte[] pv, int cb, IntPtr pcbRead);
+        void Write([MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] byte[] pv, int cb, IntPtr pcbWritten);
+
+        // IStream portion
+        void Seek(long dlibMove, int dwOrigin, IntPtr plibNewPosition);
+        void SetSize(long libNewSize);
+        void CopyTo(IStream pstm, long cb, IntPtr pcbRead, IntPtr pcbWritten);
+        void Commit(int grfCommitFlags);
+        void Revert();
+        void LockRegion(long libOffset, long cb, int dwLockType);
+        void UnlockRegion(long libOffset, long cb, int dwLockType);
+        void Stat(out STATSTG pstatstg, int grfStatFlag);
+        void Clone(out IStream ppstm);
+    }
+}

+ 36 - 0
netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/ITypeComp.cs

@@ -0,0 +1,36 @@
+// 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.ComTypes
+{
+    public enum DESCKIND
+    {
+        DESCKIND_NONE = 0,
+        DESCKIND_FUNCDESC = DESCKIND_NONE + 1,
+        DESCKIND_VARDESC = DESCKIND_FUNCDESC + 1,
+        DESCKIND_TYPECOMP = DESCKIND_VARDESC + 1,
+        DESCKIND_IMPLICITAPPOBJ = DESCKIND_TYPECOMP + 1,
+        DESCKIND_MAX = DESCKIND_IMPLICITAPPOBJ + 1
+    }
+
+    [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode)]
+    public struct BINDPTR
+    {
+        [FieldOffset(0)]
+        public IntPtr lpfuncdesc;
+        [FieldOffset(0)]
+        public IntPtr lpvardesc;
+        [FieldOffset(0)]
+        public IntPtr lptcomp;
+    }
+
+    [Guid("00020403-0000-0000-C000-000000000046")]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    [ComImport]
+    public interface ITypeComp
+    {
+        void Bind([MarshalAs(UnmanagedType.LPWStr)] string szName, int lHashVal, short wFlags, out ITypeInfo ppTInfo, out DESCKIND pDescKind, out BINDPTR pBindPtr);
+        void BindType([MarshalAs(UnmanagedType.LPWStr)] string szName, int lHashVal, out ITypeInfo ppTInfo, out ITypeComp ppTComp);
+    }
+}

+ 303 - 0
netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/ITypeInfo.cs

@@ -0,0 +1,303 @@
+// 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.ComTypes
+{
+    public enum TYPEKIND
+    {
+        TKIND_ENUM = 0,
+        TKIND_RECORD = TKIND_ENUM + 1,
+        TKIND_MODULE = TKIND_RECORD + 1,
+        TKIND_INTERFACE = TKIND_MODULE + 1,
+        TKIND_DISPATCH = TKIND_INTERFACE + 1,
+        TKIND_COCLASS = TKIND_DISPATCH + 1,
+        TKIND_ALIAS = TKIND_COCLASS + 1,
+        TKIND_UNION = TKIND_ALIAS + 1,
+        TKIND_MAX = TKIND_UNION + 1
+    }
+
+    [Flags]
+    public enum TYPEFLAGS : short
+    {
+        TYPEFLAG_FAPPOBJECT = 0x1,
+        TYPEFLAG_FCANCREATE = 0x2,
+        TYPEFLAG_FLICENSED = 0x4,
+        TYPEFLAG_FPREDECLID = 0x8,
+        TYPEFLAG_FHIDDEN = 0x10,
+        TYPEFLAG_FCONTROL = 0x20,
+        TYPEFLAG_FDUAL = 0x40,
+        TYPEFLAG_FNONEXTENSIBLE = 0x80,
+        TYPEFLAG_FOLEAUTOMATION = 0x100,
+        TYPEFLAG_FRESTRICTED = 0x200,
+        TYPEFLAG_FAGGREGATABLE = 0x400,
+        TYPEFLAG_FREPLACEABLE = 0x800,
+        TYPEFLAG_FDISPATCHABLE = 0x1000,
+        TYPEFLAG_FREVERSEBIND = 0x2000,
+        TYPEFLAG_FPROXY = 0x4000
+    }
+
+    [Flags]
+    public enum IMPLTYPEFLAGS
+    {
+        IMPLTYPEFLAG_FDEFAULT = 0x1,
+        IMPLTYPEFLAG_FSOURCE = 0x2,
+        IMPLTYPEFLAG_FRESTRICTED = 0x4,
+        IMPLTYPEFLAG_FDEFAULTVTABLE = 0x8,
+    }
+
+    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+    public struct TYPEATTR
+    {
+        // Constant used with the memid fields.
+        public const int MEMBER_ID_NIL = unchecked((int)0xFFFFFFFF);
+
+        // Actual fields of the TypeAttr struct.
+        public Guid guid;
+        public int lcid;
+        public int dwReserved;
+        public int memidConstructor;
+        public int memidDestructor;
+        public IntPtr lpstrSchema;
+        public int cbSizeInstance;
+        public TYPEKIND typekind;
+        public short cFuncs;
+        public short cVars;
+        public short cImplTypes;
+        public short cbSizeVft;
+        public short cbAlignment;
+        public TYPEFLAGS wTypeFlags;
+        public short wMajorVerNum;
+        public short wMinorVerNum;
+        public TYPEDESC tdescAlias;
+        public IDLDESC idldescType;
+    }
+
+    [StructLayout(LayoutKind.Sequential)]
+    public struct FUNCDESC
+    {
+        public int memid;                   //MEMBERID memid;
+        public IntPtr lprgscode;            // /* [size_is(cScodes)] */ SCODE RPC_FAR *lprgscode;
+        public IntPtr lprgelemdescParam;    // /* [size_is(cParams)] */ ELEMDESC __RPC_FAR *lprgelemdescParam;
+        public FUNCKIND funckind;           //FUNCKIND funckind;
+        public INVOKEKIND invkind;          //INVOKEKIND invkind;
+        public CALLCONV callconv;           //CALLCONV callconv;
+        public short cParams;               //short cParams;
+        public short cParamsOpt;            //short cParamsOpt;
+        public short oVft;                  //short oVft;
+        public short cScodes;               //short cScodes;
+        public ELEMDESC elemdescFunc;       //ELEMDESC elemdescFunc;
+        public short wFuncFlags;            //WORD wFuncFlags;
+    }
+
+    [Flags]
+    public enum IDLFLAG : short
+    {
+        IDLFLAG_NONE = PARAMFLAG.PARAMFLAG_NONE,
+        IDLFLAG_FIN = PARAMFLAG.PARAMFLAG_FIN,
+        IDLFLAG_FOUT = PARAMFLAG.PARAMFLAG_FOUT,
+        IDLFLAG_FLCID = PARAMFLAG.PARAMFLAG_FLCID,
+        IDLFLAG_FRETVAL = PARAMFLAG.PARAMFLAG_FRETVAL
+    }
+
+    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+    public struct IDLDESC
+    {
+        public IntPtr dwReserved;
+        public IDLFLAG wIDLFlags;
+    }
+
+    [Flags]
+    public enum PARAMFLAG : short
+    {
+        PARAMFLAG_NONE = 0,
+        PARAMFLAG_FIN = 0x1,
+        PARAMFLAG_FOUT = 0x2,
+        PARAMFLAG_FLCID = 0x4,
+        PARAMFLAG_FRETVAL = 0x8,
+        PARAMFLAG_FOPT = 0x10,
+        PARAMFLAG_FHASDEFAULT = 0x20,
+        PARAMFLAG_FHASCUSTDATA = 0x40
+    }
+
+    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+    public struct PARAMDESC
+    {
+        public IntPtr lpVarValue;
+        public PARAMFLAG wParamFlags;
+    }
+
+    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+    public struct TYPEDESC
+    {
+        public IntPtr lpValue;
+        public short vt;
+    }
+
+    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+    public struct ELEMDESC
+    {
+        public TYPEDESC tdesc;
+
+        [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode)]
+        public struct DESCUNION
+        {
+            [FieldOffset(0)]
+            public IDLDESC idldesc;
+            [FieldOffset(0)]
+            public PARAMDESC paramdesc;
+        };
+        public DESCUNION desc;
+    }
+
+    public enum VARKIND : int
+    {
+        VAR_PERINSTANCE = 0x0,
+        VAR_STATIC = 0x1,
+        VAR_CONST = 0x2,
+        VAR_DISPATCH = 0x3
+    }
+
+    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+
+    public struct VARDESC
+    {
+        public int memid;
+        public string lpstrSchema;
+
+        [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode)]
+        public struct DESCUNION
+        {
+            [FieldOffset(0)]
+            public int oInst;
+            [FieldOffset(0)]
+            public IntPtr lpvarValue;
+        };
+
+        public DESCUNION desc;
+
+        public ELEMDESC elemdescVar;
+        public short wVarFlags;
+        public VARKIND varkind;
+    }
+
+    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+    public struct DISPPARAMS
+    {
+        public IntPtr rgvarg;
+        public IntPtr rgdispidNamedArgs;
+        public int cArgs;
+        public int cNamedArgs;
+    }
+
+    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+    public struct EXCEPINFO
+    {
+        public short wCode;
+        public short wReserved;
+        [MarshalAs(UnmanagedType.BStr)] public string bstrSource;
+        [MarshalAs(UnmanagedType.BStr)] public string bstrDescription;
+        [MarshalAs(UnmanagedType.BStr)] public string bstrHelpFile;
+        public int dwHelpContext;
+        public IntPtr pvReserved;
+        public IntPtr pfnDeferredFillIn;
+        public int scode;
+    }
+
+    public enum FUNCKIND : int
+    {
+        FUNC_VIRTUAL = 0,
+        FUNC_PUREVIRTUAL = 1,
+        FUNC_NONVIRTUAL = 2,
+        FUNC_STATIC = 3,
+        FUNC_DISPATCH = 4
+    }
+
+    [Flags]
+    public enum INVOKEKIND : int
+    {
+        INVOKE_FUNC = 0x1,
+        INVOKE_PROPERTYGET = 0x2,
+        INVOKE_PROPERTYPUT = 0x4,
+        INVOKE_PROPERTYPUTREF = 0x8
+    }
+
+    public enum CALLCONV : int
+    {
+        CC_CDECL = 1,
+        CC_MSCPASCAL = 2,
+        CC_PASCAL = CC_MSCPASCAL,
+        CC_MACPASCAL = 3,
+        CC_STDCALL = 4,
+        CC_RESERVED = 5,
+        CC_SYSCALL = 6,
+        CC_MPWCDECL = 7,
+        CC_MPWPASCAL = 8,
+        CC_MAX = 9
+    }
+
+    [Flags]
+    public enum FUNCFLAGS : short
+    {
+        FUNCFLAG_FRESTRICTED = 0x1,
+        FUNCFLAG_FSOURCE = 0x2,
+        FUNCFLAG_FBINDABLE = 0x4,
+        FUNCFLAG_FREQUESTEDIT = 0x8,
+        FUNCFLAG_FDISPLAYBIND = 0x10,
+        FUNCFLAG_FDEFAULTBIND = 0x20,
+        FUNCFLAG_FHIDDEN = 0x40,
+        FUNCFLAG_FUSESGETLASTERROR = 0x80,
+        FUNCFLAG_FDEFAULTCOLLELEM = 0x100,
+        FUNCFLAG_FUIDEFAULT = 0x200,
+        FUNCFLAG_FNONBROWSABLE = 0x400,
+        FUNCFLAG_FREPLACEABLE = 0x800,
+        FUNCFLAG_FIMMEDIATEBIND = 0x1000
+    }
+
+    [Flags]
+    public enum VARFLAGS : short
+    {
+        VARFLAG_FREADONLY = 0x1,
+        VARFLAG_FSOURCE = 0x2,
+        VARFLAG_FBINDABLE = 0x4,
+        VARFLAG_FREQUESTEDIT = 0x8,
+        VARFLAG_FDISPLAYBIND = 0x10,
+        VARFLAG_FDEFAULTBIND = 0x20,
+        VARFLAG_FHIDDEN = 0x40,
+        VARFLAG_FRESTRICTED = 0x80,
+        VARFLAG_FDEFAULTCOLLELEM = 0x100,
+        VARFLAG_FUIDEFAULT = 0x200,
+        VARFLAG_FNONBROWSABLE = 0x400,
+        VARFLAG_FREPLACEABLE = 0x800,
+        VARFLAG_FIMMEDIATEBIND = 0x1000
+    }
+
+    [Guid("00020401-0000-0000-C000-000000000046")]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    [ComImport]
+    public interface ITypeInfo
+    {
+        void GetTypeAttr(out IntPtr ppTypeAttr);
+        void GetTypeComp(out ITypeComp ppTComp);
+        void GetFuncDesc(int index, out IntPtr ppFuncDesc);
+        void GetVarDesc(int index, out IntPtr ppVarDesc);
+        void GetNames(int memid, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2), Out] string[] rgBstrNames, int cMaxNames, out int pcNames);
+        void GetRefTypeOfImplType(int index, out int href);
+        void GetImplTypeFlags(int index, out IMPLTYPEFLAGS pImplTypeFlags);
+        void GetIDsOfNames([MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 1), In] string[] rgszNames, int cNames, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1), Out] int[] pMemId);
+        void Invoke([MarshalAs(UnmanagedType.IUnknown)] object pvInstance, int memid, short wFlags, ref DISPPARAMS pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, out int puArgErr);
+        void GetDocumentation(int index, out string strName, out string strDocString, out int dwHelpContext, out string strHelpFile);
+        void GetDllEntry(int memid, INVOKEKIND invKind, IntPtr pBstrDllName, IntPtr pBstrName, IntPtr pwOrdinal);
+        void GetRefTypeInfo(int hRef, out ITypeInfo ppTI);
+        void AddressOfMember(int memid, INVOKEKIND invKind, out IntPtr ppv);
+        void CreateInstance([MarshalAs(UnmanagedType.IUnknown)] object pUnkOuter, [In] ref Guid riid, [MarshalAs(UnmanagedType.IUnknown), Out] out object ppvObj);
+        void GetMops(int memid, out string pBstrMops);
+        void GetContainingTypeLib(out ITypeLib ppTLB, out int pIndex);
+        [PreserveSig]
+        void ReleaseTypeAttr(IntPtr pTypeAttr);
+        [PreserveSig]
+        void ReleaseFuncDesc(IntPtr pFuncDesc);
+        [PreserveSig]
+        void ReleaseVarDesc(IntPtr pVarDesc);
+    }
+}

+ 51 - 0
netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/ITypeInfo2.cs

@@ -0,0 +1,51 @@
+// 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.ComTypes
+{
+    [Guid("00020412-0000-0000-C000-000000000046")]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    [ComImport]
+    public interface ITypeInfo2 : ITypeInfo
+    {
+        new void GetTypeAttr(out IntPtr ppTypeAttr);
+        new void GetTypeComp(out ITypeComp ppTComp);
+        new void GetFuncDesc(int index, out IntPtr ppFuncDesc);
+        new void GetVarDesc(int index, out IntPtr ppVarDesc);
+        new void GetNames(int memid, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2), Out] string[] rgBstrNames, int cMaxNames, out int pcNames);
+        new void GetRefTypeOfImplType(int index, out int href);
+        new void GetImplTypeFlags(int index, out IMPLTYPEFLAGS pImplTypeFlags);
+        new void GetIDsOfNames([MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 1), In] string[] rgszNames, int cNames, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1), Out] int[] pMemId);
+        new void Invoke([MarshalAs(UnmanagedType.IUnknown)] object pvInstance, int memid, short wFlags, ref DISPPARAMS pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, out int puArgErr);
+        new void GetDocumentation(int index, out string strName, out string strDocString, out int dwHelpContext, out string strHelpFile);
+        new void GetDllEntry(int memid, INVOKEKIND invKind, IntPtr pBstrDllName, IntPtr pBstrName, IntPtr pwOrdinal);
+        new void GetRefTypeInfo(int hRef, out ITypeInfo ppTI);
+        new void AddressOfMember(int memid, INVOKEKIND invKind, out IntPtr ppv);
+        new void CreateInstance([MarshalAs(UnmanagedType.IUnknown)] object pUnkOuter, [In] ref Guid riid, [MarshalAs(UnmanagedType.IUnknown), Out] out object ppvObj);
+        new void GetMops(int memid, out string pBstrMops);
+        new void GetContainingTypeLib(out ITypeLib ppTLB, out int pIndex);
+        [PreserveSig]
+        new void ReleaseTypeAttr(IntPtr pTypeAttr);
+        [PreserveSig]
+        new void ReleaseFuncDesc(IntPtr pFuncDesc);
+        [PreserveSig]
+        new void ReleaseVarDesc(IntPtr pVarDesc);
+        void GetTypeKind(out TYPEKIND pTypeKind);
+        void GetTypeFlags(out int pTypeFlags);
+        void GetFuncIndexOfMemId(int memid, INVOKEKIND invKind, out int pFuncIndex);
+        void GetVarIndexOfMemId(int memid, out int pVarIndex);
+        void GetCustData(ref Guid guid, out object pVarVal);
+        void GetFuncCustData(int index, ref Guid guid, out object pVarVal);
+        void GetParamCustData(int indexFunc, int indexParam, ref Guid guid, out object pVarVal);
+        void GetVarCustData(int index, ref Guid guid, out object pVarVal);
+        void GetImplTypeCustData(int index, ref Guid guid, out object pVarVal);
+        [LCIDConversion(1)]
+        void GetDocumentation2(int memid, out string pbstrHelpString, out int pdwHelpStringContext, out string pbstrHelpStringDll);
+        void GetAllCustData(IntPtr pCustData);
+        void GetAllFuncCustData(int index, IntPtr pCustData);
+        void GetAllParamCustData(int indexFunc, int indexParam, IntPtr pCustData);
+        void GetAllVarCustData(int index, IntPtr pCustData);
+        void GetAllImplTypeCustData(int index, IntPtr pCustData);
+    }
+}

+ 54 - 0
netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/ITypeLib.cs

@@ -0,0 +1,54 @@
+// 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.ComTypes
+{
+    public enum SYSKIND
+    {
+        SYS_WIN16 = 0,
+        SYS_WIN32 = SYS_WIN16 + 1,
+        SYS_MAC = SYS_WIN32 + 1,
+        SYS_WIN64 = SYS_MAC + 1
+    }
+
+    [Flags]
+    public enum LIBFLAGS : short
+    {
+        LIBFLAG_FRESTRICTED = 0x1,
+        LIBFLAG_FCONTROL = 0x2,
+        LIBFLAG_FHIDDEN = 0x4,
+        LIBFLAG_FHASDISKIMAGE = 0x8
+    }
+
+    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+    public struct TYPELIBATTR
+    {
+        public Guid guid;
+        public int lcid;
+        public SYSKIND syskind;
+        public short wMajorVerNum;
+        public short wMinorVerNum;
+        public LIBFLAGS wLibFlags;
+    }
+
+    [Guid("00020402-0000-0000-C000-000000000046")]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    [ComImport]
+    public interface ITypeLib
+    {
+        [PreserveSig]
+        int GetTypeInfoCount();
+        void GetTypeInfo(int index, out ITypeInfo ppTI);
+        void GetTypeInfoType(int index, out TYPEKIND pTKind);
+        void GetTypeInfoOfGuid(ref Guid guid, out ITypeInfo ppTInfo);
+        void GetLibAttr(out IntPtr ppTLibAttr);
+        void GetTypeComp(out ITypeComp ppTComp);
+        void GetDocumentation(int index, out string strName, out string strDocString, out int dwHelpContext, out string strHelpFile);
+        [return: MarshalAs(UnmanagedType.Bool)]
+        bool IsName([MarshalAs(UnmanagedType.LPWStr)] string szNameBuf, int lHashVal);
+        void FindName([MarshalAs(UnmanagedType.LPWStr)] string szNameBuf, int lHashVal, [MarshalAs(UnmanagedType.LPArray), Out] ITypeInfo[] ppTInfo, [MarshalAs(UnmanagedType.LPArray), Out] int[] rgMemId, ref short pcFound);
+        [PreserveSig]
+        void ReleaseTLibAttr(IntPtr pTLibAttr);
+    }
+}

+ 31 - 0
netcore/System.Private.CoreLib/shared/System/Runtime/InteropServices/ComTypes/ITypeLib2.cs

@@ -0,0 +1,31 @@
+// 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.ComTypes
+{
+    [Guid("00020411-0000-0000-C000-000000000046")]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    [ComImport]
+    public interface ITypeLib2 : ITypeLib
+    {
+        [PreserveSig]
+        new int GetTypeInfoCount();
+        new void GetTypeInfo(int index, out ITypeInfo ppTI);
+        new void GetTypeInfoType(int index, out TYPEKIND pTKind);
+        new void GetTypeInfoOfGuid(ref Guid guid, out ITypeInfo ppTInfo);
+        new void GetLibAttr(out IntPtr ppTLibAttr);
+        new void GetTypeComp(out ITypeComp ppTComp);
+        new void GetDocumentation(int index, out string strName, out string strDocString, out int dwHelpContext, out string strHelpFile);
+        [return: MarshalAs(UnmanagedType.Bool)]
+        new bool IsName([MarshalAs(UnmanagedType.LPWStr)] string szNameBuf, int lHashVal);
+        new void FindName([MarshalAs(UnmanagedType.LPWStr)] string szNameBuf, int lHashVal, [MarshalAs(UnmanagedType.LPArray), Out] ITypeInfo[] ppTInfo, [MarshalAs(UnmanagedType.LPArray), Out] int[] rgMemId, ref short pcFound);
+        [PreserveSig]
+        new void ReleaseTLibAttr(IntPtr pTLibAttr);
+        void GetCustData(ref Guid guid, out object pVarVal);
+        [LCIDConversionAttribute(1)]
+        void GetDocumentation2(int index, out string pbstrHelpString, out int pdwHelpStringContext, out string pbstrHelpStringDll);
+        void GetLibStatistics(IntPtr pcUniqueNames, out int pcchUniqueNames);
+        void GetAllCustData(IntPtr pCustData);
+    }
+}