https://github.com/avakar/vcrtl
C++ Exceptions in Windows Drivers
https://github.com/avakar/vcrtl
cpp exceptions kernel-mode-driver windows
Last synced: 5 months ago
JSON representation
C++ Exceptions in Windows Drivers
- Host: GitHub
- URL: https://github.com/avakar/vcrtl
- Owner: avakar
- License: mit
- Created: 2019-11-26T23:36:04.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-12-21T22:23:37.000Z (over 4 years ago)
- Last Synced: 2024-12-06T06:31:02.655Z (6 months ago)
- Topics: cpp, exceptions, kernel-mode-driver, windows
- Language: C++
- Homepage:
- Size: 48.8 KB
- Stars: 200
- Watchers: 14
- Forks: 40
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# C++ Exceptions in Windows Drivers
This project implements parts of the Visual Studio runtime library
that are needed for C++ exception handling. Currently, x86 and x64
platforms are supported.## Getting started
To use exceptions in your kernel-mode driver, first
* [download the binaries](https://github.com/avakar/vcrtl/releases), and then
* add `vcrtl_driver.props` to your driver project.C++ exceptions will magically work.
## Features
The exception handling code was optimized to significantly reduce
the required stack space. On x86, the stack usage is negligible,
on x64, approximately 300 bytes are used during handler search,
these are, however, reclaimed before the catch handler is called.No dynamic allocations or thread-local storage is used, everything
happens on the stack.On x64, both FH3 and FH4 C++ exception ABI is supported. FH4 is
much better than FH3, prefer it.No string comparisons are done during exception dispatch.
## Limitations
An exception must not leave the module in which it was thrown,
otherwise the dispatcher will bug-check.No SEH exception may pass through frames in which you do C++
exception handling (this includes functions with `try/catch` blocks
or functions marked as `noexcept`, or functions with automatic variables
with non-trivial destructors). This will be detected and
you'll get a bug-check.## TODO
Although `/GS` is supported, the frame cookies aren't checked yet.