xbarns
22nd December 2008 10:41 UTC
Determine "Default User" Path
Hello all,
i am looking for a way to determine the "Default User" Path on different OS, is there by any chance a NSIS Variable for it? I looked in the Manual but didn't find anything useful.
Maybe a little explanation what i want to do:
Target is to set a default background to all users that might log on to a machine.
For this i load the Default Users ntuser.dat (C:\Documents and Settings\Default User\ntuser.dat (XP /2003) , or c:\users\default\ntuser.dat (Vista))
Make the needed changes, and done.
For this to work i need to find the "Default User" which depending on language and OS might be totally different :(
Anders
22nd December 2008 10:51 UTC
if you call SHGetFolderPath with the system plugin, you can pass -1 as the token to get the paths for the "default user" (XP and later MSDN says; http://msdn.microsoft.com/en-us/libr...81(VS.85).aspx ) on NT4/2000 you can find the path and folder name in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList , on 9x I don't know, might be in the registry or a .ini file somewhere, search around (not sure if it can change on 9x or if you even care)
xbarns
22nd December 2008 11:18 UTC
I only care for XP and later, may i ask you for an example on how to use this?
I looked at the msdn page you provided but to be honest i cannot make anything of it :)
I guess System::SHGetFolderPath "-1" will not do it.....
Anders
22nd December 2008 11:41 UTC
!define CSIDL_APPDATA 0x001a
>!define CSIDL_PROFILE 0x0028
System::Call 'shell32::SHGetFolderPath(i $HWNDPARENT,i ${CSIDL_PROFILE},i -1,i 0,t.r0)i.r1'
>DetailPrint "$1=$0"