Aptivi - Deprecated Manuals
ProjectsWebsiteBlog
Nitrocid KS v0.1.0 Beta 3 - Manual
Nitrocid KS v0.1.0 Beta 3 - Manual
  • 👋Welcome!
  • Versions and Compatibility
    • 🔱Supported Versions
    • 🕘EOL Versions
    • 🗞️Version Release Notes
      • ✨v0.0.1.x series
      • 🌈v0.0.2.x series
      • 👥v0.0.3.x series
      • 🛠️v0.0.4.x series
      • 🕔v0.0.5.x series
        • ⌚v0.0.5.0 Beta Versions
      • 📕v0.0.6.x series
        • 📄v0.0.6.0 Beta Versions
      • 🔌v0.0.7.x series
        • ⚡v0.0.7.0 Beta Versions
      • 🌌v0.0.8.x series
      • 💌v0.0.9.x series
      • 📜v0.0.10.x series
      • ✏️v0.0.11.x series
      • ⚙️v0.0.12.x series
      • 🌐v0.0.13.x series
      • 🏃‍♀️v0.0.14.x series
      • ⏳v0.0.15.x series
      • ⭐v0.0.16.x series
      • 🌃v0.0.17.x series
      • 🥁v0.0.18.x series
      • 🔧v0.0.19.x series
      • 🍀v0.0.20.x series
      • 🧰v0.0.21.x series
      • 📱v0.0.22.x series
      • 🖥️v0.0.23.x series
      • 👾v0.0.24.x series
      • 🔮v0.1.x.x series
        • ⚠️Known issues for 0.1.0 Beta
    • 👍Compatibility Notes for KS API Revisions
      • 🔼Upgrading from API v1.0
      • 🔼Upgrading from API v1.1
      • 🔼Upgrading from API v1.2
      • 🔼Upgrading from API v1.3
      • 🔼Upgrading from API v2.0
      • 🔼Upgrading from API v2.1
      • 🔼Upgrading to API v3.0
        • ⬆️From 0.0.24.x to 0.1.0 Beta 1
        • ⬆️From 0.1.0 Beta 1 to 0.1.0 Beta 2
        • ⬆️From 0.1.0 Beta 2 to 0.1.0 Beta 3
  • Installation and Maintenance
    • 📀Installing the Kernel
      • 💻Windows
      • 🍎macOS
      • 🐧Linux
      • 📱Android
    • ⏫Upgrading the Kernel
      • 💻Windows
      • 🍎macOS
      • 🐧Linux
      • 📱Android
    • 📦Dependency Information
  • Fundamentals
    • 🌽What is the Kernel?
    • 👾What is Nitrocid KS?
    • ⭐Simulated Kernel Features
      • 🌟Extra Features
        • 🌏More Networking
          • 🗃️FTP Client
          • 🔒SFTP Client
          • 📰RSS Client
          • 🌐HTTP Client
          • 📧Mail Client
        • 🎮Games and Amusements
          • 🔤Hangman
          • 🏇BackRace
          • ☄️Meteor
          • 🎰Russian Roulette
          • ☄️ShipDuet
          • 🐍Snaker
          • 🔢Solver
          • ⌨️SpeedPress
          • 🔠Wordle
        • 🖊️More Editors
          • 🖊️JSON Editor
          • 🗄️SQL Editor
        • 🧰Common Programs
          • 📦Archive
          • ☕Caffeine
          • 🗓️Calendar
          • 🔢Calculator
          • 👥Contacts
          • 👩‍💻Git Shell
          • 🎧Music Player
          • 🗒️Notes
          • 🔌SSH Connection
          • ⏰Stopwatch and Timer
          • ☑️To-do List
          • ⚖️Unit Converter
          • ☀️Weather
        • 🪄ChatGPT Client
        • 🖼️Docking
        • 🌏Language Studio
        • 🎨Theme Studio
      • 👤Accounts
        • 👥Groups
        • 🔓Permissions
      • ✏️Editors
        • 📝Text Editor
        • 💾Hex Editor
      • 🐚Shells
        • 📄Commands List
        • 📄Addon Commands List
      • 📂Files and Folders
      • 🌎Networking
      • 🇺🇸Languages
      • 🌌Screensavers
      • 💿Bootable Simulation
  • Advanced and Power Users
    • ⚒️Building the Kernel
      • 🪟Building on Windows
      • 🍎Building on macOS
      • 🐧Building on Linux
      • 📱Building on Android
    • 🧰Kernel Modifications
      • 🏗️Build your...
        • 🧪Your Mod
        • 🪄Your Splash
      • 📉Analyzers for Mods
      • 📈Analyzer Diagnostics
        • 📉Text - NKS0001
        • 📉ConsoleBase - NKS0002
        • 📉ConsoleBase - NKS0003
        • 📉ConsoleBase - NKS0004
        • 📉ConsoleBase - NKS0005
        • 📉ConsoleBase - NKS0006
        • 📉ConsoleBase - NKS0007
        • 📉ConsoleBase - NKS0008
        • 📉ConsoleBase - NKS0009
        • 📉Files - NKS0010
        • 📉Files - NKS0011
        • 📉Files - NKS0012
        • 📉Files - NKS0013
        • 📉Files - NKS0014
        • 📉Files - NKS0015
        • 📉Files - NKS0016
        • 📉Files - NKS0017
        • 📉Files - NKS0018
        • 📉Files - NKS0019
        • 📉Files - NKS0020
        • 📉Files - NKS0021
        • 📉Files - NKS0022
        • 📉Files - NKS0023
        • 📉Kernel - NKS0024
        • 📉Kernel - NKS0025
        • 📉Kernel - NKS0026
        • 📉Kernel - NKS0027
        • 📉Kernel - NKS0031
        • 📉Kernel - NKS0032
        • 📉Kernel - NKS0033
        • 📉Kernel - NKS0037
        • 📉Kernel - NKS0038
        • 📉Kernel - NKS0039
        • 📉Kernel - NKS0040
        • 📉Kernel - NKS0041
        • 📉Kernel - NKS0042
        • 📉Kernel - NKS0043
        • 📉Kernel - NKS0052
        • 📉Kernel - NKS0053
        • 📉Languages - NKS0044
        • 📉Languages - NKS0045
        • 📉Languages - NKS0046
        • 📉Network - NKS0051
        • 📉Text - NKS0047
        • 📉Text - NKS0048
        • 📉Text - NKS0049
        • 📉Text - NKS0050
        • 📉Text - NKS0054
        • 📉Text - NKS0055
      • 🔧Kernel Modification Management
      • 📞Inter-Mod Communication
      • 📞Inter-Addon Communication
    • 🦠Diagnostics
      • 🔬Debugging
        • 🧬Local Debugging
        • 🛰️Remote Debugging
      • 🧪Testing
      • 💉Other Diagnostics
    • ⚒️Inner Workings
      • 🔧Kernel Settings
        • ⛏️Mechanics of Settings App
        • 🔩Settings Format
        • ⚙️Custom Settings
      • 🐚Shell Structure
        • ❔Help System
        • 🗜️Command Parsing
        • 🔋Command Information
        • ⏲️Command Switch Management
        • 🎚️Command Switch Information
        • ⏳Shell History
        • 📜Shell Scripting
        • 📟Shell Presets
        • 💠Extra Shell Features
      • 🌍Multilingual Kernel
        • 🌐Custom Languages
      • 🖥️Console Manipulation
        • 🧩Console Wrappers
        • 🖥️Console Screen
      • 🖲️Console Input
        • ⌨️Interactive TUI
        • 📽️Presentation System
      • ♦️Inner Essentials
        • 🪧Kernel Placeholders
        • 🔐The Permissions
        • 👥The Users
        • 📞Kernel Threads
        • 🔌Kernel Drivers
        • 🎛️Kernel Arguments
        • 📒Kernel Journaling
        • 📡Remote Procedure
        • 🗃️Nitrocid Filesystem
        • 🌃Screensaver Internals
        • 💦Splash Internals
        • 🖥️Kernel Platform
        • 🎨Theme Internals
        • ⛱️Color Internals
        • 🔏Privacy Consents
        • 🔔System Notifications
        • ✉️MAL and MOTD
        • ⌛Progress Handlers
        • ✒️Assembly Signing
        • 🎰Random Number Generation
        • 🌍Network Tools
      • 🌀Miscellaneous APIs
  • 🧱Project Dependencies
  • Report an issue
  • Source code
  • API Reference
Powered by GitBook
On this page
  • Mods and Drivers
  • Local drivers
  • Fallback drivers
  • Current drivers
  • Driver Configuration
Edit on GitHub
  1. Advanced and Power Users
  2. Inner Workings
  3. Inner Essentials

Kernel Drivers

How the kernel drivers work and their role in the kernel

The kernel drivers allows your kernel to provide interfaces for different purposes, from console to filesystem. This is to present the kernel your implementation of different driver types. It's not a device driver, though!

The kernel drivers can be called using either the properties that point to the current driver of each driver type or the GetDriver<TResult>() function found in the DriverHandler class under the KS.Drivers namespace. These two will return an appropriate driver interface that actually allows you to call their functions that each driver of the same type implements. The types of kernel drivers are listed below:

Driver
Interface
Base
Description

Random

IRandomDriver

BaseRandomDriver

Random number generator drivers

Console

IConsoleDriver

BaseConsoleDriver

Console drivers

Network

INetworkDriver

BaseNetworkDriver

Network drivers

Filesystem

IFilesystemDriver

BaseFilesystemDriver

Filesystem drivers

Encryption

IEncryptionDriver

BaseEncryptionDriver

Encryption drivers

Regexp

IRegexpDriver

BaseRegexpDriver

Regular expression drivers

DebugLogger

IDebugLoggerDriver

BaseDebugLoggerDriver

Debug logger drivers

Encoding

IEncodingDriver

BaseEncodingDriver

Encoding drivers

HardwareProber

IHardwareProberDriver

BaseHardwareProberDriver

Hardware probing drivers

Sorting

ISortingDriver

BaseSortingDriver

Integer sorting drivers

Input

IInputDriver

BaseInputDriver

Input drivers

Mods and Drivers

Your kernel modifications should reference local versions of driver properties, like CurrentConsoleDriverLocal, unless it's not possible.

Each driver contains its own interface containing its own method definitions and their signatures. These interfaces are the ones that you must implement with your mod. The most basic interface for the kernel drivers is IDriver found in the same namespace, which is implemented by the driver-specific interfaces.

The final driver class implementation must implement both the base driver-specific base class and its interface, such as:

internal class Terminal : BaseConsoleDriver, IConsoleDriver

IsBuiltin() only returns true if the driver is found in the built-in driver list. IsRegistered(), however, returns true if the driver is either built-in or found in the custom drivers list.

If you have a kernel driver that you wish to register, you'll have to register the kernel driver, passing it the IDriver interface for your driver and the appropriate type. You can use the RegisterDriver() function to perform this operation, but you should set the current driver to your driver for the target wrappers, like the methods found in the KS.Files namespace that call the current filesystem driver, using the SetDriverSafe<T>() function.

The SetDriver<T>() function can be used, but doesn't prevent you from using internal drivers. We advice you to use the SetDriverSafe<T>() function instead.

Be sure to unregister your driver with the UnregisterDriver() function, or your driver will not get updated in the list of kernel drivers!

Local drivers

If you want to temporarily to use a driver without affecting the entire kernel and its configuration, you can use this feature to temporarily switch drivers of supported types.

Assuming that your mod uses local drivers to do their actions, like CurrentConsoleDriverLocal, you must use the following functions in order:

  • BeginLocalDriverSafe<T>(): This notifies the kernel that the mod is going to use the provided driver temporarily.

  • EndLocalDriver<T>(): This notifies the kernel that the mod is done with the temporary driver.

Where T is the interface type of the driver found in the above table at the start of this page.

The BeginLocalDriver<T>() function can be used, but doesn't prevent you from using internal drivers. We advice you to use the BeginLocalDriverSafe<T>() function instead.

Be sure to execute the two above functions in the order specified above. Forgetting to call EndLocalDriver<T>() after you're done with the driver can cause the kernel to think that the mod is going to use your local driver forever.

Fallback drivers

Additionally, the driver management API provides you an easy way to get the default driver that the kernel declares. You can use the below functions:

  • DriverHandler.GetFallbackDriver<TDriverInterfaceType>()

    • This returns an instance of the default driver that the kernel initialized before drivers get set by the config reader.

  • DriverHandler.GetFallbackDriverName<TDriverInterfaceType>()

    • This returns the actual driver name grabbed from the dictionary.

Don't confuse the name given by the GetDriverName() and its siblings with the name from the driver instance.

Current drivers

If you have a driver interface type or the driver type from the DriverTypes enumeration, you can request for a current driver either from the available properties or from the GetCurrentDriver() and GetCurrentDriverLocal() functions.

var currentDriver = DriverHandler.GetCurrentDriver(driverType);
  • GetCurrentDriver() returns the current driver that's used by the kernel

  • GetCurrentDriverLocal() returns the current local driver set by BeginLocalDriver<T>() or its safe sibling function.

For all the driver management functions, you can also use the non-generic versions where they ask for a DriverTypes value in their first argument.

Driver Configuration

The settings application now lets you set your system-wide kernel drivers up in a completely new section called Kernel driver settings. It lets you configure current drivers for each supported driver type.

In order to configure your driver, select one of the driver types from the settings section shown above by pressing ENTER, and select your driver.

Like all other settings, you must save your kernel settings to apply your changes across reboots.

Last updated 1 year ago

⚒️
♦️
🔌