本文整理汇总了C#中RegistryRights类的典型用法代码示例。如果您正苦于以下问题:C# RegistryRights类的具体用法?C# RegistryRights怎么用?C# RegistryRights使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RegistryRights类属于命名空间,在下文中一共展示了RegistryRights类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: base
public RegistryAccessRule
(String identity, RegistryRights registryRights,
InheritanceFlags inheritanceFlags,
PropagationFlags propagationFlags, AccessControlType type)
: base(IdentityReference.IdentityFromName(identity),
(int)registryRights, false, inheritanceFlags,
propagationFlags, type) {}
示例2: base
public RegistryAuditRule
(String identity, RegistryRights registryRights,
InheritanceFlags inheritanceFlags,
PropagationFlags propagationFlags, AuditFlags auditFlags)
: base(IdentityReference.IdentityFromName(identity),
(int)registryRights, false, inheritanceFlags,
propagationFlags, auditFlags) {}
示例3: RegistryAccessRule
public RegistryAccessRule (IdentityReference identity,
RegistryRights registryRights,
InheritanceFlags inheritanceFlags,
PropagationFlags propagationFlags,
AccessControlType type)
: this (identity, registryRights, false, inheritanceFlags, propagationFlags, type)
{
}
示例4: RegistryAuditRule
public RegistryAuditRule (string identity,
RegistryRights registryRights,
InheritanceFlags inheritanceFlags,
PropagationFlags propagationFlags,
AuditFlags flags)
: this (new NTAccount (identity), registryRights, inheritanceFlags, propagationFlags, flags)
{
}
示例5: RegistryAccessRule
public RegistryAccessRule (IdentityReference identity,
RegistryRights registryRights,
InheritanceFlags inheritanceFlags,
PropagationFlags propagationFlags,
AccessControlType type)
// FIXME: accessMask=0 likely causes an error
: base (identity, 0, false, inheritanceFlags, propagationFlags, type)
{
this.rights = registryRights;
}
示例6: SafeRegistryHandle
public SafeRegistryHandle(RegistryHive hive, string key, RegistryRights samDesired)
: base(true)
{
IntPtr handle;
int result = UnsafeNativeMethods.RegOpenKeyEx(hive, key, 0, samDesired, out handle);
if (result != 0)
{
throw new Win32Exception(result);
}
SetHandle(handle);
}
示例7: SetUserAccess
private static void SetUserAccess(RegistryKey registryKey, IdentityReference user, RegistryRights accessType)
{
RegistrySecurity registrySecurity = registryKey.GetAccessControl();
RegistryAccessRule rule = new RegistryAccessRule(
user,
accessType,
InheritanceFlags.ContainerInherit,
PropagationFlags.None,
AccessControlType.Allow
);
registrySecurity.AddAccessRule(rule);
registryKey.SetAccessControl(registrySecurity);
}
示例8: DoesUserHaveAccess
public static bool DoesUserHaveAccess(RegistryKey registryKey, string userNameOrSID, RegistryRights accessType)
{
RegistrySecurity registrySecurity = registryKey.GetAccessControl();
foreach (RegistryAccessRule registryAccessRule in registrySecurity.GetAccessRules(true, true, typeof(NTAccount)))
{
IdentityReference sidIdentityReference = registryAccessRule.IdentityReference.Translate(typeof(SecurityIdentifier));
if (
(userNameOrSID.Equals(registryAccessRule.IdentityReference.Value, StringComparison.InvariantCultureIgnoreCase) == true
|| userNameOrSID.Equals(sidIdentityReference.Value, StringComparison.InvariantCultureIgnoreCase) == true)
&& (registryAccessRule.RegistryRights & accessType) == accessType)
return true;
}
return false;
}
示例9: OpenSubKey
public RegistryKey OpenSubKey (string name, RegistryKeyPermissionCheck permissionCheck, RegistryRights rights)
{
return OpenSubKey (name, permissionCheck == RegistryKeyPermissionCheck.ReadWriteSubTree);
}
示例10: OpenSubKey
public RegistryKey OpenSubKey (string name, RegistryKeyPermissionCheck permissionCheck, RegistryRights rights)
{
return OpenSubKey (name);
}
示例11: RegistryAccessRule
public RegistryAccessRule(String identity, RegistryRights registryRights, AccessControlType type)
: this(new NTAccount(identity), (int) registryRights, false, InheritanceFlags.None, PropagationFlags.None, type)
{
}
示例12: OpenSubKey
public RegistryKey OpenSubKey(String name, RegistryRights rights)
{
return InternalOpenSubKey(name, this.checkMode, (int)rights);
}
示例13: InternalOpenSubKeyCore
private RegistryKey InternalOpenSubKeyCore(string name, RegistryRights rights, bool throwOnPermissionFailure)
{
SafeRegistryHandle result = null;
int ret = Interop.Advapi32.RegOpenKeyEx(_hkey, name, 0, ((int)rights | (int)_regView), out result);
if (ret == 0 && !result.IsInvalid)
{
RegistryKey key = new RegistryKey(result, IsWritable((int)rights), false, _remoteKey, false, _regView);
key._keyName = _keyName + "\\" + name;
return key;
}
if (throwOnPermissionFailure)
{
if (ret == Interop.Errors.ERROR_ACCESS_DENIED || ret == Interop.Errors.ERROR_BAD_IMPERSONATION_LEVEL)
{
// We need to throw SecurityException here for compatibility reason,
// although UnauthorizedAccessException will make more sense.
ThrowHelper.ThrowSecurityException(SR.Security_RegistryPermission);
}
}
// Return null if we didn't find the key.
return null;
}
示例14: RegistryAccessRule
public RegistryAccessRule(string identity, RegistryRights registryRights, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type);
示例15: RegCreateKeyEx
static extern int RegCreateKeyEx(
SafeRegistryHandle hKey,
string lpSubKey,
int Reserved,
string lpClass,
RegistryOptions dwOptions,
RegistryRights samDesired,
IntPtr lpSecurityAttributes,
out SafeRegistryHandle phkResult,
out int lpdwDisposition);