What I need to do, is from the installer, place some entries into a specific user's registry settings. I tried this example I found from the web (below). It always dies with error 3 on the RegLoadUserHive.
Section User
UserMgr::CreateAccountEx "myuserA" "mypassword" "A test user created by the UserMgr plugin" "My User A" "A test user created by the UserMgr plugin" "UF_PASSWD_NOTREQD|UF_DONT_EXPIRE_PASSWD"
Pop $0
MessageBox MB_OK "CreateUser Result : $0"
UserMgr::BuiltAccountEnv "myuserA" "mypassword"
Pop $0
MessageBox MB_OK "BuiltAccountEnv Result : $0"
UserMgr::RegLoadUserHive "myuserA"
Pop $0
MessageBox MB_OK "RegLoadUserHive Result : $0"
WriteRegStr HKEY_USERS "myuserA\Software\My Company\My Software" "String Value" "dead beef"
UserMgr::RegUnLoadUserHive "myuserA"
Pop $0
MessageBox MB_OK "RegUnLoadUserHive Result : $0"
SectionEnd
UserMgr plugin question
7 posts
Digging further... even though the command returns success.. The Build Account Environment does not seem to be creating an entry in the registry HKEY_USERS either.
Does it create a user? Is there a ntuser.dat file in the profile folder?
Yes. The user is good. The Build Env return success.
If I do this stuff from the Command line with Reg load and Reg add it works, but I'd rather use nsis.
If I do this stuff from the Command line with Reg load and Reg add it works, but I'd rather use nsis.
Which Windows version is this?
I just tried this on a fresh Windows 2000 install (why not) and BuiltAccountEnv fails with error 1314 (when calling LogonUser) but RegLoadUserHive works and is able to write the value.
I guess my problem comes from https://support.microsoft.com/en-us/...ting-systems#: "The first and biggest of these restrictions is that on Windows NT and Windows 2000, the process that is calling LogonUser must have the SE_TCB_NAME privilege (in User Manager, this is the "Act as part of the Operating System" right)."
I just tried this on a fresh Windows 2000 install (why not) and BuiltAccountEnv fails with error 1314 (when calling LogonUser) but RegLoadUserHive works and is able to write the value.
I guess my problem comes from https://support.microsoft.com/en-us/...ting-systems#: "The first and biggest of these restrictions is that on Windows NT and Windows 2000, the process that is calling LogonUser must have the SE_TCB_NAME privilege (in User Manager, this is the "Act as part of the Operating System" right)."
Windows 10.
It works fine on XP for me if I add a call to UserMgr::AddToGroup:
* BuiltAccountEnv calls LogonUser+LoadUserProfile+UnloadUserProfile (This creates the profile directory and probably the ntuser.dat file but it does not load it into HKEY_USERS)
* RegLoadUserHive calls RegLoadKey after finding the path to ntuser.dat in ProfileList
If this does not work for you then perhaps you should try contacting the plug-in author for support, it was probably never tested on Windows 10.
UserMgr::CreateAccountEx "myuserA" "mypassword" "A test user created by the UserMgr plugin" "My User A" "A test user created by the UserMgr plugin" "UF_PASSWD_NOTREQD|UF_DONT_EXPIRE_PASSWD"
Pop $0
DetailPrint "CreateUser Result : $0"
UserMgr::AddToGroup "myuserA" "Users"
Pop $0
DetailPrint AddToGroup=$0
UserMgr::BuiltAccountEnv "myuserA" "mypassword"
Pop $0
DetailPrint "BuiltAccountEnv Result : $0"
UserMgr::RegLoadUserHive "myuserA"
Pop $0
DetailPrint "RegLoadUserHive Result : $0"
WriteRegStr HKEY_USERS "myuserA\Software\My Company\My Software" "String Value" "dead beef"
MessageBox mb_ok "Check in Regedit but remember to close Regedit again so the key is not held open!"
UserMgr::RegUnLoadUserHive "myuserA"
Pop $0
DetailPrint "RegUnLoadUserHive Result : $0" * CreateAccountEx calls NetUserAdd(USER_INFO_2)* BuiltAccountEnv calls LogonUser+LoadUserProfile+UnloadUserProfile (This creates the profile directory and probably the ntuser.dat file but it does not load it into HKEY_USERS)
* RegLoadUserHive calls RegLoadKey after finding the path to ntuser.dat in ProfileList
If this does not work for you then perhaps you should try contacting the plug-in author for support, it was probably never tested on Windows 10.