I am creating an installer with a NSIS program for which to run on NTFS volumes. How can I find out that installing the path is on the volume of NTFS and work accordingly (show help / warning message)?
Using external equipment is not always a good idea (every command line tool on the home versions of windows Does not exist) It is always better to call the API directly in the system plug-in.
! LogicLib.nsh StrCpy $ 0 "c: \" System :: Call 'Kernel 32 :: GetVolumeInformation (t "$ 0", t, i $ {NSIS_MAX_STRLEN}, * i, * i, * i, t.r1 !, I $ {NSIS_MAX_STRLEN}) i.r0 '$ {if} $ 0 & lt; & Gt; 0 MessageBox mb_ok "fs = $ 1" $ {endIf}
In this situation, you should not check the file system type, but you need the actual feature (compression, encryption , Junction, sparse file etc)
! Define FILE_SUPPORTS_ENCRYPTION 0x00020000! Define FILE_READ_ONLY_VOLUME 0x00080000! FILE_VOLUME_QUOTAS 0x00000020! Macro MakeBitFlagging a Flag Bit Outworcher $ {outvar} $ {flags} & amp; $ {Bit} $ {IfThen} $ {outvar} & lt; & Gt; $ {|} Stroke $ {Overvar} "Yes" $ {|} $ {ifThen} $ {outvar} == 0 $ {|} Stackpie $ {Overvar} "No" $ {|}! Macroand Strong $ 0 "C: \" System :: Call 'Kernel32 :: GetVolumeInformation (T "$ 0", T $ iN $ {NSIS_MAX_STRLEN}, * i, * i, * i.r1, t, i $ {NSIS_MAX_STRLEN} }) I.r0 '$ {if} $ 0 & lt; & Gt; 0! Insertmacro MakeBitFlagYesNo $ 1 $ {FILE_SUPPORTS_ENCRYPTION} $ 2! Insertmacro MakeBitFlagYesNo $ 1 $ {FILE_READ_ONLY_VOLUME} $ 3! Insertmacro MakeBitFlagYesNo $ 1 $ {FILE_VOLUME_QUOTAS} $ 4 MessageBox mb_ok "Flags = $ 1 $ \ nFILE_SUPPORTS_ENCRYPTION = $ 2 $ \ nFILE_READ_ONLY_VOLUME = $ 3 $ \ nFILE_VOLUME_QUOTAS = $ 4" $ {endif}
Comments
Post a Comment