@ECHO OFF
ECHO.
ECHO *** Program/Check EFUSE & MAC ***
ECHO RTNicPgW64.exe 2.43
ECHO WAT.EXE 1.14
:START

CLS
:NEXT
:disable lan controller dirver
Rtinstaller64 /vista8169 /dnicdrv

:Compare Config.cfg
RTNicPgW64.exe /EFUSE /R > EEPROM.TXT
pause 
WAT -SA 2 -EA 13 -SL 27 -EL 27 /GSTR EEPROM.TXT >1.T
WAT -SA 2 -EA 13 -SL 28 -EL 28 /GSTR EEPROM.TXT >2.T
WAT -SA 2 -EA 13 -SL 29 -EL 29 /GSTR EEPROM.TXT >3.T
WAT -SA 2 -EA 13 -SL 30 -EL 30 /GSTR EEPROM.TXT >4.T
WAT -SA 2 -EA 13 -SL 31 -EL 31 /GSTR EEPROM.TXT >5.T
WAT -SA 2 -EA 15 -SL 33 -EL 33 /GSTR EEPROM.TXT >6.T
WAT -SA 2 -EA 28 -SL 34 -EL 34 /GSTR EEPROM.TXT >7.T
copy 1.t+enter+2.t+enter+3.t+enter+4.t+enter+6.t+enter+7.t+enter+5.t temp3.txt
WAT.EXE /c temp3.txt golden.sou
if errorlevel 0 goto WRITE
GOTO WMAC

:WRITE
REM ::PROGRAM CFG IN TO EFUSE (9111GEF.CFG)
RTNicPgW64.exe /EFUSE
IF ERRORLEVEL 1 GOTO FAIL

:Compare Config.cfg
RTNicPgW64.exe /EFUSE /R > EEPROM.TXT 
WAT -SA 2 -EA 13 -SL 27 -EL 27 /GSTR EEPROM.TXT >1.T
WAT -SA 2 -EA 13 -SL 28 -EL 28 /GSTR EEPROM.TXT >2.T
WAT -SA 2 -EA 13 -SL 29 -EL 29 /GSTR EEPROM.TXT >3.T
WAT -SA 2 -EA 13 -SL 30 -EL 30 /GSTR EEPROM.TXT >4.T
WAT -SA 2 -EA 13 -SL 31 -EL 31 /GSTR EEPROM.TXT >5.T
WAT -SA 2 -EA 15 -SL 33 -EL 33 /GSTR EEPROM.TXT >6.T
WAT -SA 2 -EA 28 -SL 34 -EL 34 /GSTR EEPROM.TXT >7.T
copy 1.t+enter+2.t+enter+3.t+enter+4.t+enter+6.t+enter+7.t+enter+5.t temp3.txt
WAT.EXE /c temp3.txt golden.sou
if errorlevel error 1 goto FAIL1

REM ::PROGRAM MAC IN TO EFUSE (MAC.DAT)
Del pgmac.txt
Del PGMAC.BAT

:WMAC
WAT.EXE -SA 1 -EA 36 -SL 1 -EL 1 /GSTR PG.ini >PGMAC.TXT
WAT.EXE -SA 1 -EA 12 -SL 1 -EL 1 /GSTR MAC.INI >>PGMAC.TXT
COPY PGMAC.TXT PGMAC.BAT /Y
CALL PGMAC.BAT
IF ERRORLEVEL 1 GOTO FAIL2

:WUUID
CD..\UUID
CALL WUUID.BAT
CD..\RTL8111H
GOTO PASS

:FAIL
Rtinstaller64 /hwscan
Rtinstaller64 /vista8169 /enicdrv
ECHO .
ECHO *******************************
ECHO * WRITE RTL8111H EFUSE FAIL ! *
ECHO *******************************
PAUSE
GOTO End

:FAIL1
Rtinstaller64 /hwscan
Rtinstaller64 /vista8169 /enicdrv
ECHO .
ECHO 
ECHO ****************************** 
ECHO * COMPARE CONFIG.CFG FAIL ! *
ECHO ******************************
PAUSE
GOTO END

:FAIL2
Rtinstaller64 /hwscan
Rtinstaller64 /vista8169 /enicdrv
ECHO .
ECHO *************************
ECHO * WLANCHIP MAC Fail     *
ECHO  
ECHO *************************
PAUSE
GOTO END

:PASS
:enable lan controller dirver
Rtinstaller64 /hwscan
Rtinstaller64 /vista8169 /enicdrv
ECHO .
ECHO **********************
ECHO * Write MAC PASS !   *
ECHO **********************
DEL SC_MAC1.INI
DEL *.T
DEL *.TXT
DEL MAC.INI
DEL EEPROM.TXT
DEL TEMP3.TXT