Write REG_BINARY value to registry

I am working on an application to install VNC on remote machines. To do this I need to be able to set a Binary value in the remote machine registry.

Here is my code:

Dim RemoteMachine As String
RemoteMachine = txtRemoteMachine.text

Dim MyReg As Microsoft.Win32.RegistryKey = Microsoft.Win32.RegistryKey.OpenRemoteBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RemoteMachine)
Dim oKey As RegistryKey
Dim myPassword As String

oKey = MyReg.OpenSubKey("SoftwareORLWinVNC3Default", True)
myPassword = txtPassword.Text

If IsNothing(oKey) Then
MyReg.CreateSubKey("SoftwareORLWinVNC3Default")
oKey = MyReg.OpenSubKey("SoftwareORLWinVNC3Default", True)
oKey.SetValue("AutoPortSelect", 1)
oKey.SetValue("InputsEnabled", 1)
oKey.SetValue("LocalInputsDisabled", 0)
oKey.SetValue("OnlyPollConsole", 1)
oKey.SetValue("OnlyPollOnEvent", 0)

'This is where I need to write a REG_BINARY value
oKey.SetValue("Password", myPassword)

oKey.SetValue("PollForeground", 1)
oKey.SetValue("PollFullScreen", 0)
oKey.SetValue("PollUnderCursor", 0)
oKey.SetValue("SocketConnect", 1)
End If

The password value needs to be REG_BINARY.
With this code it is entered as REG_SZ.

Can anyone help?


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories