sage45
07-09-2003, 12:22 AM
OK, we don't have a forum for this so I thought I'd post it here and see what you guys can come up with...
Currently I am trying to find a way to load a profile on a local workstation for a local application... This application is a VB application...
In looking through the different API's I have stumbled across the various functions available in the ADVAPI32 Library... No problem if you want to open or create or edit a reg value... But I can not find a single piece of documentation that gives proper usage or examples encompassing the RegLoadKey function...
Here is what I have so far, any guidance or pointers would be most appreciated:
Option Explicit
Dim nwkey As String, nwkeypth As String, res As Long
Private Declare Function RegLoadKey Lib _
"advapi32" Alias "RegLoadKeyA" _
(ByVal hKey As Long, _
ByVal lpSubKey As String, _
ByVal lpFile As String) As Long
Private Declare Function RegUnloadKey Lib _
"advapi32" Alias "RegUnloadKeyA" _
(ByVal hKey As Long, _
ByVal lpSubKey As String) As Long
Const READ_CONTROL = &H20000
Const KEY_QUERY_VALUE = &H1
Const KEY_SET_VALUE = &H2
Const KEY_CREATE_SUB_KEY = &H4
Const KEY_ENUMERATE_SUB_KEYS = &H8
Const KEY_NOTIFY = &H10
Const SYNCHRONIZE = &H100000
Const KEY_READ = ((READ_CONTROL Or KEY_QUERY_VALUE Or _
KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) And _
(Not SYNCHRONIZE)
Const HKEY_USERS = &H80000003
Const HKEY_LOCAL_MACHINE = &H80000002
Private Sub Form_Load()
nwkey = "NTUSER"
nwkeypth = "Administrator\NTUSER.DAT" 'Im lost here dont know what to put in
res = RegLoadKey(HKEY_USERS, nwkey, nwkeypath)
If res <> 0 Then
MsgBox "Unable to load registry key."
Exit Sub
Else
MsgBox "Key loaded successfully"
End If
End Sub
I always get the error message... I never get the loaded successfully message... A quick check of the registry also shows that the key did not load...
HELP!!! :)
Thanks for any help you can provide guys...
-sage-
Currently I am trying to find a way to load a profile on a local workstation for a local application... This application is a VB application...
In looking through the different API's I have stumbled across the various functions available in the ADVAPI32 Library... No problem if you want to open or create or edit a reg value... But I can not find a single piece of documentation that gives proper usage or examples encompassing the RegLoadKey function...
Here is what I have so far, any guidance or pointers would be most appreciated:
Option Explicit
Dim nwkey As String, nwkeypth As String, res As Long
Private Declare Function RegLoadKey Lib _
"advapi32" Alias "RegLoadKeyA" _
(ByVal hKey As Long, _
ByVal lpSubKey As String, _
ByVal lpFile As String) As Long
Private Declare Function RegUnloadKey Lib _
"advapi32" Alias "RegUnloadKeyA" _
(ByVal hKey As Long, _
ByVal lpSubKey As String) As Long
Const READ_CONTROL = &H20000
Const KEY_QUERY_VALUE = &H1
Const KEY_SET_VALUE = &H2
Const KEY_CREATE_SUB_KEY = &H4
Const KEY_ENUMERATE_SUB_KEYS = &H8
Const KEY_NOTIFY = &H10
Const SYNCHRONIZE = &H100000
Const KEY_READ = ((READ_CONTROL Or KEY_QUERY_VALUE Or _
KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) And _
(Not SYNCHRONIZE)
Const HKEY_USERS = &H80000003
Const HKEY_LOCAL_MACHINE = &H80000002
Private Sub Form_Load()
nwkey = "NTUSER"
nwkeypth = "Administrator\NTUSER.DAT" 'Im lost here dont know what to put in
res = RegLoadKey(HKEY_USERS, nwkey, nwkeypath)
If res <> 0 Then
MsgBox "Unable to load registry key."
Exit Sub
Else
MsgBox "Key loaded successfully"
End If
End Sub
I always get the error message... I never get the loaded successfully message... A quick check of the registry also shows that the key did not load...
HELP!!! :)
Thanks for any help you can provide guys...
-sage-