8000 GitHub - oopsmishap/KTL: Kernel Template Library: STL-style containers and tools for Windows kernel space programming
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
/ KTL Public

Kernel Template Library: STL-style containers and tools for Windows kernel space programming

License

Notifications You must be signed in to change notification settings

oopsmishap/KTL

Repository files navigation

KTL

Kernel Template Library is open-source library providing CRT environment, STL-style containers and RAII tools for Windows Kernel programming.

Credits

Features

  • C Runtime environment

    • Exception handling mechanism (now for x64 only)
    • Buffer security checks
    • C++ Standard compatible termination if execution is run out of control
    • Construction and destruction of the non-trivial static objects
    • Memory allocation using new and delete
    • Filesystem Mini-Filter support routines
  • C++ Standard Library implementation

    • <atomic> (now for x86 and x64 only)
    • Optimized, C++ Standard compatible <algorithm> library
    • <allocator> with standard allocators for different pool types
    • Boost-based implementation of the compressed_pair
    • Exceptions objects hierarchy (std::exception analog optimized for use in the kernel)
    • Iterators
    • MSVC-intrinsic-based coroutines
    • Mutexes, events and condition variables based on kernel synchronization primitives with RAII wrappers
    • Smart pointers (unique_ptr, shared_ptr and weak_ptr, intrusive_ptr)
    • <type_traits>
    • <thread> for managing driver-dedicated threads
    • <tuple>
    • <optional> with constexpr support
    • unordered_node_map, unordered_node_set, unordered_flat_map and unordered_flat_set using robin-hood-hashing
    • <vector>
    • Lock-free queue, node_allocator and some auxiliary algorithms
    • fmt as a string formatting library
    • Tested with C++20
  • CMake

    • Building of kernel drivers
    • Generating a test-signing certificate
    • Driver signing

Complete documentation in progress.

Installation & Usage

You can use KTL directly as driver CMake project subdirectory or link with pre-built KTL binaries applying find_package().

It includes 2 static libraries:

  • ktl-runtime.lib (CRT)
  • ktl.lib (C++ tools)

Basic cmake.toml for a driver

[cmake]
version = "3.10"
cmkr-include = "cmake/cmkr.cmake"

[variables]
CMAKE_MODULE_PATH = "${CMAKE_CURRENT_SOURCE_DIR}/cmake"

[project]
name = "KTL-Example"
languages = ["CXX"]
include-before = ["cmake/msvc-configurations.cmake"]

[fetch-content]
ktl = { git = "https://github.com/oopsmishap/ktl" }

[find-package.WDK]

[template.ktl-driver]
type = "executable"
add-function = "wdk_add_driver"
compile-features = ["cxx_std_20"]
link-libraries = ["ktl::ktl"]

[target.ktl-example]
type = "ktl-driver"
sources = ["src/**.cpp"]
include-directories = ["include"]

Build requirements:

  • WDK10
  • Visual Studio 2019 (not tested on older versions)
  • cmkr
  • CMake 3.10 and higher

Examples

  • KTL-Example - A barebones driver utilizing KTL
  • CoroDriverSample - a simple driver demonstrating the use of C++20 coroutines in kernel mode

Roadmap for the near future

  • Linked lists and Red-Black-Tree containers
  • Intrusive containers
  • Coroutine-compatible async primitives
  • Exception handling on the x86 platforms

About

Kernel Template Library: STL-style containers and tools for Windows kernel space programming

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5

0