Advertisement
Java_Volume1 Registry #92260

Write to Registry with No API

Who says you cant write to the registry without API? This code is fast,smooth, and refreshes the registry instantly. This is speed at work!

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
Function SetDwordKeyValue(Hkey As String, SubKey As String, Keyname As String, Dword As String, Value As String)
Dword = "=dword:"
A$ = "REGEDIT4" & vbCrLf & "[" & Hkey & "\" & SubKey & "]" & vbCrLf & """" & Keyname & """" & Dword & Value
Open "c:\reg.reg" For Output As 1'create a 'Reg file and name it: 'Reg.reg
Print #1, A$
Close #1
ret = Shell("regedit.exe /s " & "c:\reg.reg", 0)
Kill "c:\reg.reg"
End Function
Sub DoIt(rtn As Boolean)
'Disable/Re-enable Regedit.exe
If rtn = True Then
ret = SetDwordKeyValue("HKEY_CURRENT_USER", "\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableRegistryTools", "", "00000001")
Else
ret = SetDwordKeyValue("HKEY_CURRENT_USER", "\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableRegistryTools", "", "00000000")
End If
End Sub

Private Sub Form_Load()
'Writing to the Registry with no API's! What! No joke, It can be done!
'Changing this value to True Disables Regedit.Exe & Vice Versa.
'Comments:Steve.Brigden@Usa.Net
DoIt False
End Sub
Original Comments (3)
Recovered from Wayback Machine