CLRInterop.cs :  » Installers-Generators » WiX » Microsoft » Tools » WindowsInstallerXml » CLR » Interop » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Installers Generators » WiX 
WiX » Microsoft » Tools » WindowsInstallerXml » CLR » Interop » CLRInterop.cs
//-------------------------------------------------------------------------------------------------
// <copyright file="CLRInterop.cs" company="Microsoft">
//    Copyright (c) Microsoft Corporation.  All rights reserved.
//    
//    The use and distribution terms for this software are covered by the
//    Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
//    which can be found in the file CPL.TXT at the root of this distribution.
//    By using this software in any fashion, you are agreeing to be bound by
//    the terms of this license.
//    
//    You must not remove this notice, or any other, from this software.
// </copyright>
// 
// <summary>
// Interop class for mscorwks.dll assembly name APIs.
// </summary>
//-------------------------------------------------------------------------------------------------

namespace Microsoft.Tools.WindowsInstallerXml.CLR.Interop{
    using System;
    using System.Text;
    using System.Runtime.InteropServices;

    /// <summary>
    /// Interop class for mscorwks.dll assembly name APIs.
    /// </summary>
    internal sealed class CLRInterop
    {
        private static readonly Guid referenceIdentityGuid = new Guid("6eaf5ace-7917-4f3c-b129-e046a9704766");

        /// <summary>
        /// Protect the constructor.
        /// </summary>
        private CLRInterop()
        {
        }

        /// <summary>
        /// Represents a reference to the unique signature of a code object.
        /// </summary>
        [ComImport]
            [Guid("6eaf5ace-7917-4f3c-b129-e046a9704766")]
            [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
            internal interface IReferenceIdentity
        {
            /// <summary>
            /// Get an assembly attribute.
            /// </summary>
            /// <param name="attributeNamespace">Attribute namespace.</param>
            /// <param name="attributeName">Attribute name.</param>
            /// <returns>The assembly attribute.</returns>
            [return: MarshalAs(UnmanagedType.LPWStr)]
            string GetAttribute(
                [In, MarshalAs(UnmanagedType.LPWStr)] string attributeNamespace,
                [In, MarshalAs(UnmanagedType.LPWStr)] string attributeName);

            /// <summary>
            /// Set an assembly attribute.
            /// </summary>
            /// <param name="attributeNamespace">Attribute namespace.</param>
            /// <param name="attributeName">Attribute name.</param>
            /// <param name="attributeValue">Attribute value.</param>
            void SetAttribute(
                [In, MarshalAs(UnmanagedType.LPWStr)] string attributeNamespace,
                [In, MarshalAs(UnmanagedType.LPWStr)] string attributeName,
                [In, MarshalAs(UnmanagedType.LPWStr)] string attributeValue);

            /// <summary>
            /// Get an iterator for the assembly's attributes.
            /// </summary>
            /// <returns>Assembly attribute enumerator.</returns>
            IEnumIDENTITY_ATTRIBUTE EnumAttributes();

            /// <summary>
            /// Clone an IReferenceIdentity.
            /// </summary>
            /// <param name="countOfDeltas">Count of deltas.</param>
            /// <param name="deltas">The deltas.</param>
            /// <returns>Cloned IReferenceIdentity.</returns>
            IReferenceIdentity Clone(
                [In] IntPtr /*SIZE_T*/ countOfDeltas,
                [In, MarshalAs(UnmanagedType.LPArray)] IDENTITY_ATTRIBUTE[] deltas);
        }

        /// <summary>
        /// IEnumIDENTITY_ATTRIBUTE interface.
        /// </summary>
        [ComImport]
            [Guid("9cdaae75-246e-4b00-a26d-b9aec137a3eb")]
            [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
            internal interface IEnumIDENTITY_ATTRIBUTE
        {
            /// <summary>
            /// Gets the next attributes.
            /// </summary>
            /// <param name="celt">Count of elements.</param>
            /// <param name="attributes">Array of attributes being returned.</param>
            /// <returns>The next attribute.</returns>
            uint Next(
                [In] uint celt,
                [Out, MarshalAs(UnmanagedType.LPArray)] IDENTITY_ATTRIBUTE[] attributes);

            /// <summary>
            /// Copy the current attribute into a buffer.
            /// </summary>
            /// <param name="available">Number of available bytes.</param>
            /// <param name="data">Buffer into which attribute should be written.</param>
            /// <returns>Pointer to buffer containing the attribute.</returns>
            IntPtr CurrentIntoBuffer(
                [In] IntPtr /*SIZE_T*/ available,
                [Out, MarshalAs(UnmanagedType.LPArray)] byte[] data);

            /// <summary>
            /// Skip past a number of elements.
            /// </summary>
            /// <param name="celt">Count of elements to skip.</param>
            void Skip([In] uint celt);

            /// <summary>
            /// Reset the enumeration to the beginning.
            /// </summary>
            void Reset();

            /// <summary>
            /// Clone this attribute enumeration.
            /// </summary>
            /// <returns>Clone of a IEnumIDENTITY_ATTRIBUTE.</returns>
            IEnumIDENTITY_ATTRIBUTE Clone();
        }

        /// <summary>
        /// Gets the guid.
        /// </summary>
        public static Guid ReferenceIdentityGuid
        {
            get { return referenceIdentityGuid; }
        }

        /// <summary>
        /// Gets an interface pointer to an object with the specified IID, in the assembly at the specified file path.
        /// </summary>
        /// <param name="wszAssemblyPath">A valid path to the requested assembly.</param>
        /// <param name="riid">The IID of the interface to return.</param>
        /// <param name="i">The returned interface pointer.</param>
        /// <returns>The error code.</returns>
        [DllImport("mscorwks.dll", CharSet = CharSet.Unicode, EntryPoint = "GetAssemblyIdentityFromFile")]
        internal static extern uint GetAssemblyIdentityFromFile(System.String wszAssemblyPath, ref Guid riid, out IReferenceIdentity i);

        /// <summary>
        /// Assembly attributes. Contains data about an IReferenceIdentity.
        /// </summary>
        [StructLayout(LayoutKind.Sequential)]
        internal struct IDENTITY_ATTRIBUTE
        {
            [MarshalAs(UnmanagedType.LPWStr)] public string AttributeNamespace;
            [MarshalAs(UnmanagedType.LPWStr)] public string AttributeName;
            [MarshalAs(UnmanagedType.LPWStr)] public string AttributeValue;
        }
    }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.