Beispiel #1
0
        }// ImportCodegroup

        private NamedPermissionSet ImportPermissionSet()
        {
            // We're importing a permission set
            NamedPermissionSet nps = null;

            try
            {
                SecurityElement se = SecurityXMLStuff.GetSecurityElementFromXMLFile(PermissionSetFilename);
                if (se == null)
                {
                    throw new Exception("Invalid XML");
                }

                nps = new NamedPermissionSet("Hi");
                nps.FromXml(se);

                if (nps.Name == null || nps.Name.Length == 0)
                {
                    nps.Name = Security.FindAGoodPermissionSetName(m_pl, "CustomPermissionSet");
                }

                return(nps);
            }
            catch (Exception)
            {
                MessageBox(CResourceStore.GetString("XMLNoPermSet"),
                           CResourceStore.GetString("XMLNoPermSetTitle"),
                           MB.ICONEXCLAMATION);
            }
            return(null);
        }// ImportPermissionSet
 //-------------------------------------------------
 // CConfigAssemWiz1 - Constructor
 //
 // Initializes some variables.
 // sf is a delegate that, when called, will turn on
 // the "Finish" button on the wizard
 //-------------------------------------------------
 internal CConfigAssemWiz1(CApplicationDepends appDepends)
 {
     m_sHeaderTitle    = CResourceStore.GetString("CConfigAssemWiz1:HeaderTitle");
     m_sHeaderSubTitle = CResourceStore.GetString("CConfigAssemWiz1:HeaderSubTitle");
     m_sTitle          = CResourceStore.GetString("CConfigAssemWiz1:Title");
     m_appDepends      = appDepends;
 }// CConfigAssemWiz1
Beispiel #3
0
        internal CDNSPermDialog(DnsPermission perm)
        {
            this.Text = CResourceStore.GetString("Dnsperm:PermName");

            m_PermControls = new CDNSPermControls(perm, this);
            Init();
        } // CDNSPermDialog
Beispiel #4
0
        }// PutValuesinPage

        void onBrowse(Object o, EventArgs e)
        {
            // Pop up a file dialog so the user can find an assembly
            OpenFileDialog fd = new OpenFileDialog();

            fd.Title  = CResourceStore.GetString("CEvalAssemWiz1:FDTitle");
            fd.Filter = CResourceStore.GetString("CEvalAssemWiz1:FDMask");
            System.Windows.Forms.DialogResult dr = fd.ShowDialog();
            if (dr == System.Windows.Forms.DialogResult.OK)
            {
                if (Fusion.isManaged(fd.FileName))
                {
                    m_txtFilename.Text = fd.FileName;
                    onTextChange(null, null);

                    // Get a jump on the loading of this assembly
                    if (m_tEvidence != null)
                    {
                        m_tEvidence.Abort();
                    }

                    m_tEvidence = new Thread(new ThreadStart(NewAssembly));
                    m_tEvidence.Start();
                }
                else
                {
                    MessageBox(CResourceStore.GetString("isNotManagedCode"),
                               CResourceStore.GetString("isNotManagedCodeTitle"),
                               MB.ICONEXCLAMATION);
                }
            }
        }// onBrowse
        }// InsertPropSheetPageControls

        internal bool PutValuesinPage()
        {
            m_txtAssemEval.Text = m_sAssemName;
            // Make sure this starts off enabled
            m_btnViewPerm.Enabled = true;

            m_lblLevelEvalVal.Text = CEvalAssemWizard.GetDisplayString(m_nPolicyLevel);

            // Display the various permissions in the currently selected permission set
            m_lvPermissions.Items.Clear();
            if (m_ps != null)
            {
                if (m_ps.IsUnrestricted())
                {
                    ListViewItem lvi = new ListViewItem(CResourceStore.GetString("Unrestricted"), UNRESTRICTEDIMAGEINDEX);
                    m_lvPermissions.Items.Add(lvi);
                    m_btnViewPerm.Enabled = false;
                }
                else
                {
                    IEnumerator permEnumerator = m_ps.GetEnumerator();
                    while (permEnumerator.MoveNext())
                    {
                        IPermission  perm        = (IPermission)permEnumerator.Current;
                        int          nImageIndex = DeterminePermissionIcon(perm);
                        ListViewItem lvi         = new ListViewItem(Security.GetDisplayStringForPermission(perm), nImageIndex);
                        m_lvPermissions.Items.Add(lvi);
                    }
                }
            }

            m_txtAssemEval.Select(0, 0);
            return(true);
        }// PutValuesinPage
        }// onTextChange

        void onBrowse(Object o, EventArgs e)
        {
            // Pop up a file dialog so the user can find an assembly
            OpenFileDialog fd = new OpenFileDialog();

            fd.Title  = CResourceStore.GetString("CTrustAppWiz2:ChooseAssemFDTitle");
            fd.Filter = CResourceStore.GetString("AssemFDMask");
            System.Windows.Forms.DialogResult dr = fd.ShowDialog();
            if (dr == System.Windows.Forms.DialogResult.OK)
            {
                if (Fusion.isManaged(fd.FileName))
                {
                    m_txtFilename.Text = fd.FileName;
                    // Inform our wizard that we have a new assembly for it to try and load
                    CFullTrustWizard wiz = (CFullTrustWizard)CNodeManager.GetNode(m_iCookie);
                    wiz.NewAssembly();
                }
                else
                {
                    MessageBox(CResourceStore.GetString("isNotManagedCode"),
                               CResourceStore.GetString("isNotManagedCodeTitle"),
                               MB.ICONEXCLAMATION);
                }
            }
        } // onBrowse
Beispiel #7
0
        }// onDelete

        internal override void AddMenuItems(ref IContextMenuCallback piCallback, ref int pInsertionAllowed)
        {
            // See if we're allowed to insert an item in the "view" section
            if (!ReadOnly && (pInsertionAllowed & (int)CCM.INSERTIONALLOWED_TOP) > 0)
            {
                // Stuff common to the top menu
                CONTEXTMENUITEM newitem = new CONTEXTMENUITEM();
                newitem.lInsertionPointID = CCM.INSERTIONPOINTID_PRIMARY_TOP;
                newitem.fFlags            = 0;
                newitem.fSpecialFlags     = 0;

                newitem.strName          = CResourceStore.GetString("CSingleCodeGroup:NewOption");
                newitem.strStatusBarText = CResourceStore.GetString("CSingleCodeGroup:NewOptionDes");
                newitem.lCommandID       = COMMANDS.CREATE_CODEGROUP;

                // Now add this item through the callback
                piCallback.AddItem(ref newitem);


                newitem.strName          = CResourceStore.GetString("CSingleCodeGroup:DuplicateOption");
                newitem.strStatusBarText = CResourceStore.GetString("CSingleCodeGroup:DuplicateOptionDes");
                newitem.lCommandID       = COMMANDS.DUPLICATE_CODEGROUP;

                // Now add this item through the callback
                piCallback.AddItem(ref newitem);
            }
        }// AddMenuItems
Beispiel #8
0
        }// InsertPropSheetPageControls

        void onChangeWindowOption(Object o, EventArgs e)
        {
            if (m_cbWindowOptions.SelectedIndex == 0)
            {
                m_lblWindowOptionDescription.Text = CResourceStore.GetString("Uiperm:AllWinDes");
            }
            else if (m_cbWindowOptions.SelectedIndex == 1)
            {
                m_lblWindowOptionDescription.Text = CResourceStore.GetString("Uiperm:SafeTopDes");
            }
            else if (m_cbWindowOptions.SelectedIndex == 2)
            {
                m_lblWindowOptionDescription.Text = CResourceStore.GetString("Uiperm:SafeSubDes");
            }
            else if (m_cbWindowOptions.SelectedIndex == 3)
            {
                m_lblWindowOptionDescription.Text = CResourceStore.GetString("Uiperm:NoWinDes");
            }
            else
            {
                m_lblWindowOptionDescription.Text = "";
            }

            ActivateApply();
        }// onChangeWindowOption
Beispiel #9
0
        }// LoadAssembly

        // This function is used to create the strings to put in the summary table
        private String GetNameOfNewPermissionLevel()
        {
            if (m_nPageToGetPermissionLevel == 3)
            {
                return(CResourceStore.GetString("CSecurityAdjustmentWiz3:FullTrustName"));
            }
            else
            {
                if (Page5.MyTrustLevel == PermissionSetType.FULLTRUST)
                {
                    return(CResourceStore.GetString("CSecurityAdjustmentWiz3:FullTrustName"));
                }
                else if (Page5.MyTrustLevel == PermissionSetType.INTERNET)
                {
                    return(CResourceStore.GetString("CSecurityAdjustmentWiz3:InternetName"));
                }
                else if (Page5.MyTrustLevel == PermissionSetType.INTRANET)
                {
                    return(CResourceStore.GetString("CSecurityAdjustmentWiz3:LocalIntranetName"));
                }
                else if (Page5.MyTrustLevel == PermissionSetType.NONE)
                {
                    return(CResourceStore.GetString("CSecurityAdjustmentWiz3:NoTrustName"));
                }
            }
            return(CResourceStore.GetString("<unknown>"));
        }// GetNameOfNewPermissionLevel
        }// class PropPagePairs

        internal CSharedAssemblies()
        {
            m_sGuid        = "96821C0B-CBE2-4dc9-AC52-756A3361B07F";
            m_sHelpSection = "";
            m_hIcon        = CResourceStore.GetHIcon("sharedassemblies_ico");
            DisplayName    = CResourceStore.GetString("CSharedAssemblies:DisplayName");
            Name           = "Assembly Cache";

            m_taskPad       = new CGenericTaskPad(this, "SHAREDASSEM_HTML");
            m_fReadShowHTML = false;

            m_olAssems = Fusion.ReadFusionCache();

            m_alResultPropPages = new ArrayList();


            // Set up the blank icon
            m_hBlankIcon      = CResourceStore.GetHIcon("blank_ico");
            m_iBlankIconIndex = CResourceStore.GetIconCookie(m_hBlankIcon);

            m_hGACIcon      = CResourceStore.GetHIcon("gac_ico");
            m_iGACIconIndex = CResourceStore.GetIconCookie(m_hGACIcon);

            m_hZAPIcon      = CResourceStore.GetHIcon("zap_ico");
            m_iZAPIconIndex = CResourceStore.GetIconCookie(m_hZAPIcon);

            m_fAllowMultiSelectResults = true;
        }// CSharedAssemblies
Beispiel #11
0
        }// GetNumberFromTimeString

        private String GetTimeUnitFromTimeString(String s)
        {
            int nIndex = s.Length - 1;

            while (nIndex >= 0 && !Char.IsNumber(s[nIndex]))
            {
                nIndex--;
            }

            String sUnit = s.Substring(nIndex + 1);

            if (sUnit.ToLower(CultureInfo.InvariantCulture).Equals("d"))
            {
                return(CResourceStore.GetString("Days"));
            }
            if (sUnit.ToLower(CultureInfo.InvariantCulture).Equals("m"))
            {
                return(CResourceStore.GetString("Minutes"));
            }
            if (sUnit.ToLower(CultureInfo.InvariantCulture).Equals("s"))
            {
                return(CResourceStore.GetString("Seconds"));
            }
            if (sUnit.ToLower(CultureInfo.InvariantCulture).Equals("ms"))
            {
                return(CResourceStore.GetString("Milliseconds"));
            }
            // If we don't know the time value, let's make it seconds
            return(CResourceStore.GetString("Seconds"));
        }// GetTimeUnitFromTimeString
Beispiel #12
0
 internal CNewPermSetWiz1(PolicyLevel pl)
 {
     m_pl              = pl;
     m_sTitle          = CResourceStore.GetString("CNewPermSetWiz1:Title");
     m_sHeaderTitle    = CResourceStore.GetString("CNewPermSetWiz1:HeaderTitle");
     m_sHeaderSubTitle = CResourceStore.GetString("CNewPermSetWiz1:HeaderSubTitle");
 }// CNewPermSetWiz1
Beispiel #13
0
        }// CGenApplications

        internal override void AddMenuItems(ref IContextMenuCallback piCallback, ref int pInsertionAllowed)
        {
            // See if we're allowed to insert an item in the "view" section
            if ((pInsertionAllowed & (int)CCM.INSERTIONALLOWED_TOP) > 0)
            {
                // Stuff common to the top menu
                CONTEXTMENUITEM newitem = new CONTEXTMENUITEM();
                newitem.lInsertionPointID = CCM.INSERTIONPOINTID_PRIMARY_TOP;
                newitem.fFlags            = 0;
                newitem.fSpecialFlags     = 0;

                newitem.strName          = CResourceStore.GetString("CGenApplications:AddApplicationOption");
                newitem.strStatusBarText = CResourceStore.GetString("CGenApplications:AddApplicationOptionDes");
                newitem.lCommandID       = COMMANDS.ADD_APPLICATION;

                // Now add this item through the callback
                piCallback.AddItem(ref newitem);


                newitem.strName          = CResourceStore.GetString("CGenApplications:FixApplicationOption");
                newitem.strStatusBarText = CResourceStore.GetString("CGenApplications:FixApplicationOptionDes");
                newitem.lCommandID       = COMMANDS.FIX_APPLICATION;

                // Now add this item through the callback
                piCallback.AddItem(ref newitem);
            }
        }// AddMenuItems
        //-------------------------------------------------
        // CApplication - Constructor
        //
        // Initializes some variables, and determines the icon
        // we'll be displaying for this application.
        //-------------------------------------------------
        internal CApplication(AppFiles appInfo)
        {
            // Standard stuff we need to set for all nodes
            m_sGuid        = "C338CBF6-2F60-4e1b-8FB5-12FEAE2DD937";
            m_sHelpSection = "";
            m_appInfo      = appInfo;

            // Let's pull the path and extension off of the application filename
            // so we can display just the application name to the user

            // We're guarenteed to have at least the config file, but not necessarily the
            // application file... let's get our best name

            String sName = (m_appInfo.sAppFile.Length > 0) ? m_appInfo.sAppFile : m_appInfo.sAppConfigFile;

            // Get the file description
            FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(sName);

            if (fvi.FileDescription != null && fvi.FileDescription.Length > 0 && !fvi.FileDescription.Equals(" "))
            {
                m_sDisplayName = fvi.FileDescription;
            }
            else
            {
                String[] sWords = sName.Split(new char[] { '\\' });
                m_sDisplayName = sWords[sWords.Length - 1];
            }

            // Can't set this up until we know what our display name is
            m_oResults = new CApplicationTaskPad(this);

            // Let's try and get the icon that explorer would use to display this file
            m_hIcon = (IntPtr)(-1);
            SHFILEINFO finfo   = new SHFILEINFO();
            uint       iRetVal = 0;

            // Grab an icon for this application
            iRetVal = SHGetFileInfo(sName, 0, out finfo, 20, SHGFI.ICON | SHGFI.SMALLICON);

            // If this function returned a zero, then we know it was a failure...
            // We'll just grab a default icon
            if (iRetVal == 0)
            {
                m_hIcon   = CResourceStore.GetHIcon("application_ico");
                m_bBigPic = new Bitmap(Bitmap.FromHicon(m_hIcon), new Size(32, 32));
            }
            // We could get a valid icon from the shell
            else
            {
                m_hIcon = finfo.hIcon;
                // Obtain a cookie for this icon
                int iIconCookie = CResourceStore.StoreHIcon(m_hIcon);
                // Put this icon in MMC's image list
                CNodeManager.ConsoleImageListSetIcon(m_hIcon, iIconCookie);

                // We can also get the 'big' icon to use in the property page
                iRetVal   = SHGetFileInfo(sName, 0, out finfo, 20, SHGFI.ICON);
                m_bBigPic = new Bitmap(Bitmap.FromHicon(finfo.hIcon));
            }
        }// CApplication
        internal CFileDialogPermPropPage(CPSetWrapper nps) :  base(nps)
        {
            IPermission perm = m_pSetWrap.PSet.GetPermission(typeof(FileDialogPermission));

            m_PermControls = new CFileDialogPermControls(perm, this);
            m_sTitle       = CResourceStore.GetString("FileDialogPerm:PermName");
        }// CFileDialogPermPropPage
        }// CNewCodeGroupWiz1

        internal override int InsertPropSheetPageControls()
        {
            base.InsertPropSheetPageControls();
            m_radCreateNew.Text = CResourceStore.GetString("CNewCodeGroupWiz1:m_radCreateNew.Text");
            m_radImportXML.Text = CResourceStore.GetString("CNewCodeGroupWiz1:m_radImportXML.Text");
            return(1);
        }// InsertPropSheetPageControls
Beispiel #17
0
        //-------------------------------------------------
        // CNode - Constructor
        //
        // This transfers data for the node information structure
        // into the class and loads the node's icon.
        //-------------------------------------------------
        internal CNode()
        {
            // Zero out all the info out of the structure
            m_sGuid                          = null;
            m_sHelpSection                   = null;
            m_sDisplayName                   = null;
            m_sIDName                        = null;
            m_oResults                       = null;
            m_aPropSheetPage                 = null;
            m_hModule                        = Marshal.GetHINSTANCE(this.GetType().Module);
            m_iResultNum                     = 0;
            m_iHScopeItem                    = 0;
            m_iData                          = 0;
            m_hPropertyPageRouter            = (IntPtr)(-1);
            m_iParentHScopeItem              = -1;
            m_sPropPageTemplate              = "IDD_WFCWRAPPERPROP";
            m_fAllowMultiSelectResults       = false;
            m_fInsertedChildrenOnExpand      = false;
            m_fStartResultRefresh            = false;
            m_fWantToMakePropertyPageVisible = false;
            m_fWantToRefreshResult           = false;

            // Set up the blank icon
            m_hBlankIcon      = CResourceStore.GetHIcon("blank_ico");
            m_iBlankIconIndex = CResourceStore.GetIconCookie(m_hBlankIcon);
        }// CNode
        }// AddSetting

        public String GetPermissionString()
        {
            String s = "";

            if (fRead)
            {
                s += CResourceStore.GetString("FileIOPermission:Read");
            }
            if (fWrite)
            {
                if (s.Length > 0)
                {
                    s += CResourceStore.GetString("FileIOPerm:Seperator");
                }
                s += CResourceStore.GetString("FileIOPermission:Write");
            }
            if (fAppend)
            {
                if (s.Length > 0)
                {
                    s += CResourceStore.GetString("FileIOPerm:Seperator");
                }
                s += CResourceStore.GetString("FileIOPermission:Append");
            }
            if (fPDiscovery)
            {
                if (s.Length > 0)
                {
                    s += CResourceStore.GetString("FileIOPerm:Seperator");
                }
                s += CResourceStore.GetString("FileIOPermission:PathDiscovery");
            }

            return(s);
        } // GetPermissionString
Beispiel #19
0
        internal CSingleCodeGroup(ref PolicyLevel pl, ref CodeGroup cg, bool fReadOnly)
        {
            ReadOnly       = fReadOnly;
            m_sGuid        = "E1768EA0-51D6-42ea-BA97-C9BC7F4C5CC0";
            m_sHelpSection = "";

            if (cg.Name != null && cg.Name.Length > 0)
            {
                m_sDisplayName = cg.Name;
            }
            else
            {
                m_sDisplayName = CResourceStore.GetString("CSingleCodeGroup:NoName");
            }

            m_aPropSheetPage = null;

            if (cg is UnionCodeGroup)
            {
                m_hIcon    = CResourceStore.GetHIcon("singlecodegroup_ico");
                m_oResults = new CSingleCodeGroupTaskPad(this, cg);
            }
            else
            {
                m_hIcon    = CResourceStore.GetHIcon("customcodegroup_ico");
                m_oResults = new CNonUnionCGTaskPad(this, cg);
            }

            m_cg          = cg;
            m_cgOld       = m_cg.Copy();
            m_pl          = pl;
            m_fIAmDeleted = false;
        }// CSingleCodeGroup
Beispiel #20
0
        internal CEventLogPermDialog(EventLogPermission perm)
        {
            this.Text = CResourceStore.GetString("EventLogPermission:PermName");

            m_PermControls = new CEventLogPermControls(perm, this);
            Init();
        } // CEventLogPermDialog
Beispiel #21
0
        }// RemoveChildCodegroup

        internal override void SecurityPolicyChanged(bool fShowDialog)
        {
            if (!m_fIAmDeleted)
            {
                // We need to catch this policy change in the event that our display name
                // has changed
                if (m_cg.Name == null || m_cg.Name.Length == 0)
                {
                    m_sDisplayName = CResourceStore.GetString("CSingleCodeGroup:NoName");
                }
                else
                {
                    m_sDisplayName = m_cg.Name;
                }

                // We need to remove this node from the policy tree, then replace it
                // with the updated Codegroup
                if (Security.GetRootCodeGroupNode(m_pl) == this)
                {
                    // This is the easy case... we'll just replace the root code
                    m_pl.RootCodeGroup = m_cg;
                }
                else
                {
                    // We need to do a big deal update
                    Security.UpdateCodegroup(m_pl, this);
                }
                m_cgOld = m_cg.Copy();
                RefreshResultView();
            }
            base.SecurityPolicyChanged(fShowDialog);
        } // SecurityPolicyChanged
        }// COleDbPermControls

        protected override DataTable CreateDataTable(DataGrid dg)
        {
            DataTable dt = new DataTable("Stuff");

            // Create the "Provider" Column
            DataColumn dcProvider = new DataColumn();

            dcProvider.ColumnName = "Provider";
            dcProvider.DataType   = typeof(String);
            dt.Columns.Add(dcProvider);

            // Now set up any column-specific behavioral stuff....
            // like not letting the checkboxes allow null, setting
            // column widths, etc.

            DataGridTableStyle    dgts          = new DataGridTableStyle();
            DataGridTextBoxColumn dgtbcProvider = new DataGridTextBoxColumn();

            dg.TableStyles.Add(dgts);
            dgts.MappingName       = "Stuff";
            dgts.RowHeadersVisible = false;
            dgts.AllowSorting      = false;

            // Set up the column info for the Path column
            dgtbcProvider.MappingName          = "Provider";
            dgtbcProvider.HeaderText           = CResourceStore.GetString("Provider");
            dgtbcProvider.Width                = ScaleWidth(CResourceStore.GetInt("OleDbPermission:ProviderColumnWidth"));
            dgtbcProvider.NullText             = "";
            dgtbcProvider.TextBox.TextChanged += new EventHandler(onChange);
            dgts.GridColumnStyles.Add(dgtbcProvider);

            return(dt);
        }// CreateDataTable
        }// AddMenuItems

        internal override void MenuCommand(int nCommandID, Object oResultItem)
        {
            if (nCommandID == COMMANDS.DUPLICATE_PERMISSIONSET)
            {
                NamedPermissionSet nps = (NamedPermissionSet)m_psetWrapper.PSet.Copy();

                String sBaseName = nps.Name;

                nps.Name = String.Format(CResourceStore.GetString("CSinglePermissionSet:PrependtoDupPSets"), nps.Name);
                int nCounter = 1;
                // make sure it's not already used
                while (Security.isPermissionSetNameUsed(m_pl, nps.Name))
                {
                    nCounter++;
                    nps.Name = String.Format(CResourceStore.GetString("CSinglePermissionSet:NumPrependtoDupPSets"), nCounter.ToString(), sBaseName);
                }


                CNode node = CNodeManager.GetNodeByHScope(ParentHScopeItem);
                CSinglePermissionSet newNode = ((CPermissionSet)node).AddPermissionSet(nps);
                newNode.SecurityPolicyChanged();
                // Put the selection on the new permission set we just created
                CNodeManager.SelectScopeItem(newNode.HScopeItem);
            }

            else if (nCommandID == COMMANDS.VIEW_PERMISSION)
            {
                int iResultItem = (int)oResultItem - 1;
                // Pop up the Dialog Box for this permission
                (new CReadOnlyPermission((IPermission)m_alPermissions[iResultItem])).ShowDialog();
            }

            else if (nCommandID == COMMANDS.ADD_PERMISSIONS)
            {
                CAddPermissionsWizard wiz = new CAddPermissionsWizard(m_psetWrapper);
                wiz.LaunchWizard(Cookie);
                if (wiz.didFinish)
                {
                    SecurityPolicyChanged();
                    GenerateGivenPermissionsStringList();
                    CNodeManager.Console.SelectScopeItem(HScopeItem);
                }
            }
            else if (nCommandID == COMMANDS.SHOW_LISTVIEW)
            {
                m_oResults = this;
                RefreshResultView();
                m_fShowHTMLPage = false;
            }

            else if (nCommandID == COMMANDS.SHOW_TASKPAD)
            {
                m_oResults      = m_taskpad;
                m_fShowHTMLPage = true;
                // The HTML pages comes displayed with this checkbox marked. Make
                // sure we update the xml setting
                CConfigStore.SetSetting("ShowHTMLForPermissionSet", "yes");
                RefreshResultView();
            }
        }// MenuCommand
Beispiel #24
0
        }// onTextChange

        void CheckFile(Object o, CancelEventArgs e)
        {
            OpenFileDialog fd = (OpenFileDialog)o;

            try
            {
                String sFilename = fd.FileName;
                // Check to see if this is a http path....
                if (!File.Exists(sFilename))
                {
                    MessageBox.Show(String.Format(CResourceStore.GetString("CChooseAppDialog:FileNotExist"), sFilename),
                                    CResourceStore.GetString("CChooseAppDialog:FileNotExistTitle"),
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                    e.Cancel = true;
                }
            }
            catch (Exception)
            {
                MessageBox.Show(CResourceStore.GetString("CChooseAppDialog:BadFile"),
                                CResourceStore.GetString("CChooseAppDialog:BadFileTitle"),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
                e.Cancel = true;
            }
        }// CheckFile
 internal CTrustAppWiz8()
 {
     m_sTitle          = CResourceStore.GetString("CTrustAppWiz8:Title");
     m_sHeaderTitle    = CResourceStore.GetString("CTrustAppWiz8:HeaderTitle");
     m_sHeaderSubTitle = CResourceStore.GetString("CTrustAppWiz8:HeaderSubTitle");
     m_sInfo           = null;
 }// CTrustAppWiz8
Beispiel #26
0
 internal CDependAssembliesDialog(CApplicationDepends appDepends)
 {
     m_appDepends = appDepends;
     m_ol         = GenerateAssemblyList();
     PutInAssemblies();
     this.Text = CResourceStore.GetString("InheritedAssemblyDialogs:ChooseFromDepend");
 }// CFusionDialog
Beispiel #27
0
        }// SecurityPolicyChanged

        internal void SavePolicy(bool fUI)
        {
            if (isNoSave)
            {
                if (fUI)
                {
                    MessageBox(String.Format(CResourceStore.GetString("CSecurityPolicy:CannotSave"), m_sPolicyName),
                               CResourceStore.GetString("CSecurityPolicy:CannotSaveTitle"),
                               MB.ICONEXCLAMATION);
                }
                return;
            }

            // Refresh our root codegroup
            try
            {
                SecurityManager.SavePolicyLevel(m_pl);
                m_fUndo = true;
            }
            catch (Exception)
            {
                // Ok, we got an error somehow. This should be pretty rare, and could happen
                // if another process has the policy file locked. Inform the user and see
                // what they want to do.
                bool fSaved = false;
                bool fRetry = true;

                while (!fSaved && fRetry)
                {
                    int nRet = MessageBox(String.Format(CResourceStore.GetString("CSecurityPolicy:SaveFailedRetry"),
                                                        m_pl.StoreLocation),
                                          CResourceStore.GetString("CSecurityPolicy:SaveFailedRetryTitle"),
                                          MB.RETRYCANCEL | MB.ICONEXCLAMATION);
                    if (nRet == MB.IDRETRY)
                    {
                        try
                        {
                            SecurityManager.SavePolicyLevel(m_pl);
                            m_fUndo = true;
                            fSaved  = true;
                        }
                        catch (Exception)
                        {}
                    }
                    else
                    {
                        fRetry = false;
                    }
                }

                if (!fSaved)
                {
                    MessageBox(String.Format(CResourceStore.GetString("CSecurityPolicy:SaveFailed"),
                                             LocalizedPolicyName,
                                             m_pl.StoreLocation),
                               CResourceStore.GetString("CSecurityPolicy:SaveFailedTitle"),
                               MB.ICONEXCLAMATION);
                }
            }
        }// SavePolicy
        }// CreateChildren

        internal CSinglePermissionSet AddPermissionSet(NamedPermissionSet nps)
        {
            // Make sure we have a unique permission set name
            int    nCounter = 1;
            String sBase    = nps.Name;

            while (Security.isPermissionSetNameUsed(m_pl, nps.Name))
            {
                if (nCounter == 1)
                {
                    nps.Name = String.Format(CResourceStore.GetString("CSinglePermissionSet:NewDupPermissionSet"), sBase);
                }
                else
                {
                    nps.Name = String.Format(CResourceStore.GetString("CSinglePermissionSet:NumNewDupPermissionSet"), nCounter.ToString(), sBase);
                }
                nCounter++;
            }

            // Now add the new permission set
            m_pl.AddNamedPermissionSet(nps);
            CNode node    = new CSinglePermissionSet(nps, m_pl, ReadOnly);
            int   nCookie = CNodeManager.AddNode(ref node);

            AddChild(nCookie);
            InsertSpecificChild(nCookie);
            // Return the node we created
            return((CSinglePermissionSet)node);
        } // AddPermissionSet
Beispiel #29
0
 internal CNewCodeGroupWiz3(PolicyLevel pl)
 {
     m_sTitle          = CResourceStore.GetString("CNewCodeGroupWiz3:Title");
     m_sHeaderTitle    = CResourceStore.GetString("CNewCodeGroupWiz3:HeaderTitle");
     m_sHeaderSubTitle = CResourceStore.GetString("CNewCodeGroupWiz3:HeaderSubTitle");
     m_pl = pl;
 }// CNewCodeGroupWiz3
        internal CSecurityAdjustmentWiz2()
        {
            m_sTitle          = CResourceStore.GetString("CSecurityAdjustmentWiz2:Title");
            m_sHeaderTitle    = CResourceStore.GetString("CSecurityAdjustmentWiz2:HeaderTitle");
            m_sHeaderSubTitle = CResourceStore.GetString("CSecurityAdjustmentWiz2:HeaderSubTitle");

            // Set up the zone descriptions
            m_sZoneDescriptions = new String[] { CResourceStore.GetString("CSecurityAdjustmentWiz2:MyComputerDes"),
                                                 CResourceStore.GetString("CSecurityAdjustmentWiz2:IntranetDes"),
                                                 CResourceStore.GetString("CSecurityAdjustmentWiz2:InternetDes"),
                                                 CResourceStore.GetString("CSecurityAdjustmentWiz2:TrustedDes"),
                                                 CResourceStore.GetString("CSecurityAdjustmentWiz2:UntrustedDes") };

            m_sSecLevelDescriptions = new String[] {
                CResourceStore.GetString("TightSecurityDes"),
                CResourceStore.GetString("FairlyTightSecurityDes"),
                CResourceStore.GetString("FairlyLooseSecurityDes"),
                CResourceStore.GetString("LooseSecurityDes"),
                CResourceStore.GetString("CSecurityAdjustmentWiz2:Custom")
            };


            m_nDefaultLevels = new int[] { PermissionSetType.FULLTRUST,
                                           PermissionSetType.INTRANET,
                                           PermissionSetType.INTERNET,
                                           PermissionSetType.INTERNET,
                                           PermissionSetType.NONE };

            m_nZoneLevels = null;
        }// CSecurityAdjustmentWiz2