当前位置: 首页>>代码示例>>C#>>正文


C# RegistryPermission.SetPathList方法代码示例

本文整理汇总了C#中System.Security.Permissions.RegistryPermission.SetPathList方法的典型用法代码示例。如果您正苦于以下问题:C# RegistryPermission.SetPathList方法的具体用法?C# RegistryPermission.SetPathList怎么用?C# RegistryPermission.SetPathList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Security.Permissions.RegistryPermission的用法示例。


在下文中一共展示了RegistryPermission.SetPathList方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RunSecurityDemands

        public static bool RunSecurityDemands()
        {
            FileIOPermission fPer = new FileIOPermission(PermissionState.None);
            fPer.AllLocalFiles = FileIOPermissionAccess.AllAccess;
            fPer.AllFiles = FileIOPermissionAccess.AllAccess;
            try
            {
                fPer.Demand();
            }
            catch (SecurityException s)
            {
                Common.DebugHelper.WriteLine("File IO Permission Error: {0}", s.Message);
                return false;
            }

            System.Security.Permissions.FileDialogPermission fdPer = new FileDialogPermission(FileDialogPermissionAccess.None);
            fdPer.Access = FileDialogPermissionAccess.OpenSave;
            try
            {
                fdPer.Demand();
            }
            catch (System.Security.SecurityException s)
            {
                Common.DebugHelper.WriteLine("File Dialog Persmission Error: {0}", s.Message);
                return false;
            }

            System.Security.Permissions.RegistryPermission rPer = new RegistryPermission(PermissionState.None);
            rPer.SetPathList(RegistryPermissionAccess.AllAccess, "HKEY_LOCAL_MACHINE");
            try
            {
                fPer.Demand();
            }
            catch (System.Security.SecurityException s)
            {
                Common.DebugHelper.WriteLine("Registry Access Permission Error: {0}", s.Message);
                return false;
            }

            return true;
        }
开发者ID:JoeGilkey,项目名称:RadioLog,代码行数:41,代码来源:App.xaml.cs

示例2: CreatePermission

        public override IPermission CreatePermission()
        {
            if (m_unrestricted)
            {
                return new RegistryPermission( PermissionState.Unrestricted );
            }
            else
            {
                RegistryPermission perm = new RegistryPermission(PermissionState.None);
                if (m_read != null)
                    perm.SetPathList( RegistryPermissionAccess.Read, m_read );
                if (m_write != null)
                    perm.SetPathList( RegistryPermissionAccess.Write, m_write );
                if (m_create != null)
                    perm.SetPathList( RegistryPermissionAccess.Create, m_create );
#if FEATURE_MACL
                if (m_viewAcl != null)
                    perm.SetPathList( AccessControlActions.View, m_viewAcl );
                if (m_changeAcl != null)
                    perm.SetPathList( AccessControlActions.Change, m_changeAcl );
#endif
                return perm;
            }
        }
开发者ID:destinyclown,项目名称:coreclr,代码行数:24,代码来源:PermissionAttributes.cs

示例3: Copy

		public override IPermission Copy () 
		{
			RegistryPermission rp = new RegistryPermission (_state);

			string path = GetPathList (RegistryPermissionAccess.Create);
			if (path != null)
				rp.SetPathList (RegistryPermissionAccess.Create, path);

			path = GetPathList (RegistryPermissionAccess.Read);
			if (path != null)
				rp.SetPathList (RegistryPermissionAccess.Read, path);

			path = GetPathList (RegistryPermissionAccess.Write);
			if (path != null)
				rp.SetPathList (RegistryPermissionAccess.Write, path);
			return rp;
		}
开发者ID:runefs,项目名称:Marvin,代码行数:17,代码来源:RegistryPermission.cs

示例4: SetPathList

		public void SetPathList ()
		{
			RegistryPermission ep = new RegistryPermission (PermissionState.None);
			ep.SetPathList (RegistryPermissionAccess.AllAccess, keyLocalMachine);
			// LAMESPEC NoAccess do not remove the TMP from AllAccess
			ep.SetPathList (RegistryPermissionAccess.NoAccess, keyLocalMachine);
			ep.SetPathList (RegistryPermissionAccess.Read, keyCurrentUser);
			ep.SetPathList (RegistryPermissionAccess.Write, keyCurrentUser);
			SecurityElement se = ep.ToXml ();
			Assert.AreEqual (keyCurrentUser, se.Attribute ("Read"), "SetPathList-ToXml-Read");
			Assert.AreEqual (keyCurrentUser, se.Attribute ("Write"), "SetPathList-ToXml-Write");
		}
开发者ID:RobertZenz,项目名称:mono,代码行数:12,代码来源:RegistryPermissionTest.cs

示例5: CreatePermission

 public override IPermission CreatePermission()
 {
     if (m_unrestricted)
     {
         return new RegistryPermission( PermissionState.Unrestricted );
     }
     else
     {
         RegistryPermission perm = new RegistryPermission(PermissionState.None);
         if (m_read != null)
             perm.SetPathList( RegistryPermissionAccess.Read, m_read );
         if (m_write != null)
             perm.SetPathList( RegistryPermissionAccess.Write, m_write );
         if (m_create != null)
             perm.SetPathList( RegistryPermissionAccess.Create, m_create );
         return perm;
     }
 }
开发者ID:kouvel,项目名称:coreclr,代码行数:18,代码来源:PermissionAttributes.cs


注:本文中的System.Security.Permissions.RegistryPermission.SetPathList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。