SoundScape_2910
19th January 2005 22:43 UTC
How to prevent C:\ install
Hello,
I am trying to create an installer where the user is not allowed to install the product on C drive if he belong to a group other than "Administrator". I use the plugin UserInfo to determine that. At first, I used AllowRootDirInstall = FALSE to prevent that, but even if "C:\Program Files" is selected, nothing happens. Installer continues normally without prompting user to change directory. How can I achieve that? Is there any command or something like that I can use? Any help is much appreciated!
Gosev
19th January 2005 22:56 UTC
Re: How to prevent C:\ install
Originally posted by SoundScape_2910
Hello,
At first, I used AllowRootDirInstall = FALSE to prevent that, but even if "C:\Program Files" is selected, nothing happens. Installer continues normally without prompting user to change directory. How can I achieve that? Is there any command or something like that I can use? Any help is much appreciated!
I think AllowRootDirInstall prevents you from writing on the roots of any the hard drives, it doesn't prevent you from writing on C:
What I'd do is just do a check on the first character of the $INSTDIR string (using StrCpy to get the first char) : if that character is "C", ask the user to select another path.
Afrow UK
20th January 2005 15:06 UTC
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE "checkINSTDIR"
!insertmacro MUI_PAGE_DIRECTORY
Function checkINSTDIR
Push $R0
StrCpy $R0 $INSTDIR "" 2
StrCmp $R0 "C:" 0 NoAbort
MessageBox MB_OK|MB_ICONEXCLAMATION "Not on C: dude!"
Pop $R0
Abort
NoAbort:
Pop $R0
FunctionEnd
-Stu
rsegal
20th January 2005 17:15 UTC
Had a similar problem with a user installing our software to their desktop. When they uninstalled my script just deleted the installation directory which of course deleted everything on their desktop. Pretty funny. Well.. for me at least. Not so much for them.
SoundScape_2910
20th January 2005 22:29 UTC
Afrow UK,
MessageBox MB_OK|MB_ICONEXCLAMATION "Not on C: dude!"
LOL!!! Thanks for the code, I'll try it out.
Thanks you all, take care.
Takhir
21st January 2005 07:40 UTC
2 rsegal
.. and this is why I had to add installation folder check out and to create safe subfolder for suspicious situations in one of my programs (while we had only few such reports for 2.5 mln downloads).