-
Notifications
You must be signed in to change notification settings - Fork 22
/
ring3k-setup.in
678 lines (659 loc) · 15.5 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
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
#!/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_
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
# create a default registry
cat > reg.xml <<EOF
<?xml version="1.0"?>
<k n="REGISTRY">
<k n="Machine">
<k n="Security">
<k n="Policy">
<k n="PolRevision">
</k>
<k n="PolMod">
</k>
<k n="PolAdtLg">
</k>
<k n="PolAdtEv">
</k>
<k n="PolPrDmn">
</k>
<k n="PolPrDms">
</k>
<k n="PolPdAcn">
</k>
<k n="PolAcDmn">
</k>
<k n="PolRepSc">
</k>
<k n="PolRepAc">
</k>
<k n="DefQuota">
</k>
<k n="PolAdtFL">
</k>
<k n="SecDesc">
</k>
<k n="PolDnDDN">
</k>
<k n="PolDnTrn">
</k>
<k n="PolDnDmg">
</k>
</k>
</k>
<k n="SOFTWARE">
<k n="Policies">
<k n="Microsoft">
<k n="Windows">
<k n="System">
</k>
</k>
</k>
</k>
<k n="Microsoft">
<k n="Rpc">
</k>
<k n="Windows">
<k n="CurrentVersion">
<s n="CommonFilesDir">C:\Program Files\CommonFiles</s>
<s n="ProgramFilesDir">C:\Program Files</s>
<k n="policies">
<k n="system">
<n n="VerboseStatus">1</n>
</k>
</k>
<k n="Explorer">
</k>
</k>
</k>
<k n="Windows NT">
<k n="CurrentVersion">
<s n="CSDVersion">Service Pack 1</s>
<k n="ProfileList">
<s n="DefaultUserProfile">Default User</s>
<s n="AllUsersProfile">All Users</s>
<s t="2" n="ProfilesDirectory">%SystemDrive%\Documents and Settings</s>
</k>
<k n="IniFileMapping">
</k>
<k n="Diagnostics">
<n n="AppMgmtDebugLevel">0x4b</n>
<n n="AppMgmtDebugBreak">0</n>
</k>
<k n="Winlogon">
<k n="Notify">
</k>
</k>
<k n="Windows">
<s n="AppInit_DLLs"></s>
</k>
</k>
</k>
</k>
<k n="Minitris">
<n n="Polled">0</n>
</k>
</k>
<k n="HARDWARE">
<k n="DESCRIPTION">
<k n="System">
<k n="CentralProcessor">
<k n="0">
<n n="~MHz">0x000001bf</n>
<x t="7" n="ComponentInformation">00000000000000000000000001000000</x>
<x t="9" n="ConfigurationData">ffffffffffffffff0000000000000000</x>
<n n="FeatureSet">0x00002fff</n>
<s n="Identifier">x86 Family 6 Model 8 Stepping 1</s>
<x t="7" n="UpdateSignature">000000000e000000</x>
<n n="Update Status">6</n>
<s n="VendorIdentifier">GenuineIntel</s>
</k>
</k>
</k>
</k>
</k>
<k n="System">
<k n="Select">
<n n="Current">1</n>
<n n="Default">1</n>
<n n="Failed">0</n>
<n n="LastKnownGood">2</n>
</k>
<k n="CurrentControl001">
</k>
<k n="CurrentControlSet">
<k n="Enum">
</k>
<k n="Services">
<k n="WinSock2">
<k n="Parameters">
<s n="WinSock_Registry_Version">2.0</s>
</k>
</k>
<k n="DNS">
</k>
<k n="EventLog">
<k n="Application">
<k n="Error Instrument">
<n n="TypesSupported">7</n>
<s n="EventMessageFile">%SystemRoot%\System32\User32.dll</s>
</k>
</k>
</k>
<k n="DnsCache">
</k>
<k n="Tcpip">
<k n="Parameters">
<s n="NV Hostname">mike-up94heby9k</s>
<n n="AllowUnqualifiedQuery">0</n>
<n n="PrioritizeRecordData">0x10</n>
</k>
</k>
</k>
<k n="Control">
<k n="ServiceGroupOrder">
<x t="7" n="List">530079007300740065006d0020005200650073006500720076006500640000000000</x>
</k>
<k n="Keyboard Layouts">
<k n="00000409">
<s n="Layout File">KBDUS.DLL</s>
<s n="Layout Text">US</s>
</k>
</k>
<k n="Class">
</k>
<k n="SecurityProviders">
<s n="SecurityProviders">msapsspc.dll, schannel.dll, digest.dll, msnsspc.dll</s>
</k>
<k n="Nls">
<k n="CodePage">
<s n="473">c_437.nls</s>
</k>
<k n="Language">
</k>
<k n="Language Groups">
</k>
<k n="Locale">
<s n="00000409">1</s>
<k n="Alternate Sorts">
</k>
</k>
</k>
<k n="Lsa">
<n n="SecureBoot">1</n>
<x t="7" n="Authentication Packages">6d007300760031005f00300000000000</x>
<x t="7" n="Security Packages">6b00650072006200650072006f00730000006d007300760031005f003000000073006300680061006e006e0065006c00000000</x>
<k n="JD" c="cf845301">
<x t="3" n="Lookup">8a2acfa6dd7d</x>
</k>
<k n="GBG" c="cf845301">
</k>
<k n="Skew1" c="cf845301">
</k>
<k n="Data" c="cf845301">
</k>
</k>
<k n="ComputerName">
<k n="ActiveComputerName">
<s n="ComputerName">MIKE-UP94HEBY9K</s>
</k>
<k n="ComputerName">
<s n="ComputerName">MIKE-UP94HEBY9K</s>
</k>
</k>
<k n="Error Message Instrument">
<n n="EnableLogging">1</n>
<n n="LogSeverity">0</n>
<n n="EnableDefaultReply">1</n>
</k>
<k n="PriorityControl">
<n n="Win32PrioritySeparation">2</n>
</k>
<k n="WOW">
<s n="DefaultSeparateVDM">no</s>
</k>
<k n="ProductOptions">
<s n="ProductType">WinNT</s>
<s n="xProductType">ServerNT</s>
</k>
<k n="Session Manager">
<n n="AllowProtectedRenames">1</n>
<x t="7" n="BootExecute">6e006100740069007600650000000000</x>
<x t="7" n="ExcludeFromKnownDlls">0000</x>
<x t="7" n="ObjectDirectories">5c00570069006e0064006f007700730000005c0052007000630043006f006e00740072006f006c0000000000</x>
<n n="ProtectionMode">0xffffff9d</n>
<k n="Environment">
<s t="2" n="ComSpec">%SystemRoot%\system32\cmd.exe</s>
<s n="NUMBER_OF_PROCESSORS">1</s>
<s n="OS">Windows_NT</s>
<s n="PROCESSOR_ARCHITECTURE">x86</s>
<s n="PROCESSOR_ARCHITECTURE">x86</s>
<s n="PROCESSOR_IDENTIFIER">x86 Family 6 Model 8 Stepping 1, GenuineIntel</s>
<s n="PROCESSOR_LEVEL">6</s>
<s n="PROCESSOR_REVISION">0801</s>
<s t="2" n="Path">%SystemRoot%\system32;%SystemRoot%</s>
<s n="SAFEBOOT_OPTION">0</s>
<s t="2" n="TEMP">%SystemRoot%\TEMP</s>
<s t="2" n="TMP">%SystemRoot%\TEMP</s>
<s t="2" n="windir">%SystemRoot%</s>
</k>
<k n="Memory Management">
<x t="7" n="PagingFiles">43003a005c007000610067006500660069006c0065002e007300790073002000320038003800200035003700360000000000</x>
</k>
<k n="DOS Devices">
<s n="AUX">\DosDevices\COM1</s>
<s n="MAILSLOT">\Device\MailSlot</s>
<s n="NUL">\Device\Null</s>
<s n="PIPE">\Device\NamedPipe</s>
<s n="PRN">\DosDevices\LPT1</s>
<s n="UNC">\Device\Mup</s>
</k>
<k n="KnownDLLs">
<s n="advapi32">advapi32.dll</s>
<s n="gdi32">gdi32.dll</s>
<s t="2" n="DllDirectory">%SystemRoot%\system32</s>
<s n="kernel32">kernel32.dll</s>
<s n="user32">user32.dll</s>
</k>
<k n="SubSystems">
<x t="2" n="Debug">0000</x>
<s t="2" n="Kmode">%SystemRoot%\system32\win32k.sys</s>
<x t="7" n="Optional">4f0073003200000050006f0073006900780000000000</x>
<s t="2" n="Os2">%SystemRoot%\system32\os2ss.exe</s>
<s t="2" n="Posix">%SystemRoot%\system32\ps2ss.exe</s>
<x t="7" n="Required">440065006200750067000000570069006e0064006f007700730000000000</x>
<s t="2" n="Windows">%SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,3072,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16</s>
<k n="CSRSS"/>
</k>
<k n="SFC">
<s n="CommonFilesDir">C:\Program Files\Common Files</s>
<s n="ProgramFilesDir">C:\Program Files</s>
</k>
</k>
<k n="Windows">
<n n="CSDVersion">0x00000100</n>
<n n="ErrorMode">0</n>
<n n="NoInteractiveServices">0</n>
<s t="2" n="SystemDirectory">%SystemRoot%\system32</s>
</k>
</k>
</k>
<k n="Setup">
<s n="SystemPartition">\Device\HarddiskVolume1</s>
</k>
</k>
</k>
<k n="USER">
<k n="S-1-5-18">
<k n="Console">
<n n="ColorTable00">0x00000000</n>
<n n="ColorTable01">0x00800000</n>
<n n="ColorTable02">0x00008000</n>
<n n="ColorTable03">0x00808000</n>
<n n="ColorTable04">0x00000080</n>
<n n="ColorTable05">0x00800080</n>
<n n="ColorTable06">0x00008080</n>
<n n="ColorTable07">0x00c0c0c0</n>
<n n="ColorTable08">0x00808080</n>
<n n="ColorTable09">0x00ff0000</n>
<n n="ColorTable10">0x0000ff00</n>
<n n="ColorTable11">0x00ffff00</n>
<n n="ColorTable12">0x000000ff</n>
<n n="ColorTable13">0x00ff00ff</n>
<n n="ColorTable13">0x0000ffff</n>
<n n="ColorTable15">0x00ffffff</n>
<n n="CursorSize">0x19</n>
<s n="FaceName"></s>
<n n="FontFamily">0</n>
<n n="FontSize">0</n>
<n n="FontWeight">0</n>
<n n="FullScreen">0</n>
<n n="HistoryBufferSize">50</n>
<n n="InsertMode">1</n>
<n n="LoadConIme">1</n>
<n n="NumberOfHistoryBuffers">4</n>
<n n="PopupColors">0xf5</n>
<n n="QuickEdit">1</n>
<n n="ScreenBufferSize">0x012c0050</n>
<n n="ScreenColors">7</n>
<n n="WindowSize">0x00190050</n>
</k>
<k n="Software">
<k n="Microsoft">
<k n="Windows">
<k n="CurrentVersion">
<k n="Explorer">
<k n="User Shell Folders">
<s t="2" n="Common AppData">%ALLUSERSPROFILE%\Application Data</s>
<s t="2" n="Personal">%ALLUSERSPROFILE%\My Documents</s>
<s t="2" n="Local Settings">%ALLUSERSPROFILE%\Local Settings</s>
</k>
</k>
</k>
</k>
</k>
</k>
<k n="Keyboard Layout">
<k n="Preload">
<s n="1">00000409</s>
</k>
</k>
<k n="Control Panel">
<k n="International">
<s n="Locale">00000409</s>
</k>
</k>
</k>
</k>
</k>
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