1999-01-17 17:17:09 +00:00
|
|
|
* Introduction
|
|
|
|
|
|
|
|
Having successfully built ReactOS and been amazed by what it does, you're
|
|
|
|
now desperate to fill in some of the omissions, this document shows you how.
|
|
|
|
|
|
|
|
* Prerequisites
|
|
|
|
|
|
|
|
A working knowledge of NT driver development is useful for understanding the
|
|
|
|
kernel and some of its abstractions. The NT4 ddk is available for free
|
|
|
|
download from http://www.microsoft.com/hwdev/. The Windows 98 and Windows
|
|
|
|
2000 DDKs are also available but the NT4 one is the most useful. See
|
|
|
|
Legal Stuff below however.
|
|
|
|
|
|
|
|
There are a number of books on NT driver development, I would recommend
|
|
|
|
'Windows NT Device Driver Development' (http://www.osr.com/book/) since OSR
|
|
|
|
seem to know their stuff. There is only one book on NT filesystem
|
|
|
|
development 'Windows NT File System Internals'. Please don't buy any of
|
2021-09-13 01:33:14 +00:00
|
|
|
these books unless you need to, and can afford it.
|
1999-01-17 17:17:09 +00:00
|
|
|
|
2021-09-13 01:33:14 +00:00
|
|
|
These mailing lists and newsgroups are useful for NT internals related
|
1999-01-17 17:17:09 +00:00
|
|
|
questions,
|
2021-09-13 01:33:14 +00:00
|
|
|
ntfsd@atria.com, ntdev@atria.com
|
1999-01-17 17:17:09 +00:00
|
|
|
(subscribe by email to majordomo@atria.com)
|
|
|
|
comp.os.????
|
|
|
|
microsoft.public.????
|
2021-09-13 01:33:14 +00:00
|
|
|
|
1999-01-17 17:17:09 +00:00
|
|
|
* Style
|
|
|
|
|
2006-06-11 21:05:25 +00:00
|
|
|
There is a coding style used for ReactOS, it's described in a ReactOS's Wiki
|
2023-02-06 14:01:52 +00:00
|
|
|
page called Coding Style: https://reactos.org/wiki/index.php/Coding_Style
|
2006-06-11 21:05:25 +00:00
|
|
|
|
|
|
|
However, not all codebase complies with the rules outlined in that page, so
|
|
|
|
if you need to hack some code which has not been yet formatted, it's wise
|
|
|
|
to keep the kind of formatting it already has, to make it looking good until
|
|
|
|
it receives a formatting patch.
|
1999-01-17 17:17:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
* Debugging
|
|
|
|
|
|
|
|
Debugging kernel-mode code is tricky, these are some snippets
|
|
|
|
|
|
|
|
DbgPrint writes a message to the console using a printf style format
|
|
|
|
string. The DPRINT macro (defined in internal/debug.h) expands to
|
|
|
|
DbgPrint unless NDEBUG is defined, this is useful for having copious
|
|
|
|
output from a module only when a problem is being debugging. DPRINT
|
|
|
|
also prefixes the message with the file and line number to make it
|
|
|
|
easier to see where output is coming from. DbgPrint can be used at any
|
|
|
|
point including in interrupt handlers.
|
2021-09-13 01:33:14 +00:00
|
|
|
|
2000-01-17 21:02:50 +00:00
|
|
|
There are options in ntoskrnl/kd/kdebug.c for copying DbgPrint output
|
1999-10-16 21:10:23 +00:00
|
|
|
to a serial device or bochs logging port (parallel support should also
|
|
|
|
be added). This can be useful if a lot of output is being generated.
|
2021-09-13 01:33:14 +00:00
|
|
|
|
1999-01-17 17:17:09 +00:00
|
|
|
It should be possible to include support for debugging the kernel with
|
|
|
|
gdb over a serial line. Bochs (a shareware CPU emulator) is also useful
|
|
|
|
for debugging the kernel, I wrote some patches to allow capture of console
|
|
|
|
output from within bochs to file and for debugging a kernel running
|
2021-09-13 01:33:14 +00:00
|
|
|
under bochs with gdb. Contact me (welch@cwcom.net) if you're are
|
1999-01-17 17:17:09 +00:00
|
|
|
interested.
|
2021-09-13 01:33:14 +00:00
|
|
|
|
1999-01-17 17:17:09 +00:00
|
|
|
If CPU reports an exception not handled by the kernel (any page fault
|
2021-09-13 01:33:14 +00:00
|
|
|
not part of virtual memory support or any other exception) the kernel
|
1999-01-17 17:17:09 +00:00
|
|
|
will display output like this and halt
|
2021-09-13 01:33:14 +00:00
|
|
|
|
1999-01-17 17:17:09 +00:00
|
|
|
General Protection Fault Exception: 13(0)
|
|
|
|
CS:EIP xxxxxxxx:xxxxxxx
|
|
|
|
DS xxxx ES xxxx FS xxxx GS xxxxx
|
|
|
|
EAX: xxxx EBX: xxxx
|
|
|
|
....
|
|
|
|
EDI: xxxx EFLAGS: xxxx ESP: xxxx
|
|
|
|
cr2: xxxx
|
|
|
|
Stack: xxxx xxxx xxxx ...
|
|
|
|
....
|
|
|
|
Frames: xxxx xxxx xxxx ...
|
|
|
|
....
|
2021-09-13 01:33:14 +00:00
|
|
|
|
1999-01-17 17:17:09 +00:00
|
|
|
The fault type will usually be either 'General Protection' or
|
|
|
|
'Page Fault', see your Intel manual for the more exotic types. The
|
|
|
|
'EIP' number is the address of the faulting instruction. If the 'CS'
|
|
|
|
number is 0x20 then the exception occured in kernel mode, if it is 0x11
|
|
|
|
then the exception occurred in user mode. 'cr2' is the address that the
|
2021-09-13 01:33:14 +00:00
|
|
|
faulting instruction was trying to access, if the exception was a page
|
1999-01-17 17:17:09 +00:00
|
|
|
fault. The number printed after 'Frames' are any addresses on the stack
|
2021-09-13 01:33:14 +00:00
|
|
|
that look like function addresses.
|
|
|
|
|
|
|
|
|
1999-01-17 17:17:09 +00:00
|
|
|
If the kernel detects a serious problem that it will bug check, displaying
|
|
|
|
output like this
|
2021-09-13 01:33:14 +00:00
|
|
|
|
1999-01-17 17:17:09 +00:00
|
|
|
Bug detected (code x, param x x x x)
|
|
|
|
Frames: xxx xxxx xxxx
|
|
|
|
....
|
2021-09-13 01:33:14 +00:00
|
|
|
|
1999-01-17 17:17:09 +00:00
|
|
|
Again the numbers printed after 'Frames' are any addresses on the stack
|
|
|
|
that look like function addresss. Usually the kernel will also print a
|
|
|
|
message describing the problem in more detail, the bug check code isn't
|
2021-09-13 01:33:14 +00:00
|
|
|
very useful at the moment.
|
|
|
|
|
1999-01-17 17:17:09 +00:00
|
|
|
* Contacts
|
|
|
|
|
|
|
|
There is a mailing list for kernel development,
|
2021-09-13 01:33:14 +00:00
|
|
|
|
2006-06-11 21:05:25 +00:00
|
|
|
ros-dev@reactos.org
|
2021-09-13 01:33:14 +00:00
|
|
|
|
|
|
|
The main developers use a svn account to coordinate changes, ask
|
2006-06-11 21:05:25 +00:00
|
|
|
Aleksey (aleksey@reactos.org) for an account if you are going to be
|
|
|
|
adding a lot of code. Smaller patches can go to the mailing list or to the
|
1999-01-17 17:17:09 +00:00
|
|
|
relevant developer (usually the comment at the top of a module will have
|
|
|
|
an email address). Regular snapshots are made available for download,
|
|
|
|
see the mailing list for announcements.
|
2021-09-13 01:33:14 +00:00
|
|
|
|
1999-01-17 17:17:09 +00:00
|
|
|
* Legal stuff
|
|
|
|
|
|
|
|
The ReactOS project is GPL'ed, please make sure any code submitted is
|
2021-09-13 01:33:14 +00:00
|
|
|
compatible with this.
|
|
|
|
|
1999-01-17 17:17:09 +00:00
|
|
|
The NT4 ddk license agreement allows its usage for developing nt drivers
|
|
|
|
only. Legally therefore it can not be used to develop ReactOS, neither the
|
|
|
|
documentation or the sample code. I'm not a lawyer, but I doubt the
|
2021-09-13 01:33:14 +00:00
|
|
|
effiacy of 'shrinkwrap licenses' particularly on freely downloadable
|
1999-01-17 17:17:09 +00:00
|
|
|
software. The only precendent I know of, in a Scottish court, didn't
|
|
|
|
upload this type of license.
|
2021-09-13 01:33:14 +00:00
|
|
|
|
1999-01-17 17:17:09 +00:00
|
|
|
Also the 'fair use' section of copyright law allows the 'quoting' of small
|
|
|
|
sections from copyrighted documents, e.g. Windows API or DDK documentation
|