forked from mikemccormack/ring3k
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME
166 lines (108 loc) · 4.02 KB
/
README
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
Ring 3 Kernel
Copyright (C) 2006-2009 Mike McCormack
About
-----
This project aims to load the userspace of an NT system
into a user space controlled by a usermode kernel.
Why?
----
There are several aims for this project:
* understand how the Windows kernel-userland interface works
* provide an alternate method of virtualization
* reduce the scope of reimplementation as compared to Wine
* make application's address space indistinguishable from native Windows
* move closed and non-free code out of ring 0
Requirements
------------
* A Linux (tm) 2.6.x kernel patches applied.
* A Windows 2000 (tm) CD
* libSDL 1.2
* the mingw cross compiler (for tests)
* glibc with the NPTL version of pthreads
* gcc, g++ 4.2.1 or so
* libxml2 (for registry code)
* cabextract (extract windows cab files)
* isoinfo from http://cdrecord.berlios.de (read the CD)
* On x86-64, the compiler should be able to generate 32-bit code
(Debian users should install gcc-multilib, g++-multilib, ia32-libs)
Instructions
------------
To run smss.exe, from the top level directory, do:
./configure
make
ln -s /path/to/your/win2k.iso
make test
./ring3k
To run a test (for example the semaphore test):
./runtest sema
To run all the working tests, do:
make test
Debugging ring3k using gdb
--------------------------
As ring3k uses ptrace, it interferes with gdb. You can still debug
ring3k coredumps as follows:
$ ulimit -c unlimited
# echo "core-%p" > /proc/sys/kernel/core_pattern
# echo "1" > /proc/sys/kernel/core_uses_pid
$ ring3k --trace=core
If ring3k crashes, two core files will be generated, one for ring3k-client
and one for ring3k-bin. You can load them alternately into gdb as follows:
$ gdb --core=core-1234
(gdb) symbol-file kernel/ring3k-bin
Files
-----
kernel/ - implementation of the userspace kernel
libudis86/ - the udis86 disassembler
libmspack/ - code to extract files from the windows install disk
tests/ - test cases that run on both NT and the loader
tools/ - a collection of windows executables
documents/ - a few notes
Development
-----------
Development of new code and bug fixes should be done with test cases.
The test case should show how Windows functions, and should test the code
that has been written as much as possible.
Using QEMU to run tests
-----------------------
Optionally, install kqemu
One time setup:
1. Create a 2G sparse disk image:
dd if=/dev/null of=win2k.img bs=1024 seek=2M
2 Install Windows 2000:
qemu -hda win2k.img -cdrom win2k.iso -boot d -m 64
3. Run QEMU:
make qemu
OR
qemu -hda win2k.img -cdrom nttest.iso -m 64
4. To run a test, login and start cmd.exe. To run the thread test, type:
d:
hostnt thread.exe
5. If you wish to rebuild a test case, do:
make
make cdrom
To use the new ISO in QEMU, press <ALT><CTRL>2, to switch to the QEMU
console and type:
eject cdrom
You need to make windows notice that there's no disk in the drive first by.
Do this by pressing <ALT><CTRL>1, and try run the test case by up arrowing
to hostnt thread.exe then pressing <ENTER>. When you get a message box
saying "There is no disk in drive...", switch back to the console using
<ALT><CTRL>2, and type:
change cdrom nttest.iso
Then <ALT><CTRL>1 back to Windows and select "Try Again"
by up arrowing twice on the dialog and pressing enter.
Starting minitris.exe or pixels.exe on a Windows 2000 QEMU image
----------------------------------------------------------------
Assume you have a windows 2000 install on QEMU in a file named win2k.img,
you can copy minitris.exe over the winlogon.exe on there and it will run
when the image is booted.
Mount the Windows 2000 disk image (as root):
mount -o loop,offset=32256 win2k.img /mnt/
Backup winlogon.exe:
cp -i /mnt/winnt/system32/winlogon.exe /mnt/winnt/system32/_winlogon.exe
Replace winlogon.exe:
cp -i ring3k/tools/minitris.exe /mnt/winnt/system32/winlogon.exe
Unmount the Windows 2000 disk image:
umount /mnt
Run QEMU (as user, making sure you have umount'ed the image first!)
qemu -hda win2k.img