LsaOpenPolicy is defined here and LsaStorePrivateData can be found here!define strLSA_UNICODE_STRING '(i,i,w)i'
!define strLSA_OBJECT_ATTRIBUTES '(i,i,w,i,i,i)i'
!define POLICY_CREATE_SECRET 0x00000020L
; open the Lsa handle
System::Call '*${strLSA_OBJECT_ATTRIBUTES}(0,n,n,0,n,n).s'
Pop $R1
System::Call '*$R1${strLSA_OBJECT_ATTRIBUTES}(0,n,n,0,n,n)'
StrCpy $4 ${POLICY_CREATE_SECRET}
System::Call 'advapi32::LsaOpenPolicy(w n, i R1, i r4, *i .R0) ?e'
Pop $R6
System::Call 'advapi32::LsaNtStatusToWinError(R6) ?e'
Pop $R7
;define the key type
StrLen $1 "DefaultPassword"
IntOp $2 $1 * 2
IntOp $3 $1 + 1
IntOp $3 $3 * 2
StrCpy $4 "DefaultPassword"
StrLen $5 $2
IntOp $5 $5 * 2
StrLen $6 $3
IntOp $6 $6 * 2
System::Call '*(&i$5 r2, &i$6 r3, &w$1 r4)i.s'
Pop $R1
System::Call '*$R1(&i$5 r2, &i$6 r3, &w$1 r4)'
;define the secret to be stored
StrLen $1 "$UserPassword"
IntOp $2 $1 * 2
IntOp $3 $1 + 1
IntOp $3 $3 * 2
StrCpy $4 "$UserPassword"
StrLen $5 $2
IntOp $5 $5 * 2
StrLen $6 $3
IntOp $6 $6 * 2
System::Call '*(&i$5 r2, &i$6 r3, &w$1 r4)i.s'
Pop $R2
System::Call '*$R2(&i$5 r2, &i$6 r3, &w$1 r4)'
;store the secret
System::Call 'advapi32::LsaStorePrivateData(i R0, i R1, i R2) ?e'
Pop $R6
System::Call 'advapi32::LsaNtStatusToWinError(R6) ?e'
Pop $R7
System::Call 'advapi32::LsaClose(R0)'
Most likely it is something obvious but I can't seem to find it, and I have tried many different things ... If anyone has an insight, I would really appreciate some input 😔
Thanks,
CF