A free Windows-compatible Operating System - mirrored from GitHub
Go to file
Hermès Bélusca-Maïto 4ce819ca5a
[NTOS:KD][KDBG] Rework the BootPhase >= 2 initialization of the KD/KDBG kernel debugger. (#4892)
CORE-17470

+ KdpDebugLogInit: Add resources cleanup in failure code paths.

Fix, in an NT-compatible manner, how (and when) the KD/KDBG BootPhase >=2
initialization steps are performed.
These are necessary for any functionality KDBG needs, that would depend
on the NT I/O Manager and the storage and filesystem stacks to be running.
This includes, creating the debug log file, and for KDBG, loading its
KDBinit initialization file.

As a result, file debug logging is fixed.

The old ReactOS-specific (NT-incompatible) callback we did in the middle
of IoInitSystem() is removed, in favor of a runtime mechanism that should
work on Windows as well.

The idea for this new mechanism is loosely inspired by the TDL4 rootkit,
see http://blog.w4kfu.com/public/tdl4_article/draft_tdl4article.html
but contrary to it, a specific hook is used instead, as well as the
technique of driver reinitialization:
https://web.archive.org/web/20211021050515/https://driverentry.com.br/en/blog/?p=261

Its rationale is as follows:

We want to be able to perform I/O-related initialization (starting a
logger thread for file log debugging, loading KDBinit file for KDBG,
etc.). A good place for this would be as early as possible, once the
I/O Manager has started the storage and the boot filesystem drivers.

Here is an overview of the initialization steps of the NT Kernel and
Executive:
----
KiSystemStartup(KeLoaderBlock)
    if (Cpu == 0) KdInitSystem(0, KeLoaderBlock);
    KiSwitchToBootStack() -> KiSystemStartupBootStack()
    -> KiInitializeKernel() -> ExpInitializeExecutive(Cpu, KeLoaderBlock)

(NOTE: Any unexpected debugger break will call KdInitSystem(0, NULL); )
KdInitSystem(0, LoaderBlock) -> KdDebuggerInitialize0(LoaderBlock);

ExpInitializeExecutive(Cpu == 0):    ExpInitializationPhase = 0;
    HalInitSystem(0, KeLoaderBlock); <-- Sets HalInitPnpDriver callback.
    ...
    PsInitSystem(LoaderBlock)
        PsCreateSystemThread(Phase1Initialization)

Phase1Initialization(Discard):       ExpInitializationPhase = 1;
    HalInitSystem(1, KeLoaderBlock);
    ...
    Early initialization of Ob, Ex, Ke.
    KdInitSystem(1, KeLoaderBlock);
    ...
    KdDebuggerInitialize1(LoaderBlock);
    ...
    IoInitSystem(LoaderBlock);
    ...
----
As we can see, KdDebuggerInitialize1() is the last KD initialization
routine the kernel calls, and is called *before* the I/O Manager starts.
Thus, direct Nt/ZwCreateFile ... calls done there would fail. Also,
we want to do the I/O initialization as soon as possible. There does
not seem to be any exported way to be notified about the I/O manager
initialization steps... that is, unless we somehow become a driver and
insert ourselves in the flow!

Since we are not a regular driver, we need to invoke IoCreateDriver()
to create one. However, remember that we are currently running *before*
IoInitSystem(), the I/O subsystem is not initialized yet. Due to this,
calling IoCreateDriver(), much like any other IO functions, would lead
to a crash, because it calls
ObCreateObject(..., IoDriverObjectType, ...), and IoDriverObjectType
is non-initialized yet (it's NULL).

The chosen solution is to hook a "known" exported callback: namely, the
HalInitPnpDriver() callback (it initializes the "HAL Root Bus Driver").
It is set very early on by the HAL via the HalInitSystem(0, ...) call,
and is called early on by IoInitSystem() before any driver is loaded,
but after the I/O Manager has been minimally set up so that new drivers
can be created.
When the hook: KdpInitDriver() is called, we create our driver with
IoCreateDriver(), specifying its entrypoint KdpDriverEntry(), then
restore and call the original HalInitPnpDriver() callback.

Another possible unexplored alternative, could be to insert ourselves
in the KeLoaderBlock->LoadOrderListHead boot modules list, or in the
KeLoaderBlock->BootDriverListHead boot-driver list. (Note that while
we may be able to do this, because boot-drivers are resident in memory,
much like we are, we cannot insert ourselves in the system-driver list
however, since those drivers are expected to come from PE image files.)

Once the KdpDriverEntry() driver entrypoint is called, we register
KdpDriverReinit() for re-initialization with the I/O Manager, in order
to provide more initialization points. KdpDriverReinit() calls the KD
providers at BootPhase >= 2, and schedules further reinitializations
(at most 3 more) if any of the providers request so.
2023-03-11 01:22:19 +01:00
.github [GITHUB] Fix LLVM version for the clang-cl build (#4578) 2022-07-16 16:10:56 +03:00
.theia [GITPOD]Add gitpod config 2020-04-02 18:03:18 +02:00
base [MSPAINT] There were two "main" windows (#5147) 2023-03-11 07:42:04 +09:00
boot [BOOTDATA][INF] Add pt-PT translation (#4926) 2023-02-23 09:51:33 +09:00
dll [SYSSETUP] Tweak resources CORE-18870 2023-03-10 21:36:46 +01:00
drivers [IP] Allow 0xFFFF as Valid Network Port Number (#5074) 2023-02-18 00:11:00 +02:00
hal [HALX86] Update the PCI hardware IDs database. 2022-11-25 16:17:10 +01:00
media [TRANSLATION] Add/Update Turkish (tr-TR) translations (#4959) 2023-02-15 17:29:52 +01:00
modules [MSVCRT][CRT_APITEST] Implement _wsystem (#5032) 2023-03-05 21:01:14 +09:00
ntoskrnl [NTOS:KD][KDBG] Rework the BootPhase >= 2 initialization of the KD/KDBG kernel debugger. (#4892) 2023-03-11 01:22:19 +01:00
sdk [NTOS:KD] Add some annotations. 2023-03-09 18:32:36 +01:00
subsystems [SMSS][CSRSRV] Undefine CreateProcess symbol. Name the union inside SB_API_MSG. 2022-11-14 00:10:32 +01:00
win32ss [WINESYNC] user32/edit: Allow buffer access after EM_GETHANDLE. 2023-03-07 21:48:06 -05:00
.clang-format [REACTOS] Introduce .clang-format file 2019-12-28 01:23:49 +02:00
.editorconfig Remove the 'end_of_line' value. Addendum to 32db19f6 - PR #2528 2020-04-11 17:56:23 +02:00
.gitattributes Fix remaining text file line endings in the tree. (#18) 2017-10-06 15:00:36 +02:00
.gitignore [GIT] Add .DS_Store files to .gitignore (#4762) 2022-10-08 13:18:18 +02:00
.gitmessage [FORMATTING] Remove trailing whitespace. Addendum to 34593d93. 2021-09-13 03:52:22 +02:00
.gitpod.Dockerfile [GITPOD] change extract directory to automatically extract to RosBE, and set tar to verbose mode 2021-12-28 02:14:47 +03:00
.gitpod.yml [GITPOD]Add gitpod config 2020-04-02 18:03:18 +02:00
apistatus.lst Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
CMakeLists.txt [LOG2LINES] Compile the tool for MSVC builds 2022-12-29 16:51:40 +01:00
CODE_OF_CONDUCT.md Add a document on the rules we should follow while managing/reviewing PRs, 2018-06-24 17:00:00 +02:00
CODEOWNERS [FASTFAT] And now use the MS-open-sourced fastfat_new as our official FAT12/16/32 FS driver. 2022-10-01 01:28:19 +02:00
configure.cmd [CONFIGURE] Add support for 'Visual Studio 2022, v17.x' 2021-11-20 12:14:32 +03:00
configure.sh [CONFIGURE] Make configure.sh print out an error when CMake fails 2021-08-02 01:40:43 +03:00
CONTRIBUTING.md [CONTRIBUTING] Fix broken hash links. (#4816) 2022-10-27 16:37:16 +02:00
COPYING Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
COPYING.ARM [FORMATTING] Remove trailing whitespace. Addendum to 34593d93. 2021-09-13 03:52:22 +02:00
COPYING.LIB Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
COPYING3 Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
COPYING3.LIB Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
CREDITS [CREDITS] Add myself to the credits document (#2747) 2020-05-07 12:39:44 +02:00
Doxyfile [DOXYGEN] Update Doxyfile for our build of Doxygen 1.8.15. 2019-01-15 09:37:54 +01:00
INSTALL [REACTOS] Remove some ending spaces 2020-04-24 02:32:05 +03:00
overrides-gcc.cmake [CMAKE] Clear CMAKE_<LANGUAGE>_IMPLICIT_LINK_LIBRARIES and 2019-04-06 17:43:38 +02:00
overrides-msvc.cmake CORE-14513 [CMAKE] Remove modules that are shipped with cmake (#575) 2018-08-19 22:01:31 +02:00
PreLoad.cmake Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
PULL_REQUEST_MANAGEMENT.md Add a document on the rules we should follow while managing/reviewing PRs, 2018-06-24 17:00:00 +02:00
README.md [README] Add Discord server join link (#4352) 2022-02-16 19:04:44 +03:00
toolchain-clang.cmake [CMAKE] toolchain-clang.cmake: Use overrides-gcc.cmake 2021-12-28 01:56:33 +03:00
toolchain-gcc.cmake [CMAKE] Search the PATH for the compilers and cache the results 2022-05-25 16:34:16 +03:00
toolchain-msvc.cmake [CMAKE] Fixes for clang-cl build 2021-09-14 17:58:23 +03:00

ReactOS


ReactOS 0.4.14 Release Download ReactOS SourceForge Download License Donate Follow on Twitter

WebsiteOfficial chatWikiForumCommunity DiscordJIRA Bug TrackerReactOS Git mirrorTestman

What is ReactOS?

ReactOS™ is an Open Source effort to develop a quality operating system that is compatible with applications and drivers written for the Microsoft® Windows™ NT family of operating systems (NT4, 2000, XP, 2003, Vista, 7).

The ReactOS project, although currently focused on Windows Server 2003 compatibility, is always keeping an eye toward compatibility with Windows Vista and future Windows NT releases.

The code of ReactOS is licensed under GNU GPL 2.0.

Product quality warning

ReactOS is currently an Alpha quality operating system. This means that ReactOS is under heavy development and you have to be ready to encounter some problems. Different things may not work well and it can corrupt the data present on your hard disk. It is HIGHLY recommended to test ReactOS on a virtual machine or on a computer with no sensitive or critical data!

Building

Build rosbewin.badge rosbeunix.badge coverity.badge

To build the system it is strongly advised to use the ReactOS Build Environment (RosBE). Up-to-date versions for Windows and for Unix/GNU-Linux are available from our download page at: "Build Environment".

Alternatively one can use Microsoft Visual C++ (MSVC) version 2015+. Building with MSVC is covered here: "Visual Studio or Microsoft Visual C++".

See "Building ReactOS" article for more details.

Binaries

To build ReactOS you must run the configure script in the directory you want to have your build files. Choose configure.cmd or configure.sh depending on your system. Then run ninja <modulename> to build a module you want or just ninja to build all modules.

Bootable images

To build a bootable CD image run ninja bootcd from the build directory. This will create a CD image with a filename bootcd.iso.

You can always download fresh binary builds of bootable images from the "Daily builds" page.

Installing

By default, ReactOS currently can only be installed on a machine that has a FAT16 or FAT32 partition as the active (bootable) partition. The partition on which ReactOS is to be installed (which may or may not be the bootable partition) must also be formatted as FAT16 or FAT32. ReactOS Setup can format the partitions if needed.

Starting with 0.4.10, ReactOS can be installed using the BtrFS file system. But consider this as an experimental feature and thus regressions not triggered on FAT setup may be observed.

To install ReactOS from the bootable CD distribution, extract the archive contents. Then burn the CD image, boot from it, and follow the instructions.

See "Installing ReactOS" Wiki page or INSTALL for more details.

Testing

If you discover a bug in ReactOS search on JIRA first - it might be reported already. If not report the bug providing logs and as much information as possible.

See "File Bugs" for a guide.

NOTE: The bug tracker is not for discussions. Please use our official chat or our forum.

Contributing prwelcome.badge

We are always looking for developers! Check how to contribute if you are willing to participate.

Legal notice: If you have seen proprietary Microsoft Windows source code (including but not limited to the leaked Windows NT 3.5, NT 4, 2000 source code and the Windows Research Kernel), your contribution won't be accepted because of potential copyright violation.

Try out cloud-based ReactOS development using Gitpod and Docker:

Open in Gitpod

You can also support ReactOS by donating! We rely on our backers to maintain our servers and accelerate development by hiring full-time devs.

More information

ReactOS is a Free and Open Source operating system based on the Windows architecture, providing support for existing applications and drivers, and an alternative to the current dominant consumer operating system.

It is not another wrapper built on Linux, like WINE. It does not attempt or plan to compete with WINE; in fact, the user-mode part of ReactOS is almost entirely WINE-based and our two teams have cooperated closely in the past.

ReactOS is also not "yet another OS". It does not attempt to be a third player like any other alternative OS out there. People are not meant to uninstall Linux and use ReactOS instead; ReactOS is a replacement for Windows users who want a Windows replacement that behaves just like Windows.

More information is available at: reactos.org.

Also see the media/doc subdirectory for some sparse notes.

Who is responsible

Active devs are listed as members of GitHub organization. See also the CREDITS file for others.

Code mirrors

The main development is done on GitHub. We have an alternative mirror in case GitHub is down.

There is also an obsolete SVN archive repository that is kept for historical purposes.