⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ddkbuild.bat

📁 经典的文件透明加解密程序
💻 BAT
📖 第 1 页 / 共 2 页
字号:

shift

if "%BASEDIR%"=="" goto ErrNoBASEDIR
call :MakeShort BASEDIR "%BASEDIR%"

set path=%BASEDIR%\bin;%path%

call :SetMode %1
if "%error_code%" NEQ "0" goto ErrBadMode

call :CheckTargets %2
if "%error_code%" NEQ "0" goto ErrNoDir

call :DetectVistaWDK
pushd .
call "%BASEDIR%\bin\setenv.bat" %BASEDIR% %mode% %OSR_AMD64FLAG% WLH 
popd

@echo %scriptDebug%

goto RegularBuild

rem //
rem // WLH IA64 BIT BUILD using WLH DDK
rem //
:WLHI64Build

@echo WLH IA64 BIT BUILD using WLH DDK

set BASEDIR=%WLHBASE%

shift

if "%BASEDIR%"=="" goto ErrNoBASEDIR
call :MakeShort BASEDIR "%BASEDIR%"

set path=%BASEDIR%\bin;%path%

call :SetMode %1
if "%error_code%" NEQ "0" goto ErrBadMode

call :CheckTargets %2
if "%error_code%" NEQ "0" goto ErrNoDir

pushd .
call "%BASEDIR%\bin\setenv.bat" %BASEDIR% %mode% 64 WLH 
popd

@echo %scriptDebug%

goto RegularBuild

rem //
rem // WNET X64 BIT BUILD using WLH DDK
rem //
:WLHNETX64Build

@echo WNET X64 BIT BUILD using WLH DDK

set BASEDIR=%WLHBASE%

shift

if "%BASEDIR%"=="" goto ErrNoBASEDIR
call :MakeShort BASEDIR "%BASEDIR%"

set path=%BASEDIR%\bin;%path%

call :SetMode %1
if "%error_code%" NEQ "0" goto ErrBadMode

call :CheckTargets %2
if "%error_code%" NEQ "0" goto ErrNoDir

call :DetectVistaWDK
pushd .
call "%BASEDIR%\bin\setenv.bat" %BASEDIR% %mode% %OSR_AMD64FLAG% WNET 
popd

goto RegularBuild

rem //
rem // WNET IA64 BIT BUILD using WLH DDK
rem //
:WLHNETI64Build

@echo WNET IA64 BIT BUILD using WLH DDK

set BASEDIR=%WLHBASE%

shift

if "%BASEDIR%"=="" goto ErrNoBASEDIR
call :MakeShort BASEDIR "%BASEDIR%"

set path=%BASEDIR%\bin;%path%

call :SetMode %1
if "%error_code%" NEQ "0" goto ErrBadMode

call :CheckTargets %2
if "%error_code%" NEQ "0" goto ErrNoDir

pushd .
call "%BASEDIR%\bin\setenv.bat" %BASEDIR% %mode% 64 WNET 
popd

goto RegularBuild

rem //
rem // WXP 32 BIT BUILD using WLH DDK
rem //
:WLHXPBuild
@echo WLH 32 BIT BUILD using WLH DDK

set BASEDIR=%WLHBASE%

shift

if "%BASEDIR%"=="" goto ErrNoBASEDIR
call :MakeShort BASEDIR "%BASEDIR%"

set path=%BASEDIR%\bin;%path%

call :SetMode %1
if "%error_code%" NEQ "0" goto ErrBadMode

call :CheckTargets %2
if "%error_code%" NEQ "0" goto ErrNoDir

pushd .
call "%BASEDIR%\bin\setenv.bat" %BASEDIR% %mode% WXP
popd

@echo %scriptDebug%

goto RegularBuild

rem //
rem // W2K 32 BIT BUILD using WLH DDK
rem //
:WLH2KBuild
@echo WLH 32 BIT BUILD using WLH DDK

set BASEDIR=%WLHBASE%

shift

if "%BASEDIR%"=="" goto ErrNoBASEDIR
call :MakeShort BASEDIR "%BASEDIR%"

set path=%BASEDIR%\bin;%path%

call :SetModeWLH2K %1
if "%error_code%" NEQ "0" goto ErrBadMode

call :CheckTargets %2
if "%error_code%" NEQ "0" goto ErrNoDir

pushd .
call "%BASEDIR%\bin\setenv.bat" %BASEDIR% %mode% W2K
popd

@echo %scriptDebug%

goto RegularBuild

rem //
rem // WNET 32 BIT BUILD using WLH DDK
rem //
:WLHNETBuild
@echo WLH 32 BIT BUILD using WLH DDK

set BASEDIR=%WLHBASE%

shift

if "%BASEDIR%"=="" goto ErrNoBASEDIR
call :MakeShort BASEDIR "%BASEDIR%"

set path=%BASEDIR%\bin;%path%

call :SetMode %1
if "%error_code%" NEQ "0" goto ErrBadMode

call :CheckTargets %2
if "%error_code%" NEQ "0" goto ErrNoDir

pushd .
call "%BASEDIR%\bin\setenv.bat" %BASEDIR% %mode% WNET
popd

@echo %scriptDebug%

goto RegularBuild

rem //
rem // All builds go here for the rest of the procedure.  Now,
rem // we are getting ready to call build.  The big problem
rem // here is to figure our the name of the buildxxx files being
rem // generated for the different platforms.
rem //
 
:RegularBuild

set NO_BROWSWER_FILE=
set NO_BINPLACE=

set mpFlag=-M
if "%BUILD_ALT_DIR%"=="" goto NT4

rem win2k sets this!
set W2kEXT=%BUILD_ALT_DIR%

set mpFlag=-MI

:NT4

if "%NUMBER_OF_PROCESSORS%"=="" set mpFlag=
if "%NUMBER_OF_PROCESSORS%"=="1" set mpFlag=

rem //
rem // Determine the settings of flags, WDF and PREFAST in other words
rem // what was set for %3 and beyond....
rem // 
@echo build in directory %~2 with arguments %3 %4 %5 (basedir %BASEDIR%)

set buildDirectory=%~f2
call :MakeShort buildDirectory %buildDirectory%

cd /D %buildDirectory%
set bflags=-Ze
set bscFlags=""

:ContinueParsing
if "%3" == "" goto done
if "%3" == "/a" goto RebuildallFound
if "%3" == "-WDF" goto WDFFound
if "%3" == "-wdf" goto WDFFound
if "%3" == "-PREFAST" goto PrefastFound
if "%3" == "-prefast" goto PrefastFound
set bscFlags=/n
set bflags=%bflags% %3
shift
goto ContinueParsing

:WDFFound
shift
if "%BASEDIR%" == "%WLHBASE%" goto WDFOkay
if "%WDF_ROOT%" == "" goto errNoWdfRoot
pushd .
call "%WDF_ROOT%\set_wdf_env.cmd"
popd
:WDFOkay
set scriptDebug=on
goto ContinueParsing

:PrefastFound
shift
set prefast_build=1
goto ContinueParsing

:RebuildallFound
shift
set bscFlags=/n
set bflags=-cfeZ
goto ContinueParsing

:done

if EXIST build%W2kEXT%.err	 erase build%W2kEXT%.err
if EXIST build%W2kEXT%.wrn   erase build%W2kEXT%.wrn
if EXIST build%W2kEXT%.log	 erase build%W2kEXT%.log
if EXIST prefast%W2kEXT%.log erase prefast%W2kEXT%.log

if "%prefast_build%" NEQ "0" goto RunPrefastBuild
@echo run build %bflags% %mpFlag% for %mode% version in %buildDirectory%
pushd .
build  %bflags% %mpFlag%
goto BuildComplete

:RunPrefastBuild
@echo run prefast build %bflags% %mpFlag% for %mode% version in %buildDirectory%
pushd .
prefast build  %bflags% %mpFlag%
if "%errorlevel%" GTR "0" set error_code=%errorlevel%
prefast list > prefast%W2kEXT%.log
goto BuildComplete

:BuildComplete
if "%errorlevel%" GTR "0" set error_code=%errorlevel%
popd

@echo %scriptDebug%

rem assume that the onscreen errors are complete!

@echo =============== build warnings ======================
if exist build%W2kEXT%.wrn findstr "warning[^.][DRCLU][0-9]*" build%W2kEXT%.log
if exist build%W2kEXT%.log findstr "error[^.][DRCLU][0-9]*" build%W2kEXT%.log

if "%prefast_build%" == "0" goto SkipPrefastWarnings
@echo =============== prefast warnings ======================
if exist prefast%W2kEXT%.log findstr "warning[^.][CLU]*" prefast%W2kEXT%.log
:SkipPrefastWarnings

@echo. 
@echo. 
@echo build complete

@echo building browse information files

if EXIST buildbrowse.cmd goto doBrowsescript

set sbrlist=sbrList.txt

if not EXIST sbrList%CPU%.txt goto sbrDefault

set sbrlist=sbrList%CPU%.txt

:sbrDefault

if not EXIST %sbrlist% goto end

if %bscFlags% == "" goto noBscFlags

bscmake %bscFlags% @%sbrlist%

goto end

:noBscFlags

bscmake @%sbrlist%

goto end

:doBrowsescript

call buildBrowse %mode%

goto end

rem //
rem //  SetMode
rem //
rem //  Subroutine to validate the mode of the build passed in.
rem //  it must be free, FREE, fre, FRE or checked, CHECKED,
rem //  chk, CHK.   Anything else is an error.
rem //
:SetMode
set mode=
for %%f in (free FREE fre FRE) do if %%f == %1 set mode=free
for %%f in (checked CHECKED chk CHK) do if %%f == %1 set mode=checked
if "%mode%" =="" set error_code=1
goto :EOF

rem //
rem //  SetModeWLH2K
rem //
rem //  Subroutine to validate the mode of the build passed in.
rem //  it must be free, FREE, fre, FRE or checked, CHECKED,
rem //  chk, CHK.   Anything else is an error.
rem //
:SetModeWLH2K
set mode=
for %%f in (free FREE fre FRE) do if %%f == %1 set mode=f
for %%f in (checked CHECKED chk CHK) do if %%f == %1 set mode=c
if "%mode%" =="" set error_code=1
goto :EOF

rem //
rem //  MakeShort
rem //
rem //  Subroutine to convert a long file path into a short (8.3)
rem //  file path for better compatibility with DDK tools.
rem //
:MakeShort
setlocal ENABLEEXTENSIONS
set PATH_SHORT=%~dpns2
set PATH_EXTSHORT=%~xs2
if not "" == "%PATH_EXTSHORT%" set PATH_EXTSHORT=%PATH_EXTSHORT:~0,4%
set PATH_SHORT=%PATH_SHORT%%PATH_EXTSHORT%
endlocal & set %~1=%PATH_SHORT%
goto :EOF

rem //
rem // CheckTargets
rem //
rem // Subroutine to validate that the target directory exists
rem // and that there is either a DIRS or SOURCES and MakeFile in
rem // it.
rem // 
:CheckTargets
if "%1" NEQ "" goto CheckTargets1
set error_code=1
goto :EOF
:CheckTargets1
if exist %1 goto CheckTargets2
set error_code=1
goto :EOF
:CheckTargets2
if not exist %1\DIRS  goto CheckTargets3
set error_code=0
goto :EOF
:CheckTargets3
if exist %1\SOURCES  goto CheckTargets4
set error_code=2
goto :EOF
:CheckTargets4
if exist %1\MAKEFILE  goto CheckTargets5
set error_code=2
goto :EOF
:CheckTargets5
set error_code=0
goto :EOF

:DetectVistaWDK
setlocal ENABLEEXTENSIONS
rem // Newer flag (starting with W2K8) is default
set OSR_AMD64FLAG=x64
rem // The Vista WDK accepted *only* "AMD64", the newer W2K8 WDK accepts only "x64"
rem // We detect the older one by checking the setenv.bat for a certain string
findstr /C:"Windows Server Longhorn" "%BASEDIR%\bin\setenv.bat" > NUL 2>&1 && set OSR_AMD64FLAG=AMD64
endlocal & set OSR_AMD64FLAG=%OSR_AMD64FLAG%
goto :EOF

rem //
rem //  Error processing code.   Whenever we encounter an
rem //  error in the parameters, we come to one of the following
rem //  labels to output a decent error to help the user
rem //  understand what is wrong.
rem //

:ErrBadMode
@echo -
@echo ERROR: first param must be "checked", "free", "chk" or "fre"
set error_code=1
goto usage

:ErrNoBASEDIR
@echo -
@echo ERROR: NT4BASE, W2KBASE, WXPBASE, or WNETBASE environment variable not set.
@echo ERROR: Environment variable must be set by user according to DDK version installed.
set error_code=1
goto usage

:ErrUnKnownBuildType
@echo -
@echo ERROR: Unknown type of build.  Please recheck parameters.
set error_code=1
goto usage

:ErrNoDir
if "%error_code%" EQU "2" goto ErrNoTarget
@echo -
@echo ERROR: second parameter must be a valid directory
goto usage

:ErrNoTarget
@echo -
@echo ERROR: target directory must contain a SOURCES or DIRS file
goto usage

:errNoWdfRoot
@echo -
@echo ERROR: WDF_ROOT is not defined, are you using 00.01.5054 or later?
goto usage

rem //
rem // Usage output
rem //
:usage
@echo -
@echo -
@echo usage: ddkbuild [-W2K] "checked | free | chk | fre" "directory-to-build" [flags] [-WDF] [-PREFAST]
@echo        -W2K       indicates development system uses W2KBASE environment variable
@echo                   to locate the win2000 ddk
@echo        -W2K64     indicates development sytsem uses W2KBASE environment variable
@echo                   to locate the win2000 IA64 ddk
@echo        -WXP       to indicate WXP Build uses WXPBASE enviornment variable.
@echo        -WXP64     to indicate WXP IA64 bit build, uses WXPBASE
@echo        -WXP2K     to indicate Windows 2000 build using WXP ddk
@echo        -WNET      to indicate Windows .Net builds using WNET ddk
@echo        -WNET64    to indicate Windows .Net 64 bit builds using WNET DDK
@echo        -WNETXP    to indicate Windows XP builds suing WNET DDK
@echo        -WNETXP64  to indicate Windows XP 64 bit builds suing WNET DDK
@echo        -WNETAMD64 to indicate Windows .NET build for AMD64 using WNET DDK
@echo        -WNET2K    to indicate Windows 2000 builds using WNET DDK
@echo        -NT4       to indicate NT4 build using NT4 DDK.
@echo        -WLH       to indicate Windows LH builds using WLH DDK
@echo        -WLH2K     to indicate Windows 2K builds using WLH DDK
@echo        -WLHXP     to indicate Windows XP builds using WLH DDK
@echo        -WLHNET    to indicate Windows NET builds using WLH DDK
@echo        -WLHNETX64 to indicate Windows NET X64 builds using WLH DDK
@echo        -WLHNETI64 to indicate Windows NET IA64 builds using WLH DDK
@echo        -WLHX64    to indicate Windows LH X64 builds using WLH DDK
@echo        -WLHI64    to indicate Windows LH IA64 builds using WLH DDK
@echo         checked   indicates a checked build
@echo         free      indicates a free build
@echo         chk		indicates a checked build
@echo         fre		indicates a free build
@echo         directory path to build directory, try . (cwd)
@echo         flags     any random flags you think should be passed to build (try /a for clean)
@echo         -WDF      performs a WDF build
@echo         -PREFAST  preforms a PREFAST build
@echo -
@echo         ex: ddkbuild -NT4 checked . (for NT4 BUILD)
@echo         ex: ddkbuild -WXP64 chk .
@echo         ex: ddkbuild -WXP chk c:\projects\myproject
@echo         ex: ddkbuild -WNET64 chk .      (IA64 bit build)
@echo         ex: ddkbuild -WNETAMD64 chk .   (AMD64/EM64T bit build)
@echo         ex: ddkbuild -WNETXP chk . -cZ -WDF
@echo         ex: ddkbuild -WNETXP chk . -cZ -PREFAST
@echo -
@echo         In order for this procedure to work correctly for each platform, it requires
@echo         an environment variable to be set up for certain platforms.   The environment
@echo         variables are as follows:
@echo -
@echo         NT4BASE - You must set this up to do -NT4 builds
@echo         W2KBASE - You must set this up to do -W2K and -W2K64 builds
@echo         WXPBASE - You must set this up to do -WXP, -WXP64, -WXP2K builds
@echo         WNETBASE - You must set this up to do -WNET, -WNET64, -WNETXP, -WNETXP64, 
@echo                    -WNETAMD64, and -WNET2K builds
@echo         WLHBASE  - You must set this to do any -WLH* builds
@echo -
@echo         WDF_ROOT must be set if attempting to do a WDF Build.
@echo -
@echo -
@echo   OSR DDKBUILD.BAT V6.12 - OSR, Open Systems Resources, Inc.
@echo     report any problems found to info@osr.com
@echo  - 

rem goto end

:end

exit /b %error_code%

@echo ddkbuild complete

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -