-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added Module32First and Module32Next to Kernel32 #552
added Module32First and Module32Next to Kernel32 #552
Conversation
mlfreeman2
commented
Dec 4, 2015
- Added Module32First() and Module32Next() mappings to Kernel32
- Added MODULEENTRY32 structure to Tlhelp32
- Added getModules() helper to Kernel32Util
@@ -22,6 +22,8 @@ Features | |||
* [#547](https://github.com/java-native-access/jna/pull/547): Added `GetSystemTimes` to `com.sun.jna.platform.win32.Kernel32` - [@dbwiddis](https://github.com/dbwiddis). | |||
* [#548](https://github.com/java-native-access/jna/pull/548): Return 64-bit unsigned integer from `com.sun.jna.platform.win32.WinBase.FILETIME` - [@dbwiddis](https://github.com/dbwiddis). | |||
* [#524](https://github.com/java-native-access/jna/pull/524): Added IShellFolder interface plus necessary utility functions to Windows platform, and a sample for enumerating objects in My Computer - [@lwahonen](https://github.com/lwahonen). | |||
* [#552](https://github.com/java-native-access/jna/pull/552): Added `Module32First` and `Module32Next` to Kernel32 (and helper to Kernel32Util) and `MODULEENTRY32` structure to Tlhelp32 - [@mlfreeman2](https://github.com/mlfreeman2). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please expand Kernel32
into com.sun...
like the other ones, not all of this is Windows. Thx.
Looks good, minor comment above for changelog. This needs to be rebased, please. |
Changelog updated and everything rebased. |
* GetLastError function if no modules exist or the snapshot does | ||
* not contain module information. | ||
*/ | ||
boolean Module32First(HANDLE hSnapshot, Tlhelp32.MODULEENTRY32.ByReference lpme); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ByReference
here is superfluous; struct *
is inferred from Structure
for function parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this depends on a Structure
with explicit native wide strings, you should explicitly map to Module32FirstW
. I believe you should still be able to reference with Module32First
in client code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the com.sun.jna.FunctionMapper
interface but I'm unsure how I could use it surgically (without potentially impacting the rest of Kernel32).
Is there something I should mark up Module32First
and Module32Next
with (e.g. an annotation)?
As an alternative, I posted an idea about changing MODULEENTRY32 to potentially handle both the ANSI and Unicode versions of the functions (see my reply to your other comment).
Last but not least, note that the Unicode functions do end in -W
but the ANSI versions do not end in -A
according to MSDN.
added MODULEENTRY32W to Tlhelp32
I think this is what we want. It would be probably ideal to name the funciton |
I think the default behavior for the function mapper is to try the undecorated first and then attempt the suffix, which would fail in this case if the non-suffixed function is actually the wrong one. OK to merge this as-is.
|
added Module32First and Module32Next to Kernel32
Motivation: We should add leak tracking to QuicheQuicConnection to ensure we never leak the connection Modifications: Add LeakTracker to QuicheQuicConnection Result: Be able to understand why direct memory leak