Html документация по windows research kernel

Windows Research Kernel

Содержание

Что такое Windows Research Kernel?

Windows Research Kernel (WRK) — исходный код ядра ОС Windows (Windows XP x64 и Windows Server 2003 SP1), распространяемый для некоммерческих, исследовательских целей в рамках «Windows Academic Program» под НЕ СВОБОДНОЙ лицензией (где пруфлинк?). Как следствие, этот код не может быть использован в процессе разработки ReactOS (т.е. разработчики никогда не смотрели этот код и не планируют этого делать, пока не изменятся условия лицензирования WRK)

WRK предназначен для факультетов и преподавателей, работающих в области операционных систем, для разработчиков курсов, авторов учебников и т.д., желающих включить информацию о ядре Windows, основанную на действующем исходном коде. WRK содержит среду для сборки/тестирования и бинарные файлы для исключённых компонентов исходного кода, которые могут быть использованы, чтобы собрать полнофункциональные NTOS ядра для последующей установки на Windows Server 2003 для x86/x64 и Windows XP x64.

Ниже информация из лекции «Исследовательское ядро Windows» курса «Введение во внутреннее устройство Windows» от Intuit.ru.

Windows Academic Program

В 2006 году корпорация Microsoft в рамках академической программы Windows (Windows Academic Program) сделала доступной для академических организаций исходный код исследовательского ядра Windows (Windows Research Kernel, WRK). WRK основано на коде операционных систем Windows Server 2003 SP1 и Windows XP x64.

Кроме WRK в академическую программу Microsoft входят следующие компоненты:

  • учебные материалы по курсу операционных систем на основе Windows XP – Windows Internals Curriculum Resource Kit (CRK). Составлены в соответствии с рекомендациями ACM/IEEE по преподаванию курса «Операционные системы» (Operating systems, OS). Материалы включают презентации лекций, указания к лабораторным работам (в том числе лабораторные работы для Windows 7), задания, тесты, а также материалы для преподавателей (Instructor Supplement);
  • среда ProjectOZ для экспериментального исследования ядра Windows;
  • описание опыта университетов (Faculty Experiences) по преподаванию в рамках академической программы Microsoft.

Все компоненты Windows Academic Program, кроме WRK и материалов для преподавателей (Instructor Supplement), доступны любому желающему. WRK и Instructor Supplement можно получить, подтвердив свой статус преподавателя или по подписке Microsoft Developer Network Academic Alliance (MSDN AA).

Microsoft, предоставляя академическому сообществу исходные коды ядра Windows, преследовало следующие цели:

  • облегчить студентам и преподавателям сравнение Windows с другими операционными системами;
  • предоставить студентам возможность для изучения исходных кодов ядра и создания собственных проектов на их основе;
  • поддержать исследования и публикации по внутреннему устройству Windows;
  • содействовать разработке учебников по операционным системам на основе ядра Windows;
  • упростить лицензирование.

Исследовательское ядро Windows включает более 800 000 строк исходного кода, в основном на языке программирования C, но есть файлы и на ассемблере. В процессе подготовки к опубликованию исходный код в некоторых местах был упрощен, а комментарии улучшены.

На следующем рисунке представлена схема, отражающая покрытие исходным кодом WRK компонентов ядра.

Рис.1. Покрытие исходным кодом WRK компонентов ядра (выделено серым цветом)

Как видно из рисунка, исходные коды практически всех компонентов исполнительной системы (кроме диспетчера Plug-and-Play и диспетчера электропитания) и ядра представлены в WRK.

Структура Windows Research Kernel

В состав WRK, кроме собственно исходных кодов ядра Windows, входят руководство по ядру Windows NT (NT OS/2 Design Workbook) и решение (solution) Visual Studio 2008 (WRK.sln) (которое можно преобразовать для более новых версий Visual Studio).

Руководство по ядру Windows NT было составлено в конце 1980 х – начале 1990 х гг., когда в Microsoft велась разработка новой операционной системы Windows NT с рабочим названием «NT OS/2» сначала совместно с IBM, затем самостоятельно. Руководство содержит ценную информацию по структуре и функциям ядра Windows, а также раскрывает соображения, которые привели разработчиков к тем или иным архитектурным решениям.

Главные компоненты WRK находятся в папке WRK-v1.2\base\ntos и включают, в основном описания и определения функций и структур данных. В ядре Windows при именовании функций используются определенные соглашения [5; 2]. Название функции обычно строится по следующей схеме:

Читайте также:  Где расположены заставки windows

где обозначает модуль, которому принадлежит функция, – действие, совершаемое над .

Например, рассмотрим функцию KeStartThread:

  • Ke (префикс) – функция входит в состав ядра;
  • Start (операция) – функция начинает выполнение объекта;
  • Thread (объект) – объектом является поток.
Компонент WRK Префикс функций Название компонента на англ. языке Название компонента на русском языке
cache Cc Cache manager диспетчер кэша
config Cm Configuration manager диспетчер конфигурации
dbgk Dbgk Debugging Framework подсистема отладки
ex Ex Executive support routines функции поддержки исполнительной системы – синхронизация, таймеры, структуры данных исполнительной системы, системная информация
fsrtl FsRtl File system driver run-time library библиотека функций поддержки файловой системы времени выполнения
io Io Input/Output manager диспетчер ввода-вывода
ke Ke Kernel ядро
lpc Lpc Local Procedure Call механизм вызова локальных процедур
mm Mm Memory manager диспетчер памяти
ob Ob Object manager диспетчер объектов
perf Perf Performance функции для сбора информации о производительности системы
ps Ps Process manager диспетчер процессов
raw Raw Raw File System функции для Raw File System
rtl Rtl Run-Time Library библиотека функций времени выполнения
se Se Security manager диспетчер безопасности
wmi Wmi Windows Management Instrumentation поддержка WMI – инструментальные средства управления Windows

Компоненты WRK и префиксы функций

Кроме перечисленных в таблице, в WRK есть ещё два важных компонента:

  • inc – общедоступные заголовочные файлы;
  • init – функции инициализации системы.

Приведем ещё один префикс часто встречающихся в WRK функций – Nt. Функции ядра с этим префиксом входят в Native API, они экспортируются Ntdll.dll, их можно вызывать из пользовательского режима. Часто функции с префиксом Nt соответствует WinAPI функция, и, например, при вызове WinAPI функции CreateProcess происходит вызов функции NtCreateProcess.

HTML документация по WRK

В Институте программной инженерии Хассо Платтнера Университета г. Потсдама (Hasso-Plattner-Institute for Software Engineering at University Potsdam) Александром Шмидтом (Alexander Schmidt) и Михаэлем Шёбелем (Michael Schobel) была создана HTML документация по WRK с использованием генератора документации Phoenix Cross Reference (PXR)2 . Данная документация доступна для преподавателей по следующей ссылке:

HTML документация по WRK включает 4 раздела: функции (functions), типы данных (types), синонимы (typedefs) и макросы (macros).

По информации, предоставляемой HTML документацией, WRK содержит 4167 функций и 1957 типов данных.

Html документация по windows research kernel

Windows Research Kernel Source Code

Copyright (c) Microsoft Corporation. All rights reserved.

You may only use this code if you agree to the terms of the Windows Research Kernel Source Code License agreement (see License.txt). If you do not agree to the terms, do not use the code.

The Windows Research Kernel v1.2 contains the sources for the core of the Windows (NTOS) kernel and a build environment for a kernel that will run on x86 (Windows Server 2003 Service Pack 1) and amd64 (Windows XP x64 Professional) A future version may also support booting WRK kernels on Windows XP x86 systems, but the current kernels will fail to boot due to differences in some shared structures.

The NTOS kernel implements the basic OS functions for processes, threads, virtual memory and cache managers, I/O management, the registry, executive functions such as the kernel heap and synchronization, the object manager, the local procedure call mechanism, the security reference monitor, low-level CPU management (thread scheduling, Asynchronous and Deferred Procedure calls, interrupt/trap handling, exceptions), etc.

The NT Hardware Abstraction Layer, file systems, network stacks, and device drivers are implemented separately from NTOS and loaded into kernel mode as dynamic libraries. Sources for these dynamic components are not included in the WRK, but some are available in various development kits published by Microsoft, such as the Installable File System (IFS) Kit and the Windows Driver Development Kit (DDK).

WRK v1.2 includes most of the NTOS kernel sources from the latest released version of Windows, which supports the AMD64 architecture on the Desktop. The kernel sources excluded from the kit are primarily in the areas of plug-and-play, power management, the device verifier, kernel debugger interface, and virtual dos machine. The primary modifications to WRK from the released kernel are related to cleanup and removal of server support, such as code related to the Intel IA64.

Читайте также:  История современной ос windows начинается с

Organization of the WRK sources

The file License.txt contains the license covering use of the WRK.

The public\ directory contains a number of include files shared among system components. base\ntos\ contains the NTOS sources.

The primary NTOS source components included in the WRK are organized as follows:

Copying and building the WRK

WRK can be built on Windows Server 2003 or later, or on Windows XP or later.

To copy WRK to your machine:

  • open a console window;
  • switch to DVD;
  • switch to \Resources\Windows_Research_Kernel\Get_WRK;
  • run WRKCopy.bat /w (if you run WRKCopy.bat without parameters, WRK will be copied to C:\WRK-v1.2); ALTERNATIVELY
  • open Windows Explorer (MyComputer);
  • create the destination directory on your hard drive;
  • switch to DVD;
  • navigate to \Resources\Windows_Research_Kernel\Get_WRK\WRK-v1.2;
  • select all files and subdirectories, drag and drop them to the destination directory.

To adjust the WRK environment setting batch file:

  • open console window;
  • switch to the directory WRK was copied to;
  • run Notepad WRKEnv.bat;
  • make sure the «set path=. » statement contains the directory WinDbg was installed to; (unchanged WRKEnv.bat refers to default directory C:\Program Files\Debugging Tools for Windows);
  • save the file and exit Notepad.

To build WRK from command line:

  • open console window;
  • switch to the directory WRK was copied to;
  • run Build (or Rebuild or Clean ), see note about below; ALTERNATIVELY
  • open console window;
  • switch to the directory WRK was copied to;
  • run WRKEnv , see note about below;
  • switch to base\ntos;
  • run nmake %wrkarch%=

To build WRK in Visual Studio 2008 environment:

  • start VS2008;
  • open solution \WRK.sln, where is the directory WRK was copied to;
  • make sure the configuration is amd64/Win32 or x86/Win32, as is appropriate;
  • select Build/Build Solution (or Rebuild Solution, or Clean Solution).

To start Windows Debugger from command line:

  • open console window;
  • switch to the directory WRK was copied to;
  • run WRKDebug , see note about below; ALTERNATIVELY
  • open console window;
  • switch to the directory WRK was copied to;
  • run WRKEnv , see note about below;
  • run WinDbg %windbgargs%

Batch files Build.bat, Rebuild.bat, Clean.bat, WRKEnv.bat and WRKDebug.bat take one parameter – target architecture, which is x86 or amd64.

For the first use of either of these batch files, default target architecture is x86.

Once the target architecture was defined (explicitly or by default), it cannot be changed for current console window, and parameter of the batch files is ignored.

The title of the window where the WRK environment has been set to some target architecture changes to “WRK x86” or “WRK amd64”.

To work with different target architecture, open another console window.

Copyright (c) Microsoft Corporation. All rights reserved.

You may only use this code if you agree to the terms of the Windows Research Kernel Source Code License agreement (see License.txt). If you do not agree to the terms, do not use the code.

The Windows Research Kernel v1.2 contains the sources for the core of the Windows (NTOS) kernel and a build environment for a kernel that will run on x86 (Windows Server 2003 Service Pack 1) and amd64 (Windows XP x64 Professional) A future version may also support booting WRK kernels on Windows XP x86 systems, but the current kernels will fail to boot due to differences in some shared structures.

The NTOS kernel implements the basic OS functions for processes, threads, virtual memory and cache managers, I/O management, the registry, executive functions such as the kernel heap and synchronization, the object manager, the local procedure call mechanism, the security reference monitor, low-level CPU management (thread scheduling, Asynchronous and Deferred Procedure calls, interrupt/trap handling, exceptions), etc.

Читайте также:  Windows не может открыть общий доступ принтеру

The NT Hardware Abstraction Layer, file systems, network stacks, and device drivers are implemented separately from NTOS and loaded into kernel mode as dynamic libraries. Sources for these dynamic components are not included in the WRK, but some are available in various development kits published by Microsoft, such as the Installable File System (IFS) Kit and the Windows Driver Development Kit (DDK).

WRK v1.2 includes most of the NTOS kernel sources from the latest released version of Windows, which supports the AMD64 architecture on the Desktop. The kernel sources excluded from the kit are primarily in the areas of plug-and-play, power management, the device verifier, kernel debugger interface, and virtual dos machine. The primary modifications to WRK from the released kernel are related to cleanup and removal of server support, such as code related to the Intel IA64.

Organization of the WRK sources

The file License.txt contains the license covering use of the WRK.

The public\ directory contains a number of include files shared among system components. base\ntos\ contains the NTOS sources.

The primary NTOS source components included in the WRK are organized as follows:

Copying and building the WRK

WRK can be built on Windows Server 2003 or later, or on Windows XP or later.

To copy WRK to your machine:

  • open a console window;
  • switch to DVD;
  • switch to \Resources\Windows_Research_Kernel\Get_WRK;
  • run WRKCopy.bat /w (if you run WRKCopy.bat without parameters, WRK will be copied to C:\WRK-v1.2); ALTERNATIVELY
  • open Windows Explorer (MyComputer);
  • create the destination directory on your hard drive;
  • switch to DVD;
  • navigate to \Resources\Windows_Research_Kernel\Get_WRK\WRK-v1.2;
  • select all files and subdirectories, drag and drop them to the destination directory.

To adjust the WRK environment setting batch file:

  • open console window;
  • switch to the directory WRK was copied to;
  • run Notepad WRKEnv.bat;
  • make sure the «set path=. » statement contains the directory WinDbg was installed to; (unchanged WRKEnv.bat refers to default directory C:\Program Files\Debugging Tools for Windows);
  • save the file and exit Notepad.

To build WRK from command line:

  • open console window;
  • switch to the directory WRK was copied to;
  • run Build (or Rebuild or Clean ), see note about below; ALTERNATIVELY
  • open console window;
  • switch to the directory WRK was copied to;
  • run WRKEnv , see note about below;
  • switch to base\ntos;
  • run nmake %wrkarch%=

To build WRK in Visual Studio 2008 environment:

  • start VS2008;
  • open solution \WRK.sln, where is the directory WRK was copied to;
  • make sure the configuration is amd64/Win32 or x86/Win32, as is appropriate;
  • select Build/Build Solution (or Rebuild Solution, or Clean Solution).

To start Windows Debugger from command line:

  • open console window;
  • switch to the directory WRK was copied to;
  • run WRKDebug , see note about below; ALTERNATIVELY
  • open console window;
  • switch to the directory WRK was copied to;
  • run WRKEnv , see note about below;
  • run WinDbg %windbgargs%

Batch files Build.bat, Rebuild.bat, Clean.bat, WRKEnv.bat and WRKDebug.bat take one parameter – target architecture, which is x86 or amd64.

For the first use of either of these batch files, default target architecture is x86.

Once the target architecture was defined (explicitly or by default), it cannot be changed for current console window, and parameter of the batch files is ignored.

The title of the window where the WRK environment has been set to some target architecture changes to “WRK x86” or “WRK amd64”.

To work with different target architecture, open another console window.

Оцените статью
Adblock
detector