#91

`_KERNEL_MODE` shouldn't be used to detect drivers

OpenMichalPetrykaopened 1y ago

The MSVC /kernel option says: The /kernel option and the /driver option operate independently. They have no effect on each other.

As such, using it to detect being in a driver is invalid and causes errors due to wdk.h not being there while building with /kernel in usermode. This should be changed to detect the need for driver headers in some other way or an opt-out option should be provided.

Activity

1
mappzor1y ago

/kernel disables C++ exception handling, RTTI, new/delete operators but it also defines _KERNEL_MODE and I think setting ZYAN_KERNEL based on that is perfectly fine.

This should be changed to detect the need for driver headers in some other way or an opt-out option should be provided.

We have opt-out via ZYAN_NO_LIBC. You can define it to prevent Zycore from accessing "standard" headers. Different sets of headers are required for user-mode and kernel (there are platform-specific requirements as well).