本文整理汇总了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;
}
示例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;
}
}
示例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;
}
示例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");
}
示例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;
}
}