View Single Post
Old 2nd September 2009, 12:57   #4
ginglese
Junior Member
 
Join Date: Jul 2006
Posts: 42
Hello everybody,

I think I found a way (replace "pilgrim" and "postgres" by your server name and user account name):

-LookupAccountNameW retrieves SID from user name
-ConvertSidToStringSid converts SID to something like "S-1-5-21-1801674531-*********-**********-***"
-Then retrieve "ProfileImagePath" from HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList + string SID
-End by expending registry values.

code:

System::Call '*(&w${NSIS_MAX_STRLEN})i.R8'
System::Call 'advapi32::LookupAccountNameW(w "pilgrim",w "postgres",i R8,*i ${NSIS_MAX_STRLEN}, w .R1, *i ${NSIS_MAX_STRLEN}, *i .r0)i .r1'
System::Call 'advapi32::ConvertSidToStringSid(i R8,*t .R1)i .r0'

ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$R1" "ProfileImagePath"
ExpandEnvStrings $0 $0

ginglese is offline   Reply With Quote