You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2008/04/03 06:30:30 UTC

svn commit: r644158 - /commons/proper/daemon/trunk/src/native/nt/procrun/apps/prunsrv/prunsrv.c

Author: mturk
Date: Wed Apr  2 21:30:29 2008
New Revision: 644158

URL: http://svn.apache.org/viewvc?rev=644158&view=rev
Log:
Fix Vista runs by prefixing the global object with Global, and 64 builds by using the same registry key, so 32-bit manager can manage 64-bit services

Modified:
    commons/proper/daemon/trunk/src/native/nt/procrun/apps/prunsrv/prunsrv.c

Modified: commons/proper/daemon/trunk/src/native/nt/procrun/apps/prunsrv/prunsrv.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/nt/procrun/apps/prunsrv/prunsrv.c?rev=644158&r1=644157&r2=644158&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/nt/procrun/apps/prunsrv/prunsrv.c (original)
+++ commons/proper/daemon/trunk/src/native/nt/procrun/apps/prunsrv/prunsrv.c Wed Apr  2 21:30:29 2008
@@ -40,6 +40,12 @@
 #define STDOUT_FILENO 1
 #define STDERR_FILENO 2
 
+#ifdef WIN64
+#define KREG_WOW6432  KEY_WOW64_32KEY
+#else
+#define KREG_WOW6432  0
+#endif
+
 typedef struct APX_STDWRAP {
     LPCWSTR szLogPath;
     LPCWSTR szStdOutFilename;
@@ -413,7 +419,8 @@
     int i = 0;
 
     SetLastError(ERROR_SUCCESS);
-    hRegistry = apxCreateRegistryW(gPool, KEY_READ, PRG_REGROOT,
+    hRegistry = apxCreateRegistryW(gPool, KEY_READ | KREG_WOW6432,
+                                   PRG_REGROOT,
                                    lpCmdline->szApplication,
                                    APXREG_SOFTWARE | APXREG_SERVICE);
     if (IS_INVALID_HANDLE(hRegistry)) {
@@ -485,7 +492,8 @@
 {
     APXHANDLE hRegistry;
     int i = 0;
-    hRegistry = apxCreateRegistryW(gPool, KEY_WRITE, PRG_REGROOT,
+    hRegistry = apxCreateRegistryW(gPool, KEY_WRITE | KREG_WOW6432,
+                                   PRG_REGROOT,
                                    lpCmdline->szApplication,
                                    APXREG_SOFTWARE | APXREG_SERVICE);
     if (IS_INVALID_HANDLE(hRegistry))
@@ -1161,9 +1169,10 @@
         WCHAR en[SIZ_DESLEN];
         int i;
         PSECURITY_ATTRIBUTES sa = GetNullACL();
-        lstrcpyW(en, _service_name);
+        lstrcpyW(en, L"Global\\");
+        lstrcatW(en, _service_name);
         lstrcatW(en, PRSRV_SIGNAL);
-        for (i = 0; i < lstrlenW(en); i++) {
+        for (i = 7; i < lstrlenW(en); i++) {
             if (en[i] >= L'a' && en[i] <= L'z')
                 en[i] = en[i] - 32;
         }