示例#1
0
        public static IEnumerable <InstallReference> GetInstallReferences(AssemblyName assemblyName)
        {
            IAssemblyName fusionAssemblyName = null;

            ComCheck(FusionApi.CreateAssemblyNameObject(out fusionAssemblyName, assemblyName.GetFullyQualifiedName(), CreateAssemblyNameObjectFlags.ParseDisplayName, IntPtr.Zero));

            IInstallReferenceEnum installReferenceEnum = null;

            ComCheck(FusionApi.CreateInstallReferenceEnum(out installReferenceEnum, fusionAssemblyName, 0, IntPtr.Zero));

            IInstallReferenceItem item = null;

            do
            {
                int hResult = installReferenceEnum.GetNextInstallReferenceItem(out item, 0, IntPtr.Zero);
                if ((uint)hResult == 0x80070103)  // ERROR_NO_MORE_ITEMS
                {
                    yield break;
                }
                ComCheck(hResult);

                IntPtr refData;
                ComCheck(item.GetReference(out refData, 0, IntPtr.Zero));

                FusionInstallReference fusionReference = new FusionInstallReference();
                Marshal.PtrToStructure(refData, fusionReference);

                var reference = new InstallReference(InstallReferenceGuid.ToType(fusionReference.GuidScheme), fusionReference.Identifier,
                                                     fusionReference.NonCanonicalData);

                yield return(reference);
            } while (true);
        }
示例#2
0
文件: GAC.cs 项目: LowerCode/tools
 internal static extern int CreateInstallReferenceEnum(
     out IInstallReferenceEnum ppRefEnum,
     IAssemblyName pName,
     int dwFlags,
     IntPtr pvReserved);
示例#3
0
 internal static extern int CreateInstallReferenceEnum(
         out IInstallReferenceEnum ppRefEnum,
         IAssemblyName pName,
         int dwFlags,
         IntPtr pvReserved);
示例#4
0
 public static extern HRESULT CreateInstallReferenceEnum(out IInstallReferenceEnum installReferenceEnum, IAssemblyName assemblyName,
                                                         CreateInstallReferenceFlags flags, int reserved);
示例#5
0
 private static extern void CreateInstallReferenceEnum(out IInstallReferenceEnum ppRefEnum, IAssemblyName pName,
                                                       uint dwFlags, IntPtr pvReserved);
示例#6
0
 public static extern void CreateInstallReferenceEnum(out IInstallReferenceEnum ppRefEnum, IAssemblyName pName,
     uint dwFlags, IntPtr pvReserved);