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

Write REG_EXPAND_SZ values #320

Closed
ChrLipp opened this issue Apr 19, 2014 · 5 comments
Closed

Write REG_EXPAND_SZ values #320

ChrLipp opened this issue Apr 19, 2014 · 5 comments

Comments

@ChrLipp
Copy link

ChrLipp commented Apr 19, 2014

At the moment it is not possible to write String values to the registry with type REG_EXPAND_SZ. When I try to set a path variable with

Advapi32Util.registrySetStringValue(
    WinReg.HKEY_CURRENT_USER, 'ENVIRONMENT', key, value)

a REG_SZ value is created. I would like to have one additional (or overloaded) function which is able to create a REG_EXPAND_SZ value.

@twall
Copy link
Contributor

twall commented Apr 19, 2014

Patches (with associated tests) are welcome.

On Apr 19, 2014, at 8:24 AM, Christian LIPP [email protected] wrote:

At the moment it is not possible to write String values to the registry with type REG_EXPAND_SZ. When I try to set a path variable with

   Advapi32Util.registrySetStringValue(WinReg.HKEY_CURRENT_USER, 'ENVIRONMENT', key, value)

a REG_SZ value is created. I would like to have one additional (or overloaded) function which is able to create a REG_EXPAND_SZ value.


Reply to this email directly or view it on GitHub.

@dblock
Copy link
Member

dblock commented Apr 19, 2014

@dblock dblock closed this as completed Apr 19, 2014
@ChrLipp
Copy link
Author

ChrLipp commented Apr 20, 2014

Thanks for your help. I am using groovyConcole, so I didn't have AutoComplete and the function is also not mentioned in JavaDoc: https://jna.java.net/javadoc/platform/com/sun/jna/platform/win32/Advapi32Util.html

Regards, CL

@dblock
Copy link
Member

dblock commented Apr 20, 2014

That doc link is very old. See http://twall.github.io/jna/4.1.0. If you found a link to that doc on Github somewhere, lets fix it.

@ChrLipp
Copy link
Author

ChrLipp commented Apr 20, 2014

It was the first hit on Google when searching for Advapi32Util.registrySetStringValue
The second link would have been a correct one - although an older version (3.4.0 instead of 4.1.0).
Thanks for your help!

ChrLipp added a commit to ChrLipp/Scripts that referenced this issue Apr 20, 2014
mstyura pushed a commit to mstyura/jna that referenced this issue Sep 9, 2024
Motivation:

We should release in a finally blog so we don't leak on failure

Modifications:

Move release() to finally block.

Result:

No more leaks when write fails
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

No branches or pull requests

3 participants