I have the following folder in registry
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Defender\Exclusions\Paths
But how can I show their value name to listbox?
Here is my code:
Dim FontKey As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows Defender\Exclusions\Paths")
For Each ValueName As String In FontKey.GetValueNames()
Dim Value As Object = FontKey.GetValue(ValueName) 'Get the value (data) of the specified value name.
If Value IsNot Nothing Then 'Make sure it exists.
ListBox1.Items.Add(Value.ToString())
End If
Next
FontKey.Close()
P/s: I get this error: (Because I do not have the requisite permissions to create a new key)
System.NullReferenceException: 'Object reference not set to an instance of an object.'
FontKey was Nothing.