Fix read/write of WinDivertAddress fields from/to native memory#2
Open
marvinlehmann wants to merge 1 commit intoffalcinelli:masterfrom
Open
Fix read/write of WinDivertAddress fields from/to native memory#2marvinlehmann wants to merge 1 commit intoffalcinelli:masterfrom
marvinlehmann wants to merge 1 commit intoffalcinelli:masterfrom
Conversation
...from/to native memory "Note that if you use the structure's pointer as a function argument, you are responsible for calling write() prior to the call and read() after the call." - https://java-native-access.github.io/jna/4.2.1/com/sun/jna/Structure.html#getPointer--
Owner
|
Thank you for this PR. Well the direction is just outbound/inbound so a byte is more than enough. Mapping as USHORT it's maybe an error, but should not be a problem as long as the value is below the byte size. I'll merge this soon and update on maven too. May I add you to contributors? |
Author
|
OK! |
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.
I noticed that the WinDivertAddress fields weren't set properly because the native memory of the JNA structure didn't get updated.
- https://java-native-access.github.io/jna/4.2.1/com/sun/jna/Structure.html#getPointer--
Unrelated:
I also noticed that WinDef.USHORT is used for the direction which has a size of 2 bytes but it originally is defined as UINT8 (uint8_t) with a size of 1 byte. Could this generally be a problem? I'm just interested because I don't know much about JNA.