本文整理汇总了C#中Microsoft.Win32.SafeHandles.SafeRegistryHandle类的典型用法代码示例。如果您正苦于以下问题:C# SafeRegistryHandle类的具体用法?C# SafeRegistryHandle怎么用?C# SafeRegistryHandle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SafeRegistryHandle类属于Microsoft.Win32.SafeHandles命名空间,在下文中一共展示了SafeRegistryHandle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegSetValueEx
internal static extern int RegSetValueEx(
SafeRegistryHandle hKey,
String lpValueName,
int Reserved,
RegistryValueKind dwType,
String lpData,
int cbData);
示例2: UnmapRegistryKey
static void UnmapRegistryKey(RegistryKey registryKey)
{
using (var emptyHandle = new SafeRegistryHandle(IntPtr.Zero, true))
{
Win32Api.Registry.RedirectRegistryKey(registryKey.Handle, emptyHandle);
}
}
示例3: FromHandle
public IRegistryKey FromHandle(
SafeRegistryHandle handle,
RegistryView view
)
{
return new RegistryKeyWrap(RegistryKey.FromHandle(handle, view));
}
示例4: RegQueryValueEx
internal static extern int RegQueryValueEx(
SafeRegistryHandle hKey,
String lpValueName,
int[] lpReserved,
ref int lpType,
[Out]StringBuilder lpData,
ref int lpcbData);
示例5: RegEnumKeyEx
internal unsafe static extern int RegEnumKeyEx(
SafeRegistryHandle hKey,
int dwIndex,
char* lpName,
ref int lpcbName,
int[] lpReserved,
[Out]StringBuilder lpClass,
int[] lpcbClass,
long[] lpftLastWriteTime);
示例6: RegEnumValue
internal static extern unsafe int RegEnumValue(
SafeRegistryHandle hKey,
int dwIndex,
char* lpValueName,
ref int lpcbValueName,
IntPtr lpReserved_MustBeZero,
int[] lpType,
byte[] lpData,
int[] lpcbData);
示例7: RegCreateKeyEx
internal static extern int RegCreateKeyEx(
SafeRegistryHandle hKey,
String lpSubKey,
int Reserved,
String lpClass,
int dwOptions,
int samDesired,
ref SECURITY_ATTRIBUTES secAttrs,
out SafeRegistryHandle hkResult,
out int lpdwDisposition);
示例8: RegQueryInfoKey
internal static extern int RegQueryInfoKey(
SafeRegistryHandle hKey,
[Out]StringBuilder lpClass,
int[] lpcbClass,
IntPtr lpReserved_MustBeZero,
ref int lpcSubKeys,
int[] lpcbMaxSubKeyLen,
int[] lpcbMaxClassLen,
ref int lpcValues,
int[] lpcbMaxValueNameLen,
int[] lpcbMaxValueLen,
int[] lpcbSecurityDescriptor,
int[] lpftLastWriteTime);
示例9: RegistryKey
private RegistryKey(SafeRegistryHandle hkey, bool writable, bool systemkey, bool remoteKey, bool isPerfData, RegistryView view)
{
this.hkey = hkey;
this.keyName = "";
this.remoteKey = remoteKey;
this.regView = view;
if (systemkey)
{
this.state |= 2;
}
if (writable)
{
this.state |= 4;
}
if (isPerfData)
{
this.state |= 8;
}
ValidateKeyView(view);
}
示例10: Persist
internal void Persist(SafeRegistryHandle hKey, string keyName)
{
new RegistryPermission(RegistryPermissionAccess.NoAccess, AccessControlActions.Change, keyName).Demand();
base.WriteLock();
try
{
AccessControlSections accessControlSectionsFromChanges = this.GetAccessControlSectionsFromChanges();
if (accessControlSectionsFromChanges != AccessControlSections.None)
{
bool flag;
bool flag2;
base.Persist(hKey, accessControlSectionsFromChanges);
base.AccessRulesModified = flag = false;
base.AuditRulesModified = flag2 = flag;
base.OwnerModified = base.GroupModified = flag2;
}
}
finally
{
base.WriteUnlock();
}
}
示例11: RegistryKey
/// <summary>
/// Creates a RegistryKey.
/// This key is bound to hkey, if writable is <b>false</b> then no write operations
/// will be allowed. If systemkey is set then the hkey won't be released
/// when the object is GC'ed.
/// The remoteKey flag when set to true indicates that we are dealing with registry entries
/// on a remote machine and requires the program making these calls to have full trust.
/// </summary>
private RegistryKey(SafeRegistryHandle hkey, bool writable, bool systemkey, bool remoteKey, bool isPerfData, RegistryView view)
{
ValidateKeyView(view);
_hkey = hkey;
_keyName = "";
_remoteKey = remoteKey;
_regView = view;
if (systemkey)
{
_state |= StateFlags.SystemKey;
}
if (writable)
{
_state |= StateFlags.WriteAccess;
}
if (isPerfData)
{
_state |= StateFlags.PerfData;
}
}
示例12: FromHandle
public static RegistryKey FromHandle(SafeRegistryHandle handle)
{
return FromHandle(handle, RegistryView.Default);
}
示例13: RegistryHandler
public RegistryHandler(int hKey)
{
key_found = false;
SafeRegistryHandle safeRegistryHandle = new SafeRegistryHandle(new IntPtr(hKey), true);
root_key = RegistryKey.FromHandle(safeRegistryHandle);
}
示例14: FromHandle
public RegistryKey FromHandle (SafeRegistryHandle handle)
{
// At this point we can't tell whether the key is writable
// or not (nor the name), so we let the error check code handle it later, as
// .Net seems to do.
return new RegistryKey (handle.DangerousGetHandle (), String.Empty, true);
}
示例15: RedirectRegistryKey
/// <summary>
/// Override a registry hive key to another registry key.
/// </summary>
/// <param name="key">Handle of the key to override.</param>
/// <param name="newKey">Handle to override key.</param>
internal static void RedirectRegistryKey(SafeRegistryHandle key, SafeRegistryHandle newKey)
{
if (0 != RegOverridePredefKey(key, newKey))
{
throw new Exception();
}
}