Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
7.4 KiB

  1. @echo OFF
  2. SETLOCAL ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
  3. REM ---- read the arguments --------------------------------------------------------------
  4. set BVTDRIVE=%SYSTEMDRIVE%
  5. set BVTDOMAIN=ntdev
  6. set BVTUSER=winbld
  7. set BVTPASSWORD=*********
  8. set /p BVTDRIVE="Enter the drive letter with colon (%BVTDRIVE%) "
  9. set /p BVTUSER="Enter the user name for perform BVT (%BVTUSER%) "
  10. set /p BVTDOMAIN="Enter the domain to join in order run BVT (%BVTDOMAIN%) "
  11. set /p BVTPASSWORD="Enter the BVT user's password (%BVTPASSWORD%) "
  12. REM ---- check user input ----------------------------------------------------------------
  13. IF "%BVTUSER%" == "" GOTO :EOF
  14. IF "%BVTDRIVE%" == "" GOTO :EOF
  15. IF "%BVTDOMAIN%" == "" GOTO :EOF
  16. IF "%BVTPASSWORD%" == "" GOTO :EOF
  17. IF "%BVTPASSWORD%" == "*********" GOTO :EOF
  18. REM ---- perform administrator's actions if necessary -------------------------------------
  19. SET _WRONG_USER=
  20. SET ADMINUSR=ADMINISTRATOR
  21. SET ADMINGRP=%ADMINUSR:~0,9%
  22. REM SET ADMINUSR=SERGUEIK
  23. for /F "tokens=2 delims==" %%i in ('set username') do (
  24. set n=%%i
  25. if /I "!n!"=="%ADMINUSR%" call :admincommands
  26. )
  27. DEL /q %BVTDRIVE%\TOOLS\ETC\*.*
  28. IF "%_WRONG_USER%"=="1" GOTO :resetlogon
  29. CALL %BVTDRIVE%\TOOLS\ETC\MYRUNBVT.CMD
  30. goto :EOF
  31. :resetlogon
  32. CALL :ADD_INF %BVTDRIVE%\TOOLS\ETC\ADD.INF MYRUNBVT.CMD %BVTDRIVE%\TOOLS\ETC
  33. CALL :CLN_INF %BVTDRIVE%\TOOLS\ETC\CLN.INF
  34. CALL :MYRUNBVT %BVTDRIVE%\TOOLS\ETC\MYRUNBVT.CMD CLN.INF
  35. %SystemRoot%\system32\rundll32.exe setupapi.dll InstallHinfSection DefaultInstall 132 %BVTDRIVE%\TOOLS\ETC\ADD.INF
  36. CALL :INIT6
  37. REM NEVER HERE
  38. REM --------------------------------------------------------------------------------------
  39. :ADD_INF
  40. ECHO [Version] >>%1
  41. ECHO Signature=$CHICAGO$ >>%1
  42. ECHO. >>%1
  43. ECHO [DefaultInstall] >>%1
  44. ECHO CopyFiles=BVT.CopyFiles >>%1
  45. ECHO AddReg=BVT.AddReg >>%1
  46. ECHO. >>%1
  47. ECHO [BVT.AddReg] >>%1
  48. ECHO HKLM,^%%WINLOGON^%%,DefaultDomainName,^%%REG_SZ^%%,^%%BVTDOMAIN^%% >>%1
  49. ECHO HKLM,^%%WINLOGON^%%,DefaultUserName,^%%REG_SZ^%%,^%%BVTUSER^%% >>%1
  50. ECHO HKLM,^%%WINLOGON^%%,DefaultPassword,^%%REG_SZ^%%,^%%BVTPASSWORD^%% >>%1
  51. ECHO HKLM,^%%WINLOGON^%%,AutoAdminLogon,^%%REG_SZ^%%,1 >>%1
  52. ECHO HKLM,^%%WINLOGON^%%,ForceAutoLogon,^%%REG_SZ^%%,1 >>%1
  53. ECHO HKLM,^%%WINLOGON^%%,passwordexpirywarning,^%%REG_DWORD^%%,0 >>%1
  54. ECHO. >>%1
  55. ECHO [BVT.CopyFiles] >>%1
  56. ECHO %2 >>%1
  57. ECHO. >>%1
  58. ECHO [DestinationDirs] >>%1
  59. ECHO BVT.CopyFiles=16408 >>%1
  60. ECHO ; /Documents And Settings/Start Menu/Programs/Startup >>%1
  61. ECHO. >>%1
  62. ECHO [Strings] >>%1
  63. ECHO. >>%1
  64. ECHO REG_SZ="0" >>%1
  65. ECHO REG_DWORD="0x10001" >>%1
  66. ECHO. >>%1
  67. ECHO WINLOGON="SOFTWARE\Microsoft\WINDOWS NT\CurrentVersion\Winlogon" >>%1
  68. ECHO RUNONCE="SOFTWARE\\Microsoft\\WINDOWS\\CurrentVersion\\RunOnce" >>%1
  69. ECHO. >>%1
  70. ECHO BVTDOMAIN="%BVTDOMAIN%" >>%1
  71. ECHO BVTUSER="%BVTUSER%" >>%1
  72. ECHO BVTPASSWORD="%BVTPASSWORD%" >>%1
  73. ECHO. >>%1
  74. GOTO :EOF
  75. REM --------------------------------------------------------------------------------------
  76. :CLN_INF
  77. ECHO [Version] >>%1
  78. ECHO Signature=$CHICAGO$ >>%1
  79. ECHO. >>%1
  80. ECHO [DefaultInstall] >>%1
  81. ECHO DelReg=BVT.DelReg >>%1
  82. ECHO AddReg=BVT.AddReg >>%1
  83. ECHO. >>%1
  84. ECHO [BVT.DelReg] >>%1
  85. ECHO HKLM,^%%WINLOGON^%%,DefaultDomainName >>%1
  86. ECHO HKLM,^%%WINLOGON^%%,DefaultUserName >>%1
  87. ECHO HKLM,^%%WINLOGON^%%,DefaultPassword >>%1
  88. ECHO HKLM,^%%WINLOGON^%%,AutoAdminLogon >>%1
  89. ECHO HKLM,^%%WINLOGON^%%,ForceAutoLogon >>%1
  90. ECHO. >>%1
  91. ECHO [BVT.AddReg] >>%1
  92. ECHO HKLM,^%%WINLOGON^%%,DefaultDomainName,^%%REG_SZ^%%,"%COMPUTERNAME%" >>%1
  93. ECHO HKLM,^%%WINLOGON^%%,DefaultUserName,^%%REG_SZ^%%,"ADMINISTRATOR" >>%1
  94. ECHO HKLM,^%%WINLOGON^%%,ForceAutoLogon,^%%REG_SZ^%%,1 >>%1
  95. ECHO. >>%1
  96. ECHO [Strings] >>%1
  97. ECHO. >>%1
  98. ECHO REG_SZ="0" >>%1
  99. ECHO REG_DWORD="0x10001" >>%1
  100. ECHO WINLOGON="SOFTWARE\Microsoft\WINDOWS NT\CurrentVersion\Winlogon" >>%1
  101. ECHO. >>%1
  102. GOTO :EOF
  103. REM --------------------------------------------------------------------------------------
  104. :MYRUNBVT
  105. ECHO ^%%SystemRoot^%%\system32\rundll32.exe ^%%SystemRoot^%%\system32\setupapi.dll InstallHinfSection DefaultInstall 132 %BVTDRIVE%\TOOLS\ETC\%2 >>%1
  106. ECHO \\intlntsetup\bvtsrc\runbvt.cmd %BVTDRIVE%\BVT \\intlntsetup\bvtresults >>%1
  107. ECHO. >>%1
  108. GOTO :EOF
  109. REM ---- end of data section --------------------------------------------------------------
  110. :INIT6
  111. IF "%_WRONG_USER%"=="1" call :runcommand shutdown /f
  112. GOTO :EOF
  113. :admincommands
  114. SET _WRONG_USER=1
  115. for /F "skip=4" %%g in ('net localgroup') do (
  116. SET c=
  117. SET n=%%g
  118. SET n=!n:~1,20!
  119. SET a=!n:~0,9!
  120. if /I "!a!"=="%ADMINGRP%" SET c=net localgroup !n! %BVTDOMAIN%\%BVTUSER% /add
  121. if NOT "!c!"=="" call :runcommand !c!
  122. )
  123. GOTO :EOF
  124. :runcommand
  125. echo.
  126. echo %*
  127. %*
  128. GOTO :eof
  129. :logme
  130. IF "%LOGFILE%"=="" SET LOGFILE=NUL
  131. echo %1
  132. echo %1>>%LOGFILE%
  133. goto :EOF
  134. ENDLOCAL