Archive: User Directory in Vista


User Directory in Vista
I have run into a problem with Vista when the unistall is run. The files in the installation directory are all removed without a problem, but Vista has decided to make copies of the data files used by the application. So after an uninstall is run and the application is reinstalled in the same location for some reason the application looks for the copies first??????? (gotta love Vista). I need to remove these files on uninstall, but they exist in the users folder structure, specifically: c:\Users\"username"\AppData\Local\VirtualStore\Program Files\MyProgram\myprogram.exe

So what I am trying to get is the Window users name so I can remove the appropiate folders.

Any help is appreciated.

Sorry for the long winded question but I thought others might be having a similar problem and I wanted it to be understood by all.

Thank you,

Mike


System::Call "advapi32::GetUserName(t.r0,*i ${NSIS_MAX_STRLEN})i"
DetailPrint "User name - $0"

If you want to write to program files you should add a manifest to your application telling vista it needs to run it as admin or save your users data in a folder where a normal user has access (Appdata or My documents etc)