forked from maojun1998/NTOSBE
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuildrepoidw.cmd
225 lines (172 loc) · 4.36 KB
/
buildrepoidw.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
@echo off
REM ///////////////////////////////////////////////////////////////////////////
REM buildrepoidw.cmd
REM ///////////////////////////////////////////////////////////////////////////
pushd %~dp0
setlocal ENABLEDELAYEDEXPANSION
REM //
REM // Verify that the script is running under the sizzle environment.
REM //
if [%NTROOT%] equ [] (
echo You must run this script under the sizzle environment.
goto End
)
REM //
REM // Display build information.
REM //
echo Building repository-specific IDW tools from the source tree SDKTOOLS project.
echo.
echo Repository Name = %NTREPO%
echo SDKTOOLS Project Path = %NTROOT%\sdktools
echo Repository IDW Path = %BEREPOIDW%
echo.
REM //
REM // Check for existing IDW path.
REM //
if exist "%BEREPOIDW%" (
REM Check for the -y switch before attempting to delete the repository IDW directory.
if not [%1] equ [-y] (
echo Repository IDW path already exists.
echo Please specify -y switch if you would like to rebuild the repository-specific IDW.
goto End
)
REM Delete the existing repository IDW directory.
rmdir /s /q "%BEREPOIDW%"
)
REM //
REM // Create the repository IDW directory.
REM //
mkdir "%BEREPOIDW%"
REM //
REM // Store the native IDW path.
REM //
set NATIVEBEREPOIDW=%BEREPOIDW%
REM //
REM // Switch the build environment if necessary.
REM //
set PROCESSOR_ARCHITECTURE_LOCASE=%PROCESSOR_ARCHITECTURE%
call :LoCase PROCESSOR_ARCHITECTURE_LOCASE
if [%PROCESSOR_ARCHITECTURE_LOCASE%] equ [amd64] (
set IDWARCH=x86
)
if not [%IDWARCH%] equ [%NTARCH%] (
echo Temporarily switching to %IDWARCH% build environment.
call ntswitch %IDWARCH% chk
)
REM //
REM // Build repository IDW tools.
REM //
call :Build ztools sdktools\ztools
if errorlevel 1 goto Error
call :Build generr sdktools\generr idw\generr.exe generr.exe
if errorlevel 1 goto Error
call :Build genlvl sdktools\genlvl bldtools\genlvl.exe genlvl.exe
if errorlevel 1 goto Error
call :Build gensrv sdktools\gensrv idw\gensrv.exe gensrv.exe
if errorlevel 1 goto Error
call :Build genxx base\tools\genxx idw\genxx.exe genxx.exe
if errorlevel 1 goto Error
call :Build hdivide sdktools\hdivide bldtools\hdivide.exe hdivide.exe
if errorlevel 1 goto Error
call :Build hextract sdktools\hextract bldtools\hextract.exe hextract.exe
if errorlevel 1 goto Error
call :Build hsplit sdktools\hsplit bldtools\hsplit.exe hsplit.exe
if errorlevel 1 goto Error
call :Build munge sdktools\munge idw\munge.exe munge.exe
if errorlevel 1 goto Error
call :Build wcshdr sdktools\wcshdr bldtools\wcshdr.exe wcshdr.exe
if errorlevel 1 goto Error
call :Build wmimofck sdktools\wmimofck mstools\wmimofck.exe wmimofck.exe
if errorlevel 1 goto Error
call :Build zwapi sdktools\zwapi bldtools\zwapi.exe zwapi.exe
if errorlevel 1 goto Error
REM //
REM // Done.
REM //
echo.
echo Build successfully completed! Done.
goto End
REM //
REM // Error.
REM //
:Error
echo.
echo Error! Build aborted.
REM //
REM // End.
REM //
:End
endlocal
popd
exit /b 0
REM //
REM // ** Build Function **
REM //
REM // %~1 = Tool name
REM // %~2 = Relative source directory path under %NTROOT%
REM // %~3 = Relative binary path under %NTTREE%
REM // %~4 = Relative binary path under %BEREPOIDW%
REM //
:Build
echo.
echo [%~1]
REM //
REM // Verify that the source directory for the specified tool exists.
REM //
if not exist "%NTROOT%\%~2" (
echo %~1 does not exist in the local source tree. Skipping %~1 build.
exit /b
)
cd "%NTROOT%\%~2"
REM //
REM // Perform build.
REM //
build -c
if errorlevel 1 (
echo Build command failed for %~1.
exit /b 1
)
REM //
REM // Copy the built tool to the repository idw directory.
REM //
if not [%~3] equ [] (
copy /y "%NTTREE%\%~3" "%NATIVEBEREPOIDW%\%~4"
if errorlevel 1 (
echo Failed to copy %~1 to tools directory.
exit /b 2
)
)
exit /b 0
REM //
REM // ** LoCase Function **
REM //
REM // %~1 = Variable name
REM //
:LoCase
set %~1=!%1:A=a!
set %~1=!%1:B=b!
set %~1=!%1:C=c!
set %~1=!%1:D=d!
set %~1=!%1:E=e!
set %~1=!%1:F=f!
set %~1=!%1:G=g!
set %~1=!%1:H=h!
set %~1=!%1:I=i!
set %~1=!%1:J=j!
set %~1=!%1:K=k!
set %~1=!%1:L=l!
set %~1=!%1:M=m!
set %~1=!%1:N=n!
set %~1=!%1:O=o!
set %~1=!%1:P=p!
set %~1=!%1:Q=q!
set %~1=!%1:R=r!
set %~1=!%1:S=s!
set %~1=!%1:T=t!
set %~1=!%1:U=u!
set %~1=!%1:V=v!
set %~1=!%1:W=w!
set %~1=!%1:X=x!
set %~1=!%1:Y=y!
set %~1=!%1:Z=z!
exit /b 0