本文整理汇总了C#中RegistryPermissionAccess类的典型用法代码示例。如果您正苦于以下问题:C# RegistryPermissionAccess类的具体用法?C# RegistryPermissionAccess怎么用?C# RegistryPermissionAccess使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RegistryPermissionAccess类属于命名空间,在下文中一共展示了RegistryPermissionAccess类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddPathList
// Properties
// Methods
public void AddPathList (RegistryPermissionAccess access, string pathList)
{
if (pathList == null)
throw new ArgumentNullException ("pathList");
switch (access) {
case RegistryPermissionAccess.AllAccess:
AddWithUnionKey (createList, pathList);
AddWithUnionKey (readList, pathList);
AddWithUnionKey (writeList, pathList);
break;
case RegistryPermissionAccess.NoAccess:
// ??? unit tests doesn't show removal using NoAccess ???
break;
case RegistryPermissionAccess.Create:
AddWithUnionKey (createList, pathList);
break;
case RegistryPermissionAccess.Read:
AddWithUnionKey (readList, pathList);
break;
case RegistryPermissionAccess.Write:
AddWithUnionKey (writeList, pathList);
break;
default:
ThrowInvalidFlag (access, false);
break;
}
}
示例2: RegistryPermission
public RegistryPermission(RegistryPermissionAccess flag, String pathList)
{
if(pathList == null)
{
throw new ArgumentNullException("pathList");
}
if((flag & ~(RegistryPermissionAccess.AllAccess)) != 0)
{
throw new ArgumentException(_("Arg_RegistryAccess"));
}
this.state = PermissionState.None;
String[] split = EnvironmentPermission.SplitPath(pathList);
if((flag & RegistryPermissionAccess.Read) != 0)
{
readList = split;
}
if((flag & RegistryPermissionAccess.Write) != 0)
{
writeList = split;
}
if((flag & RegistryPermissionAccess.Create) != 0)
{
createList = split;
}
}
示例3: AddPathList
public void AddPathList( RegistryPermissionAccess access, AccessControlActions control, String pathList )
{
VerifyAccess( access );
if ((access & RegistryPermissionAccess.Read) != 0)
{
if (m_read == null)
m_read = new StringExpressionSet();
m_read.AddExpressions( pathList );
}
if ((access & RegistryPermissionAccess.Write) != 0)
{
if (m_write == null)
m_write = new StringExpressionSet();
m_write.AddExpressions( pathList );
}
if ((access & RegistryPermissionAccess.Create) != 0)
{
if (m_create == null)
m_create = new StringExpressionSet();
m_create.AddExpressions( pathList );
}
}
示例4: RegistryPermission
public RegistryPermission (RegistryPermissionAccess access, string pathList)
{
_state = PermissionState.None;
createList = new ArrayList ();
readList = new ArrayList ();
writeList = new ArrayList ();
AddPathList (access, pathList);
}
示例5: HavePermissionsOnKey
public static bool HavePermissionsOnKey(this RegistryPermission reg, RegistryPermissionAccess accessLevel, string key)
{
try
{
RegistryPermission r = new RegistryPermission(accessLevel, key);
r.Demand();
return true;
}
catch (SecurityException)
{
return false;
}
}
示例6: HavePermissionsOnKey
protected bool HavePermissionsOnKey(RegistryPermissionAccess accessLevel, string key)
{
try
{
RegistryPermission r = new RegistryPermission(accessLevel, key);
r.Demand();
return true;
}
catch (SecurityException)
{
return false;
}
}
示例7: SetPathList
[System.Security.SecuritySafeCritical] // auto-generated
public void SetPathList( RegistryPermissionAccess access, String pathList )
{
VerifyAccess( access );
m_unrestricted = false;
if ((access & RegistryPermissionAccess.Read) != 0)
m_read = null;
if ((access & RegistryPermissionAccess.Write) != 0)
m_write = null;
if ((access & RegistryPermissionAccess.Create) != 0)
m_create = null;
AddPathList( access, pathList );
}
示例8: GetSubTreeReadWritePermission
private void GetSubTreeReadWritePermission(string subkeyName, out RegistryPermissionAccess access, out string path) {
access = RegistryPermissionAccess.Write | RegistryPermissionAccess.Read;
path = keyName + "\\" + subkeyName;
}
示例9: GetSubKeyWritePermission
private void GetSubKeyWritePermission(string subkeyName, out RegistryPermissionAccess access, out string path) {
// If we want to open a subkey of a read-only key as writeable, we need to do the check.
access = RegistryPermissionAccess.Write;
path = keyName + "\\" + subkeyName + "\\.";
}
示例10: GetSubKeyCreatePermission
private void GetSubKeyCreatePermission(string subkeyName, out RegistryPermissionAccess access, out string path) {
access = RegistryPermissionAccess.Create;
path = keyName + "\\" + subkeyName + "\\.";
}
示例11: GetPathList
public String GetPathList( RegistryPermissionAccess access )
{
// SafeCritical: these are registry paths, which means we're not leaking file system information here
VerifyAccess( access );
ExclusiveAccess( access );
if ((access & RegistryPermissionAccess.Read) != 0)
{
if (m_read == null)
{
return "";
}
return m_read.UnsafeToString();
}
if ((access & RegistryPermissionAccess.Write) != 0)
{
if (m_write == null)
{
return "";
}
return m_write.UnsafeToString();
}
if ((access & RegistryPermissionAccess.Create) != 0)
{
if (m_create == null)
{
return "";
}
return m_create.UnsafeToString();
}
/* not reached */
return "";
}
示例12: RegistryPermission
public RegistryPermission (RegistryPermissionAccess access, string pathList) {
return default(RegistryPermission);
}
示例13: GetPathList
public string GetPathList(RegistryPermissionAccess access)
{
return default(string);
}
示例14: GetPathList
public String GetPathList( RegistryPermissionAccess access )
{
VerifyAccess( access );
ExclusiveAccess( access );
if ((access & RegistryPermissionAccess.Read) != 0)
{
if (m_read == null)
{
return "";
}
return m_read.ToString();
}
if ((access & RegistryPermissionAccess.Write) != 0)
{
if (m_write == null)
{
return "";
}
return m_write.ToString();
}
if ((access & RegistryPermissionAccess.Create) != 0)
{
if (m_create == null)
{
return "";
}
return m_create.ToString();
}
/* not reached */
return "";
}
示例15: AddPathList
[System.Security.SecuritySafeCritical] // auto-generated
public void AddPathList( RegistryPermissionAccess access, String pathList )
{
AddPathList( access, AccessControlActions.None, pathList );
}