CreateAssemblyNameObject() private method

private CreateAssemblyNameObject ( SafeFusionHandle &ppEnum, String szAssemblyName, uint dwFlags, IntPtr pvReserved ) : int
ppEnum SafeFusionHandle
szAssemblyName String
dwFlags uint
pvReserved IntPtr
return int
Exemplo n.º 1
0
        public static void ReadCache(ArrayList alAssems, string name, uint nFlag)
        {
            IAssemblyEnum       ppEnum1  = (IAssemblyEnum)null;
            IAssemblyName       ppName   = (IAssemblyName)null;
            IAssemblyName       ppEnum2  = (IAssemblyName)null;
            IApplicationContext ppAppCtx = (IApplicationContext)null;

            if (name != null)
            {
                int assemblyNameObject = Win32Native.CreateAssemblyNameObject(out ppEnum2, name, 1U, IntPtr.Zero);
                if (assemblyNameObject != 0)
                {
                    Marshal.ThrowExceptionForHR(assemblyNameObject);
                }
            }
            int assemblyEnum = Win32Native.CreateAssemblyEnum(out ppEnum1, ppAppCtx, ppEnum2, nFlag, IntPtr.Zero);

            if (assemblyEnum != 0)
            {
                Marshal.ThrowExceptionForHR(assemblyEnum);
            }
            while (true)
            {
                string displayName;
                do
                {
                    int nextAssembly = ppEnum1.GetNextAssembly(out ppAppCtx, out ppName, 0U);
                    if (nextAssembly != 0)
                    {
                        if (nextAssembly < 0)
                        {
                            Marshal.ThrowExceptionForHR(nextAssembly);
                            return;
                        }
                        goto label_10;
                    }
                    else
                    {
                        displayName = Fusion.GetDisplayName(ppName, 0U);
                    }
                }while (displayName == null);
                alAssems.Add((object)displayName);
            }
            label_10 :;
        }
        public static void ReadCache(ArrayList alAssems, String name, uint nFlag)
        {
            SafeFusionHandle aEnum     = null;
            SafeFusionHandle aNameEnum = null;
            SafeFusionHandle AppCtx    = SafeFusionHandle.InvalidHandle;
            int hr;

            if (name != null)
            {
                hr = Win32Native.CreateAssemblyNameObject(out aNameEnum, name, CANOF.PARSE_DISPLAY_NAME, IntPtr.Zero);
                if (hr != 0)
                {
                    Marshal.ThrowExceptionForHR(hr);
                }
            }

            using (aNameEnum) {
                hr = Win32Native.CreateAssemblyEnum(out aEnum, AppCtx, aNameEnum, nFlag, IntPtr.Zero);
                if (hr != 0)
                {
                    Marshal.ThrowExceptionForHR(hr);
                }

                using (aEnum) {
                    for (;;)
                    {
                        using (SafeFusionHandle aAppCtx = new SafeFusionHandle(), aName = new SafeFusionHandle())
                        {
                            if (!GetNextAssembly(aEnum, aAppCtx, aName, 0))
                            {
                                break;
                            }

                            String sDisplayName = GetDisplayName(aName, 0);
                            if (sDisplayName == null)
                            {
                                continue;
                            }

                            alAssems.Add(sDisplayName);
                        }
                    }
                } // using (aEnum)
            }     // using (aNameEnum)
        }
Exemplo n.º 3
0
        [System.Security.SecurityCritical]  // auto-generated
        public static void ReadCache(ArrayList alAssems, String name, uint nFlag)
        {
            IAssemblyEnum       aEnum     = null;
            IAssemblyName       aName     = null;
            IAssemblyName       aNameEnum = null;
            IApplicationContext AppCtx    = null;
            int hr;

            if (name != null)
            {
                hr = Win32Native.CreateAssemblyNameObject(out aNameEnum, name, CANOF.PARSE_DISPLAY_NAME, IntPtr.Zero);
                if (hr != 0)
                {
                    Marshal.ThrowExceptionForHR(hr);
                }
            }

            hr = Win32Native.CreateAssemblyEnum(out aEnum, AppCtx, aNameEnum, nFlag, IntPtr.Zero);
            if (hr != 0)
            {
                Marshal.ThrowExceptionForHR(hr);
            }

            for (; ;)
            {
                hr = aEnum.GetNextAssembly(out AppCtx, out aName, 0);
                if (hr != 0)
                {
                    if (hr < 0)
                    {
                        Marshal.ThrowExceptionForHR(hr);
                    }
                    break;
                }

                String sDisplayName = GetDisplayName(aName, 0);
                if (sDisplayName == null)
                {
                    continue;
                }

                alAssems.Add(sDisplayName);
            } // for (;;)
        }
Exemplo n.º 4
0
        public static void ReadCache(ArrayList alAssems, string name, uint nFlag)
        {
            IAssemblyEnum       assemblyEnum = null;
            IAssemblyName       aName        = null;
            IAssemblyName       pName        = null;
            IApplicationContext pAppCtx      = null;
            int num;

            if (name != null)
            {
                num = Win32Native.CreateAssemblyNameObject(out pName, name, 1U, IntPtr.Zero);
                if (num != 0)
                {
                    Marshal.ThrowExceptionForHR(num);
                }
            }
            num = Win32Native.CreateAssemblyEnum(out assemblyEnum, pAppCtx, pName, nFlag, IntPtr.Zero);
            if (num != 0)
            {
                Marshal.ThrowExceptionForHR(num);
            }
            for (;;)
            {
                num = assemblyEnum.GetNextAssembly(out pAppCtx, out aName, 0U);
                if (num != 0)
                {
                    break;
                }
                string displayName = Fusion.GetDisplayName(aName, 0U);
                if (displayName != null)
                {
                    alAssems.Add(displayName);
                }
            }
            if (num < 0)
            {
                Marshal.ThrowExceptionForHR(num);
                return;
            }
        }
Exemplo n.º 5
0
        public static void ReadCache(ArrayList alAssems, string name, uint nFlag)
        {
            IAssemblyEnum       ppEnum  = null;
            IAssemblyName       ppName  = null;
            IAssemblyName       name3   = null;
            IApplicationContext pAppCtx = null;
            int num;

            if (name != null)
            {
                num = Win32Native.CreateAssemblyNameObject(out name3, name, 1, IntPtr.Zero);
                if (num != 0)
                {
                    Marshal.ThrowExceptionForHR(num);
                }
            }
            num = Win32Native.CreateAssemblyEnum(out ppEnum, pAppCtx, name3, nFlag, IntPtr.Zero);
            if (num != 0)
            {
                Marshal.ThrowExceptionForHR(num);
            }
Label_0042:
            num = ppEnum.GetNextAssembly(out pAppCtx, out ppName, 0);
            if (num == 0)
            {
                string displayName = GetDisplayName(ppName, 0);
                if (displayName != null)
                {
                    alAssems.Add(displayName);
                }
                goto Label_0042;
            }
            if (num < 0)
            {
                Marshal.ThrowExceptionForHR(num);
            }
        }