Exemple #1
0
        }// QueryDataObject

        //-------------------------------------------------
        // GetDisplayInfo
        //
        // This function is called by MMC whenever it needs to
        // display a node in the scope pane.
        //-------------------------------------------------
        public void GetDisplayInfo(ref SCOPEDATAITEM sdi)
        {
            // First let's find this node we want info on....
            CNode NodeWeWant = CNodeManager.GetNode((int)sdi.lParam);

            NodeWeWant.GetDisplayInfo(ref sdi);
        }// GetDisplayInfo
        }// 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
        }// GetRootCodeGroupNode

        //-------------------------------------------------
        // CreateChildren
        //
        // This function will create all the codegroup nodes
        // for this policy level
        //-------------------------------------------------
        internal override void CreateChildren()
        {
            SuperCodeGroupArrayList al;

            Security.ListifyCodeGroup(m_pl.RootCodeGroup.Copy(), null, out al);


            // Now run through all the others and put them in too
            for (int i = 0; i < al.Count; i++)
            {
                CNode parentNode;
                // If this is the root codegroup, it has a different parent
                if (i == 0)
                {
                    parentNode = this;
                }
                else
                {
                    parentNode = (CNode)(al[al[i].nParent].o);
                }

                CodeGroup cg        = al[i].cg;
                CNode     childNode = new CSingleCodeGroup(ref m_pl, ref cg, ReadOnly);
                int       iCookie   = CNodeManager.AddNode(ref childNode);
                parentNode.AddChild(iCookie);

                // Now set this codegroup's node
                al[i].o = childNode;
            }
        } // CreateChildren
Exemple #4
0
        }// RemoveSpecificChild

        protected void RemoveSpecificChildByIndex(int nIndex)
        {
            // Have this child remove all his children nodes as well
            ArrayList al = new ArrayList();

            al.Add(CNodeManager.GetNode(Child[nIndex]));
            int i = 0;

            while (i < al.Count)
            {
                // Put all this guy's children in the queue as well
                CNode node = (CNode)al[i];
                for (int j = 0; j < node.NumChildren; j++)
                {
                    al.Add(CNodeManager.GetNode(node.Child[j]));
                }
                i++;
            }

            // Start from the bottom and work our way up
            while (al.Count > 0)
            {
                CNode node = (CNode)al[al.Count - 1];
                // First, close any property pages associated with it
                node.CloseAllMyPropertyPages();

                // Inform MMC of this removal
                CNodeManager.CNamespace.DeleteItem(node.HScopeItem, 1);

                // Remove this node from the list
                CNodeManager.RemoveNode(node.Cookie);
                al.RemoveAt(al.Count - 1);
            }
        }// RemoveSpecificChildByIndex
        }// InsertPropSheetPageControls

        //-------------------------------------------------
        // PutValuesinPage
        //
        // This function put data onto the property page
        //-------------------------------------------------
        private void PutValuesinPage()
        {
            // Get info that we'll need from the node
            CNode node = CNodeManager.GetNode(m_iCookie);
            // This should be ok now, but if we need this functionality
            // off of different nodes.....
            CVersionPolicy vp = (CVersionPolicy)node;



            m_txtAssemName.Text      = m_bri.Name;
            m_txtPublicKeyToken.Text = m_bri.PublicKeyToken;

            // Figure out the current Publisher Policy Setting

            String sGetSettingString = "PublisherPolicyFor" + m_bri.Name + "," + m_bri.PublicKeyToken;

            // If we are getting this from an App config file, let's add that info
            m_sConfigFile = vp.ConfigFile;

            if (m_sConfigFile != null)
            {
                sGetSettingString += "," + m_sConfigFile;
                bool fUsePubPolicy = (bool)CConfigStore.GetSetting(sGetSettingString);
                m_chkPubPolicy.Checked = fUsePubPolicy;
            }
            // If this isn't an app config file, we don't want to show the
            // 'Apply Publisher Policy' Checkbox or description
            else
            {
                m_chkPubPolicy.Visible           = false;
                m_lblPublisherPolicyHelp.Visible = false;
            }
        }// PutValuesinPage
Exemple #6
0
        }// MenuCommand

        private CNode CheckForDuplicateApp(AppFiles af)
        {
            // Run through this node's children to see if a node with this app file exists
            int iNumChildren = NumChildren;

            for (int i = 0; i < iNumChildren; i++)
            {
                CNode node = CNodeManager.GetNode(Child[i]);
                if (node is CApplication)
                {
                    AppFiles afNode = ((CApplication)node).MyAppInfo;
                    // Check the App file's name
                    if ((af.sAppFile == null && afNode.sAppFile == null) ||
                        af.sAppFile.Equals(afNode.sAppFile))
                    {
                        // Check the App File's config file
                        if ((af.sAppConfigFile == null && afNode.sAppConfigFile == null) ||
                            af.sAppConfigFile.Equals(afNode.sAppConfigFile))
                        {
                            return(node);
                        }
                    }
                }
            }
            // We couldn't find a node with that app info
            return(null);
        }// CheckForDuplicateApp
Exemple #7
0
        }// RefreshDisplayName

        //-------------------------------------------------
        // RefreshResultView
        //
        // Our nodes will call this when they need their Result
        // view refreshed
        //-------------------------------------------------
        internal virtual void RefreshResultView()
        {
            // We'll only refresh ourselves if we're currently selected
            if (this == CNodeManager.SelectedNode)
            {
                if (m_hPropertyPageRouter != (IntPtr)(-1))
                {
                    m_fWantToRefreshResult = true;
                }
                else
                {
                    // Record who orginally had focus. If we had a property page
                    // or something that had focus first, we're going to piss people
                    // off if we hide it with MMC
                    IntPtr hOriginalActive = GetActiveWindow();
                    m_fStartResultRefresh = true;
                    CNodeManager.SelectScopeItem(HScopeItem);
                    IntPtr hFinalActive = GetActiveWindow();
                    if (hOriginalActive != hFinalActive)
                    {
                        SetActiveWindow(hOriginalActive);
                    }
                    m_fWantToRefreshResult = false;
                }
            }
        }// RefreshDisplayName
        }// QueryDataObject

        //-------------------------------------------------
        // GetResultViewType
        //
        // This function is called when MMC needs to display
        // a specific node's information in the result pane.
        //-------------------------------------------------
        public int GetResultViewType(int cookie, out IntPtr ppViewType, out uint pViewOptions)
        {
            CNode node = CNodeManager.GetNode(cookie);

            CNodeManager.DisplayedNode = node;
            node.Showing();
            // We never want the "view" menu to appear
            pViewOptions = MMC_VIEW_OPTIONS.NOLISTVIEWS | MMC_VIEW_OPTIONS.CREATENEW;

            // CNode.Result can be potientially expensive... make sure
            // we catch the result here.

            String res = node.Result;

            // We don't have a HTML (or taspad) to display, so we'll just show a
            // standard list view
            if (res == null)
            {
                ppViewType = (IntPtr)0;
                return(HRESULT.S_FALSE);
            }

            // Ok, we're displaying a HTML page or a Taskpad

            ppViewType = Marshal.StringToCoTaskMemUni(res);
            return(HRESULT.S_OK);
        }// GetResultViewType
        //-------------------------------------------------
        // 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
        }// MenuCommand

        internal override void TaskPadTaskNotify(Object arg, Object param, IConsole2 con, CData com)
        {
            // We want to browse this apps properties
            if ((int)arg == 0)
            {
                OpenMyPropertyPage();
            }

            // We want to browse the Assembly Dependencies
            else if ((int)arg == 1)
            {
                CNode node = FindChild("Assembly Dependencies");
                CNodeManager.SelectScopeItem(node.HScopeItem);
                node.MenuCommand(COMMANDS.SHOW_LISTVIEW);
            }
            // We want to Configure Assemblies
            else if ((int)arg == 2)
            {
                CNode node = FindChild("Configured Assemblies");
                CNodeManager.SelectScopeItem(node.HScopeItem);
            }
            // We want to go to remoting node
            else if ((int)arg == 3)
            {
                CNode node = FindChild("Remoting Services");
                CNodeManager.SelectScopeItem(node.HScopeItem);
                node.OpenMyPropertyPage();
            }
            else if ((int)arg == 4)
            {
                MenuCommand(COMMANDS.FIX_APPLICATION);
                // Inform our Command History that we did this
                CCommandHistory.CommandExecuted(new CDO(this), COMMANDS.FIX_APPLICATION);
            }
        }// TaskPadTaskNotify
        }// 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
Exemple #12
0
        }// TaskPadTaskNotify

        internal bool AddConfiguredAssembly(BindingRedirInfo bri)
        {
            // Let's trace through our parents looking for an Application node
            // If this node's parent is an Application node, then we know we're
            // configuring assemblies on a per app basis
            CNode node = null;

            if (ParentHScopeItem != -1)
            {
                node = CNodeManager.GetNodeByHScope(ParentHScopeItem);
            }

            String sPostFix = "";

            // If this is an application node, make sure we tell the config store
            // about it
            if (node is CApplication)
            {
                sPostFix = "," + ((CApplication)node).AppConfigFile;
            }

            if (!CConfigStore.SetSetting("ConfiguredAssemblies" + sPostFix, bri))
            {
                return(false);
            }

            // Now we'll tell out node to Refresh itself,
            // but only if we're showing the list view
            if (m_oResults == this)
            {
                RefreshResultView();
            }

            return(true);
        }// AddConfiguredAssembly
        }// 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
        }// CIntroTaskPad

        internal override void Notify(Object arg, Object param, IConsole2 con, CData com)
        {
            String sNodeToOpen = null;


            // We want to browse the shared assemblies
            if ((int)arg == 1)
            {
                sNodeToOpen = "Assembly Cache";
            }
            // We want to Configure Assemblies
            else if ((int)arg == 2)
            {
                sNodeToOpen = "Configured Assemblies";
            }
            // We want to set Security Policy
            else if ((int)arg == 3)
            {
                sNodeToOpen = "Runtime Security Policy";
            }
            // We want to go to remoting node
            else if ((int)arg == 4)
            {
                CNode node = m_myNode.FindChild("Remoting Services");
                CNodeManager.SelectScopeItem(node.HScopeItem);
                node.OpenMyPropertyPage();
            }
            // We want to go to the applications node
            else if ((int)arg == 5)
            {
                sNodeToOpen = "Applications";
            }



            // This is a CommandHistory item
            else if ((int)arg >= 100)
            {
                CCommandHistory.FireOffCommand((int)arg);
            }
            else
            {
                MessageBox(0, "Error in web page! I don't know what to do!", "", 0);
            }

            if (sNodeToOpen != null)
            {
                CNode node = m_myNode.FindChild(sNodeToOpen);
                // This node must have a shared assemblies node... if it doesn't, then the
                // node hasn't added it's children yet. We'll force it to do that, and try
                // again
                if (node == null)
                {
                    m_myNode.CreateChildren();
                    node = m_myNode.FindChild(sNodeToOpen);
                }
                CNodeManager.Console.SelectScopeItem(node.HScopeItem);
            }
        }// Notify
        }// CCodeGroups

        internal CSingleCodeGroup GetRootCodeGroupNode()
        {
            // We only have one child, and it should be the root codegroup
            int nCookie          = Child[0];
            CSingleCodeGroup sgc = (CSingleCodeGroup)CNodeManager.GetNode(nCookie);

            return(sgc);
        }// GetRootCodeGroupNode
Exemple #16
0
        }// onDoubleClick

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

            if (o is ArrayList)
            {
                sMessage = CResourceStore.GetString("CVersionPolicy:ConfirmDeleteConfig");
            }
            else
            {
                sMessage = String.Format(CResourceStore.GetString("CVersionPolicy:ConfirmDeleteSingleConfig"), ((BindingRedirInfo)o).Name);
            }

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


            if (nRes == MB.IDYES)
            {
                // Let's trace through our parents looking for an Application node
                CNode node = CNodeManager.GetNode(m_iCookie);
                // If this node's parent is an Application node, then we know we're
                // configuring assemblies on a per app basis
                int iParentHScope = node.ParentHScopeItem;
                if (iParentHScope != -1)
                {
                    node = CNodeManager.GetNodeByHScope(iParentHScope);
                }

                String sPostFix = "";
                // If this is an application node, make sure we tell the config store
                // about it
                if (node is CApplication)
                {
                    sPostFix = "," + ((CApplication)node).AppConfigFile;
                }

                if (o is ArrayList)
                {
                    ArrayList al   = (ArrayList)o;
                    int       nLen = al.Count;
                    for (int i = 0; i < nLen; i++)
                    {
                        int iResultNum = ((int)al[i]) - 1;

                        CConfigStore.SetSetting("ConfiguredAssembliesDelete" + sPostFix, ((BindingRedirInfo)m_ol[iResultNum]));
                    }
                }
                else
                {
                    CConfigStore.SetSetting("ConfiguredAssembliesDelete" + sPostFix, (BindingRedirInfo)o);
                }
                // Now we'll Refresh ourselves
                RefreshResultView();
            }
            return(HRESULT.S_OK);
        }// onDelete
        }// CanMakeChanges

        internal void SecurityPolicyChanged()
        {
            // Tell our parent node something changed
            CSecurityNode node = CNodeManager.GetNode(m_iCookie) as CSecurityNode;

            if (node != null)
            {
                node.SecurityPolicyChanged();
            }
        } // SecurityPolicyChanged
        }// CRootNode

        //-------------------------------------------------
        // CreateChildren
        //
        // This function creates the node's children, registers
        // the nodes with the node manager, and places the node's
        // cookies in it's child array
        //-------------------------------------------------
        internal override void CreateChildren()
        {
            CNode node = new CComputerNode();

            // We'll mark this as the local machine
            node.Data = 1;
            int iCookie = CNodeManager.AddNode(ref node);

            AddChild(iCookie);
        } // CreateChildren
Exemple #19
0
        }// GetColumnWidth

        //-------------------------------------------------
        // RefreshDisplayName
        //
        // Our nodes will call this when they need their display
        // name refreshed
        //-------------------------------------------------
        protected void RefreshDisplayName()
        {
            SCOPEDATAITEM sdi = new SCOPEDATAITEM();

            sdi.mask        = SDI.STR;
            sdi.displayname = (IntPtr)(-1);
            sdi.ID          = HScopeItem;

            CNodeManager.SetItem(sdi);
        }// RefreshDisplayName
Exemple #20
0
        protected void SecurityPolicyChanged()
        {
            // Let's tell our parent that security policy changed...
            CNode node = CNodeManager.GetNodeByHScope(ParentHScopeItem);

            if (node is CSecurityNode)
            {
                ((CSecurityNode)node).SecurityPolicyChanged();
            }
        } // SecurityPolicyChanged
        }// GetResultViewType

        //-------------------------------------------------
        // GetDisplayInfo
        //
        // This function is called by MMC whenever it needs to
        // display a node in the result view.
        //-------------------------------------------------
        public void GetDisplayInfo(ref RESULTDATAITEM ResultDataItem)
        {
            // The low word in the lParam contains the index of the node
            // we're interested in.

            CNode NodeWeWant = CNodeManager.GetNode((int)ResultDataItem.lParam & 0xffff);

            // We'll let the node take care of its own Result Data
            NodeWeWant.GetResultDisplayInfo(ref ResultDataItem);
        }// GetDisplayInfo
Exemple #22
0
        }// Destroy

        //-------------------------------------------------
        // QueryDataObject
        //
        // When MMC wants a data object for a specific cookie,
        // this function will be called.
        //-------------------------------------------------
        public void QueryDataObject(int cookie, uint type, out IDataObject ppDataObject)
        {
            CNode node = CNodeManager.GetNode(cookie);

            if (node == null)
            {
                node = m_rn;
            }
            ppDataObject = new CDO(node);
        }// QueryDataObject
        }// Location

        //-------------------------------------------------
        // Init
        //
        // This function is called when we're ready to use
        // the property page. We pass in the cookie of the
        // node that this property page belongs to, and we
        // should do any setup information (with the exception
        // of creating Winform controls) here.
        //-------------------------------------------------
        internal virtual void Init(int iCookie, IntPtr routerhandle)
        {
            m_iCookie = iCookie;
            // We won't cache the node, in case it changes somehow
            // during the life of the property page
            CNode node = CNodeManager.GetNode(m_iCookie);

            m_hIcon = node.IconHandle;
            m_hPropertyPageRouter = routerhandle;
        }// Init
 internal Object GetChild(int index)
 {
     if (m_scg != null)
     {
         return((CSingleCodeGroup)CNodeManager.GetNode(m_scg.Child[index]));
     }
     else
     {
         return(m_cg.Children[index]);
     }
 } // Children
        }// ApplyData

        internal void CloseSheet()
        {
            if (m_iCookie != -1)
            {
                CNodeManager.GetNode(m_iCookie).FreePropertySheetNotifyHandle();
            }

            m_iCookie = -1;
            PostMessage(GetParent(m_hWnd), WM.COMMAND, 2 /*IDCANCEL*/, 0);
            // Set focus to the sheet to make sure it goes away.
            PostMessage(GetParent(m_hWnd), WM.SETFOCUS, 0, 0);
        }// CloseSheet
Exemple #26
0
        }// InsertChildren

        internal void InsertSpecificChild(int iChild)
        {
            SCOPEDATAITEM sdi = new SCOPEDATAITEM();

            CNode nChild = CNodeManager.GetNode(iChild);

            sdi.mask = SDI.STR |
                       SDI.PARAM |
                       SDI.PARENT |
                       SDI.IMAGE |
                       SDI.OPENIMAGE |
                       SDI.CHILDREN;

            // The image index is going to be the same as the cookie value
            sdi.nImage = CResourceStore.GetIconCookie(nChild.IconHandle);
            // The open image is the same as the closed image
            sdi.nOpenImage = sdi.nImage;
            sdi.relativeID = m_iHScopeItem;
            // We set displayname to -1 to initiate a callback for the string
            // (We need to do it this way... it's an MMCism)
            sdi.displayname = (IntPtr)(-1);

            sdi.lParam = nChild.Cookie;

            // The children field is set to either 0 or 1 (if it has children or not)
            sdi.cChildren = (nChild.NumChildren == 0)?0:1;

            // Once the item has been inserted, we're given the HScopeItem value for the node
            // MMC uses this value to uniquely identify the node. We'll store it for future
            // use.
            nChild.HScopeItem = CNodeManager.InsertItem(sdi);

            // We'll also put in the parent's HScopeItem
            nChild.m_iParentHScopeItem = HScopeItem;

            // Also, we can be slick and expand this child's node too

            // We don't care about perf savings after startup... do the expansion now
            // Also, if we have a non MMC host, we're not sure how it will behave
            // if it doesn't have all the nodes. Let's force the expand if we're not
            // running under MMC
            if (m_fInitialCreationDone || CNodeManager.Console is INonMMCHost)
            {
                // Expand this child
                CNodeManager.ExpandNodeNamespace(nChild.HScopeItem);
            }
            else if (Cookie == 0)
            {
                Thread t = new Thread(new ThreadStart(nChild.LazyExpand));
                t.Start();
            }
        }// InsertSpecificChild
Exemple #27
0
        }// InsertPropSheetPageControls

        void onSavePolicyClick(Object o, EventArgs e)
        {
            CWizard wiz = (CWizard)CNodeManager.GetNode(m_iCookie);

            if (m_chkSavePolicy.Checked)
            {
                wiz.TurnOnNext(true);
            }
            else
            {
                wiz.TurnOnNext(false);
            }
        } // onSavePolicyClick
Exemple #28
0
        }// CreatePropertyPages

        internal CSinglePermissionSet AddPermissionSet(NamedPermissionSet nps)
        {
            // Run up until we come to the policy node
            CNode node = CNodeManager.GetNodeByHScope(ParentHScopeItem);

            while (!(node is CSecurityPolicy))
            {
                node = CNodeManager.GetNodeByHScope(node.ParentHScopeItem);
            }

            // Ok, we have the policy node. Let's tell it to add this permission set
            return(((CSecurityPolicy)node).AddPermissionSet(nps));
        }// AddPermissionSet
Exemple #29
0
        }// onObjectiveChange

        void onLevelChange(Object o, EventArgs e)
        {
            // Get a jump on the loading of this assembly
            if (m_tEvidence == null && m_txtFilename.Text.Length > 0)
            {
                m_tEvidence = new Thread(new ThreadStart(NewAssembly));
                m_tEvidence.Start();
            }

            CEvalAssemWizard wiz = (CEvalAssemWizard)CNodeManager.GetNode(m_iCookie);

            wiz.RestartEvaluation();
        }// onLevelChange
Exemple #30
0
        }// onBrowse

        void onObjectiveChange(Object o, EventArgs e)
        {
            // Get a jump on the loading of this assembly
            if (m_tEvidence == null && m_txtFilename.Text.Length > 0)
            {
                m_tEvidence = new Thread(new ThreadStart(NewAssembly));
                m_tEvidence.Start();
            }

            CEvalAssemWizard wiz = (CEvalAssemWizard)CNodeManager.GetNode(m_iCookie);

            wiz.NewObjectiveReceived(m_radViewPerms.Checked);
        }// onObjectiveChange