Prev Previous Post   Next Post Next
Old 2nd September 2009, 09:45   #1
ginglese
Junior Member
 
Join Date: Jul 2006
Posts: 42
[delete user account] remaining home directory

Hi all,

During my install I'm creating a user account (postgres). Then When uninstalling I'm using the UserMgr plugin to delete a user account.
User account is correctly deleted but the user home directory remain and the next time i install the software i have a new home directoy named postgres.%computer name%.001 ...

I made a lot of search on the web to find a way do delete this remaining directory and ended with the only solution that is to retrieve the user home directory thanks to the ProfileImagePath registry keys.

But to do so I need to retreive first the user profil SID, then go to the registry and look to ProfileImagePath keys.

here is an exemple made with win32 c# (i guess)
code:

require 'win32/security'
require 'win32/registry'

key = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\"
usr = 'some_user'

sec = Win32::Security::SID.open(usr)
key += sec.to_s

Win32::Registry::HKEY_LOCAL_MACHINE.open(key) do |reg|
puts reg['ProfileImagePath']
end



to do the same with C++ win32 code i need to use LookupAccountName then convert SID to string ...

do you have better solution ? or is nsis providing something for that ?
ginglese is offline   Reply With Quote
 
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump