Windows Research Kernel (WRK) Documentation

repository·master·Indexed 21 days ago

https://github.com/ayyucedemirbas/windows-research-kernel-wrk-

Source code and build instructions for the core Windows (NTOS) kernel, supporting x86 and amd64 architectures. Includes guidance on installation via WRKCopy.bat, environment configuration for WinDbg, and building the kernel using batch files, nmake, or Visual Studio 2008. Provides a detailed map of the NTOS source organization, covering components such as the virtual memory manager, I/O manager, and scheduler.

Tokens
2.1K
Snippets
10
Records
14
Agent score
68%

What's inside Windows Research Kernel (WRK)

  1. Understand the <arch> parameter and architecture switching

    master

    The batch files Build.bat, Rebuild.bat, Clean.bat, WRKEnv.bat, and WRKDebug.bat all accept a single parameter for the target architecture: x86 or amd64.

    Important Constraints:

    • Default: If no parameter is provided, the default architecture is x86.
    • Persistence: Once the target architecture is defined in a console window, it cannot be changed within that same session. The <arch> parameter will be ignored in subsequent calls in that window.
    • Switching Architectures: To work with a different architecture (e.g., switching from x86 to amd64), you must open a new console window.
    • Verification: The title of the console window will change to WRK x86 or WRK amd64 once the environment is set.
  2. Understand the <arch> parameter for WRK batch files

    master

    The batch files Build.bat, Rebuild.bat, Clean.bat, WRKEnv.bat, and WRKDebug.bat all accept a single parameter for the target architecture: x86 or amd64.

    Important Behaviors:

    • Default: If no parameter is provided, the default architecture is x86.
    • Persistence: Once the target architecture is defined in a console window (either explicitly or by default), it cannot be changed in that same window. The <arch> parameter will be ignored for subsequent calls in that session.
    • Verification: The window title will change to WRK x86 or WRK amd64 to indicate the active architecture.
    • Switching Architectures: To work with a different architecture, you must open a new console window.
  3. Build WRK from the command line

    master

    You can build the kernel using batch files or nmake.

    Using Batch Files

    1. Open a console window and switch to the WRK directory.
    2. Run one of the following commands, specifying the target architecture (x86 or amd64):
      Build <arch>
      Rebuild <arch>
      Clean <arch>

    Using nmake

    1. Open a console window and switch to the WRK directory.
    2. Run WRKEnv <arch> to set the environment.
    3. Switch to the base\ntos directory.
    4. Run the following command:
      nmake %wrkarch%=
    Build x86
    # or
    Build amd64
  4. Configure the WRK environment

    master

    Before building, you must ensure the environment batch file points to the correct WinDbg installation directory.

    1. Open a console window and switch to the directory where WRK was copied.
    2. Run Notepad WRKEnv.bat.
    3. Locate the set path=... statement.
    4. Ensure the path contains the directory where WinDbg is installed. (The default is C:\Program Files\Debugging Tools for Windows).
    5. Save and exit Notepad.
    Notepad WRKEnv.bat
  5. Build the WRK kernel

    master

    The WRK can be built using the command line (via batch files or nmake) or through Visual Studio 2008.

    Command Line (Batch Files)

    1. Open a console window and navigate to the WRK directory.
    2. Run one of the following commands, specifying the target architecture (x86 or amd64):
      • Build <arch>
      • Rebuild <arch>
      • Clean <arch>

    Command Line (nmake)

    1. Open a console window and navigate to the WRK directory.
    2. Run WRKEnv <arch> to set the environment.
    3. Change directory to base\ntos.
    4. Run nmake %wrkarch%=.

    Visual Studio 2008

    1. Open the solution file: <WRK_DIR>\WRK.sln.
    2. Set the configuration to amd64/Win32 or x86/Win32 as appropriate.
    3. Select Build > Build Solution (or Rebuild / Clean).
    Build x86
    # or
    Build amd64
  6. Copy WRK to your machine

    master

    You can copy the Windows Research Kernel (WRK) using a batch script or manual file transfer.

    Option 1: Using WRKCopy.bat

    1. Open a console window.
    2. Switch to the DVD drive.
    3. Navigate to \Resources\Windows_Research_Kernel\Get_WRK\.
    4. Run the following command:
      WRKCopy.bat /w <destination_directory>
      Note: If you run WRKCopy.bat without parameters, it defaults to C:\WRK-v1.2\.

    Option 2: Manual Copy

    1. Create a destination directory on your hard drive using Windows Explorer.
    2. Navigate to \Resources\Windows_Research_Kernel\Get_WRK\WRK-v1.2\ on the DVD.
    3. Select all files and subdirectories and drag and drop them into your destination directory.
    WRKCopy.bat /w <destination_directory>
  7. Copy the Windows Research Kernel (WRK) to your machine

    master

    You can copy the WRK source code to your local machine using a batch script or manually via Windows Explorer.

    Using WRKCopy.bat

    1. Open a console window.
    2. Navigate to the DVD drive.
    3. Change directory to \Resources\Windows_Research_Kernel\Get_WRK\.
    4. Run the copy command:
      • To copy to a specific directory: WRKCopy.bat /w <destination_directory>
      • To copy to the default location (C:\WRK-v1.2\): WRKCopy.bat

    Manual Copy

    1. Create a destination directory on your hard drive.
    2. Navigate to \Resources\Windows_Research_Kernel\Get_WRK\WRK-v1.2\ on the DVD.
    3. Select all files and subdirectories and drag and drop them into your destination directory.
    WRKCopy.bat /w <destination_directory>
  8. Install the Windows Research Kernel via WRKCopy.bat

    master

    You can install the Windows Research Kernel using the WRKCopy.bat script.

    Default Installation: Double-clicking WRKCopy.bat will install the kernel into the default directory: C:\WRK-v1.2\.

    Custom Installation: To specify a different destination directory, run the batch file from a console window using the /w option followed by your desired path.

    Manual Installation: Alternatively, you can bypass the script by manually dragging and dropping the WRK-v1.2 folder (or its contents) into your preferred destination directory.

    # Example: Installing to a custom directory C:\TMP\MyWRK
    E:\Resources\Windows_Research_Kernel\Get_WRK\WRKCopy /w C:\TMP\MyWRK
  9. Start the Windows Debugger (WinDbg) for WRK

    master

    You can launch the debugger from the command line using WRK-specific batch files.

    Using WRKDebug

    1. Open a console window and navigate to the WRK directory.
    2. Run WRKDebug <arch> (where <arch> is x86 or amd64).

    Using WRKEnv and WinDbg directly

    1. Open a console window and navigate to the WRK directory.
    2. Run WRKEnv <arch>.
    3. Run WinDbg %windbgargs%.
    WRKDebug amd64
  10. Configure the WRK environment and WinDbg path

    master

    Before building, you must ensure the WRKEnv.bat file points to your WinDbg installation directory.

    1. Open a console window and navigate to the directory where WRK was copied.
    2. Run Notepad WRKEnv.bat.
    3. Locate the set path=... statement.
    4. Ensure it contains the directory where WinDbg is installed. (The default is C:\Program Files\Debugging Tools for Windows).
    5. Save and exit Notepad.
    Notepad WRKEnv.bat