Target directory validation

Post specialized setup scripts you have created here.
namo
Posts: 26
Joined: Thu Feb 07, 2008 6:05 am

Target directory validation

Postby namo » Wed Mar 26, 2008 8:25 am

Hi,
Please help me for the validation of the target directory for local folder path( check for directory( c:,d:,e:..) is valid or not, check for non acceptable special charracters, check whether folder exists or not ) and unc path as well.

Pleae guide me, its very urgent :!:

namo
Posts: 26
Joined: Thu Feb 07, 2008 6:05 am

Postby namo » Thu Apr 03, 2008 1:37 am

Anybody???
Please help me for his problem...

ulrichard
Posts: 150
Joined: Thu Dec 27, 2007 5:45 am
Location: Switzerland
Contact:

Postby ulrichard » Tue Sep 23, 2008 1:46 am

This should give you an idea:

~InstallAware Clipboard Data~
~End~
~{33B9F172-7A49-431F-8683-1FEA9EF65D29}~
~End~
~{89A6D392-E8C3-46EA-8012-E35566F8E01D}~
~End~
~{29A1055C-44F6-4E5B-9C58-48CF551BE018}~
~GoTo Label~
~{89477EDA-0661-412F-953C-729BBE1037BE}~
~Destination Directory~
~MessageBox~
~{C510CBF3-05EE-4468-8D48-75E3A18DD1A6}~
~Please use locally maped network drive~
~Please use a destination on a network drive that is mapped to a local share. $NEWLINE$To set up all the settings correctly, the setup needs to be installed to a destination that looks the same as on all the clients. That means, you shall use the same drive mapping as on the client machines.~
~2~
~1~
~~
~If~
~{63FAA1AC-8CA0-4CFE-B222-236021D1A05C}~
~bMappedLocally~
~0~
~TRUE~
~TRUE~
~End~
~{15C295CC-E7F5-40FD-B30A-874398028918}~
~Write to Text File~
~{9535155D-02DF-4267-9E9F-45EEFF31DAF0}~
~$LOGGED$~
~Dll call CheckPermissionDll.dll->_IsMappedLocally@4($TargetDrive$) returned $bMappedLocally$~
~FALSE~
~TRUE~
~If~
~{5778A49C-0836-42B8-8C6F-D031023552BA}~
~LOGGED~
~0~
~~
~TRUE~
~Call DLL Function~
~{569C6EC2-0C88-416C-995B-D84BF9F915CA}~
~$CheckPermissionDll$,_IsMappedLocally@4,bool,bMappedLocally,"pointer to string",$TargetDrive$\\,$~
~mIDEFunc.dll\\mEXEFunc.dll~
~Set Variable~
~{59BE18A5-9D6C-4279-B6BE-31471AFCD27B}~
~bMappedLocally$MYAH$MYAH$FALSE~
~~
~Else~
~{1275B537-2C91-4473-962C-DD7CA9F8A1CC}~
~MessageBox~
~{43D6A302-A409-4210-8A3B-169AE4C28C64}~
~Internal error~
~Cannot determine if the path is correct. Please contact the adminitrator. $NEWLINE$The setup will continue, but might fail later.~
~2~
~1~
~~
~If~
~{C717912C-1C0A-45F9-821C-5FAD03B9238F}~
~CheckPermissionDll~
~0~
~~
~FALSE~
~Comment~
~{CBA86BB1-D158-44A6-B31C-232BA61D5B45}~
~The mapped network drive shall be mapped to a local share~
~End~
~{164E4A47-F2F5-47A5-A0C7-3D1E177703CE}~
~GoTo Label~
~{342A0AE8-3D8C-4D32-BC3C-19BCAA07CF3C}~
~Destination Directory~
~MessageBox~
~{2ECC0359-139F-413C-A3EA-0B65B3C4FAEA}~
~Please use maped network drive~
~Please use a destination on a mapped network drive. $NEWLINE$To set up all the settings correctly, the setup needs to be installed to a destination that looks the same as on all the clients. That means, you shall use the same drive mapping as on the client machines.~
~2~
~1~
~~
~If~
~{79CF965B-CD9A-44D6-A055-63CB11ECA4E6}~
~DriveType~
~0~
~4~
~TRUE~
~End~
~{2094FE0A-2008-4FA8-A9EB-E6E1E15BA3E1}~
~Write to Text File~
~{065C01F4-B15B-453C-BDCF-2CD986FCCB13}~
~$LOGGED$~
~Dll call kernel32->GetDriveTypeA($TargetDrive$) returned $DriveType$~
~FALSE~
~TRUE~
~If~
~{29C26222-0E3D-4E58-9BE5-0D236421EB30}~
~LOGGED~
~0~
~~
~TRUE~
~Call DLL Function~
~{EABF7832-D37D-4FD9-AB0D-CD720AD74E2D}~
~kernel32.dll,GetDriveTypeA,word,DriveType,"pointer to string",$TargetDrive$,$~
~mIDEFunc.dll\\mEXEFunc.dll~
~Set Variable~
~{AAC34522-1493-470B-94E4-97DE47F7B775}~
~DriveType$MYAH$MYAH$FALSE~
~~
~If~
~{1D39042E-41BB-4C62-9389-5B7B97ECD4EC}~
~INSTALL_TYPE~
~4~
~NETWORK~
~FALSE~
~Comment~
~{4A64EBE3-38C8-4C61-A776-FFD0AD01442B}~
~The server installation has to go onto a mapped network drive~
~End~
~{80ADDEBB-3143-499D-8890-EC05B4673062}~
~GoTo Label~
~{09CEA5AD-E9F3-4E0C-A9BC-3E07148D40E0}~
~Destination Directory~
~MessageBox~
~{D46F3F99-7BB2-42C3-A032-569D9E7C8077}~
~Subst Paths are not allowed~
~The selected target directory is on a drive that was mapped with the dos subst command. Subst'ed paths are not allowed. Please choose a regular path.~
~2~
~1~
~~
~If~
~{73578643-A6D8-4100-A7E3-7B6E8B3D9904}~
~DosTarget~
~1~
~\\??\\~
~FALSE~
~End~
~{B5056E1D-286A-40F2-8FC0-3A44954C9C31}~
~Write to Text File~
~{E9C2CEE6-411C-48C4-8F9D-8BA4A9CE76E7}~
~$LOGGED$~
~Dll call kernel32->QueryDosDeviceA($TargetDrive$, $DosTarget$, 256) returned $DllResult$~
~FALSE~
~TRUE~
~If~
~{86CC304A-E3C6-494E-8354-4F577060BDE3}~
~LOGGED~
~0~
~~
~TRUE~
~Call DLL Function~
~{8EF4D6C8-0DF7-41AA-9B26-A136A6F68159}~
~kernel32.dll,QueryDosDeviceA,"double word",DllResult,"pointer to string",$TargetDrive$,"allocated string buffer (MAX_PATH length)",$DosTarget$,"double word",256,$~
~mIDEFunc.dll\\mEXEFunc.dll~
~Set Variable~
~{6277B377-E981-4A38-BA2D-6631F6FFD02F}~
~DllResult$MYAH$MYAH$FALSE~
~~
~Set Variable~
~{CBEF8BBA-E1C6-4550-939D-98A9C3BD9784}~
~DosTarget$MYAH$MYAH$FALSE~
~~
~Comment~
~{74617001-4438-437F-B5DD-842C81920CEC}~
~The Windows installer doesn't support subst'ed paths~
~End~
~{D3AF1FC7-0A33-4C44-BC8F-2C5E367D4F2D}~
~GoTo Label~
~{94BC50D7-D9E2-43E3-8D0F-FAFF5AE59885}~
~Destination Directory~
~MessageBox~
~{1E2DEE55-0290-4410-9D9C-077D7E569C9E}~
~UNC Paths are not allowed~
~The selected target directory is in UNC (Universal Naming Convention) format. UNC Paths are not allowed. Please choose a path that starts with a drive letter.~
~2~
~1~
~~
~End~
~{142D7FA6-5E21-4E52-93BE-0A66B3830C98}~
~Write to Text File~
~{EFB1F400-6108-4633-AC60-93F9AE60495D}~
~$LOGGED$~
~The selected target directory is in UNC (Universal Naming Convention) format. UNC Paths are not allowed. Please choose a path that starts with a drive letter.~
~FALSE~
~TRUE~
~If~
~{81B980B8-7DA0-40B9-8D49-9EE1797EACED}~
~LOGGED~
~0~
~~
~TRUE~
~If~
~{D45BC652-A709-4901-A8E9-D6F0C656F7BA}~
~TargetDrive~
~0~
~\\\\~
~FALSE~
~Comment~
~{EAF1560F-BE6E-4A19-A345-ECF75861FA2B}~
~PointLine's MFC doesn't support unc paths~
~Parse String~
~{A7AAB35D-06D5-4528-A305-A434760985B2}~
~$TARGETDIR$~
~2~
~TargetDrive~
~~
~2~
~FALSE~
~FALSE~
~Set Variable~
~{8479DECD-2F06-44D9-BD48-BD4D5E117D65}~
~TargetDrive$MYAH$MYAH$FALSE~
~~
~Comment~
~{91AFAC4F-4B09-4AF7-8FA6-FBE153BEF222}~
~validate the target directory~
~End~
~{4AC4A004-6DF3-4BDB-8ACB-0CA932FBA994}~
~GoTo Label~
~{58755D0B-3F8F-48C1-95A7-B7E2DAF2535A}~
~Destination Directory~
~MessageBox~
~{A09899CC-48B2-4DF5-886A-F71566AFFB70}~
~Please select another directory~
~The Installation Directory contains twice "PointLine2D" Please check again.~
~2~
~1~
~~
~End~
~{46D613C5-46EA-499F-BE48-5257B2503063}~
~Write to Text File~
~{53D3A2C0-A0AB-48A0-ACE8-CCB46BE6D60F}~
~$LOGGED$~
~The Installation Directory contains twice "PointLine2D" Please check again.~
~FALSE~
~TRUE~
~If~
~{443B2FF0-7125-418B-A89C-5007F41C6C69}~
~LOGGED~
~0~
~~
~TRUE~
~If~
~{9C2637F7-F5D7-40A4-965C-2455AA2777A4}~
~TARGETDIR~
~3~
~PointLine20\\PointLine20~
~FALSE~
~Compiler Variable End~
~{CB8A4F83-FBD3-4E93-BE38-1E794CCE0B14}~
~End~
~{37A0BF96-311E-42E4-8E8D-3064C9F1D62C}~
~End~
~{D11455BB-AD53-4C8B-83BE-EEA50AECA200}~
~GoTo Label~
~{26B27D5A-39D2-4946-ADD5-CD61D2B45F37}~
~Destination Directory~
~MessageBox~
~{E7240085-5A0D-46B6-BD50-A3EBECBF1783}~
~Please select another directory~
~Don't install the new PointLine on top of the old PointLine.~
~2~
~1~
~~
~End~
~{AF21F8C3-547F-4F0D-9110-6CFB45362E72}~
~Write to Text File~
~{974D4096-63EA-4376-A9E2-6CD5904EE756}~
~$LOGGED$~
~Don't install the new PointLine on top of the old PointLine.~
~FALSE~
~TRUE~
~If~
~{A2097D44-3E36-4B9E-B794-E75662C2729F}~
~LOGGED~
~0~
~~
~TRUE~
~If~
~{DD4B37E0-5037-472D-9449-8F08E7539607}~
~TARGETDIR~
~0~
~$InstallShieldInstallLocation$~
~FALSE~
~If~
~{940A7BBC-1155-4437-9931-A3396B4DD4C5}~
~UPGRADEMODE~
~0~
~MINOR~
~TRUE~
~Compiler Variable If~
~{26B41296-8835-41B9-A3F3-61341B10541C}~
~PreviewOrRelease~
~0~
~Preview~
~FALSE~
~End~
~{218BAE0C-C32D-4B33-A687-199F69B3A6D8}~
~End~
~{0B4BC4C1-ADA2-4546-954F-CD27FED667C2}~
~GoTo Label~
~{8C90BA23-0944-4581-8E85-5A1EA50AB05D}~
~Main Install~
~If~
~{6CAA7662-E23C-49E8-8A8E-E8D18A19FEC9}~
~WIZARD~
~0~
~CANCEL~
~FALSE~
~Else~
~{3E4164DD-9468-42B1-B7ED-FB257188767D}~
~GoTo Label~
~{E5FD92BF-EF3F-4CC3-B627-6745BB0C197D}~
~Custom Setup~
~If~
~{8A33BDAA-9B24-4D7D-888F-C5B5AC215F14}~
~WIZARD~
~0~
~BACK~
~FALSE~
~End~
~{1F656753-9D0B-468C-A55A-587F09D163D2}~
~Display Dialog~
~{C5E347CA-B30B-4AC8-B25A-6D173FBD0E00}~
~destination~
~WIZARD~
~TRUE~
~~
~TRUE~
~FALSE~
~If~
~{15303835-579A-44A2-8342-07220B290154}~
~UPGRADEMODE~
~0~
~MINOR~
~TRUE~
~Comment~
~{4FB0933E-4F7C-43ED-B45B-64A1D18B0210}~
~The main installation directory~
~Label~
~{D292CE6E-5EBE-4B7C-84EB-685FF8CC8C7F}~
~Destination Directory~


Or in clear text format without some parameters :

label: Destination Directory
Comment: The main installation directory
if Variable UPGRADEMODE not Equals MINOR
Display Dialog: destination, wait for dialog to return (modal)
end
if Variable WIZARD Equals BACK
GoTo Label: Custom Setup
else
if Variable WIZARD Equals CANCEL
GoTo Label: Main Install
end
end
[compiler if Variable PreviewOrRelease Equals Preview]
if Variable UPGRADEMODE not Equals MINOR
if Variable TARGETDIR Equals $InstallShieldInstallLocation$
if Variable LOGGED not Equals
Write into Text File $LOGGED$ from Value Don't install the new PointLine on top of the old PointLine. (at end of file)
end
MessageBox: Please select another directory, Don't install the new PointLine on top of the old PointLine.
GoTo Label: Destination Directory
end
end
[compiler end]
if Variable TARGETDIR Contains (Ignore Case) PointLine20\\PointLine20
if Variable LOGGED not Equals
Write into Text File $LOGGED$ from Value The Installation Directory contains twice "PointLine2D" Please check again. (at end of file)
end
MessageBox: Please select another directory, The Installation Directory contains twice "PointLine2D" Please check again.
GoTo Label: Destination Directory
end
Comment: validate the target directory
Set Variable TargetDrive to
Parse String $TARGETDIR$ into Variables TargetDrive and (Split at position from start)
Comment: PointLine's MFC doesn't support unc paths
if Variable TargetDrive Equals \\\ if Variable LOGGED not Equals
Write into Text File $LOGGED$ from Value The selected target directory is in UNC (Universal Naming Convention) format. UNC Paths are not allowed. Please choose a path that starts with a drive letter. (at end of file)
end
MessageBox: UNC Paths are not allowed, The selected target directory is in UNC (Universal Naming Convention) format. UNC Paths are not allowed. Please choose a path that starts with a drive letter.
GoTo Label: Destination Directory
end
Comment: The Windows installer doesn't support subst'ed paths
Set Variable DosTarget to
Set Variable DllResult to
Call DLL Function kernel32.dll->QueryDosDeviceA (get result into variable DllResult)
if Variable LOGGED not Equals
Write into Text File $LOGGED$ from Value Dll call kernel32->QueryDosDeviceA($TargetDrive$, $DosTarget$, 256) returned $DllResult$ (at end of file)
end
if Variable DosTarget Contains \\??\ MessageBox: Subst Paths are not allowed, The selected target directory is on a drive that was mapped with the dos subst command. Subst'ed paths are not allowed. Please choose a regular path.
GoTo Label: Destination Directory
end
Comment: The server installation has to go onto a mapped network drive
if Variable INSTALL_TYPE Equals (Ignore Case) NETWORK
Set Variable DriveType to
Call DLL Function kernel32.dll->GetDriveTypeA (get result into variable DriveType)
if Variable LOGGED not Equals
Write into Text File $LOGGED$ from Value Dll call kernel32->GetDriveTypeA($TargetDrive$) returned $DriveType$ (at end of file)
end
if Variable DriveType not Equals 4
MessageBox: Please use maped network drive, Please use a destination on a mapped network drive. $NEWLINE$To set up all the settings correctly, the setup needs to be installed to a destination that looks the same as on all the clients. That means, you shall use the same drive mapping as on the client machines.
GoTo Label: Destination Directory
end
Comment: The mapped network drive shall be mapped to a local share
if Variable CheckPermissionDll Equals
MessageBox: Internal error, Cannot determine if the path is correct. Please contact the adminitrator. $NEWLINE$The setup will continue, but might fail later.
else
Set Variable bMappedLocally to
Call DLL Function $CheckPermissionDll$->_IsMappedLocally@4 (get result into variable bMappedLocally)
if Variable LOGGED not Equals
Write into Text File $LOGGED$ from Value Dll call CheckPermissionDll.dll->_IsMappedLocally@4($TargetDrive$) returned $bMappedLocally$ (at end of file)
end
if Variable bMappedLocally not Equals TRUE
MessageBox: Please use locally maped network drive, Please use a destination on a network drive that is mapped to a local share. $NEWLINE$To set up all the settings correctly, the setup needs to be installed to a destination that looks the same as on all the clients. That means, you shall use the same drive mapping as on the client machines.
GoTo Label: Destination Directory
end
end
end

ericgentry
Posts: 7
Joined: Thu May 14, 2009 6:19 pm

Another drive validation script (for good measure).

Postby ericgentry » Thu May 21, 2009 5:25 pm

I also put (what I think) is a nice drive validation script together that checks...

- TARGETDIR starts with a letter and a colon
- drive set in TARGETDIR exists
- drive is a local fixed drive
- enough free space on the drive set in TARGETDIR
- drive set in TARGETDIR is writable

Check out the attachment for the script and read the comments!

File Attached:

DriveValidation.mia.txt


Return to “Sample Scripts”

Who is online

Users browsing this forum: No registered users and 1 guest