Add support for Windows Drivers#757
Merged
redboltz merged 1 commit intomsgpack:masterfrom Jan 20, 2019
wbenny:master
Merged
Conversation
Contributor
|
@wbenny , thank you for sending the PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit enables msgpack to be compiled as a part of Windows Driver. MSVC automatically creates macro
_KERNEL_MODEwhen source code is compiled with/kernelswitch (this compiler switch is turned on when driver is compiled).Changes:
msgpack_object_printandmsgpack_object_bin_printare disabled, because there is noprintfin kernel modemsgpack_object_printandmsgpack_object_bin_printare moved so they are together (so that one#if !defined(...)can wrap them)size_ttointto disable compiler warning4204is disabled when compiling with MSVC_msgpack_atomic_counter_headeris set to<ntddk.h>if_KERNEL_MODEis defined (it contains prototypes forInterlockedIncrementandInterlockedDecrement)TRUEandFALSEmacros are disabled if_KERNEL_MODEis defined (they are defined unconditionally in<ntddk.h>)assertis redefined toNT_ASSERT(assert specific to Windows Drivers)_NO_CRT_STDIO_INLINEis unconditionally defined (it makes_snprintfsymbol to be imported from ntoskrnl.exe)snprintfis redefined to_snprintf(because ntoskrnl.exe does not exportsnprintf, only_snprintf, but they have same behavior)NOTE: After these changes, linker still complains that symbols
malloc,reallocandfreecan't be found. The cleanest solution would be to provide interface for setting custom allocators. Nonetheless, simply creating custom version of these functions resolves that problem too.