{"id":24967368,"url":"https://github.com/mirokaku/ucxxrt","last_synced_at":"2025-04-09T08:06:12.328Z","repository":{"id":38034076,"uuid":"243931531","full_name":"MiroKaku/ucxxrt","owner":"MiroKaku","description":"The Universal C++ RunTime library, supporting kernel-mode C++ exception-handler and STL.","archived":false,"fork":false,"pushed_at":"2024-01-30T05:02:54.000Z","size":7103,"stargazers_count":371,"open_issues_count":9,"forks_count":94,"subscribers_count":15,"default_branch":"main","last_synced_at":"2024-04-07T02:19:55.317Z","etag":null,"topics":["cpp","cpp17-library","exception-handler","stl","windows-kernel"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MiroKaku.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-02-29T08:24:52.000Z","updated_at":"2024-04-15T06:24:03.380Z","dependencies_parsed_at":"2023-12-26T10:29:42.853Z","dependency_job_id":"c52dd4a7-c49c-464d-a3f3-dc033b2f1321","html_url":"https://github.com/MiroKaku/ucxxrt","commit_stats":{"total_commits":108,"total_committers":2,"mean_commits":54.0,"dds":0.0092592592592593,"last_synced_commit":"84a26c6ada83916e75492cd8b1486df2c960d5ca"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MiroKaku%2Fucxxrt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MiroKaku%2Fucxxrt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MiroKaku%2Fucxxrt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MiroKaku%2Fucxxrt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MiroKaku","download_url":"https://codeload.github.com/MiroKaku/ucxxrt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247999859,"owners_count":21031046,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","cpp17-library","exception-handler","stl","windows-kernel"],"created_at":"2025-02-03T12:53:31.123Z","updated_at":"2025-04-09T08:06:12.309Z","avatar_url":"https://github.com/MiroKaku.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [Universal C++ RunTime (UCXXRT)](https://github.com/mirokaku/ucxxrt)\r\n\r\n[![Actions Status](https://github.com/MiroKaku/ucxxrt/workflows/build/badge.svg)](https://github.com/MiroKaku/ucxxrt/actions)\r\n[![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/MiroKaku/ucxxrt/blob/main/LICENSE)\r\n![Windows](https://img.shields.io/badge/Windows-7+-orange.svg)\r\n![Visual Studio](https://img.shields.io/badge/Visual%20Studio-2022-purple.svg)\r\n[![nuget](https://img.shields.io/nuget/v/ucxxrt)](https://www.nuget.org/packages/ucxxrt/)\r\n\r\n* [简体中文](https://github.com/MiroKaku/ucxxrt/blob/main/README.zh-CN.md)\r\n\r\n\u003cbr /\u003e\r\n----\r\n\r\n# [Musa.Runtime](https://github.com/MiroKaku/Musa.Runtime) is available, ucxxrt is no longer providing support!!!\r\n\r\n### Musa.Runtime is the implementation of the new architecture of ucxxrt.\r\n\r\n### Fewer changes, more features and standard libraries support.\r\n\r\n----\r\n\u003cbr /\u003e\r\n\r\n\u003e UserMode support has been removed since March 29th, 2022. The final version known to support UserMode is [e2f159f8f](https://github.com/MiroKaku/ucxxrt/tree/e2f159f8f04a829359e3a057b70457121485b4dc). Please use [VC-LTL5](https://github.com/Chuyu-Team/VC-LTL5) instead in UserMode.\r\n\r\n## 1. About\r\n\r\n`ucxxrt` is an open source runtime library based on MSVC. The highlight of this project is its usability in *kernel-mode drivers*, and it provides you nearly the same experience as developing user-mode applications in C++.\r\n\r\nBefore `ucxxrt` was born, in order to use C++ STL in kernel-mode drivers, users have to craft their own template libraries (eg. [KTL](https://github.com/MeeSong/KTL), ustd, ...).\r\nThere are still several problems. Like it does not support C++ exceptions, and mainly, it costs very much time to implement new language features when C++ ISO standard updates.\r\n\r\nThen `ucxxrt` was born.\r\n\r\n### 1.1 How `ucxxrt` works\r\n\r\n* When developing kernel-mode drivers, kernel-mode flag is disabled by using property sheets, forcibly making the compiler support C++ exceptions. Exception flag(`/EHsc`) is also enabled.\r\n\r\n* Implements exception functions like `throw`, `catch`. Simulates the exception dispatcher in `throw` and handles the exception in callback functions.\r\n\r\n### 1.2 Features\r\n\r\n- [x] support x86, x64, ARM(experimental), ARM64(experimental).\r\n- [x] support new/delete operators.\r\n- [x] support C++ exception (/EHa, /EHsc).\r\n- [x] support SAFESEH、GS (Buffer Security Check).\r\n- [x] support STL (not fully).\r\n- [x] support static objects.\r\n\r\n[List of currently unsupported features ↓](#6-List-of-features-that-are-not-supported-at-this-time)\r\n\r\n### 1.3 Example\r\n\r\n\u003e See project [unittest](https://github.com/MiroKaku/ucxxrt/blob/main/test/unittest.cpp) for more information.\r\n\r\n```cpp\r\nvoid Test$ThrowUnknow()\r\n{\r\n    try\r\n    {\r\n        try\r\n        {\r\n            try\r\n            {\r\n                throw std::wstring();\r\n            }\r\n            catch (int\u0026 e)\r\n            {\r\n                ASSERT(false);\r\n                LOG(DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, \"Catch Exception: %d\\n\", e);\r\n            }\r\n        }\r\n        catch (std::string\u0026 e)\r\n        {\r\n            ASSERT(false);\r\n            LOG(DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, \"Catch Exception: %s\\n\", e.c_str());\r\n        }\r\n    }\r\n    catch (...)\r\n    {\r\n        LOG(DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, \"Catch Exception: ...\\n\");\r\n    }\r\n}\r\n\r\nvoid Test$HashMap()\r\n{\r\n    auto Rand = std::mt19937_64(::rand());\r\n    auto Map = std::unordered_map\u003cuint32_t, std::string\u003e();\r\n    for (auto i = 0u; i \u003c 10; ++i)\r\n    {\r\n        Map[i] = std::to_string(Rand());\r\n    }\r\n\r\n    for (const auto\u0026 Item : Map)\r\n    {\r\n        LOG(DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL,\r\n            \"map[%ld] = %s\\n\", Item.first, Item.second.c_str());\r\n    }\r\n}\r\n```\r\n\r\n## 2. How to use\r\n\r\n**First, rename `DriverEntry` to `DriverMain`.**\r\n\r\n### 2.1 Method 1 (recommended)\r\n\r\nRight click on the project, select \"Manage NuGet Packages\".\r\nSearch for `ucxxrt`, choose the version that suits you, and then click \"Install\".\r\n\r\n![nuget](https://raw.githubusercontent.com/MiroKaku/ucxxrt/main/readme/nuget.png)\r\n\r\n### 2.2 Method 2\r\n\r\n1. Download the latest package from [Releases](https://github.com/MiroKaku/ucxxrt/releases) and unzip it.\r\n\r\n2. Add the property sheet `ucxxrt.props` to your project.\r\n\r\n![usage](https://raw.githubusercontent.com/MiroKaku/ucxxrt/main/readme/use.gif)\r\n\r\n## 3. How to build\r\n\r\nIDE：Visual Studio 2022 latest version\r\n\r\nand Windows SDK\r\n\r\nand Windows Driver Kits\r\n\r\n* `git clone --recurse-submodules https://github.com/MiroKaku/ucxxrt.git`\r\n* Open `ucxxrt.sln` and build.\r\n\r\n* For clang-cl or llvm-msvc, you will have to add `-march=native` in the compiler flags.\r\n\r\n## 4. Acknowledgements\r\n\r\nThanks to [JetBrains](https://www.jetbrains.com/?from=meesong) for providing free licenses such as [Resharper C++](https://www.jetbrains.com/resharper-cpp/?from=meesong) for my open-source projects.\r\n\r\n[\u003cimg src=\"https://resources.jetbrains.com/storage/products/company/brand/logos/ReSharperCPP_icon.png\" alt=\"ReSharper C++ logo.\" width=200\u003e](https://www.jetbrains.com/?from=meesong)\r\n\r\n## 5. References\r\n\r\n* [Microsoft's C++ Standard Library](https://github.com/microsoft/stl)\r\n* [Chuyu-Team/VC-LTL](https://github.com/Chuyu-Team/VC-LTL)\r\n* [RetrievAL](https://github.com/SpoilerScriptsGroup/RetrievAL)\r\n\r\n\u003e Great thanks to these excellent projects. Without their existence, there would be no `ucxxrt` then.\r\n\r\n## 6. List of currently unsupported features\r\n\r\n- [ ] Thread Local Storage (TLS): thread_local、TlsAlloc ...\r\n- [ ] std::filesystem\r\n- [ ] std::chrono\r\n- [ ] std::stacktrace_entry\r\n- [ ] std::locale\r\n- [ ] std::stream (std::fstream、std::iostream、std::cin、std::cout、std::cerr)\r\n- [ ] std::future\r\n- [ ] std::latch\r\n- [ ] std::semaphore (std::counting_semaphore、std::binary_semaphore)\r\n- [ ] ...\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirokaku%2Fucxxrt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmirokaku%2Fucxxrt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirokaku%2Fucxxrt/lists"}