Archive: Disable of Drive


Disable of Drive
Hello,

I would like to know one more thing. I want to know if we can disbale the drive (C: or D:) in the nullsoft Installer.

Please let me know if anybody has any idea.

Thanks in advance,

Naina


Use the .onVerifyInstDir callback...

Function .onVerifyInstDir

StrCpy $0 $INSTDIR 2
StrCmp $0 "C:" PathBad
StrCmp $0 "D:" 0 PathGood
PathBad:
Abort
PathGood:

FunctionEnd


Edit:
Or do you mean just the root dir?

In that case use this.
Function .onVerifyInstDir

StrCmp $INSTDIR "C:" PathBad
StrCmp $INSTDIR "D:" 0 PathGood
PathBad:
Abort
PathGood:

FunctionEnd


PaR

Hello,

Thanks for your quick reply. But I guess the solution that you have given is not working for my requirement.

Actually as per my requirement, Installer has to create a directory structure so that the folder always have to start from the drive itself. for example, C:\DVT and D:\DVT. User should not be allowed to install in any other folder except C:\DVT or D:\DVT, we should be able to disable other folders.

I donno if it is possible to control the user to do like that in Nullsoft Installer. Please let me know if you have any idea to solve this as early as possible.

Thanks in advance,

Naina


Hello,

Thanks for your quick reply. But I guess the solution that you have given is not working for my requirement.

Actually as per my requirement, Installer has to create a directory structure so that the folder always have to start from the drive itself. for example, C:\DVT and D:\DVT. User should not be allowed to install in any other folder except C:\DVT or D:\DVT, we should be able to disable other folders.

I donno if it is possible to control the user to do like that in Nullsoft Installer. Please let me know if you have any idea to solve this as early as possible.

Here is my code attached.

Thanks in advance,

Naina


Originally posted by Naina
Installer has to create a directory structure so that the folder always have to start from the drive itself. for example, C:\DVT and D:\DVT. User should not be allowed to install in any other folder except C:\DVT or D:\DVT, we should be able to disable other folders.
Well then maybe this will work. :)

This code should only allow istall in <drive>:\DVT folder tree. If you want to strictly allow install only in <drive>:\DVT folder just replace line 'StrCpy $0 $INSTDIR 5 1' with 'StrCpy $0 $INSTDIR "" 1' in the code.
Function .onVerifyInstDir

StrCpy $0 $INSTDIR 5 1
StrCmp $0 ":\DVT" PathGood
Abort
PathGood:

FunctionEnd


PaR

Regarding disable of drive
Hello,

Thanks for the reply. I tried with the given code. But it is disabling the "Install" button. So am not able to install. I should be able to install only with the drives C:\DVT and D:\DVT and if the folder is other than the DVT, I should be able to disable the Install button that time.

Please let me know if it is possible to do like this.

Thanks,

Naina


Are you sure you picked the right path? The install button should be grayed out unless you pick the right path--one that contains <drive>:\DVT (I tested it on my own and it seems to work fine.)