public sealed class UtilRegistry
Public NotInheritable Class UtilRegistry
Dim instance As UtilRegistry
public ref class UtilRegistry sealed
[<SealedAttribute>]
type UtilRegistry = class end
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
' ----------------
' Instance RegInfo
' ----------------
Dim regInfo As New RegInfo
With regInfo
.RootKeyName = "HKCU"
.SubKeyPath = "Subkey Path"
.ValueName = "Value Name"
.ValueType = Microsoft.Win32.RegistryValueKind.String
.ValueData = "Hello World!"
End With
Dim regInfoByte As New RegInfo(Of Byte())
With regInfoByte
.RootKeyName = "HKCU"
.SubKeyPath = "Subkey Path"
.ValueName = "Value Name"
.ValueType = Microsoft.Win32.RegistryValueKind.Binary
.ValueData = Global.System.Text.Encoding.ASCII.GetBytes("Hello World!")
End With
' ----------------
' Create SubKey
' ----------------
RegistryUtil.CreateSubKey(fullKeyPath:="HKCU\Subkey Path\")
RegistryUtil.CreateSubKey(rootKeyName:="HKCU",
subKeyPath:="Subkey Path")
RegistryUtil.CreateSubKey(regInfo:=regInfoByte)
Dim regKey1 As Microsoft.Win32.RegistryKey =
RegistryUtil.CreateSubKey(fullKeyPath:="HKCU\Subkey Path\",
registryKeyPermissionCheck:=Microsoft.Win32.RegistryKeyPermissionCheck.Default,
registryOptions:=Microsoft.Win32.RegistryOptions.None)
Dim regKey2 As Microsoft.Win32.RegistryKey =
RegistryUtil.CreateSubKey(rootKeyName:="HKCU",
subKeyPath:="Subkey Path",
registryKeyPermissionCheck:=Microsoft.Win32.RegistryKeyPermissionCheck.Default,
registryOptions:=Microsoft.Win32.RegistryOptions.None)
Dim regInfo2 As Registry.RegInfo(Of String) = RegistryUtil.CreateSubKey(Of String)(fullKeyPath:="HKCU\Subkey Path\")
Dim regInfo3 As Registry.RegInfo(Of String) = RegistryUtil.CreateSubKey(Of String)(rootKeyName:="HKCU",
subKeyPath:="Subkey Path")
' ----------------
' Create Value
' ----------------
RegistryUtil.CreateValue(fullKeyPath:="HKCU\Subkey Path\",
valueName:="Value Name",
valueData:="Value Data",
valueType:=Microsoft.Win32.RegistryValueKind.String)
RegistryUtil.CreateValue(rootKeyName:="HKCU",
subKeyPath:="Subkey Path",
valueName:="Value Name",
valueData:="Value Data",
valueType:=Microsoft.Win32.RegistryValueKind.String)
RegistryUtil.CreateValue(regInfo:=regInfoByte)
RegistryUtil.CreateValue(Of String)(fullKeyPath:="HKCU\Subkey Path\",
valueName:="Value Name",
valueData:="Value Data",
valueType:=Microsoft.Win32.RegistryValueKind.String)
RegistryUtil.CreateValue(Of String)(rootKeyName:="HKCU",
subKeyPath:="Subkey Path",
valueName:="Value Name",
valueData:="Value Data",
valueType:=Microsoft.Win32.RegistryValueKind.String)
RegistryUtil.CreateValue(Of Byte())(regInfo:=regInfoByte)
' ----------------
' Copy KeyTree
' ----------------
RegistryUtil.CopyKeyTree(srcFullKeyPath:="HKCU\Source Subkey Path\",
dstFullKeyPath:="HKCU\Target Subkey Path\")
RegistryUtil.CopyKeyTree(srcRootKeyName:="HKCU",
srcSubKeyPath:="Source Subkey Path\",
dstRootKeyName:="HKCU",
dstSubKeyPath:="Target Subkey Path\")
' ----------------
' Move KeyTree
' ----------------
RegistryUtil.MoveKeyTree(srcFullKeyPath:="HKCU\Source Subkey Path\",
dstFullKeyPath:="HKCU\Target Subkey Path\")
RegistryUtil.MoveKeyTree(srcRootKeyName:="HKCU",
srcSubKeyPath:="Source Subkey Path\",
dstRootKeyName:="HKCU",
dstSubKeyPath:="Target Subkey Path\")
' ----------------
' Copy SubKeys
' ----------------
RegistryUtil.CopySubKeys(srcFullKeyPath:="HKCU\Source Subkey Path\",
dstFullKeyPath:="HKCU\Target Subkey Path\")
RegistryUtil.CopySubKeys(srcRootKeyName:="HKCU",
srcSubKeyPath:="Source Subkey Path\",
dstRootKeyName:="HKCU",
dstSubKeyPath:="Target Subkey Path\")
' ----------------
' Move SubKeys
' ----------------
RegistryUtil.MoveSubKeys(srcFullKeyPath:="HKCU\Source Subkey Path\",
dstFullKeyPath:="HKCU\Target Subkey Path\")
RegistryUtil.MoveSubKeys(srcRootKeyName:="HKCU",
srcSubKeyPath:="Source Subkey Path\",
dstRootKeyName:="HKCU",
dstSubKeyPath:="Target Subkey Path\")
' ----------------
' Copy Value
' ----------------
Registry.CopyValue(srcFullKeyPath:="HKCU\Source Subkey Path\",
sourceValueName:="Value Name",
dstFullKeyPath:="HKCU\Target Subkey Path\",
targetValueName:="Value Name")
Registry.CopyValue(srcRootKeyName:="HKCU",
srcSubKeyPath:="Source Subkey Path\",
sourceValueName:="Value Name",
dstRootKeyName:="HKCU",
dstSubKeyPath:="Target Subkey Path\",
targetValueName:="Value Name")
' ----------------
' Move Value
' ----------------
Registry.MoveValue(srcFullKeyPath:="HKCU\Source Subkey Path\",
sourceValueName:="Value Name",
dstFullKeyPath:="HKCU\Target Subkey Path\",
targetValueName:="Value Name")
Registry.MoveValue(srcRootKeyName:="HKCU",
srcSubKeyPath:="Source Subkey Path\",
sourceValueName:="Value Name",
dstRootKeyName:="HKCU",
dstSubKeyPath:="Target Subkey Path\",
targetValueName:="Value Name")
' ----------------
' DeleteValue
' ----------------
RegistryUtil.DeleteValue(fullKeyPath:="HKCU\Subkey Path\",
valueName:="Value Name",
throwOnMissingValue:=True)
RegistryUtil.DeleteValue(rootKeyName:="HKCU",
subKeyPath:="Subkey Path",
valueName:="Value Name",
throwOnMissingValue:=True)
RegistryUtil.DeleteValue(regInfo:=regInfoByte,
throwOnMissingValue:=True)
' ----------------
' Delete SubKey
' ----------------
RegistryUtil.DeleteSubKey(fullKeyPath:="HKCU\Subkey Path\",
throwOnMissingSubKey:=False)
RegistryUtil.DeleteSubKey(rootKeyName:="HKCU",
subKeyPath:="Subkey Path",
throwOnMissingSubKey:=False)
RegistryUtil.DeleteSubKey(regInfo:=regInfoByte,
throwOnMissingSubKey:=False)
' ----------------
' Exist SubKey?
' ----------------
Dim exist1 As Boolean = RegistryUtil.ExistSubKey(fullKeyPath:="HKCU\Subkey Path\")
Dim exist2 As Boolean = RegistryUtil.ExistSubKey(rootKeyName:="HKCU",
subKeyPath:="Subkey Path")
' ----------------
' Exist Value?
' ----------------
Dim exist3 As Boolean = RegistryUtil.ExistValue(fullKeyPath:="HKCU\Subkey Path\",
valueName:="Value Name")
Dim exist4 As Boolean = RegistryUtil.ExistValue(rootKeyName:="HKCU",
subKeyPath:="Subkey Path",
valueName:="Value Name")
' ----------------
' Value Is Empty?
' ----------------
Dim isEmpty1 As Boolean = RegistryUtil.ValueIsEmpty(fullKeyPath:="HKCU\Subkey Path\",
valueName:="Value Name")
Dim isEmpty2 As Boolean = RegistryUtil.ValueIsEmpty(rootKeyName:="HKCU",
subKeyPath:="Subkey Path",
valueName:="Value Name")
' ----------------
' Export Key
' ----------------
RegistryUtil.ExportKey(fullKeyPath:="HKCU\Subkey Path\",
outputFile:="C:\Backup.reg")
RegistryUtil.ExportKey(rootKeyName:="HKCU",
subKeyPath:="Subkey Path",
outputFile:="C:\Backup.reg")
' ----------------
' Import RegFile
' ----------------
Registry.ImportRegFile(regFilePath:="C:\Backup.reg")
' ----------------
' Jump To Key
' ----------------
RegistryUtil.JumpToKey(fullKeyPath:="HKCU\Subkey Path\")
RegistryUtil.JumpToKey(rootKeyName:="HKCU",
subKeyPath:="Subkey Path")
' ----------------
' Find SubKey
' ----------------
Dim regInfoSubkeyCol As IEnumerable(Of Registry.Reginfo) =
RegistryUtil.FindSubKey(rootKeyName:="HKCU",
subKeyPath:="Subkey Path",
subKeyName:="Subkey Name",
matchFullSubKeyName:=False,
ignoreCase:=True,
searchOption:=IO.SearchOption.AllDirectories)
For Each reg As Registry.RegInfo In regInfoSubkeyCol
Debug.WriteLine(reg.RootKeyName)
Debug.WriteLine(reg.SubKeyPath)
Debug.WriteLine(reg.ValueName)
Debug.WriteLine(reg.ValueData.ToString())
Debug.WriteLine("")
Next reg
' ----------------
' Find Value
' ----------------
Dim regInfoValueNameCol As IEnumerable(Of Registry.Reginfo) =
RegistryUtil.FindValue(rootKeyName:="HKCU",
subKeyPath:="Subkey Path",
valueName:="Value Name",
matchFullValueName:=False,
ignoreCase:=True,
searchOption:=IO.SearchOption.AllDirectories)
For Each reg As Registry.RegInfo In regInfoValueNameCol
Debug.WriteLine(reg.RootKeyName)
Debug.WriteLine(reg.SubKeyPath)
Debug.WriteLine(reg.ValueName)
Debug.WriteLine(reg.ValueData.ToString())
Debug.WriteLine("")
Next reg
' ----------------
' Find Value Data
' ----------------
Dim regInfoValueDataCol As IEnumerable(Of Registry.Reginfo) =
RegistryUtil.FindValueData(rootKeyName:="HKCU",
subKeyPath:="Subkey Path",
valueData:="Value Data",
matchFullData:=False,
ignoreCase:=True,
searchOption:=IO.SearchOption.AllDirectories)
For Each reg As Registry.RegInfo In regInfoValueDataCol
Debug.WriteLine(reg.RootKeyName)
Debug.WriteLine(reg.SubKeyPath)
Debug.WriteLine(reg.ValueName)
Debug.WriteLine(reg.ValueData.ToString())
Debug.WriteLine("")
Next reg
' ----------------
' Get...
' ----------------
Dim rootKeyName As String = RegistryUtil.GetRootKeyName(registryPath:="HKCU\Subkey Path\")
Dim subKeyPath As String = RegistryUtil.GetSubKeyPath(registryPath:="HKCU\Subkey Path\")
Dim rootKey As Microsoft.Win32.RegistryKey = RegistryUtil.GetRootKey(registryPath:="HKCU\Subkey Path\")
' ----------------
' Get Value Data
' ----------------
Dim dataObject As Object = RegistryUtil.GetValueData(rootKeyName:="HKCU",
subKeyPath:="Subkey Path",
valueName:="Value Name")
Dim dataString As String = RegistryUtil.GetValueData(Of String)(fullKeyPath:="HKCU\Subkey Path\",
valueName:="Value Name",
registryValueOptions:=Microsoft.Win32.RegistryValueOptions.DoNotExpandEnvironmentNames)
Dim dataByte As Byte() = RegistryUtil.GetValueData(Of Byte())(regInfo:=regInfoByte,
registryValueOptions:=Microsoft.Win32.RegistryValueOptions.None)
Debug.WriteLine("dataByte=" & String.Join(",", dataByte))
' -----------------
Set UserAccessKey
' -----------------
Registry.SetUserAccessKey(fullKeyPath:="HKCU\Subkey Path",
userAccess:={Registry.ReginiUserAccess.AdministratorsFullAccess})
Registry.SetUserAccessKey(rootKeyName:="HKCU",
subKeyPath:="Subkey Path",
userAccess:={Registry.ReginiUserAccess.AdministratorsFullAccess,
Registry.ReginiUserAccess.CreatorFullAccess,
Registry.ReginiUserAccess.SystemFullAccess})
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
CopyKeyTree(RegistryView, String, RegistryView, String) | Copies a registry key tree to another registry path. |
CopyKeyTree(RegistryView, String, String, RegistryView, String, String) | Copies a registry key tree to another registry path. |
CopySubKeys(RegistryView, String, RegistryView, String) | Copies the sub-keys of the specified registry key. |
CopySubKeys(RegistryView, String, String, RegistryView, String, String) | Copies the sub-keys of the specified registry key. |
CopyValue(RegistryView, String, String, RegistryView, String, String) | Copies a registry value (with its data) to another subkey. |
CopyValue(RegistryView, String, String, String, RegistryView, String, String, String) | Copies a registry value (with its data) to another subkey. |
CreateSubKey(RegInfo, RegistryKeyPermissionCheck, RegistryOptions) | Creates a new registry subkey. |
CreateSubKey(RegistryView, String, RegistryKeyPermissionCheck, RegistryOptions) | Creates a new registry subkey. |
CreateSubKey(RegistryView, String, String, RegistryKeyPermissionCheck, RegistryOptions) | Creates a new registry subkey. |
CreateSubKeyT(RegInfoT, RegistryKeyPermissionCheck, RegistryOptions) | Creates a new registry subkey. |
CreateSubKeyT(RegistryView, String, RegistryKeyPermissionCheck, RegistryOptions) | Creates a new registry subkey. |
CreateSubKeyT(RegistryView, String, String, RegistryKeyPermissionCheck, RegistryOptions) | Creates a new registry subkey. |
CreateValueT(RegInfoT) | Creates or replaces a registry value. |
CreateValueT(RegistryView, String, String, T, RegistryValueKind) | Creates or replaces a registry value. |
CreateValueT(RegistryView, String, String, String, T, RegistryValueKind) | Creates or replaces a registry value. |
DeleteSubKey(RegistryView, String, Boolean) | Deletes a registry subkey. |
DeleteSubKey(RegistryView, String, String, Boolean) | Deletes a registry subkey. |
DeleteSubKeyT(RegInfoT, Boolean) | Deletes a registry subkey. |
DeleteValue(RegistryView, String, String, Boolean) | Deletes a registry subkey. |
DeleteValue(RegistryView, String, String, String, Boolean) | Deletes a registry subkey. |
DeleteValueT(RegInfoT, Boolean) | Deletes a registry subkey. |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
ExistSubKey(RegistryView, String) | Determines whether a registry subkey exists. |
ExistSubKey(RegistryView, String, String) | Determines whether a registry subkey exists. |
ExistSubKeyT(RegInfoT) | Determines whether a registry subkey exists. |
ExistValue(RegistryView, String, String) | Determines whether a registry subkey exists. |
ExistValue(RegistryView, String, String, String) | Determines whether a registry value exists. |
ExistValueT(RegInfoT) | Determines whether a registry value exists. |
ExportKey(RegistryView, String, String) | Exports a key to a registry file. |
ExportKey(RegistryView, String, String, String) | Exports a key to a registry file. |
FindSubKey(RegistryView, String, String, Boolean, Boolean, SearchOption) | Finds on a registry path all the subkey names that matches the specified criteria. |
FindSubKey(RegistryView, String, String, String, Boolean, Boolean, SearchOption) | Finds on a registry path all the subkey names that matches the specified criteria. |
FindValue(RegistryView, String, String, Boolean, Boolean, SearchOption) | Finds on a registry path all the value names that matches the specified criteria. |
FindValue(RegistryView, String, String, String, Boolean, Boolean, SearchOption) | Finds on a registry path all the value names that matches the specified criteria. |
FindValueData | Finds on a registry path all the values that contains data that matches the specified criteria. |
GetHashCode | Serves as the default hash function. (Inherited from Object) |
GetRootKey | Gets the root RegistryKey of a registry path. |
GetRootKeyName | Gets the root key name of a registry path. |
GetSubKeyPath | Gets the subkey path of a registry path. |
GetType | Gets the Type of the current instance. (Inherited from Object) |
GetValueData(RegInfo, RegistryValueOptions) | Gets the data of a registry value. |
GetValueData(RegInfo, Object, RegistryValueOptions) | Gets the data of a registry value. |
GetValueData(RegistryView, String, String, RegistryValueOptions) | Gets the data of a registry value. |
GetValueData(RegistryView, String, String, Object, RegistryValueOptions) | Gets the data of a registry value. |
GetValueData(RegistryView, String, String, String, RegistryValueOptions) | Gets the data of a registry value. |
GetValueData(RegistryView, String, String, String, Object, RegistryValueOptions) | Gets the data of a registry value. |
GetValueDataT(RegInfoT, RegistryValueOptions) | Gets the data of a registry value. |
GetValueDataT(RegInfoT, T, RegistryValueOptions) | Gets the data of a registry value. |
GetValueDataT(RegistryView, String, String, RegistryValueOptions) | Gets the data of a registry value. |
GetValueDataT(RegistryView, String, String, T, RegistryValueOptions) | Gets the data of a registry value. |
GetValueDataT(RegistryView, String, String, String, RegistryValueOptions) | Gets the data of a registry value. |
GetValueDataT(RegistryView, String, String, String, T, RegistryValueOptions) | Gets the data of a registry value. |
ImportRegFile | Imports a registry file into the current registry Hive. |
IsRegistryFile | Determines whether a file is a valid Registry script file. |
JumpToKey(RegistryView, String) | Runs Registry.exe process to jump at the specified key. |
JumpToKey(RegistryView, String, String) | Runs Regedit.exe process to jump at the specified key. |
LoadHive | Loads the subkeys of a hive file, creating a subkey with the specified name into HKEY_LOCAL_MACHINE root key. |
MoveKeyTree(RegistryView, String, RegistryView, String) | Moves a registry key tree to another registry path. |
MoveKeyTree(RegistryView, String, String, RegistryView, String, String) | Moves a registry key tree to another registry path. |
MoveSubKeys(RegistryView, String, RegistryView, String) | Moves the sub-keys of the specified registry key. |
MoveSubKeys(RegistryView, String, String, RegistryView, String, String) | Moves the sub-keys of the specified registry key. |
MoveValue(RegistryView, String, String, RegistryView, String, String) | Moves a registry value (with its data) to another subkey. |
MoveValue(RegistryView, String, String, String, RegistryView, String, String, String) | Moves a registry value (with its data) to another subkey. |
ToString | Returns a string that represents the current object. (Inherited from Object) |
UnloadHive | Unloads a previously hive file that has been loaded into HKEY_LOCAL_MACHINE root key. |
ValueIsEmpty(RegistryView, String, String) | Determines whether a registry value is empty. |
ValueIsEmpty(RegistryView, String, String, String) | Determines whether a registry value is empty. |
CanConvertTo |
Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions) |
CanConvertToT |
Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions) |
ConvertToT |
Converts an object to the specified target type.
If the conversion fails, an exception is thrown.
(Defined by ObjectExtensions) |
ConvertToT |
Converts an object to the specified target type.
If the conversion fails, returns the specified default value.
(Defined by ObjectExtensions) |
IsDisposable |
Determines whether the specified object is a disposable type
(i.e., it implements IDisposable interface).
(Defined by ObjectExtensions) |
Speak |
Speaks the string representation of the source object by using the
operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions) |
Speak |
Speaks the string representation of the source object by using the
operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions) |
ThrowIfNullTException |
Throws the specified exception if the source object is null.
(Defined by ObjectExtensions) |