|
|
楼主 |
发表于 2014-6-8 15:11:45
|
显示全部楼层
本帖最后由 sratlf 于 2014-6-8 16:44 编辑
那没什么区别吧 执行第二段命令的前提都是前一段命令为假。。。 不管是不同还是命令错误返回值都是假。。。
顺手把HWID变量也去掉了 一个tmp变量搞定
- set inipath=/boot/grub/srs/driverpack.ini
- :root_path
- if "%~1"=="" && exit
- set tmp=%~1
- cat --locatei="%tmp:~-16%" %inipath% | call :hwid_check %~1 %@retval%
- if "%tmp%"=="" && exit
- if %tmp%<=1024 && calc %tmp% > nul ! calc 1024 > nul
- call :get_[ %tmp% %@retval% || exit
- ::tmp值为最近[位置
- set /a tmp=%?% + 1 > nul
- cat --skip=%tmp% --locate="]" --number=1 %inipath% > nul || exit
- calc %?% - %tmp% > nul
- cat --skip=%tmp% --length=%@retval% %inipath% > (md)0x200+1
- cat --locate=\x2D --replace=\x2F (md)0x200+1 > nul
- cat (md)0x200+1 | set /u root=D/M/
- set tmp=
- exit
- :hwid_check
- ::tmp值为匹配ID位置
- set tmp=
- if "%~3"=="" && exit
- calc 0x%~3 + 16 > nul
- cat --skip=%@retval% --length=1 %inipath% | set tmp=
- ::不以,或"结尾则继续
- if "%tmp%"=="," || if "%tmp%">="0x22" if "%tmp%"<="0x22" || shift 3 && goto :hwid_check
- calc 0x%~3 - %~2 + 16 > nul
- cat --skip=%@retval% --length=%~2 %inipath% | set tmp=
- call Fn.15 "%~1" "%tmp%" && shift 3 && goto :hwid_check
- set /a tmp=0x%~3 - %~2 + 16 > nul
- exit
- :get_[
- ::tmp值为检测段开始位置,每次检测1kb
- if %tmp%<=%~2 && set tmp=0 ! set /a tmp=%tmp% - %~2 > nul
- cat --skip=%tmp% --length=%~2 --locate="[" %inipath% > nul && exit
- if %tmp%<=0 && exit 1
- goto :get_[
复制代码
还有dpms.bat里146行开始的
- ::读取SCSI为变量hardids
- set /u locate=%~1
- set locate=%locate:~-16%
- cat --locatei=%locate% --number=1 (8)/oem | set locate=
- if not exist locate && goto :chkpci-1
- set /a locate=0x%locate%
- cat --length=%locate% --locate=[ (8)/oem > nul
- calc %@retval% && set /a first=%?% ! goto :chkpci-1
- cat --skip=%first% --locate=] --number=1 (8)/oem > nul
- set /a len=%?%-%first%
- cat --skip=%first% --length=%len% (8)/oem | set hardids=
- set hardids=%hardids:~18%
复制代码
可以改成
- ::读取SCSI为变量hardids
- set tmp=%~1
- set tmp= && cat --locatei=%tmp:~-16% --number=1 (8)/oem > nul || goto :chkpci-1
- cat --length=%?% --locate=[ (8)/oem > nul || goto :chkpci-1
- set /a first=%?% + 1 > nul
- cat --skip=%first% --locate=] --number=1 (8)/oem > nul
- calc %?% - %first% > nul
- cat --skip=%first% --length=%@retval% (8)/oem | set hardids=
- set hardids=%hardids:~17%
复制代码 |
|