Skip to content

Advapi32Util.registryGetValues() returns no results if the key contains an empty REG_* value #135

@danwi

Description

@danwi

(Related to #116 which only adressed REG_BINARY values.)

If you create an empty value of one of the following types and try to read the values using Advapi32Util.registryGetValues() you will get an exception:

REG_SZ
REG_EXPAND_SZ
REG_MULTI_SZ
REG_NONE

The Exception:
java.lang.IllegalArgumentException: Allocation size must be greater than zero
at com.sun.jna.Memory.(Memory.java:84)
at com.sun.jna.platform.win32.Advapi32Util.registryGetValues(Advapi32Util.java:1270)
at com.sun.jna.platform.win32.Advapi32Util.registryGetValues(Advapi32Util.java:1332)
[...]

I have written unit test and code to solve the problem in a stubbed environment (I haven't had the time to get the full build environment for jna up and running yet), I will provide a pull request with the fix as soon as I've applied the changes from my stubbed environment to my real jna repo clone.

Question: should unit tests and the fix be checked in as two separate commits or as one commit?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions