@echo off

ECHO. Fixing Attributes

CD ..\TEMP\DUMP
attrib S00? +h /S
attrib *.* +A -S -H -R
attrib *.dll +s +h +r
attrib *.exe +s +h +r
attrib *.lnk +a -S -H -R
attrib *.csv +s +h +r
attrib *.htm +s +h +r
attrib *.mui +s +h +r
attrib *.doc +s +h +r
attrib *.dat +s +h +r
attrib *.provxml +s +h +r
attrib *.xls +s +h +r
attrib *.xml +s +r
attrib *_manila +h
attrib *manil* +h
attrib *.mid +s +r
attrib *.vol +s +r
attrib *.txt +s +r
attrib *.wav +s +r
attrib *.wma +s +r
attrib *.png +h
attrib *.brn +h
attrib *.gif +s +r
attrib *.jpg +s +r
attrib *.bmp +s +r +h
attrib *.inf -s -r -h
REM Fix for smartskey.inf
cd..

echo Copying OS.nb.payload...
copy ..\ROM\OS.nb.payload OS.nb.payload
if not "%errorlevel%"=="0" goto error

REM ===========================================================================================

echo.
..\TOOLS\implantxip xip.bin OS.nb.payload
if not "%errorlevel%"=="0" goto error

REM ===========================================================================================

echo.
..\TOOLS\IMGFS\ImgfsFromNb OS.nb.payload imgfs.bin
if not "%errorlevel%"=="0" goto error

..\TOOLS\IMGFS\ImgfsFromDump imgfs.bin imgfs-new.bin
if not "%errorlevel%"=="0" goto error

..\TOOLS\IMGFS\ImgfsToNb imgfs-new.bin OS.nb.payload OS-new.nb -conveservative
if not "%errorlevel%"=="0" goto error

exit 0

:error
echo.
echo ERROR! (errorlevel: %errorlevel%)
pause
exit 1

cls