You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Mark Thomas (Jira)" <ji...@apache.org> on 2019/09/03 21:33:00 UTC

[jira] [Resolved] (DAEMON-401) Environment variables set on service not available in JNI dll

     [ https://issues.apache.org/jira/browse/DAEMON-401?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Thomas resolved DAEMON-401.
--------------------------------
    Resolution: Fixed

Fixed. See [https://bz.apache.org/bugzilla/show_bug.cgi?id=63625] for analysis of root cause.

> Environment variables set on service not available in JNI dll
> -------------------------------------------------------------
>
>                 Key: DAEMON-401
>                 URL: https://issues.apache.org/jira/browse/DAEMON-401
>             Project: Commons Daemon
>          Issue Type: Bug
>            Reporter: Jonathan Gallimore
>            Priority: Major
>             Fix For: 1.2.1, 1.1.1
>
>         Attachments: daemon-1.diff, daemon-env.diff, simple-jni.zip
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> I have a JNI dll loaded by a Java process running as a Windows service on Windows 2019 using prunsrv. The JNI library is built with VC14, and makes calls to getenv(), which is imported from ucrtbase.dll.
> This call to getenv does not pick up environment variables that are set on the service via //US//Service ++Environment "key=value". Commons Daemon is setting these environment variables using _wputenv(), which is imported from msvcrt.dll.
> I started a discussion on the mailing list regarding this. I have patch which dynamically loads ucrtbase.dll and calls its _wputenv method as well, if it is available.
> I'm happy to provide changes or further patches, and work on this issue, but feedback would be useful and very much appreciated.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)