Skip to content
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

Merged
merged 1 commit into from
Dec 10, 2015
Merged

added Module32First and Module32Next to Kernel32 #552

merged 1 commit into from
Dec 10, 2015

Conversation

mlfreeman2
Copy link
Contributor

  • 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).
Copy link
Member

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.

@dblock
Copy link
Member

dblock commented Dec 5, 2015

Looks good, minor comment above for changelog. This needs to be rebased, please.

@mlfreeman2
Copy link
Contributor Author

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);
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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
@dblock
Copy link
Member

dblock commented Dec 10, 2015

I think this is what we want. It would be probably ideal to name the funciton Module32First and force it to invoke Module32FirstW, but I don't remember how to do that, @twall ? (merge if there's not an easy way)

@twall
Copy link
Contributor

twall commented Dec 10, 2015

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.

On Dec 10, 2015, at 6:49 AM, Daniel Doubrovkine (dB.) @dblockdotorg notifications@github.com wrote:

I think this is what we want. It would be probably ideal to name the funciton Module32First and force it to invoke Module32FirstW, but I don't remember how to do that, @twall ? (merge if there's not an easy way)


Reply to this email directly or view it on GitHub.

twall added a commit that referenced this pull request Dec 10, 2015
added Module32First and Module32Next to Kernel32
@twall twall merged commit a6a0c4e into java-native-access:master Dec 10, 2015
mstyura pushed a commit to mstyura/jna that referenced this pull request Sep 9, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants