API Reference
OfflineRegistryPolicySource
An IPolicySource implementation backed by an offline registry hive mounted temporarily under HKEY_USERS or HKEY_LOCAL_MACHINE using RegLoadKey.
Inheritance
- Object
- OfflineRegistryPolicySource
Constructors
public OfflineRegistryPolicySource(RegistryKey rootKey) #Initializes a new instance over an existing RegistryKey that represents the root of the offline hive (already mounted by the caller).
Parameters
- rootKey Microsoft.Win32.RegistryKey
Methods
public virtual Void ClearKey(String key) #VoidDeletes all values under the specified key in the offline hive.
Parameters
- key System.String
public virtual Boolean ContainsValue(String key, String value) #BooleanDetermines whether the specified value exists in the offline hive.
Parameters
- key System.String
- Registry key path.
- value System.String
- Registry value name.
Returns
True when the value exists.
public virtual Void DeleteValue(String key, String value) #VoidDeletes a value from the offline hive if present.
Parameters
- key System.String
- value System.String
public virtual Void ForgetKeyClearance(String key) #VoidStops tracking key clearance. No-op for this implementation.
Parameters
- key System.String
public virtual Void ForgetValue(String key, String value) #VoidStops tracking a value change. No-op for this implementation.
Parameters
- key System.String
- value System.String
public static OfflineRegistryPolicySource FromMachineHive(String hivePath, String mountName = null) #OfflineRegistryPolicySourceLoads a machine hive (e.g., SOFTWARE) under HKEY_LOCAL_MACHINE and exposes it as a policy source.
Parameters
- hivePath System.String
- Path to the hive file (e.g., C:\\Windows\\System32\\config\\SOFTWARE).
- mountName System.String = null
- Mount name under HKEY_LOCAL_MACHINE (e.g., "Temp_SOFTWARE").
public static OfflineRegistryPolicySource FromUserHive(String ntUserDatPath, String mountName = null) #OfflineRegistryPolicySourceLoads a user hive (NTUSER.DAT) under HKEY_USERS and exposes it as a policy source.
Parameters
- ntUserDatPath System.String
- Path to NTUSER.DAT.
- mountName System.String = null
- Mount name under HKEY_USERS (e.g., "Temp_Offline").
public virtual IReadOnlyList<String> GetSubKeyNames(String key) #IReadOnlyList<String>Gets subkey names under the specified key.
Parameters
- key System.String
public virtual Object GetValue(String key, String value) #ObjectGets a registry value from the offline hive without expanding environment variables.
Parameters
- key System.String
- Registry key path.
- value System.String
- Registry value name.
Returns
Value data or null when missing.
public virtual IReadOnlyList<String> GetValueNames(String key) #IReadOnlyList<String>Gets all value names defined under the specified key.
Parameters
- key System.String
- Registry key path.
Returns
List of value names; empty when not found.
public virtual Void SetValue(String key, String value, Object data, RegistryValueKind dataType) #VoidWrites a value to the offline hive.
Parameters
- key System.String
- Registry key path.
- value System.String
- Registry value name.
- data System.Object
- Value data.
- dataType Microsoft.Win32.RegistryValueKind
- Registry value type.
public virtual Boolean WillDeleteValue(String key, String value) #BooleanIndicates whether the specified value is scheduled for deletion. Always false for this implementation.
Parameters
- key System.String
- value System.String