internal static AppContainer[] GetAppContainers(bool bUseDevPreviewBuildMemoryLayout, bool bUseBetaEnumFunction, bool bForceBinaryNames)
        {
            Dictionary <string, AppContainer> dictionary = null;

            if (LoopbackIsolation.NetIsoEnumAppContainers(out uint pdwCntACs, out IntPtr ppACs, bUseBetaEnumFunction, bForceBinaryNames) == 0)
            {
                try
                {
                    if (pdwCntACs != 0)
                    {
                        dictionary = new Dictionary <string, AppContainer>();
                        long num = ppACs.ToInt64();
                        for (int i = 0; i < pdwCntACs; i++)
                        {
                            if (bUseDevPreviewBuildMemoryLayout)
                            {
                                INET_FIREWALL_APP_CONTAINER_PREVIEWBUILD ifacNative = (INET_FIREWALL_APP_CONTAINER_PREVIEWBUILD)Marshal.PtrToStructure((IntPtr)num, typeof(INET_FIREWALL_APP_CONTAINER_PREVIEWBUILD));
                                AppContainer appContainer = new AppContainer(ifacNative);
                                if (dictionary.ContainsKey(appContainer.AppContainerSid))
                                {
                                    dictionary[appContainer.AppContainerSid].AddUser(appContainer.GetUsers());
                                }
                                else
                                {
                                    dictionary.Add(appContainer.AppContainerSid, appContainer);
                                }
                                num += Marshal.SizeOf(typeof(INET_FIREWALL_APP_CONTAINER_PREVIEWBUILD));
                            }
                            else
                            {
                                INET_FIREWALL_APP_CONTAINER ifacNative2 = (INET_FIREWALL_APP_CONTAINER)Marshal.PtrToStructure((IntPtr)num, typeof(INET_FIREWALL_APP_CONTAINER));
                                AppContainer appContainer2 = new AppContainer(ifacNative2);
                                if (dictionary.ContainsKey(appContainer2.AppContainerSid))
                                {
                                    dictionary[appContainer2.AppContainerSid].AddUser(appContainer2.GetUsers());
                                }
                                else
                                {
                                    dictionary.Add(appContainer2.AppContainerSid, appContainer2);
                                }
                                num += Marshal.SizeOf(typeof(INET_FIREWALL_APP_CONTAINER));
                            }
                        }
                    }
                }
                finally
                {
                    LoopbackIsolation.NetIsoFreeAppContainers(ppACs);
                }
            }
            if (dictionary == null)
            {
                return(null);
            }
            AppContainer[] array = new AppContainer[dictionary.Count];
            dictionary.Values.CopyTo(array, 0);
            return(array);
        }
        internal AppContainer(INET_FIREWALL_APP_CONTAINER_PREVIEWBUILD ifacNative)
        {
            appContainerRawSid = ifacNative.appContainerSid;
            try
            {
                appContainerSid = new SecurityIdentifier(appContainerRawSid);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to parse AppContainerSID\n\n" + ex.Message, "Unexpected");
                appContainerSid = null;
            }
            try
            {
                userSid = new SecurityIdentifier(ifacNative.userSid);
                AddUser(userSid);
            }
            catch (Exception ex2)
            {
                MessageBox.Show("Failed to parse userSID\n\n" + ex2.Message, "Unexpected");
                userSid = null;
            }
            appContainerName = ifacNative.appContainerName;
            displayName      = LoopbackIsolation.LoadIndirectString(ifacNative.displayName);
            description      = LoopbackIsolation.LoadIndirectString(ifacNative.description);
            packageFullName  = "Unknown";
            INET_FIREWALL_AC_BINARIES iNET_FIREWALL_AC_BINARIES = ifacNative.binaries;

            if (iNET_FIREWALL_AC_BINARIES.count != 0 && IntPtr.Zero != iNET_FIREWALL_AC_BINARIES.binaries)
            {
                binaries = new string[iNET_FIREWALL_AC_BINARIES.count];
                long num = iNET_FIREWALL_AC_BINARIES.binaries.ToInt64();
                for (int i = 0; i < iNET_FIREWALL_AC_BINARIES.count; i++)
                {
                    binaries[i] = Marshal.PtrToStringUni(Marshal.ReadIntPtr((IntPtr)num));
                    num        += IntPtr.Size;
                }
            }
        }