コード例 #1
0
        }// 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
コード例 #2
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
コード例 #3
0
        }// 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
コード例 #4
0
        internal CApplicationDepends(String sAppFile)
        {
            m_sGuid        = "96821C0B-CBE2-4dc9-AC52-756A3361B07F";
            m_sHelpSection = "";
            m_hIcon        = CResourceStore.GetHIcon("sharedassemblies_ico");
            DisplayName    = CResourceStore.GetString("CApplicationDepends:DisplayName");
            Name           = "Assembly Dependencies";

            m_taskPadWaiting = new CGenericTaskPad(this, "WAITINGDEPENDASSEM_HTML");
            m_taskPad        = new CGenericTaskPad(this, "DEPENDASSEM_HTML");

            m_fIKnowMyDependencies     = false;
            m_fAllowListView           = false;
            m_fAllowMultiSelectResults = true;


            m_fReadShowHTML = false;
            m_oResults      = m_taskPadWaiting;
            m_olAssems      = null;

            m_sAppFile = sAppFile;

            // Get icons for the assemblies we show
            m_hAssemIcon      = CResourceStore.GetHIcon("gac_ico");
            m_iAssemIconIndex = CResourceStore.GetIconCookie(m_hAssemIcon);


            // If we're not managed, then don't bother trying to have our dependencies
            // found
            if (!Fusion.isManaged(m_sAppFile))
            {
                m_taskPad              = new CGenericTaskPad(this, "UNMANAGEDDEPENDASSEM_HTML");
                m_oResults             = m_taskPad;
                m_fIKnowMyDependencies = true;
            }
            else
            {
                // Get ourselves in a queue to have our dependent assemblies discovered....
                if (m_alNodes == null)
                {
                    m_alNodes = ArrayList.Synchronized(new ArrayList());
                }

                m_alNodes.Add(this);

                if (m_thread == null)
                {
                    m_thread = new Thread(new ThreadStart(DependencyFinder));
                }
                if (!m_thread.IsAlive)
                {
                    m_thread.Priority = ThreadPriority.Lowest;
                    m_thread.Start();
                }
            }
        }// CApplicationDepends
コード例 #5
0
        }// InsertPropSheetPageControls

        //-------------------------------------------------
        // PutValuesinPage
        //
        // This function put data onto the property page
        //-------------------------------------------------
        private void PutValuesinPage()
        {
            // Fill this data
            m_txtAssemName.Text      = m_ai.Name;
            m_txtLastModifed.Text    = m_ai.Modified;
            m_txtCulture.Text        = m_ai.Locale;
            m_txtVersion.Text        = m_ai.Version;
            m_txtPublicKeyToken.Text = m_ai.PublicKeyToken;
            m_txtCodebase.Text       = m_ai.Codebase;
            m_txtCacheType.Text      = Fusion.GetCacheTypeString(m_ai.nCacheType);
        } // PutValuesinPage
コード例 #6
0
        }// ResultQDO

        internal override bool ResultCompareObjects(Object o1, Object o2, out bool fEqual)
        {
            if (o1 is AssemInfo && o2 is AssemInfo)
            {
                fEqual = Fusion.CompareAssemInfo((AssemInfo)o1, (AssemInfo)o2);
                return(true);
            }
            MessageBox("Ack. I'm in ResultCompareObjects and they aren't AssemInfos!", "", 0);
            fEqual = false;
            return(false);
        }// ResultCompareObjects
コード例 #7
0
        }// onDoubleClick

        internal override int onDelete(Object o)
        {
            String sMessage;

            if (o is ArrayList)
            {
                sMessage = CResourceStore.GetString("CSharedAssemblies:VerifyDelete");
            }
            else
            {
                sMessage = String.Format(CResourceStore.GetString("CSharedAssemblies:VerifyDeleteSingle"), ((AssemInfo)o).Name);
            }


            int nRes = MessageBox(sMessage,
                                  CResourceStore.GetString("CSharedAssemblies:VerifyDeleteTitle"),
                                  MB.ICONQUESTION | MB.YESNO);

            if (nRes == MB.IDYES)
            {
                if (o is ArrayList)
                {
                    ArrayList al = (ArrayList)o;
                    for (int i = 0; i < al.Count; i++)
                    {
                        int nVictim = ((int)al[i]) - 1;
                        if (!Fusion.RemoveAssemblyFromGac((AssemInfo)m_olAssems[nVictim]))
                        {
                            MessageBox(String.Format(CResourceStore.GetString("CSharedAssemblies:ErrorRemoving"), ((AssemInfo)m_olAssems[nVictim]).Name),
                                       CResourceStore.GetString("CSharedAssemblies:ErrorRemovingTitle"),
                                       MB.ICONEXCLAMATION);
                        }
                    }
                }
                else
                {
                    AssemInfo ai = (AssemInfo)o;
                    if (!Fusion.RemoveAssemblyFromGac(ai))
                    {
                        MessageBox(String.Format(CResourceStore.GetString("CSharedAssemblies:ErrorRemoving"), ai.Name),
                                   CResourceStore.GetString("CSharedAssemblies:ErrorRemovingTitle"),
                                   MB.ICONEXCLAMATION);
                    }
                }

                m_olAssems = Fusion.ReadFusionCache();
                CNodeManager.Console.SelectScopeItem(HScopeItem);
            }

            return(HRESULT.S_OK);
        }// onDelete
コード例 #8
0
        }// onDelete

        internal override void Showing()
        {
            m_olAssems = Fusion.ReadFusionCache();

            if (!m_fReadShowHTML)
            {
                m_fShowHTMLPage = ((String)CConfigStore.GetSetting("ShowHTMLForSharedAssem")).Equals("yes");

                if (m_fShowHTMLPage)
                {
                    m_oResults = m_taskPad;
                }
                else
                {
                    m_oResults = this;
                }
                m_fReadShowHTML = true;
            }
        }// Showing
コード例 #9
0
        internal CFusionNoVersionDialog() : base(false)
        {
            this.Text = CResourceStore.GetString("InheritedAssemblyDialogs:ChooseFromGac");
            m_ol      = Fusion.ReadFusionCacheJustGAC();

            // Filter out duplicate versions....
            for (int i = 0; i < m_ol.Count; i++)
            {
                AssemInfo ai = (AssemInfo)m_ol[i];
                // Run through and see if anybody else has this name and public key token
                for (int j = i + 1; j < m_ol.Count; j++)
                {
                    AssemInfo ai2 = (AssemInfo)m_ol[j];
                    if (ai2.Name.Equals(ai.Name) && ai2.PublicKeyToken.Equals(ai.PublicKeyToken))
                    {
                        m_ol.RemoveAt(j);
                        j--;
                    }
                }
            }
            PutInAssemblies();
        } // CFusionNoVersionDialog
コード例 #10
0
        }// ApplyPropPages

        private CPropPage[] GetPropertyPages(AssemInfo ai)
        {
            // Let's see if we already have an entry for this assemby item
            int nLen = m_alResultPropPages.Count;

            for (int i = 0; i < nLen; i++)
            {
                if (Fusion.CompareAssemInfo(((PropPagePairs)m_alResultPropPages[i]).ai, ai))
                {
                    return(((PropPagePairs)m_alResultPropPages[i]).ppages);
                }
            }

            // If we're here, then we have a new property page to add
            PropPagePairs ppp = new PropPagePairs();

            ppp.ppages = new CPropPage[1] {
                new CAssemGenProps(ai)
            };
            ppp.ai = ai;
            m_alResultPropPages.Add(ppp);
            return(ppp.ppages);
        }// GetPropertyPages
コード例 #11
0
        }// Paste

        private bool AddAssemToFusion(String sFilename)
        {
            if (Fusion.isManaged(sFilename))
            {
                int hr = Fusion.AddAssemblytoGac(sFilename);
                if (hr != HRESULT.S_OK)
                {
                    if (hr == HRESULT.E_ACCESSDENIED)
                    {
                        MessageBox(CResourceStore.GetString("CSharedAssemblies:AddAssemFailNoAccess"),
                                   CResourceStore.GetString("CSharedAssemblies:AddAssemFailNoAccessTitle"),
                                   MB.ICONEXCLAMATION);
                        // If this happens, they won't be able to add any items to the gac
                        return(false);
                    }
                    else
                    {
                        MessageBox(CResourceStore.GetString("CSharedAssemblies:AddAssemFail"),
                                   CResourceStore.GetString("CSharedAssemblies:AddAssemFailTitle"),
                                   MB.ICONEXCLAMATION);
                    }
                }
                // Don't bother refreshing the screen unless we added an assembly
                else
                {
                    m_olAssems = Fusion.ReadFusionCache();
                    CNodeManager.Console.SelectScopeItem(HScopeItem);
                }
            }
            else
            {
                MessageBox(CResourceStore.GetString("isNotManagedCode"),
                           CResourceStore.GetString("isNotManagedCodeTitle"),
                           MB.ICONEXCLAMATION);
            }
            return(true);
        }// AddAssemToFusion
コード例 #12
0
        }// HaveCurrentEvidence

        internal Evidence GetEvidence()
        {
            // If we have a thread that is doing this right now, abort
            // it.
            if (m_tEvidence != null)
            {
                m_tEvidence.Abort();
            }
            try
            {
                AssemblyRef ar = m_al.LoadAssemblyInOtherAppDomainFrom(m_txtFilename.Text);
                Evidence    e  = ar.GetEvidence();
                m_al.Finished();
                m_sEvalAssem = m_txtFilename.Text;
                return(e);
            }
            catch (Exception)
            {
                // Let's see if can can figure out what failed...
                if (File.Exists(m_txtFilename.Text) && !Fusion.isManaged(m_txtFilename.Text))
                {
                    MessageBox(CResourceStore.GetString("isNotManagedCode"),
                               CResourceStore.GetString("isNotManagedCodeTitle"),
                               MB.ICONEXCLAMATION);
                }

                else
                {
                    MessageBox(String.Format(CResourceStore.GetString("CantLoadAssembly"), m_txtFilename.Text),
                               CResourceStore.GetString("CantLoadAssemblyTitle"),
                               MB.ICONEXCLAMATION);
                }
                m_al.Finished();
                return(null);
            }
        } // GetEvidence
コード例 #13
0
 internal CFusionDialog()
 {
     this.Text = CResourceStore.GetString("InheritedAssemblyDialogs:ChooseFromGac");
     m_ol      = Fusion.ReadFusionCacheJustGAC();
     PutInAssemblies();
 } // CFusionDialog
コード例 #14
0
        }// Filename

        private void SetupControls()
        {
            System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(CChooseAppDialog));
            this.m_lblHelp      = new System.Windows.Forms.Label();
            this.m_lblChooseApp = new System.Windows.Forms.Label();
            this.m_lvApps       = new System.Windows.Forms.ListView();
            this.m_lblBrowse    = new System.Windows.Forms.Label();
            this.m_btnBrowse    = new System.Windows.Forms.Button();
            this.m_btnOK        = new System.Windows.Forms.Button();
            this.m_btnCancel    = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // m_lblHelp
            //
            this.m_lblHelp.AccessibleDescription = ((string)(resources.GetObject("m_lblHelp.AccessibleDescription")));
            this.m_lblHelp.AccessibleName        = ((string)(resources.GetObject("m_lblHelp.AccessibleName")));
            this.m_lblHelp.Anchor      = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("m_lblHelp.Anchor")));
            this.m_lblHelp.AutoSize    = ((bool)(resources.GetObject("m_lblHelp.AutoSize")));
            this.m_lblHelp.Cursor      = ((System.Windows.Forms.Cursor)(resources.GetObject("m_lblHelp.Cursor")));
            this.m_lblHelp.Dock        = ((System.Windows.Forms.DockStyle)(resources.GetObject("m_lblHelp.Dock")));
            this.m_lblHelp.Enabled     = ((bool)(resources.GetObject("m_lblHelp.Enabled")));
            this.m_lblHelp.Font        = ((System.Drawing.Font)(resources.GetObject("m_lblHelp.Font")));
            this.m_lblHelp.Image       = ((System.Drawing.Image)(resources.GetObject("m_lblHelp.Image")));
            this.m_lblHelp.ImageAlign  = ((System.Drawing.ContentAlignment)(resources.GetObject("m_lblHelp.ImageAlign")));
            this.m_lblHelp.ImageIndex  = ((int)(resources.GetObject("m_lblHelp.ImageIndex")));
            this.m_lblHelp.ImeMode     = ((System.Windows.Forms.ImeMode)(resources.GetObject("m_lblHelp.ImeMode")));
            this.m_lblHelp.Location    = ((System.Drawing.Point)(resources.GetObject("m_lblHelp.Location")));
            this.m_lblHelp.Name        = "Help";
            this.m_lblHelp.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("m_lblHelp.RightToLeft")));
            this.m_lblHelp.Size        = ((System.Drawing.Size)(resources.GetObject("m_lblHelp.Size")));
            this.m_lblHelp.TabIndex    = ((int)(resources.GetObject("m_lblHelp.TabIndex")));
            this.m_lblHelp.Text        = resources.GetString("m_lblHelp.Text");
            this.m_lblHelp.TextAlign   = ((System.Drawing.ContentAlignment)(resources.GetObject("m_lblHelp.TextAlign")));
            this.m_lblHelp.Visible     = ((bool)(resources.GetObject("m_lblHelp.Visible")));
            //
            // m_lblChooseApp
            //
            this.m_lblChooseApp.AccessibleDescription = ((string)(resources.GetObject("m_lblChooseApp.AccessibleDescription")));
            this.m_lblChooseApp.AccessibleName        = ((string)(resources.GetObject("m_lblChooseApp.AccessibleName")));
            this.m_lblChooseApp.Anchor      = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("m_lblChooseApp.Anchor")));
            this.m_lblChooseApp.AutoSize    = ((bool)(resources.GetObject("m_lblChooseApp.AutoSize")));
            this.m_lblChooseApp.Cursor      = ((System.Windows.Forms.Cursor)(resources.GetObject("m_lblChooseApp.Cursor")));
            this.m_lblChooseApp.Dock        = ((System.Windows.Forms.DockStyle)(resources.GetObject("m_lblChooseApp.Dock")));
            this.m_lblChooseApp.Enabled     = ((bool)(resources.GetObject("m_lblChooseApp.Enabled")));
            this.m_lblChooseApp.Font        = ((System.Drawing.Font)(resources.GetObject("m_lblChooseApp.Font")));
            this.m_lblChooseApp.Image       = ((System.Drawing.Image)(resources.GetObject("m_lblChooseApp.Image")));
            this.m_lblChooseApp.ImageAlign  = ((System.Drawing.ContentAlignment)(resources.GetObject("m_lblChooseApp.ImageAlign")));
            this.m_lblChooseApp.ImageIndex  = ((int)(resources.GetObject("m_lblChooseApp.ImageIndex")));
            this.m_lblChooseApp.ImeMode     = ((System.Windows.Forms.ImeMode)(resources.GetObject("m_lblChooseApp.ImeMode")));
            this.m_lblChooseApp.Location    = ((System.Drawing.Point)(resources.GetObject("m_lblChooseApp.Location")));
            this.m_lblChooseApp.Name        = "ChooseAppLabel";
            this.m_lblChooseApp.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("m_lblChooseApp.RightToLeft")));
            this.m_lblChooseApp.Size        = ((System.Drawing.Size)(resources.GetObject("m_lblChooseApp.Size")));
            this.m_lblChooseApp.TabIndex    = ((int)(resources.GetObject("m_lblChooseApp.TabIndex")));
            this.m_lblChooseApp.Text        = resources.GetString("m_lblChooseApp.Text");
            this.m_lblChooseApp.TextAlign   = ((System.Drawing.ContentAlignment)(resources.GetObject("m_lblChooseApp.TextAlign")));
            this.m_lblChooseApp.Visible     = ((bool)(resources.GetObject("m_lblChooseApp.Visible")));
            //
            // m_lvApps
            //
            this.m_lvApps.AccessibleDescription = ((string)(resources.GetObject("m_lvApps.AccessibleDescription")));
            this.m_lvApps.AccessibleName        = ((string)(resources.GetObject("m_lvApps.AccessibleName")));
            this.m_lvApps.Alignment             = ((System.Windows.Forms.ListViewAlignment)(resources.GetObject("m_lvApps.Alignment")));
            this.m_lvApps.Anchor          = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("m_lvApps.Anchor")));
            this.m_lvApps.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("m_lvApps.BackgroundImage")));

            ColumnHeader chApplication = new ColumnHeader();
            ColumnHeader chLocation    = new ColumnHeader();;

            chApplication.Text      = resources.GetString("Application.Text");
            chApplication.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("Application.TextAlign")));
            chApplication.Width     = ((int)(resources.GetObject("Application.Width")));

            chLocation.Text      = resources.GetString("Location.Text");
            chLocation.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("Location.TextAlign")));
            chLocation.Width     = ((int)(resources.GetObject("Location.Width")));

            this.m_lvApps.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
                chApplication,
                chLocation
            });
            this.m_lvApps.Cursor        = ((System.Windows.Forms.Cursor)(resources.GetObject("m_lvApps.Cursor")));
            this.m_lvApps.Dock          = ((System.Windows.Forms.DockStyle)(resources.GetObject("m_lvApps.Dock")));
            this.m_lvApps.Enabled       = ((bool)(resources.GetObject("m_lvApps.Enabled")));
            this.m_lvApps.Font          = ((System.Drawing.Font)(resources.GetObject("m_lvApps.Font")));
            this.m_lvApps.ImeMode       = ((System.Windows.Forms.ImeMode)(resources.GetObject("m_lvApps.ImeMode")));
            this.m_lvApps.LabelWrap     = ((bool)(resources.GetObject("m_lvApps.LabelWrap")));
            this.m_lvApps.Location      = ((System.Drawing.Point)(resources.GetObject("m_lvApps.Location")));
            this.m_lvApps.Name          = "AppsList";
            this.m_lvApps.RightToLeft   = ((System.Windows.Forms.RightToLeft)(resources.GetObject("m_lvApps.RightToLeft")));
            this.m_lvApps.Size          = ((System.Drawing.Size)(resources.GetObject("m_lvApps.Size")));
            this.m_lvApps.TabIndex      = ((int)(resources.GetObject("m_lvApps.TabIndex")));
            this.m_lvApps.Text          = resources.GetString("m_lvApps.Text");
            this.m_lvApps.Visible       = ((bool)(resources.GetObject("m_lvApps.Visible")));
            this.m_lvApps.FullRowSelect = true;

            //
            // m_lblBrowse
            //
            this.m_lblBrowse.AccessibleDescription = ((string)(resources.GetObject("m_lblBrowse.AccessibleDescription")));
            this.m_lblBrowse.AccessibleName        = ((string)(resources.GetObject("m_lblBrowse.AccessibleName")));
            this.m_lblBrowse.Anchor      = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("m_lblBrowse.Anchor")));
            this.m_lblBrowse.AutoSize    = ((bool)(resources.GetObject("m_lblBrowse.AutoSize")));
            this.m_lblBrowse.Cursor      = ((System.Windows.Forms.Cursor)(resources.GetObject("m_lblBrowse.Cursor")));
            this.m_lblBrowse.Dock        = ((System.Windows.Forms.DockStyle)(resources.GetObject("m_lblBrowse.Dock")));
            this.m_lblBrowse.Enabled     = ((bool)(resources.GetObject("m_lblBrowse.Enabled")));
            this.m_lblBrowse.Font        = ((System.Drawing.Font)(resources.GetObject("m_lblBrowse.Font")));
            this.m_lblBrowse.Image       = ((System.Drawing.Image)(resources.GetObject("m_lblBrowse.Image")));
            this.m_lblBrowse.ImageAlign  = ((System.Drawing.ContentAlignment)(resources.GetObject("m_lblBrowse.ImageAlign")));
            this.m_lblBrowse.ImageIndex  = ((int)(resources.GetObject("m_lblBrowse.ImageIndex")));
            this.m_lblBrowse.ImeMode     = ((System.Windows.Forms.ImeMode)(resources.GetObject("m_lblBrowse.ImeMode")));
            this.m_lblBrowse.Location    = ((System.Drawing.Point)(resources.GetObject("m_lblBrowse.Location")));
            this.m_lblBrowse.Name        = "BrowseLabel";
            this.m_lblBrowse.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("m_lblBrowse.RightToLeft")));
            this.m_lblBrowse.Size        = ((System.Drawing.Size)(resources.GetObject("m_lblBrowse.Size")));
            this.m_lblBrowse.TabIndex    = ((int)(resources.GetObject("m_lblBrowse.TabIndex")));
            this.m_lblBrowse.Text        = resources.GetString("m_lblBrowse.Text");
            this.m_lblBrowse.TextAlign   = ((System.Drawing.ContentAlignment)(resources.GetObject("m_lblBrowse.TextAlign")));
            this.m_lblBrowse.Visible     = ((bool)(resources.GetObject("m_lblBrowse.Visible")));
            //
            // m_btnBrowse
            //
            this.m_btnBrowse.AccessibleDescription = ((string)(resources.GetObject("m_btnBrowse.AccessibleDescription")));
            this.m_btnBrowse.AccessibleName        = ((string)(resources.GetObject("m_btnBrowse.AccessibleName")));
            this.m_btnBrowse.Anchor          = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("m_btnBrowse.Anchor")));
            this.m_btnBrowse.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("m_btnBrowse.BackgroundImage")));
            this.m_btnBrowse.Cursor          = ((System.Windows.Forms.Cursor)(resources.GetObject("m_btnBrowse.Cursor")));
            this.m_btnBrowse.Dock            = ((System.Windows.Forms.DockStyle)(resources.GetObject("m_btnBrowse.Dock")));
            this.m_btnBrowse.Enabled         = ((bool)(resources.GetObject("m_btnBrowse.Enabled")));
            this.m_btnBrowse.FlatStyle       = ((System.Windows.Forms.FlatStyle)(resources.GetObject("m_btnBrowse.FlatStyle")));
            this.m_btnBrowse.Font            = ((System.Drawing.Font)(resources.GetObject("m_btnBrowse.Font")));
            this.m_btnBrowse.Image           = ((System.Drawing.Image)(resources.GetObject("m_btnBrowse.Image")));
            this.m_btnBrowse.ImageAlign      = ((System.Drawing.ContentAlignment)(resources.GetObject("m_btnBrowse.ImageAlign")));
            this.m_btnBrowse.ImageIndex      = ((int)(resources.GetObject("m_btnBrowse.ImageIndex")));
            this.m_btnBrowse.ImeMode         = ((System.Windows.Forms.ImeMode)(resources.GetObject("m_btnBrowse.ImeMode")));
            this.m_btnBrowse.Location        = ((System.Drawing.Point)(resources.GetObject("m_btnBrowse.Location")));
            this.m_btnBrowse.Name            = "Browse";
            this.m_btnBrowse.RightToLeft     = ((System.Windows.Forms.RightToLeft)(resources.GetObject("m_btnBrowse.RightToLeft")));
            this.m_btnBrowse.Size            = ((System.Drawing.Size)(resources.GetObject("m_btnBrowse.Size")));
            this.m_btnBrowse.TabIndex        = ((int)(resources.GetObject("m_btnBrowse.TabIndex")));
            this.m_btnBrowse.Text            = resources.GetString("m_btnBrowse.Text");
            this.m_btnBrowse.TextAlign       = ((System.Drawing.ContentAlignment)(resources.GetObject("m_btnBrowse.TextAlign")));
            this.m_btnBrowse.Visible         = ((bool)(resources.GetObject("m_btnBrowse.Visible")));
            //
            // m_btnOK
            //
            this.m_btnOK.AccessibleDescription = ((string)(resources.GetObject("m_btnOK.AccessibleDescription")));
            this.m_btnOK.AccessibleName        = ((string)(resources.GetObject("m_btnOK.AccessibleName")));
            this.m_btnOK.Anchor          = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("m_btnOK.Anchor")));
            this.m_btnOK.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("m_btnOK.BackgroundImage")));
            this.m_btnOK.Cursor          = ((System.Windows.Forms.Cursor)(resources.GetObject("m_btnOK.Cursor")));
            this.m_btnOK.DialogResult    = System.Windows.Forms.DialogResult.OK;
            this.m_btnOK.Dock            = ((System.Windows.Forms.DockStyle)(resources.GetObject("m_btnOK.Dock")));
            this.m_btnOK.Enabled         = ((bool)(resources.GetObject("m_btnOK.Enabled")));
            this.m_btnOK.FlatStyle       = ((System.Windows.Forms.FlatStyle)(resources.GetObject("m_btnOK.FlatStyle")));
            this.m_btnOK.Font            = ((System.Drawing.Font)(resources.GetObject("m_btnOK.Font")));
            this.m_btnOK.Image           = ((System.Drawing.Image)(resources.GetObject("m_btnOK.Image")));
            this.m_btnOK.ImageAlign      = ((System.Drawing.ContentAlignment)(resources.GetObject("m_btnOK.ImageAlign")));
            this.m_btnOK.ImageIndex      = ((int)(resources.GetObject("m_btnOK.ImageIndex")));
            this.m_btnOK.ImeMode         = ((System.Windows.Forms.ImeMode)(resources.GetObject("m_btnOK.ImeMode")));
            this.m_btnOK.Location        = ((System.Drawing.Point)(resources.GetObject("m_btnOK.Location")));
            this.m_btnOK.Name            = "OK";
            this.m_btnOK.RightToLeft     = ((System.Windows.Forms.RightToLeft)(resources.GetObject("m_btnOK.RightToLeft")));
            this.m_btnOK.Size            = ((System.Drawing.Size)(resources.GetObject("m_btnOK.Size")));
            this.m_btnOK.TabIndex        = ((int)(resources.GetObject("m_btnOK.TabIndex")));
            this.m_btnOK.Text            = resources.GetString("m_btnOK.Text");
            this.m_btnOK.TextAlign       = ((System.Drawing.ContentAlignment)(resources.GetObject("m_btnOK.TextAlign")));
            this.m_btnOK.Visible         = ((bool)(resources.GetObject("m_btnOK.Visible")));
            //
            // m_btnCancel
            //
            this.m_btnCancel.AccessibleDescription = ((string)(resources.GetObject("m_btnCancel.AccessibleDescription")));
            this.m_btnCancel.AccessibleName        = ((string)(resources.GetObject("m_btnCancel.AccessibleName")));
            this.m_btnCancel.Anchor          = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("m_btnCancel.Anchor")));
            this.m_btnCancel.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("m_btnCancel.BackgroundImage")));
            this.m_btnCancel.Cursor          = ((System.Windows.Forms.Cursor)(resources.GetObject("m_btnCancel.Cursor")));
            this.m_btnCancel.DialogResult    = System.Windows.Forms.DialogResult.Cancel;
            this.m_btnCancel.Dock            = ((System.Windows.Forms.DockStyle)(resources.GetObject("m_btnCancel.Dock")));
            this.m_btnCancel.Enabled         = ((bool)(resources.GetObject("m_btnCancel.Enabled")));
            this.m_btnCancel.FlatStyle       = ((System.Windows.Forms.FlatStyle)(resources.GetObject("m_btnCancel.FlatStyle")));
            this.m_btnCancel.Font            = ((System.Drawing.Font)(resources.GetObject("m_btnCancel.Font")));
            this.m_btnCancel.Image           = ((System.Drawing.Image)(resources.GetObject("m_btnCancel.Image")));
            this.m_btnCancel.ImageAlign      = ((System.Drawing.ContentAlignment)(resources.GetObject("m_btnCancel.ImageAlign")));
            this.m_btnCancel.ImageIndex      = ((int)(resources.GetObject("m_btnCancel.ImageIndex")));
            this.m_btnCancel.ImeMode         = ((System.Windows.Forms.ImeMode)(resources.GetObject("m_btnCancel.ImeMode")));
            this.m_btnCancel.Location        = ((System.Drawing.Point)(resources.GetObject("m_btnCancel.Location")));
            this.m_btnCancel.Name            = "Cancel";
            this.m_btnCancel.RightToLeft     = ((System.Windows.Forms.RightToLeft)(resources.GetObject("m_btnCancel.RightToLeft")));
            this.m_btnCancel.Size            = ((System.Drawing.Size)(resources.GetObject("m_btnCancel.Size")));
            this.m_btnCancel.TabIndex        = ((int)(resources.GetObject("m_btnCancel.TabIndex")));
            this.m_btnCancel.Text            = resources.GetString("m_btnCancel.Text");
            this.m_btnCancel.TextAlign       = ((System.Drawing.ContentAlignment)(resources.GetObject("m_btnCancel.TextAlign")));
            this.m_btnCancel.Visible         = ((bool)(resources.GetObject("m_btnCancel.Visible")));
            //
            // Win32Form2
            //
            this.AccessibleDescription = ((string)(resources.GetObject("$this.AccessibleDescription")));
            this.AccessibleName        = ((string)(resources.GetObject("$this.AccessibleName")));
            this.Anchor            = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("$this.Anchor")));
            this.AutoScaleBaseSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScaleBaseSize")));
            this.AutoScroll        = ((bool)(resources.GetObject("$this.AutoScroll")));
            this.AutoScrollMargin  = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMargin")));
            this.AutoScrollMinSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMinSize")));
            this.BackgroundImage   = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
            this.ClientSize        = ((System.Drawing.Size)(resources.GetObject("$this.ClientSize")));
            this.Controls.AddRange(new System.Windows.Forms.Control[] {
                this.m_btnCancel,
                this.m_btnOK,
                this.m_btnBrowse,
                this.m_lblBrowse,
                this.m_lvApps,
                this.m_lblChooseApp,
                this.m_lblHelp
            });
            this.Cursor        = ((System.Windows.Forms.Cursor)(resources.GetObject("$this.Cursor")));
            this.Dock          = ((System.Windows.Forms.DockStyle)(resources.GetObject("$this.Dock")));
            this.Enabled       = ((bool)(resources.GetObject("$this.Enabled")));
            this.Font          = ((System.Drawing.Font)(resources.GetObject("$this.Font")));
            this.ImeMode       = ((System.Windows.Forms.ImeMode)(resources.GetObject("$this.ImeMode")));
            this.Location      = ((System.Drawing.Point)(resources.GetObject("$this.Location")));
            this.MaximumSize   = ((System.Drawing.Size)(resources.GetObject("$this.MaximumSize")));
            this.MinimumSize   = ((System.Drawing.Size)(resources.GetObject("$this.MinimumSize")));
            this.Name          = "Win32Form2";
            this.RightToLeft   = ((System.Windows.Forms.RightToLeft)(resources.GetObject("$this.RightToLeft")));
            this.StartPosition = ((System.Windows.Forms.FormStartPosition)(resources.GetObject("$this.StartPosition")));
            this.Text          = resources.GetString("$this.Text");
            this.Visible       = ((bool)(resources.GetObject("$this.Visible")));
            this.ResumeLayout(false);
            this.MaximizeBox     = false;
            this.MinimizeBox     = false;
            this.Icon            = null;
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.CancelButton    = m_btnCancel;
            // Do some customization of controls...

            // Set up the image list for the listview
            m_ilIcons = new ImageList();

            m_lvApps.SmallImageList = m_ilIcons;
            m_lvApps.MultiSelect    = false;
            m_lvApps.View           = View.Details;

            m_btnOK.Enabled = false;
            m_lvApps.SelectedIndexChanged += new EventHandler(onAppChange);
            m_btnBrowse.Click             += new EventHandler(onBrowse);
            m_lvApps.DoubleClick          += new EventHandler(onListDoubleClick);


            // Put in the known Fusion apps
            StringCollection sc = Fusion.GetKnownFusionApps();

            if (sc != null)
            {
                for (int i = 0; i < sc.Count; i++)
                {
                    AddAppToList(sc[i], false);
                }
            }
        }// SetupControls
コード例 #15
0
        }// WizBack

        protected override int WizNext(IntPtr hwnd)
        {
            int nIndex      = GetPropPage(hwnd);
            int nReturnCode = 0;

            switch (nIndex)
            {
            // This page corresponds to the "Choose an assembly to trust" page
            case Page2Index:
                // Get our assembly to finish loading
                if (m_tAssemblyLoader != null)
                {
                    m_tAssemblyLoader.Join();
                }

                if (m_ev == null)
                {
                    // We don't have evidence yet. Let's try and get it
                    LoadAssembly();
                    // We had a problem with the load
                    if (m_ev == null)
                    {
                        // Let's see if can can figure out what failed...
                        if (File.Exists(Page2.Filename) && !Fusion.isManaged(Page2.Filename))
                        {
                            MessageBox(CResourceStore.GetString("isNotManagedCode"),
                                       CResourceStore.GetString("isNotManagedCodeTitle"),
                                       MB.ICONEXCLAMATION);
                        }

                        else
                        {
                            MessageBox(String.Format(CResourceStore.GetString("CantLoadAssembly"), Page2.Filename),
                                       CResourceStore.GetString("CantLoadAssemblyTitle"),
                                       MB.ICONEXCLAMATION);
                        }
                        nReturnCode = -1;
                        break;
                    }
                }

                X509Certificate x509 = GetCertificate();
                StrongName      sn   = GetStrongName();
                Hash            hash = GetHash();

                // Check to see if the assembly they've selected has a certificate
                if (x509 != null || sn != null)
                {
                    Page3.x509        = x509;
                    Page3.sn          = sn;
                    m_fHasCertOrSName = true;
                    break;
                }
                else
                {
                    // The assembly doesn't have a certificate or a strong name. We'll go to the
                    // page that let's them choose the permission set they want to assign
                    m_fHasCertOrSName = false;

                    // I'd like to just fall through to the next case statement, but that
                    // isn't allowed in C#. We'll need to use a goto instead
                    goto case Page3Index;
                }

            // This page corresponds to the 'how do you want to trust this assembly' when
            // the assembly has a publisher certificate
            case Page3Index:
                // Let's figure out how we can change the policy.

                // First, let's see what happens if we give this app full trust.

                // If we can't get any permissions, then this severely hampers what
                // the wizard can do. This might occur if the level of trust we can grant is
                // limited by an upper policy level. If this is the case, then we need
                // to bail
                int nLevelFromFullTrust = TryToCreateFullTrust();
                if (nLevelFromFullTrust != PermissionSetType.UNKNOWN && nLevelFromFullTrust != PermissionSetType.NONE)
                {
                    // Now, lets see if we can identify the permission set that it currently gets
                    int nCurPerm = FindCurrentPermissionSet();
                    if (nCurPerm != PermissionSetType.UNKNOWN)
                    {
                        // Go to the Slider bar page
                        Page5.MyTrustLevel  = nCurPerm;
                        Page5.MaxTrustLevel = nLevelFromFullTrust;
                        Page5.PutValuesInPage();
                        m_nPageToGetPermissionLevel = Page5Index;
                    }
                    else
                    {
                        // Go to the 'You can only assign full trust' page
                        m_nPageToGetPermissionLevel = Page4Index;
                    }
                }
                else
                {
                    // Else, we can't do anything. The app's permission level is limited by
                    // an upper policy level. Puke out now.
                    m_nPageToGetPermissionLevel = Page6Index;
                }
                // Head off to the page that will let us get a permission set to assign
                SendMessage(GetParent(hwnd), PSM.SETCURSEL, (IntPtr)m_nPageToGetPermissionLevel, (IntPtr)(-1));
                nReturnCode = -1;
                break;

            // This page is for the "You can only give this assembly full trust" page
            case Page4Index:
            // This page gives the slider and allows the user to choose the permission level
            // they want
            case Page5Index:
                // Head off to the summary page
                SendMessage(GetParent(hwnd), PSM.SETCURSEL, (IntPtr)Page7Index, (IntPtr)(-1));
                nReturnCode = -1;
                break;
            }
            int nBaseRet = base.WizNext(hwnd);

            if (nBaseRet == 0)
            {
                return(nReturnCode);
            }
            else
            {
                return(nBaseRet);
            }
        }// WizNext
コード例 #16
0
        }// AddMenuItems

        internal override void MenuCommand(int iCommandID)
        {
            if (iCommandID == COMMANDS.ADD_APPLICATION)
            {
                // Pop up a dialog so the user can find an assembly
                CChooseAppDialog cad = new CChooseAppDialog();

                System.Windows.Forms.DialogResult dr = cad.ShowDialog();
                if (dr == System.Windows.Forms.DialogResult.OK)
                {
                    String sConfigFile  = cad.Filename;
                    String sAppFilename = "";

                    // If this is an executable or Dll, or if it is managed
                    int iLen = sConfigFile.Length;
                    if (iLen > 3)
                    {
                        String sExtension = sConfigFile.Substring(sConfigFile.Length - 3).ToUpper(CultureInfo.InvariantCulture);
                        if (sExtension.ToUpper(CultureInfo.InvariantCulture).Equals("EXE") || sExtension.ToUpper(CultureInfo.InvariantCulture).Equals("DLL") || Fusion.isManaged(sConfigFile))
                        {
                            sAppFilename = sConfigFile;
                            // Let's add a config extension
                            sConfigFile = sConfigFile + ".config";
                        }
                        else if (iLen > 6)
                        {
                            // Check to see if they selected a config file
                            sExtension = sConfigFile.Substring(sConfigFile.Length - 6).ToUpper(CultureInfo.InvariantCulture);

                            if (sExtension.ToUpper(CultureInfo.InvariantCulture).Equals("CONFIG"))
                            {
                                // They've selected a config file. Let's see if there is an assembly around there as well.
                                String sAssemName = sConfigFile.Substring(0, sConfigFile.Length - 7);
                                if (File.Exists(sAssemName))
                                {
                                    sAppFilename = sAssemName;
                                }
                            }
                        }
                    }
                    AppFiles appFile = new AppFiles();
                    appFile.sAppFile       = sAppFilename;
                    appFile.sAppConfigFile = sConfigFile;

                    // Check to see if we already have this app file shown
                    CNode node = CheckForDuplicateApp(appFile);
                    if (node == null)
                    {
                        CConfigStore.SetSetting("AppConfigFiles", appFile);
                        node = new CApplication(appFile);
                        int iCookie = CNodeManager.AddNode(ref node);
                        AddChild(iCookie);
                        InsertSpecificChild(iCookie);
                    }
                    CNodeManager.Console.SelectScopeItem(node.HScopeItem);
                }
            }
            else if (iCommandID == COMMANDS.FIX_APPLICATION)
            {
                PolicyManager(CNodeManager.MMChWnd, null, null, null);
            }
        }// MenuCommand