You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ma...@apache.org on 2019/05/22 21:44:23 UTC

[commons-daemon] branch master updated (59d4b50 -> 75ef9f4)

This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-daemon.git.


    from 59d4b50  Fix https://issues.apache.org/jira/projects/DAEMON/issues/DAEMON-401
     new 39edeec  Fix DAEMON-396 problem 1
     new 75ef9f4  Polish

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/changes/changes.xml                   |  5 +++++
 src/native/windows/apps/prunsrv/prunsrv.c |  2 --
 src/native/windows/include/apxwin.h       |  2 ++
 src/native/windows/src/gui.c              |  2 +-
 src/native/windows/src/utils.c            | 12 ++++++++++++
 5 files changed, 20 insertions(+), 3 deletions(-)


[commons-daemon] 02/02: Polish

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-daemon.git

commit 75ef9f41cd5a43bfc525d22ec3884bc9321e5805
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed May 22 22:37:45 2019 +0100

    Polish
---
 src/native/windows/include/apxwin.h | 4 ++--
 src/native/windows/src/gui.c        | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/native/windows/include/apxwin.h b/src/native/windows/include/apxwin.h
index f291aa4..717f645 100644
--- a/src/native/windows/include/apxwin.h
+++ b/src/native/windows/include/apxwin.h
@@ -118,10 +118,10 @@ LPSTR       MzWideToAscii(LPCWSTR ws, LPSTR s);
 LPSTR       WideToANSI(LPCWSTR ws);
 LPSTR       MzWideToANSI(LPCWSTR ws);
 
-typedef struct APXMULTISZ APXMULTISZ;
-typedef APXMULTISZ*       LPAPXMULTISZ;
 typedef int (__stdcall *WPUTENV) (const wchar_t *env);
 
+typedef struct APXMULTISZ APXMULTISZ;
+typedef APXMULTISZ*       LPAPXMULTISZ;
 
 DWORD   apxMultiSzToArrayW(APXHANDLE hPool, LPCWSTR lpString, LPWSTR **lppArray);
 LPWSTR  apxMultiSzCombine(APXHANDLE hPool, LPCWSTR lpStrA, LPCWSTR lpStrB,
diff --git a/src/native/windows/src/gui.c b/src/native/windows/src/gui.c
index e4336f3..d780d24 100644
--- a/src/native/windows/src/gui.c
+++ b/src/native/windows/src/gui.c
@@ -29,7 +29,7 @@ DYNLOAD_TYPE_DECLARE(NetApiBufferFree, WINAPI, DWORD)(LPVOID);
 static DYNLOAD_FPTR_DECLARE(NetApiBufferFree) = NULL;
 
 DYNLOAD_TYPE_DECLARE(NetQueryDisplayInformation, WINAPI, DWORD)(LPCWSTR, DWORD, DWORD, DWORD, DWORD,
-																LPDWORD, PVOID);
+                                                                LPDWORD, PVOID);
 static DYNLOAD_FPTR_DECLARE(NetQueryDisplayInformation) = NULL;
 
 DYNLOAD_TYPE_DECLARE(NetGetDCName, WINAPI, DWORD)(LPCWSTR, LPCWSTR, LPBYTE *);


[commons-daemon] 01/02: Fix DAEMON-396 problem 1

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-daemon.git

commit 39edeec2590966d9ace3ec9788eb555c32f4347f
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed May 22 22:26:56 2019 +0100

    Fix DAEMON-396 problem 1
    
    Based on fix for DAEMON-401.
---
 src/changes/changes.xml                   |  5 +++++
 src/native/windows/apps/prunsrv/prunsrv.c |  2 --
 src/native/windows/include/apxwin.h       |  2 ++
 src/native/windows/src/utils.c            | 12 ++++++++++++
 4 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 24bed12..456926a 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -79,6 +79,11 @@
         Procrun. Ensure that JAVA_HOME/bin is on the path when running in jvm
         mode so that additional DLLs, such as awt.dll, can be found if required.
       </action>
+      <action issue="DAEMON-396" type="fix" dev="markt">
+        Procrun. Ensure that the java.library.path environment variable is
+        correctly configured when running on a JRE that depends on the Universal
+        CRT.
+      </action>
       <action type="add" dev="markt">
         Procrun. Log the error code returned if JVM creation fails to aid
         debugging.
diff --git a/src/native/windows/apps/prunsrv/prunsrv.c b/src/native/windows/apps/prunsrv/prunsrv.c
index b125850..dab90e5 100644
--- a/src/native/windows/apps/prunsrv/prunsrv.c
+++ b/src/native/windows/apps/prunsrv/prunsrv.c
@@ -58,8 +58,6 @@ typedef struct APX_STDWRAP {
     FILE   *fpStdErrFile;
 } APX_STDWRAP;
 
-typedef int (__stdcall *WPUTENV) (const wchar_t *env);
-
 /* Use static variables instead of #defines */
 static LPCWSTR  PRSRV_AUTO        = L"auto";
 static LPCWSTR  PRSRV_JAVA        = L"java";
diff --git a/src/native/windows/include/apxwin.h b/src/native/windows/include/apxwin.h
index ca7552a..f291aa4 100644
--- a/src/native/windows/include/apxwin.h
+++ b/src/native/windows/include/apxwin.h
@@ -120,6 +120,8 @@ LPSTR       MzWideToANSI(LPCWSTR ws);
 
 typedef struct APXMULTISZ APXMULTISZ;
 typedef APXMULTISZ*       LPAPXMULTISZ;
+typedef int (__stdcall *WPUTENV) (const wchar_t *env);
+
 
 DWORD   apxMultiSzToArrayW(APXHANDLE hPool, LPCWSTR lpString, LPWSTR **lppArray);
 LPWSTR  apxMultiSzCombine(APXHANDLE hPool, LPCWSTR lpStrA, LPCWSTR lpStrB,
diff --git a/src/native/windows/src/utils.c b/src/native/windows/src/utils.c
index 2e0d2bf..1e1f3cd 100644
--- a/src/native/windows/src/utils.c
+++ b/src/native/windows/src/utils.c
@@ -60,6 +60,8 @@ BOOL apxAddToPathW(APXHANDLE hPool, LPCWSTR szAdd)
     LPWSTR wsAdd;
     DWORD  rc;
     DWORD  al;
+    HMODULE hmodUcrt;
+    WPUTENV wputenv_ucrt;
 
     rc = GetEnvironmentVariableW(L"PATH", NULL, 0);
     if (rc == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND)
@@ -75,8 +77,18 @@ BOOL apxAddToPathW(APXHANDLE hPool, LPCWSTR szAdd)
         apxFree(wsAdd);
         return FALSE;
     }
+
+    hmodUcrt = LoadLibraryExA("ucrtbase.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
+    if (hmodUcrt != NULL) {
+    	wputenv_ucrt =  (WPUTENV) GetProcAddress(hmodUcrt, "_wputenv");
+    }
+
     SetEnvironmentVariableW(L"PATH", wsAdd + 5);
     _wputenv(wsAdd);
+    if (wputenv_ucrt != NULL) {
+    	wputenv_ucrt(wsAdd);
+    }
+
     apxFree(wsAdd);
     return TRUE;
 }