This repository has been archived by the owner on Jul 9, 2023. It is now read-only.
forked from salva/ring3k
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathring3k-setup.in
331 lines (313 loc) · 5.9 KB
/
ring3k-setup.in
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
#!/bin/sh
#
# ring3k - a user mode kernel for windows executables
#
# Copyright 2006-2008 Mike McCormack
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
#
# This script sets up a basic windows install for ring3k to work with
# Eventually it should be replaced with something with a GUI front end.
#
# There should also be an option to use an existing Windows install.
# list of files to extract from a Windows 2000 install disk
win2ksys32files="
ADVAPI32.DL_
AUTOCHK.EXE
BASESRV.DL_
C_1252.NL_
C_850.NL_
C_437.NL_
CGA80WOA.FO_
CGA40WOA.FO_
CSRSRV.DL_
CSRSS.EX_
CMD.EX_
COMCTL32.DL_
COMDLG32.DL_
CRYPT32.DL_
CRYPTDLL.DL_
CTYPE.NL_
DIGEST.DL_
DNSAPI.DL_
DOSAPP.FO_
EGA80WOA.FO_
EGA40WOA.FO_
GDI32.DL_
IMM32.DL_
KBDUS.DLL
KERNEL32.DL_
KERBEROS.DL_
L_INTL.NL_
LOCALE.NL_
LSASRV.DL_
LSASS.EX_
MSASN1.DL_
MSAPSSPC.DL_
MSGINA.DL_
MSNSSPC.DL_
MSPRIVS.DL_
MSV1_0.DL_
MSVCRT.DLL
MSVCIRT.DL_
MSVCRT40.DL_
NDDEAPI.DL_
NETAPI32.DL_
NETLOGON.DL_
NETRAP.DL_
NTDLL.DLL
NTDSAPI.DL_
PROFMAP.DL_
RPCRT4.DL_
SAMLIB.DL_
SAMSRV.DL_
SAVEDUMP.EX_
SCESRV.DL_
SCHANNEL.DLL
SECUR32.DL_
SERVICES.EX_
SETUPAPI.DL_
SFC.DL_
SFCFILES.DL_
SHELL32.DL_
SHLWAPI.DL_
SMSS.EX_
SORTKEY.NL_
SORTTBLS.NL_
UMPNPMGR.DL_
USER32.DL_
USERENV.DL_
UNICODE.NL_
UNIPROC/WINSRV.DL_
VGAFIX.FO_
VGAOEM.FO_
VGASYS.FO_
WINLOGON.EX_
WINMINE.EX_
WINMM.DL_
WINSTA.DL_
WLDAP32.DL_
WS2_32.DL_
WS2HELP.DL_
WSOCK32.DL_
"
# list of files to extract from a Windows XP install disk
winxpsys32files="
ADVAPI32.DL_
AUTOCHK.EXE
BASESRV.DL_
C_1252.NL_
C_850.NL_
C_437.NL_
CGA80WOA.FO_
CGA40WOA.FO_
CSRSRV.DL_
CSRSS.EX_
CMD.EX_
COMCTL32.DL_
CRYPT32.DL_
CRYPTDLL.DL_
CTYPE.NL_
DIGEST.DL_
DNSAPI.DL_
DOSAPP.FO_
EGA80WOA.FO_
EGA40WOA.FO_
GDI32.DL_
IMM32.DL_
KBDUS.DLL
KERNEL32.DL_
KERBEROS.DL_
L_INTL.NL_
LOCALE.NL_
LSASRV.DL_
LSASS.EX_
MSVCIRT.DL_
MSVCRT40.DL_
NDDEAPI.DL_
NETAPI32.DL_
NETRAP.DL_
NTDLL.DLL
NTDSAPI.DL_
PROFMAP.DL_
RPCRT4.DL_
SAMLIB.DL_
SAMSRV.DL_
SAVEDUMP.EX_
SCESRV.DL_
SECUR32.DL_
SERVICES.EX_
SFC.DL_
SFCFILES.DL_
SHELL32.DL_
SHLWAPI.DL_
SMSS.EX_
SORTKEY.NL_
SORTTBLS.NL_
UMPNPMGR.DL_
USER32.DL_
USERENV.DL_
UNICODE.NL_
WINSRV.DL_
WINLOGON.EX_
WINMINE.EX_
WINSTA.DL_
WLDAP32.DL_
WS2_32.DL_
WS2HELP.DL_
WSOCK32.DL_
"
# from Wine's launch script
appdir=""
case "$0" in
*/*)
# $0 contains a path, use it
appdir=`dirname "$0"`
;;
*)
# no directory in $0, search in PATH
saved_ifs=$IFS
IFS=:
for d in $PATH
do
IFS=$saved_ifs
if [ -x "$d/$0" ]
then
appdir="$d"
break
fi
done
;;
esac
tmp=".$$.temp.cab"
root="drive"
target="$root/winnt/system32"
win2kiso="win2k.iso"
winxpiso="winxp.iso"
# find our unpack program
unpacker="unpack/ring3k-unpack"
if test \! -x "$unpacker"
then
unpacker="$appdir/unpack/ring3k-unpack"
if test \! -x "$unpacker"
then
unpacker="$appdir/ring3k-unpack"
if test \! -x "$unpacker"
then
echo "$unpacker missing"
exit 1
fi
fi
fi
# find the winlogon replacement
minitris="programs/minitris/minitris.exe"
if test \! -r "$minitris"
then
minitris="$appdir/programs/minitris/minitris.exe"
if test \! -r "$minitris"
then
minitris="$appdir/../data/minitris.exe"
if test \! -r "$minitris"
then
echo "Can't find minitris.exe"
exit 1
fi
fi
fi
# find an iso to unpack from
if test -f "$win2kiso"
then
echo "Windows 2000 ISO found"
iso="$win2kiso"
sys32files="$win2ksys32files"
win32dlldir="win2k"
else
if test -f $winxpiso
then
echo "Windows XP ISO found"
iso="$winxpiso"
sys32files="$winxpsys32files"
win32dlldir="winxp"
else
echo "Missing a Windows 2000 or XP ISO image to extract files from"
exit 1
fi
fi
# create the various system directories
mkdir -p "$target"
if test \! -d "$target"
then
echo "Failed to make directory $target"
exit
fi
mkdir -p "$root/winnt/temp"
mkdir -p "$root/winnt/security"
mkdir -p "$root/winnt/security/logs"
mkdir -p "$root/program files"
mkdir -p "$root/program files/common files"
mkdir -p "$root/tests"
for file in $sys32files
do
# copy a file from the ISO
if isoinfo -x "/I386/$file" -i "$iso" > "$tmp"
then
if test \! -s "$tmp"
then
echo "Failed to extract $file"
rm -f "$tmp"
exit 1
fi
else
echo "Failed to read $iso"
rm -f "$tmp"
exit 1
fi
# extract the file
compressed=`echo $file | sed -e 's/.$/_/'`
if test "x$compressed" = "x$file"
then
echo "Extracting $file"
"$unpacker" -d "$target" "$tmp"
else
lower=`echo "$file" | tr A-Z a-z`
echo "Copying $lower"
cp "$tmp" "$target/$lower"
fi
rm -f "$tmp"
done
# create a default system.ini
cat > "$root/winnt/system.ini" <<EOF
[drivers]
wave=mmdrv.dll
timer=timer.drv
[mci]
[driver32]
[386enh]
woafont=dosapp.FON
EGA80WOA.FON=EGA80WOA.FON
EGA40WOA.FON=EGA40WOA.FON
CGA80WOA.FON=CGA80WOA.FON
CGA40WOA.FON=CGA40WOA.FON
EOF
# create a default win.ini
cat > "$root/winnt/win.ini" <<EOF
; empty
EOF
# add dummy security database
dd if=/dev/null of="$root/winnt/security/res1.log" bs=1024 count=1024
dd if=/dev/null of="$root/winnt/security/res2.log" bs=1024 count=1024
dd if=/dev/null of="$root/winnt/security/edb.chk" bs=8192 count=1
dd if=/dev/null of="$root/winnt/security/edb.log" bs=1024 count=1024
dd if=/dev/null of="$root/winnt/security/edb007ec.log" bs=1024 count=1024