+\r
+call :msg "hidden system file"\r
+echo 1 > file\r
+attrib +h +s file\r
+call :do_test\r
+\r
+call :msg "hidden, readonly, system file"\r
+echo 1 > file\r
+attrib +h +r +s file\r
+call :do_test\r
+\r
+call :msg "hidden directory"\r
+md subdir\r
+attrib +h subdir\r
+call :do_test\r
+\r
+call :msg "hidden system directory"\r
+md subdir\r
+attrib +h +s subdir\r
+call :do_test\r
+\r
+call :msg "hidden, readonly, system directory"\r
+md subdir\r
+attrib +h +r +s subdir\r
+call :do_test\r
+\r
+call :msg "readonly directory with named data stream"\r
+md subdir\r
+echo foo > subdir:ads\r
+attrib +r subdir\r
+call :do_test\r
+\r
+call :msg "encrypted file"\r
+echo "hello" > encrypted\r
+cipher /e encrypted > nul\r
+call :do_test\r
+\r
+call :msg "identical encrypted files"\r
+echo "hello" > encrypted1\r
+echo "hello" > encrypted2\r
+cipher /e encrypted1 > nul\r
+cipher /e encrypted2 > nul\r
+call :do_test\r
+\r
+call :msg "encrypted directory"\r
+md subdir\r
+cipher /e subdir > nul\r
+call :do_test\r
+\r
+call :msg "encrypted directory with encrypted file in it"\r
+md subdir\r
+echo 1 > subdir\1\r
+cipher /e subdir > nul\r
+cipher /e subdir\1 > nul\r
+call :do_test\r
+\r
+call :msg "encrypted directory with unencrypted file in it"\r
+md subdir\r
+echo 1 > subdir\1\r
+cipher /e subdir > nul\r
+cipher /d subdir\1 > nul\r
+call :do_test\r
+\r
+call :msg "encrypted root directory"\r
+cd ..\r
+cipher /e in.dir > nul\r
+cd in.dir\r
+echo "hello" > encrypted\r
+call :do_test\r
+\r
+call :msg "unencrypted file in encrypted directory in compressed directory"\r
+md 1\r
+md 1\2\r
+compact /c 1 > nul\r
+cipher /e 1\2 > nul\r
+echo hello > 1\2\file\r
+cipher /d 1\2\file > nul\r
+call :do_test\r
+\r
+call :msg "encrypted directory with alternate data streams"\r
+md subdir\r
+cipher /e subdir > nul\r
+echo ads1 > subdir:ads1\r
+echo ads2 > subdir:ads2\r
+call :do_test\r
+\r
+call :msg "hardlinked, encrypted file with alternate data streams"\r
+echo hello > file\r
+echo hello > file:ads\r
+cipher /e file > nul\r
+mklink /h link file > nul\r
+call :do_test\r
+\r
+REM Note: since object IDs must be unique per filesystem, we can't expect them\r
+REM to preserved using our testing scheme. Therefore, win32-tree-cmp doesn't\r
+REM compare them, and the below tests really just ensure the object ID code is\r
+REM run to some extent.\r
+\r
+call :msg "file with object ID"\r
+echo hello > file\r
+fsutil objectid create file > nul\r
+call :do_test\r
+\r
+call :msg "directory with object ID"\r
+md subdir\r
+fsutil objectid set f67394c12b17608e1d050d181ba8ffd2 7df80cbdf620f4c82c79b9e6799147b6 97621aff72915ade05abb96b15dea1a3 e0bda4caa9e33cfd461c92c16be9713d subdir\r
+call :do_test\r
+\r
+call :msg "sparse files"\r
+fsutil file createnew sparse 1000000 > nul\r
+fsutil sparse setflag sparse\r
+fsutil sparse setrange sparse 0 1000000\r
+\r
+fsutil file createnew mostly_sparse 1000000 > nul\r
+fsutil sparse setflag mostly_sparse\r
+fsutil sparse setrange mostly_sparse 0 1000000\r
+echo hello >> mostly_sparse\r
+type sparse >> mostly_sparse\r
+fsutil sparse setrange mostly_sparse 1000100 2000000\r
+call :do_test\r
+\r
+call :msg "sparse and compressed files"\r
+fsutil file createnew sparse 1000000 > nul\r
+fsutil sparse setflag sparse\r
+fsutil sparse setrange sparse 0 1000000\r
+compact /c sparse > nul\r
+\r
+fsutil file createnew mostly_sparse 1000000 > nul\r
+fsutil sparse setflag mostly_sparse\r
+fsutil sparse setrange mostly_sparse 0 1000000\r
+echo hello >> mostly_sparse\r
+type sparse >> mostly_sparse\r
+fsutil sparse setrange mostly_sparse 1000100 2000000\r
+compact /c mostly_sparse > nul\r
+\r
+type nul > compressed_first\r
+compact /c compressed_first > nul\r
+type sparse >> compressed_first\r
+fsutil sparse setflag compressed_first\r
+fsutil sparse setrange compressed_first 0 500000\r
+call :do_test\r
+\r
+:rpfix_tests\r
+\r
+echo Testing rpfix junction\r
+md subdir\r
+echo 1 > subdir\file\r
+mklink /j junction subdir > nul\r
+cd ..\r
+%WIMLIB_IMAGEX% capture in.dir test.wim > nul\r
+rd /s /q in.dir\r
+%WIMLIB_IMAGEX% apply test.wim out.dir > nul\r
+echo 1 > tmp1\r
+type out.dir\junction\file > tmp2\r
+fc tmp1 tmp2 > nul\r
+if %errorlevel% neq 0 goto :fail\r
+rd /s /q out.dir\r
+del tmp1 tmp2\r
+md in.dir\r
+cd in.dir\r
+\r
+echo Testing rpfix relative\r
+echo 1 > file\r
+mklink relink file > nul\r
+cd ..\r
+%WIMLIB_IMAGEX% capture in.dir test.wim > nul\r
+%WIMLIB_IMAGEX% apply test.wim out.dir > nul\r
+type out.dir\relink > out.dir\tmp\r
+if %errorlevel% neq 0 goto :fail\r
+fc in.dir\file out.dir\tmp > nul\r
+if %errorlevel% neq 0 goto :fail\r
+rd /s /q in.dir out.dir\r
+md in.dir\r
+cd in.dir\r