It stores the defaultpassword in HKLM\SECURITY\Policy\Secrets\DefaultPassword.
The code works.
But my problem is when using this on a clean installation of XP.
The Administrator has no permission to write to HKLM\SECURITY\Policy\Secrets\DefaultPassword
How do i set the permission for the admin to write to this key?
(HKLM\SECURITY\Policy\Secrets\DefaultPassword)
!macro CreateLsaUnicodeString VAR STRING
StrLen ${VAR} "${STRING}"
IntOp ${VAR} ${VAR} * 2
System::Call '*(&i2 ${VAR}, &i2 ${VAR}, w `${STRING}`) i .s'
Pop ${VAR}
!macroend
# open lsa handle
System::Call '*${strLSA_OBJECT_ATTRIBUTES}(24,n,n,0,n,n).s'
Pop $R1
StrCpy $4 ${POLICY_CREATE_SECRET}
System::Call 'advapi32::LsaOpenPolicy(w n, i R1, i r4, *i .R0) i .R6'
System::Call 'advapi32::LsaNtStatusToWinError(i R6) i .R6'
!insertmacro CreateLsaUnicodeString $R2 DefaultPassword
!insertmacro CreateLsaUnicodeString $R3 $UserPassword
# create private data
System::Call 'advapi32::LsaStorePrivateData(i R0, i R2, i R3) i .R6'
System::Call 'advapi32::LsaNtStatusToWinError(i R6) i .R6'
# delete private data
System::Call 'advapi32::LsaStorePrivateData(i R0, i R2, i n) i .R6'
System::Call 'advapi32::LsaNtStatusToWinError(i R6) i .R6'
# close handle
System::Call 'advapi32::LsaClose(i R0)'