JBoss Native SVN: r2749 - trunk/build/unix.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2011-04-20 12:15:24 -0400 (Wed, 20 Apr 2011)
New Revision: 2749
Modified:
trunk/build/unix/buildbin.jboss-native.windows.sh
Log:
It is not configure but build :D
Modified: trunk/build/unix/buildbin.jboss-native.windows.sh
===================================================================
--- trunk/build/unix/buildbin.jboss-native.windows.sh 2011-04-20 15:06:30 UTC (rev 2748)
+++ trunk/build/unix/buildbin.jboss-native.windows.sh 2011-04-20 16:15:24 UTC (rev 2749)
@@ -56,7 +56,7 @@
win_common_loc=`cygpath -w -a ${common_loc}`
win_prefix_loc=`cygpath -w -a ${prefix_loc}`
-echo "Configuring tomcat-native"
+echo "Building tomcat-native"
add_conf="PREFIX=${win_prefix_loc}"
if $has_openssl ; then
add_conf="${add_conf} WITH_OPENSSL=${win_common_loc}"
13 years, 9 months
JBoss Native SVN: r2748 - trunk/build/unix.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2011-04-20 11:06:30 -0400 (Wed, 20 Apr 2011)
New Revision: 2748
Modified:
trunk/build/unix/buildbin.jboss-native.windows.sh
Log:
Add messages of what is being done.
Modified: trunk/build/unix/buildbin.jboss-native.windows.sh
===================================================================
--- trunk/build/unix/buildbin.jboss-native.windows.sh 2011-04-20 14:27:25 UTC (rev 2747)
+++ trunk/build/unix/buildbin.jboss-native.windows.sh 2011-04-20 15:06:30 UTC (rev 2748)
@@ -71,6 +71,7 @@
native_sources=srclib/`ls srclib | grep tomcat-native`
src_dir=`cygpath -w -a ${native_sources}`
(cd $native_sources
+ echo "In ${native_sources} doing nmake -f NMAKEmakefile WITH_APR=${win_common_loc} ${add_conf} SRCDIR=${src_dir} install"
nmake -f NMAKEmakefile WITH_APR=${win_common_loc} ${add_conf} SRCDIR=${src_dir} install
)
@@ -80,6 +81,7 @@
# )
(cd service/jbosssvc
+ echo "In service/jbosssvc doing nmake -f NMAKEmakefile PREFIX=${win_prefix_loc} install"
nmake -f NMAKEmakefile PREFIX=${win_prefix_loc} install
)
@@ -89,7 +91,9 @@
)
(cd service/procrun
+ echo "In service/procrun doing nmake -f NMAKEsvc PREFIX=${win_prefix_loc} install"
nmake -f NMAKEsvc PREFIX=${win_prefix_loc} install
+ echo "In service/procrun doing nmake -f NMAKEmgr PREFIX=${win_prefix_loc} install"
nmake -f NMAKEmgr PREFIX=${win_prefix_loc} install
)
13 years, 9 months
JBoss Native SVN: r2747 - in trunk/utils/windows/native/service/procrun: src and 1 other directory.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2011-04-20 10:27:25 -0400 (Wed, 20 Apr 2011)
New Revision: 2747
Modified:
trunk/utils/windows/native/service/procrun/include/apxwin.h
trunk/utils/windows/native/service/procrun/include/gui.h
trunk/utils/windows/native/service/procrun/include/javajni.h
trunk/utils/windows/native/service/procrun/include/log.h
trunk/utils/windows/native/service/procrun/include/registry.h
trunk/utils/windows/native/service/procrun/include/rprocess.h
trunk/utils/windows/native/service/procrun/src/cmdline.c
trunk/utils/windows/native/service/procrun/src/gui.c
trunk/utils/windows/native/service/procrun/src/javajni.c
trunk/utils/windows/native/service/procrun/src/log.c
trunk/utils/windows/native/service/procrun/src/mclib.c
trunk/utils/windows/native/service/procrun/src/registry.c
trunk/utils/windows/native/service/procrun/src/service.c
trunk/utils/windows/native/service/procrun/src/utils.c
Log:
Upgrade to Commons Daemon 1.0.5.
Modified: trunk/utils/windows/native/service/procrun/include/apxwin.h
===================================================================
--- trunk/utils/windows/native/service/procrun/include/apxwin.h 2011-04-14 12:48:57 UTC (rev 2746)
+++ trunk/utils/windows/native/service/procrun/include/apxwin.h 2011-04-20 14:27:25 UTC (rev 2747)
@@ -22,7 +22,7 @@
#define WIN32_LEAN_AND_MEAN
#endif
#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0400
+#define _WIN32_WINNT 0x0501
#endif
#include <windows.h>
@@ -35,7 +35,6 @@
#include <shellapi.h>
#include <zmouse.h>
#include <richedit.h>
-
#include <lm.h>
#ifndef _INTPTR_T_DEFINED
@@ -96,6 +95,8 @@
#define SIZ_DESMAX (SIZ_DESLEN -1)
#define SIZ_HUGLEN 8192
#define SIZ_HUGMAX (SIZ_HUGLEN -1)
+#define SIZ_PATHLEN 4096
+#define SIZ_PATHMAX 4095
#include "handles.h"
#include "log.h"
@@ -201,6 +202,12 @@
#define AplMoveMemory AplCopyMemory
+LPSTR lstrlcatA(LPSTR dst, int siz, LPCSTR src);
+LPWSTR lstrlcatW(LPWSTR dst, int siz, LPCWSTR src);
+LPSTR lstrlcpyA(LPSTR dst, int siz, LPCSTR src);
+LPWSTR lstrlcpyW(LPWSTR dst, int siz, LPCWSTR src);
+LPWSTR lstrlocaseW(LPWSTR str);
+
PSECURITY_ATTRIBUTES GetNullACL();
void CleanNullACL(void *sa);
Modified: trunk/utils/windows/native/service/procrun/include/gui.h
===================================================================
--- trunk/utils/windows/native/service/procrun/include/gui.h 2011-04-14 12:48:57 UTC (rev 2746)
+++ trunk/utils/windows/native/service/procrun/include/gui.h 2011-04-20 14:27:25 UTC (rev 2747)
@@ -23,9 +23,8 @@
#define IDC_STATIC -1
#define IDC_APPLICATION 100
#define IDI_MAINICON 101
-#define IDI_REDHATICON 102
-#define IDC_STATBAR 103
-#define IDB_SUSERS 104
+#define IDC_STATBAR 102
+#define IDB_SUSERS 103
#define IDS_APPLICATION 150
#define IDS_APPDESCRIPTION 151
Modified: trunk/utils/windows/native/service/procrun/include/javajni.h
===================================================================
--- trunk/utils/windows/native/service/procrun/include/javajni.h 2011-04-14 12:48:57 UTC (rev 2746)
+++ trunk/utils/windows/native/service/procrun/include/javajni.h 2011-04-20 14:27:25 UTC (rev 2747)
@@ -13,30 +13,56 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#ifndef _JAVAJNI_H_INCLUDED_
#define _JAVAJNI_H_INCLUDED_
__APXBEGIN_DECLS
+#define APX_JVM_DESTROY 0x00000001
+
+typedef struct stAPXJAVA_THREADARGS
+{
+ LPVOID hJava;
+ LPCSTR szClassPath;
+ LPCVOID lpOptions;
+ DWORD dwMs;
+ DWORD dwMx;
+ DWORD dwSs;
+ DWORD bJniVfprintf;
+ LPCSTR szClassName;
+ LPCSTR szMethodName;
+ LPCVOID lpArguments;
+ BOOL setErrorOrOut;
+ LPCWSTR szStdErrFilename;
+ LPCWSTR szStdOutFilename;
+} APXJAVA_THREADARGS, *LPAPXJAVA_THREADARGS;
+
APXHANDLE apxCreateJava(APXHANDLE hPool, LPCWSTR szJvmDllPath);
BOOL apxJavaInitialize(APXHANDLE hJava, LPCSTR szClassPath,
LPCVOID lpOptions, DWORD dwMs, DWORD dwMx,
- DWORD dwSs);
+ DWORD dwSs, DWORD bJniVfprintf);
+DWORD
+apxJavaCmdInitialize(APXHANDLE hPool, LPCWSTR szClassPath, LPCWSTR szClass,
+ LPCWSTR szOptions, DWORD dwMs, DWORD dwMx,
+ DWORD dwSs, LPCWSTR szCmdArgs, LPWSTR **lppArray);
BOOL apxJavaLoadMainClass(APXHANDLE hJava, LPCSTR szClassName,
LPCSTR szMethodName,
LPCVOID lpArguments);
-BOOL apxJavaStart(APXHANDLE hJava);
+BOOL apxJavaStart(LPAPXJAVA_THREADARGS pArgs);
DWORD apxJavaWait(APXHANDLE hJava, DWORD dwMilliseconds, BOOL bKill);
BOOL apxJavaSetOut(APXHANDLE hJava, BOOL setErrorOrOut,
LPCWSTR szFilename);
+DWORD apxJavaSetOptions(APXHANDLE hJava, DWORD dwOptions);
+BOOL apxDestroyJvm(DWORD dwTimeout);
+
__APXEND_DECLS
#endif /* _JAVAJNI_H_INCLUDED_ */
Modified: trunk/utils/windows/native/service/procrun/include/log.h
===================================================================
--- trunk/utils/windows/native/service/procrun/include/log.h 2011-04-14 12:48:57 UTC (rev 2746)
+++ trunk/utils/windows/native/service/procrun/include/log.h 2011-04-20 14:27:25 UTC (rev 2747)
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-/* Logfile handling
+
+/* Logfile handling
* Use Systemdir/Logfiles/Apache as a default path
*/
@@ -54,7 +54,8 @@
APXHANDLE hPool,
LPCWSTR szPath,
LPCWSTR szPrefix,
- LPCWSTR szName
+ LPCWSTR szName,
+ BOOL bTimeStamp
);
HANDLE apxLogOpen(
Modified: trunk/utils/windows/native/service/procrun/include/registry.h
===================================================================
--- trunk/utils/windows/native/service/procrun/include/registry.h 2011-04-14 12:48:57 UTC (rev 2746)
+++ trunk/utils/windows/native/service/procrun/include/registry.h 2011-04-20 14:27:25 UTC (rev 2747)
@@ -43,12 +43,13 @@
#endif
/** Delete the process registry keys
+ * samDesired only needs to be KREG_WOW6432 or 0
*/
BOOL apxDeleteRegistryA(LPCSTR szRoot, LPCSTR szKeyName,
- BOOL bDeleteEmpty);
+ REGSAM samDesired, BOOL bDeleteEmptyRoot);
BOOL apxDeleteRegistryW(LPCWSTR szRoot, LPCWSTR szKeyName,
- BOOL bDeleteEmpty);
+ REGSAM samDesired, BOOL bDeleteEmptyRoot);
#ifdef _UNICODE
#define apxDeleteRegistry apxDeleteRegistryW
Modified: trunk/utils/windows/native/service/procrun/include/rprocess.h
===================================================================
--- trunk/utils/windows/native/service/procrun/include/rprocess.h 2011-04-14 12:48:57 UTC (rev 2746)
+++ trunk/utils/windows/native/service/procrun/include/rprocess.h 2011-04-20 14:27:25 UTC (rev 2747)
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#ifndef _RPROCESS_H_INCLUDED_
#define _RPROCESS_H_INCLUDED_
@@ -69,6 +69,7 @@
BOOL bKill);
BOOL apxProcessRunning(APXHANDLE hProcess);
+DWORD apxProcessGetPid(APXHANDLE hProcess);
__APXEND_DECLS
Modified: trunk/utils/windows/native/service/procrun/src/cmdline.c
===================================================================
--- trunk/utils/windows/native/service/procrun/src/cmdline.c 2011-04-14 12:48:57 UTC (rev 2746)
+++ trunk/utils/windows/native/service/procrun/src/cmdline.c 2011-04-20 14:27:25 UTC (rev 2747)
@@ -308,4 +308,3 @@
}
}
-
Modified: trunk/utils/windows/native/service/procrun/src/gui.c
===================================================================
--- trunk/utils/windows/native/service/procrun/src/gui.c 2011-04-14 12:48:57 UTC (rev 2746)
+++ trunk/utils/windows/native/service/procrun/src/gui.c 2011-04-20 14:27:25 UTC (rev 2747)
@@ -102,7 +102,7 @@
IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
_st_sys_gui.hIcon = LoadImage(_st_sys_gui.hInstance, MAKEINTRESOURCE(IDI_MAINICON),
IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR);
- _st_sys_gui.hIconHg = LoadImage(_st_sys_gui.hInstance, MAKEINTRESOURCE(IDI_REDHATICON),
+ _st_sys_gui.hIconHg = LoadImage(_st_sys_gui.hInstance, MAKEINTRESOURCE(IDI_MAINICON),
IMAGE_ICON, 48, 48, LR_DEFAULTCOLOR);
_st_sys_gui.hAccel = LoadAccelerators(_st_sys_gui.hInstance,
MAKEINTRESOURCE(IDC_APPLICATION));
@@ -146,7 +146,8 @@
GetWindowRect(hwndChild, &rChild);
wChild = rChild.right - rChild.left;
hChild = rChild.bottom - rChild.top;
-
+ if (hwndParent == NULL)
+ hwndParent = GetDesktopWindow();
/* Get the Height and Width of the parent window */
GetWindowRect(hwndParent, &rParent);
wParent = rParent.right - rParent.left;
@@ -609,7 +610,7 @@
lpOf.lpstrInitialDir = szDefPath;
lpOf.lpstrFile = szFile;
lpOf.nMaxFile = SIZ_BUFMAX;
- lpOf.Flags = OFN_LONGNAMES | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
+ lpOf.Flags = OFN_LONGNAMES | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
if (bOpenOrSave)
rv = GetOpenFileNameA(&lpOf);
@@ -644,7 +645,7 @@
lpOf.lpstrInitialDir = szDefPath;
lpOf.lpstrFile = szFile;
lpOf.nMaxFile = SIZ_BUFMAX;
- lpOf.Flags = OFN_LONGNAMES | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
+ lpOf.Flags = OFN_LONGNAMES | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
if (bOpenOrSave)
rv = GetOpenFileNameW(&lpOf);
Modified: trunk/utils/windows/native/service/procrun/src/javajni.c
===================================================================
--- trunk/utils/windows/native/service/procrun/src/javajni.c 2011-04-14 12:48:57 UTC (rev 2746)
+++ trunk/utils/windows/native/service/procrun/src/javajni.c 2011-04-20 14:27:25 UTC (rev 2747)
@@ -15,6 +15,8 @@
*/
#include "apxwin.h"
+#include "handles.h"
+#include "javajni.h"
#include "private.h"
#include <jni.h>
@@ -61,7 +63,6 @@
#define JVM_EXCEPTION_CHECK(jvm) \
((*((jvm)->lpEnv))->ExceptionCheck((jvm)->lpEnv) != JNI_OK)
-#ifdef _DEBUG
#define JVM_EXCEPTION_CLEAR(jvm) \
APXMACRO_BEGIN \
if ((jvm)->lpEnv) { \
@@ -70,15 +71,6 @@
(*((jvm)->lpEnv))->ExceptionClear((jvm)->lpEnv); \
} \
} APXMACRO_END
-#else
-#define JVM_EXCEPTION_CLEAR(jvm) \
- APXMACRO_BEGIN \
- if ((jvm)->lpEnv) { \
- if ((*((jvm)->lpEnv))->ExceptionCheck((jvm)->lpEnv)) { \
- (*((jvm)->lpEnv))->ExceptionClear((jvm)->lpEnv); \
- } \
- } APXMACRO_END
-#endif
#define JNI_LOCAL_UNREF(obj) \
(*(lpJava->lpEnv))->DeleteLocalRef(lpJava->lpEnv, obj)
@@ -119,12 +111,33 @@
HANDLE hWorkerThread;
DWORD iWorkerThread;
DWORD dwWorkerStatus;
-
+ SIZE_T szStackSize;
+ HANDLE hWorkerSync;
} APXJAVAVM, *LPAPXJAVAVM;
+/* This is no longer exported in jni.h
+ * However java uses it internally to get
+ * the default stack size
+ */
+typedef struct APX_JDK1_1InitArgs {
+ jint version;
+
+ char **properties;
+ jint checkSource;
+ jint nativeStackSize;
+ jint javaStackSize;
+ jint minHeapSize;
+ jint maxHeapSize;
+ jint verifyMode;
+ char *classpath;
+
+ char padding[128];
+} APX_JDK1_1InitArgs;
+
#define JAVA_CLASSPATH "-Djava.class.path="
#define JAVA_CLASSPATH_W L"-Djava.class.path="
#define JAVA_CLASSSTRING "java/lang/String"
+#define MSVCRT71_DLLNAME L"\\msvcrt71.dll"
static __inline BOOL __apxJvmAttach(LPAPXJAVAVM lpJava)
{
@@ -163,6 +176,7 @@
static BOOL __apxLoadJvmDll(LPCWSTR szJvmDllPath)
{
UINT errMode;
+ WCHAR jreAltPath[SIZ_PATHLEN];
LPWSTR dllJvmPath = (LPWSTR)szJvmDllPath;
DYNLOAD_FPTR_DECLARE(SetDllDirectoryW);
@@ -173,10 +187,52 @@
dllJvmPath = apxGetJavaSoftRuntimeLib(NULL);
if (!dllJvmPath)
return FALSE;
+ if (GetFileAttributesW(dllJvmPath) == INVALID_FILE_ATTRIBUTES) {
+ /* DAEMON-184: RuntimeLib registry key is invalid.
+ * Check from Jre JavaHome directly
+ */
+ LPWSTR szJreHome = apxGetJavaSoftHome(NULL, TRUE);
+ apxLogWrite(APXLOG_MARK_DEBUG "Invalid RuntimeLib '%S'", dllJvmPath);
+ if (szJreHome) {
+ apxLogWrite(APXLOG_MARK_DEBUG "Using Jre JavaHome '%S'", szJreHome);
+ lstrlcpyW(jreAltPath, SIZ_PATHLEN, szJreHome);
+ lstrlcatW(jreAltPath, SIZ_PATHLEN, L"\\bin\\server\\jvm.dll");
+ dllJvmPath = jreAltPath;
+ }
+ }
/* Suppress the not found system popup message */
errMode = SetErrorMode(SEM_FAILCRITICALERRORS);
+ apxLogWrite(APXLOG_MARK_DEBUG "loading jvm '%S'", dllJvmPath);
_st_sys_jvmDllHandle = LoadLibraryExW(dllJvmPath, NULL, 0);
+ if (IS_INVALID_HANDLE(_st_sys_jvmDllHandle) &&
+ GetFileAttributesW(dllJvmPath) != INVALID_FILE_ATTRIBUTES) {
+ /* There is a file but cannot be loaded.
+ * Try to load the MSVCRTxx.dll before JVM.dll
+ */
+ WCHAR jreBinPath[SIZ_PATHLEN];
+ WCHAR crtBinPath[SIZ_PATHLEN];
+ DWORD i, l = 0;
+
+ lstrlcpyW(jreBinPath, SIZ_PATHLEN, dllJvmPath);
+ for (i = lstrlenW(jreBinPath); i > 0, l < 2; i--) {
+ if (jreBinPath[i] == L'\\' || jreBinPath[i] == L'/') {
+ jreBinPath[i] = L'\0';
+ lstrlcpyW(crtBinPath, SIZ_PATHLEN, jreBinPath);
+ lstrlcatW(crtBinPath, SIZ_PATHLEN, MSVCRT71_DLLNAME);
+ if (GetFileAttributesW(crtBinPath) != INVALID_FILE_ATTRIBUTES) {
+ if (LoadLibraryW(crtBinPath)) {
+ /* Found MSVCRTxx.dll
+ */
+ apxLogWrite(APXLOG_MARK_DEBUG "preloaded '%S'",
+ crtBinPath);
+ break;
+ }
+ }
+ l++;
+ }
+ }
+ }
/* This shuldn't happen, but try to search in %PATH% */
if (IS_INVALID_HANDLE(_st_sys_jvmDllHandle))
_st_sys_jvmDllHandle = LoadLibraryExW(dllJvmPath, NULL,
@@ -192,6 +248,8 @@
if (jreBinPath[i] == L'\\' || jreBinPath[i] == L'/') {
jreBinPath[i] = L'\0';
DYNLOAD_CALL(SetDllDirectoryW)(jreBinPath);
+ apxLogWrite(APXLOG_MARK_DEBUG "Setting DLL search path to '%S'",
+ jreBinPath);
l++;
}
}
@@ -267,9 +325,12 @@
LPAPXJAVAVM lpJava;
jsize iVmCount;
JavaVM *lpJvm = NULL;
+ struct APX_JDK1_1InitArgs jArgs1_1;
if (!__apxLoadJvmDll(szJvmDllPath))
return NULL;
+
+
/*
*/
if (DYNLOAD_FPTR(JNI_GetCreatedJavaVMs)(&lpJvm, 1, &iVmCount) != JNI_OK) {
@@ -287,6 +348,16 @@
lpJava = APXHANDLE_DATA(hJava);
lpJava->lpJvm = lpJvm;
lpJava->iVmCount = iVmCount;
+
+ /* Guess the stack size
+ */
+ AplZeroMemory(&jArgs1_1, sizeof(jArgs1_1));
+ jArgs1_1.version = JNI_VERSION_1_1;
+ DYNLOAD_FPTR(JNI_GetDefaultJavaVMInitArgs)(&jArgs1_1);
+ if (jArgs1_1.javaStackSize < 0 || jArgs1_1.javaStackSize > (2048 * 1024))
+ jArgs1_1.javaStackSize = 0;
+ lpJava->szStackSize = (SIZE_T)jArgs1_1.javaStackSize;
+
if (!_st_sys_jvm)
_st_sys_jvm = lpJvm;
return hJava;
@@ -338,10 +409,7 @@
l = __apxGetMultiSzLengthA(lpString, &n);
}
n += nExtra;
- if (IS_INVALID_HANDLE(hPool))
- buff = apxPoolAlloc(hPool, (n + 1) * sizeof(JavaVMOption) + (l + 1));
- else
- buff = apxAlloc((n + 1) * sizeof(JavaVMOption) + (l + 1));
+ buff = apxPoolAlloc(hPool, (n + 1) * sizeof(JavaVMOption) + (l + 1));
*lppArray = (JavaVMOption *)buff;
p = (LPSTR)(buff + (n + 1) * sizeof(JavaVMOption));
@@ -370,7 +438,142 @@
return rv;
}
+static LPSTR __apxStrIndexA(LPCSTR szStr, int nCh)
+{
+ LPSTR pStr;
+ for (pStr = (LPSTR)szStr; *pStr; pStr++) {
+ if (*pStr == nCh)
+ return pStr;
+ }
+ return NULL;
+}
+
+static LPSTR __apxStrnCatA(APXHANDLE hPool, LPSTR pOrg, LPCSTR szStr, LPCSTR szAdd)
+{
+ DWORD len = 1;
+ DWORD nas = pOrg == NULL;
+ if (pOrg)
+ len += lstrlenA(pOrg);
+ if (szStr)
+ len += lstrlenA(szStr);
+ if (szAdd)
+ len += lstrlenA(szAdd);
+ pOrg = (LPSTR)apxPoolRealloc(hPool, pOrg, len);
+ if (pOrg) {
+ if (nas)
+ *pOrg = '\0';
+ if (szStr)
+ lstrcatA(pOrg, szStr);
+ if (szAdd)
+ lstrcatA(pOrg, szAdd);
+ }
+ return pOrg;
+}
+
+static LPSTR __apxEvalPathPart(APXHANDLE hPool, LPSTR pStr, LPCSTR szPattern)
+{
+ HANDLE hFind;
+ WIN32_FIND_DATAA stGlob;
+ char szJars[MAX_PATH + 1];
+ char szPath[MAX_PATH + 1];
+
+ if (lstrlenA(szPattern) > (sizeof(szJars) - 5)) {
+ return __apxStrnCatA(hPool, pStr, szPattern, NULL);
+ }
+ lstrcpyA(szJars, szPattern);
+ szPath[0] = ';';
+ szPath[1] = '\0';
+ lstrcatA(szPath, szPattern);
+ lstrcatA(szJars, ".jar");
+ /* Remove the trailing asterisk
+ */
+ szPath[lstrlenA(szPath) - 1] = '\0';
+ if ((hFind = FindFirstFileA(szJars, &stGlob)) == INVALID_HANDLE_VALUE) {
+ /* Find failed
+ */
+ return pStr;
+ }
+ pStr = __apxStrnCatA(hPool, pStr, &szPath[1], stGlob.cFileName);
+ if (pStr == NULL) {
+ FindClose(hFind);
+ return NULL;
+ }
+ while (FindNextFileA(hFind, &stGlob) != 0) {
+ pStr = __apxStrnCatA(hPool, pStr, szPath, stGlob.cFileName);
+ if (pStr == NULL)
+ break;
+ }
+ FindClose(hFind);
+ return pStr;
+}
+
+/**
+ * Call glob on each PATH like string path.
+ * Glob is called only if the part ends with asterisk in which
+ * case asterisk is replaced by *.jar when searching
+ */
+static LPSTR __apxEvalClasspath(APXHANDLE hPool, LPCSTR szCp)
+{
+ LPSTR pCpy = __apxStrnCatA(hPool, NULL, JAVA_CLASSPATH, szCp);
+ LPSTR pGcp = NULL;
+ LPSTR pPos;
+ LPSTR pPtr;
+
+ if (!pCpy)
+ return NULL;
+ pPtr = pCpy + sizeof(JAVA_CLASSPATH) - 1;
+ while ((pPos = __apxStrIndexA(pPtr, ';'))) {
+ *pPos = '\0';
+ if (pGcp)
+ pGcp = __apxStrnCatA(hPool, pGcp, ";", NULL);
+ else
+ pGcp = __apxStrnCatA(hPool, NULL, JAVA_CLASSPATH, NULL);
+ if ((pPos > pPtr) && (*(pPos - 1) == '*')) {
+ if (!(pGcp = __apxEvalPathPart(hPool, pGcp, pPtr))) {
+ /* Error.
+ * Return the original string processed so far.
+ */
+ return pCpy;
+ }
+ }
+ else {
+ /* Standard path element */
+ if (!(pGcp = __apxStrnCatA(hPool, pGcp, pPtr, NULL))) {
+ /* Error.
+ * Return the original string processed so far.
+ */
+ return pCpy;
+ }
+ }
+ pPtr = pPos + 1;
+ }
+ if (*pPtr) {
+ int end = lstrlenA(pPtr);
+ if (pGcp)
+ pGcp = __apxStrnCatA(hPool, pGcp, ";", NULL);
+ else
+ pGcp = __apxStrnCatA(hPool, NULL, JAVA_CLASSPATH, NULL);
+ if (end > 0 && pPtr[end - 1] == '*') {
+ /* Last path elemet ends with star
+ * Do a globbing.
+ */
+ pGcp = __apxEvalPathPart(hPool, pGcp, pPtr);
+ }
+ else {
+ /* Just add the part */
+ pGcp = __apxStrnCatA(hPool, pGcp, pPtr, NULL);
+ }
+ }
+ /* Free the allocated copy */
+ if (pGcp) {
+ apxFree(pCpy);
+ return pGcp;
+ }
+ else
+ return pCpy;
+}
+
/* ANSI version only */
BOOL
apxJavaInitialize(APXHANDLE hJava, LPCSTR szClassPath,
@@ -409,7 +612,7 @@
}
else {
CHAR iB[3][64];
- LPSTR szCp;
+ LPSTR szCp = NULL;
lpJava->iVersion = JNI_VERSION_DEFAULT;
if (dwMs)
++sOptions;
@@ -424,9 +627,11 @@
nOptions = __apxMultiSzToJvmOptions(hJava->hPool, lpOptions,
&lpJvmOptions, sOptions);
if (szClassPath && *szClassPath) {
- szCp = apxPoolAlloc(hJava->hPool, sizeof(JAVA_CLASSPATH) + lstrlenA(szClassPath));
- lstrcpyA(szCp, JAVA_CLASSPATH);
- lstrcatA(szCp, szClassPath);
+ szCp = __apxEvalClasspath(hJava->hPool, szClassPath);
+ if (szCp == NULL) {
+ apxLogWrite(APXLOG_MARK_ERROR "Invalid classpath %s", szClassPath);
+ return FALSE;
+ }
lpJvmOptions[nOptions - sOptions].optionString = szCp;
--sOptions;
}
@@ -473,24 +678,10 @@
apxFree(szCp);
apxFree(lpJvmOptions);
}
- /* Load standard classes */
- if (rv) {
- jclass jClazz = JNICALL_1(FindClass, JAVA_CLASSSTRING);
- if (!jClazz) {
- apxLogWrite(APXLOG_MARK_ERROR "FindClass " JAVA_CLASSSTRING " failed");
- goto cleanup;
- }
- lpJava->clString.jClazz = JNICALL_1(NewGlobalRef, jClazz);
- JNI_LOCAL_UNREF(jClazz);
-
+ if (rv)
return TRUE;
- }
else
return FALSE;
-
-cleanup:
- JVM_EXCEPTION_CLEAR(lpJava);
- return FALSE;
}
/* ANSI version only */
@@ -596,12 +787,21 @@
DWORD nArgs;
LPAPXJAVAVM lpJava;
jclass jClazz;
+ LPCSTR szSignature = "([Ljava/lang/String;)V";
if (hJava->dwType != APXHANDLE_TYPE_JVM)
return FALSE;
lpJava = APXHANDLE_DATA(hJava);
if (!__apxJvmAttach(lpJava))
return FALSE;
+ jClazz = JNICALL_1(FindClass, JAVA_CLASSSTRING);
+ if (!jClazz) {
+ JVM_EXCEPTION_CLEAR(lpJava);
+ apxLogWrite(APXLOG_MARK_ERROR "FindClass " JAVA_CLASSSTRING " failed");
+ return FALSE;
+ }
+ lpJava->clString.jClazz = JNICALL_1(NewGlobalRef, jClazz);
+ JNI_LOCAL_UNREF(jClazz);
/* Find the class */
jClazz = JNICALL_1(FindClass, szClassName);
@@ -616,29 +816,36 @@
if (!szMethodName)
szMethodName = "main";
+ if (lstrcmpA(szClassName, "java/lang/System") == 0) {
+ /* Usable only for exit method, so force */
+ szSignature = "(I)V";
+ szMethodName = "exit";
+ }
lstrlcpyA(lpJava->clWorker.sClazz, 1024, szClassName);
lstrlcpyA(lpJava->clWorker.sMethod, 512, szMethodName);
lpJava->clWorker.jMethod = JNICALL_3(GetStaticMethodID,
lpJava->clWorker.jClazz,
- szMethodName, "([Ljava/lang/String;)V");
+ szMethodName, szSignature);
if (!lpJava->clWorker.jMethod) {
JVM_EXCEPTION_CLEAR(lpJava);
apxLogWrite(APXLOG_MARK_ERROR "Method 'static void %s(String[])' not found in Class %s",
szMethodName, szClassName);
return FALSE;
}
- nArgs = apxMultiSzToArrayW(hJava->hPool, lpArguments, &lpArgs);
- lpJava->clWorker.jArgs = JNICALL_3(NewObjectArray, nArgs,
- lpJava->clString.jClazz, NULL);
- if (nArgs) {
- DWORD i;
- for (i = 0; i < nArgs; i++) {
- jstring arg = JNICALL_2(NewString, lpArgs[i], lstrlenW(lpArgs[i]));
- JNICALL_3(SetObjectArrayElement, lpJava->clWorker.jArgs, i, arg);
- apxLogWrite(APXLOG_MARK_DEBUG "argv[%d] = %S", i, lpArgs[i]);
+ if (lstrcmpA(szClassName, "java/lang/System")) {
+ nArgs = apxMultiSzToArrayW(hJava->hPool, lpArguments, &lpArgs);
+ lpJava->clWorker.jArgs = JNICALL_3(NewObjectArray, nArgs,
+ lpJava->clString.jClazz, NULL);
+ if (nArgs) {
+ DWORD i;
+ for (i = 0; i < nArgs; i++) {
+ jstring arg = JNICALL_2(NewString, lpArgs[i], lstrlenW(lpArgs[i]));
+ JNICALL_3(SetObjectArrayElement, lpJava->clWorker.jArgs, i, arg);
+ apxLogWrite(APXLOG_MARK_DEBUG "argv[%d] = %S", i, lpArgs[i]);
+ }
}
+ apxFree(lpArgs);
}
- apxFree(lpArgs);
return TRUE;
}
@@ -651,11 +858,31 @@
#define WORKER_EXIT(x) { rv = x; goto finished; }
DWORD rv = 0;
LPAPXJAVAVM lpJava;
- APXHANDLE hJava = (APXHANDLE)lpParameter;
- /* This shouldn't happen */
+ LPAPXJAVA_THREADARGS pArgs = (LPAPXJAVA_THREADARGS)lpParameter;
+ APXHANDLE hJava;
+
+ hJava = (APXHANDLE)pArgs->hJava;
if (hJava->dwType != APXHANDLE_TYPE_JVM)
- WORKER_EXIT(0);
- lpJava = APXHANDLE_DATA(hJava);
+ WORKER_EXIT(1);
+
+ if (!apxJavaInitialize(pArgs->hJava,
+ pArgs->szClassPath,
+ pArgs->lpOptions,
+ pArgs->dwMs, pArgs->dwMx, pArgs->dwSs,
+ pArgs->bJniVfprintf)) {
+ WORKER_EXIT(2);
+ }
+
+ if (!apxJavaLoadMainClass(pArgs->hJava,
+ pArgs->szClassName,
+ pArgs->szMethodName,
+ pArgs->lpArguments)) {
+ WORKER_EXIT(2);
+ }
+ apxJavaSetOut(pArgs->hJava, TRUE, pArgs->szStdErrFilename);
+ apxJavaSetOut(pArgs->hJava, FALSE, pArgs->szStdOutFilename);
+
+ lpJava = APXHANDLE_DATA(pArgs->hJava);
/* Check if we have a class and a method */
if (!lpJava->clWorker.jClazz || !lpJava->clWorker.jMethod)
WORKER_EXIT(2);
@@ -664,45 +891,53 @@
apxLogWrite(APXLOG_MARK_DEBUG "Java Worker thread started %s:%s",
lpJava->clWorker.sClazz, lpJava->clWorker.sMethod);
lpJava->dwWorkerStatus = 1;
+ SetEvent(lpJava->hWorkerSync);
JNICALL_3(CallStaticVoidMethod,
lpJava->clWorker.jClazz,
lpJava->clWorker.jMethod,
lpJava->clWorker.jArgs);
-
- JVM_EXCEPTION_CLEAR(lpJava);
- __apxJvmDetach(lpJava);
- apxLogWrite(APXLOG_MARK_DEBUG "Java Worker thread %s:%s finished",
- lpJava->clWorker.sClazz, lpJava->clWorker.sMethod);
+ if (JVM_EXCEPTION_CHECK(lpJava)) {
+ WORKER_EXIT(4);
+ }
+ else {
+ __apxJvmDetach(lpJava);
+ }
finished:
lpJava->dwWorkerStatus = 0;
- apxLogWrite(APXLOG_MARK_DEBUG "Java Worker thread finished %s:%s",
- lpJava->clWorker.sClazz, lpJava->clWorker.sMethod);
+ apxLogWrite(APXLOG_MARK_DEBUG "Java Worker thread finished %s:%s with status=%d",
+ lpJava->clWorker.sClazz, lpJava->clWorker.sMethod, rv);
+ SetEvent(lpJava->hWorkerSync);
ExitThread(rv);
/* never gets here but keep the compiler happy */
return 0;
}
-
-BOOL
-apxJavaStart(APXHANDLE hJava)
+apxJavaStart(LPAPXJAVA_THREADARGS pArgs)
{
LPAPXJAVAVM lpJava;
-
- if (hJava->dwType != APXHANDLE_TYPE_JVM)
- return FALSE;
- lpJava = APXHANDLE_DATA(hJava);
-
- lpJava->hWorkerThread = CreateThread(NULL, 0, __apxJavaWorkerThread,
- hJava, CREATE_SUSPENDED,
- &lpJava->iWorkerThread);
+ lpJava = APXHANDLE_DATA(pArgs->hJava);
+ lpJava->dwWorkerStatus = 0;
+ lpJava->hWorkerSync = CreateEvent(NULL, FALSE, FALSE, NULL);
+ lpJava->hWorkerThread = CreateThread(NULL,
+ lpJava->szStackSize,
+ __apxJavaWorkerThread,
+ pArgs, CREATE_SUSPENDED,
+ &lpJava->iWorkerThread);
if (IS_INVALID_HANDLE(lpJava->hWorkerThread)) {
apxLogWrite(APXLOG_MARK_SYSERR);
return FALSE;
}
ResumeThread(lpJava->hWorkerThread);
- /* Give some time to initialize the thread */
- Sleep(1000);
+ /* Wait until the worker thread initializes */
+ WaitForSingleObject(lpJava->hWorkerSync, INFINITE);
+ if (lstrcmpA(lpJava->clWorker.sClazz, "java/lang/System")) {
+ /* Give some time to initialize the thread
+ * Unless we are calling System.exit(0).
+ * This will be hanled by _onexit hook.
+ */
+ Sleep(1000);
+ }
return TRUE;
}
Modified: trunk/utils/windows/native/service/procrun/src/log.c
===================================================================
--- trunk/utils/windows/native/service/procrun/src/log.c 2011-04-14 12:48:57 UTC (rev 2746)
+++ trunk/utils/windows/native/service/procrun/src/log.c 2011-04-20 14:27:25 UTC (rev 2747)
@@ -18,13 +18,13 @@
#include "private.h"
#include <stdio.h>
-#define LINE_SEP "\n"
+#define LINE_SEP "\r\n"
#define LOGF_EXT L".%04d-%02d-%02d.log"
static LPCSTR _log_level[] = {
"[debug] ",
- "[info] ",
- "[warn] ",
+ "[info] ",
+ "[warn] ",
"[error] ",
NULL
};
@@ -112,7 +112,16 @@
if (!szPath) {
if (GetSystemDirectoryW(sPath, MAX_PATH) == 0)
return INVALID_HANDLE_VALUE;
- lstrlcatW(sPath, MAX_PATH, L"\\LogFiles\\Apache");
+ lstrlcatW(sPath, MAX_PATH, L"\\LogFiles");
+ if (!CreateDirectoryW(sPath, NULL) && GetLastError() != ERROR_ALREADY_EXISTS) {
+ if (!CreateDirectoryW(sPath, NULL))
+ return INVALID_HANDLE_VALUE;
+ }
+ lstrlcatW(sPath, MAX_PATH, L"\\Apache");
+ if (!CreateDirectoryW(sPath, NULL) && GetLastError() != ERROR_ALREADY_EXISTS) {
+ if (!CreateDirectoryW(sPath, NULL))
+ return INVALID_HANDLE_VALUE;
+ }
}
else {
lstrlcpyW(sPath, MAX_PATH, szPath);
@@ -125,7 +134,7 @@
sysTime.wMonth,
sysTime.wDay);
if (!(h = (apx_logfile_st *)apxPoolCalloc(hPool, sizeof(apx_logfile_st))))
- return NULL;
+ return INVALID_HANDLE_VALUE;
/* Set default level to info */
h->dwLogLevel = APXLOG_LEVEL_INFO;
CreateDirectoryW(sPath, NULL);
@@ -141,6 +150,13 @@
OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH | FILE_FLAG_SEQUENTIAL_SCAN,
NULL);
+ if (h->hFile == INVALID_HANDLE_VALUE) {
+ /* Make sure we write somewhere */
+ h = &_st_sys_errhandle;
+ apxDisplayError(FALSE, NULL, 0,
+ "Unable to create logger at '%S'\n", sPath);
+ return (HANDLE)h;
+ }
/* Set this file as system log file */
if (!_st_sys_loghandle)
_st_sys_loghandle = h;
@@ -231,7 +247,7 @@
...)
{
va_list args;
- CHAR buffer[1024+32];
+ CHAR buffer[1024+32] = "";
LPSTR szBp;
int len = 0;
LPCSTR f = szFile;
@@ -258,16 +274,26 @@
if(f != szFile)
f++;
}
- szBp = &buffer[0];
+ else
+ f = "";
+ szBp = buffer;
if (!szFormat) {
- FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- err,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- szBp,
- 1000,
- NULL);
+ if (err == 0) {
+ lstrcpyA(szBp, "Unknown error code");
+ if (dwLevel == APXLOG_LEVEL_ERROR) {
+ szBp += 18;
+ wsprintfA(szBp, " occured in (%s:%d) ", f, dwLine);
+ }
+ }
+ else
+ FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ err,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ szBp,
+ 1000,
+ NULL);
}
else {
va_start(args, szFormat);
@@ -277,10 +303,10 @@
len = lstrlenA(buffer);
if (len > 0) {
/* Remove trailing line separator */
- if (buffer[len - 1] == '\n') {
- buffer[len - 1] = '\0';
- --len;
- }
+ if (buffer[len - 1] == '\n')
+ buffer[--len] = '\0';
+ if (len > 0 && buffer[len - 1] == '\r')
+ buffer[--len] = '\0';
if (!IS_INVALID_HANDLE(lf->hFile)) {
SYSTEMTIME t;
GetLocalTime(&t);
@@ -303,8 +329,9 @@
wsprintfA(sb, "(%10s:%-4d) ", f, dwLine);
WriteFile(lf->hFile, sb, lstrlenA(sb), &wr, NULL);
}
- WriteFile(lf->hFile, buffer, len, &wr, NULL);
-
+ if (len)
+ WriteFile(lf->hFile, buffer, len, &wr, NULL);
+
/* Terminate the line */
WriteFile(lf->hFile, LINE_SEP, sizeof(LINE_SEP) - 1, &wr, NULL);
#ifdef _DEBUG_FULL
@@ -324,6 +351,11 @@
}
/* Restore the last Error code */
SetLastError(err);
+ if (szFormat && err != 0 && dwLevel == APXLOG_LEVEL_ERROR) {
+ /* Print the System error description
+ */
+ apxLogWrite(hFile, dwLevel, bTimeStamp, szFile, dwLine, NULL);
+ }
return len;
}
@@ -365,6 +397,8 @@
if(f != szFile)
f++;
}
+ else
+ f = "";
sysbuf[0] = '\0';
if (err != ERROR_SUCCESS) {
len = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
@@ -375,26 +409,24 @@
sysbuf,
SIZ_DESLEN,
NULL);
+ sysbuf[len] = '\0';
if (len > 0) {
- sysbuf[len] = '\0';
- if (sysbuf[len - 1] == '\n') {
- sysbuf[len - 1] = '\0';
- --len;
- }
+ if (sysbuf[len - 1] == '\n')
+ sysbuf[--len] = '\0';
+ if (len > 0 && sysbuf[len - 1] == '\r')
+ sysbuf[--len] = '\0';
}
- else
- sysbuf[0] = '\0';
}
if (szFormat) {
va_start(args, szFormat);
wvsprintfA(buffer, szFormat, args);
va_end(args);
- if (f) {
+ if (f && *f) {
CHAR sb[SIZ_PATHLEN];
wsprintfA(sb, "%s (%d)", f, dwLine);
lstrcatA(sysbuf, sb);
}
- lstrlcatA(sysbuf, SIZ_HUGLEN, "\n");
+ lstrlcatA(sysbuf, SIZ_HUGLEN, LINE_SEP);
lstrlcatA(sysbuf, SIZ_HUGLEN, buffer);
}
len = lstrlenA(sysbuf);
@@ -409,7 +441,8 @@
}
else {
fputs(sysbuf, stderr);
- fputc('\n', stderr);
+ if (!szFormat)
+ fputs(LINE_SEP, stderr);
fflush(stderr);
}
}
Modified: trunk/utils/windows/native/service/procrun/src/mclib.c
===================================================================
--- trunk/utils/windows/native/service/procrun/src/mclib.c 2011-04-14 12:48:57 UTC (rev 2746)
+++ trunk/utils/windows/native/service/procrun/src/mclib.c 2011-04-20 14:27:25 UTC (rev 2747)
@@ -311,7 +311,7 @@
/* Find the end of dst and adjust bytes left but don't go past end */
while (n-- != 0 && *d != '\0')
d++;
- dlen = d - dst;
+ dlen = (int)(d - dst);
n = siz - dlen;
if (n == 0)
@@ -339,7 +339,7 @@
/* Find the end of dst and adjust bytes left but don't go past end */
while (n-- != 0 && *d != '\0')
d++;
- dlen = d - dst;
+ dlen = (int)(d - dst);
n = siz - dlen;
if (n == 0)
@@ -407,3 +407,14 @@
return d;
}
+
+LPWSTR
+lstrlocaseW(LPWSTR str)
+{
+ LPWSTR p = str;
+ while (p && *p != 0) {
+ *p = towlower(*p);
+ p++;
+ }
+ return str;
+}
Modified: trunk/utils/windows/native/service/procrun/src/registry.c
===================================================================
--- trunk/utils/windows/native/service/procrun/src/registry.c 2011-04-14 12:48:57 UTC (rev 2746)
+++ trunk/utils/windows/native/service/procrun/src/registry.c 2011-04-20 14:27:25 UTC (rev 2747)
@@ -236,10 +236,14 @@
HKEY hSparamKey = NULL;
HKEY hUparamKey = NULL;
- if (!szKeyName || lstrlenW(szKeyName) > SIZ_RESMAX)
+ if (!szKeyName || lstrlenW(szKeyName) > SIZ_RESMAX) {
+ SetLastError(ERROR_INVALID_PARAMETER);
return NULL;
- if (szRoot && lstrlenW(szRoot) > SIZ_RESMAX)
+ }
+ if (szRoot && lstrlenW(szRoot) > SIZ_RESMAX) {
+ SetLastError(ERROR_INVALID_PARAMETER);
return NULL;
+ }
/* make the HKLM\\SOFTWARE key */
lstrcpyW(buff, REGSOFTWARE_ROOT);
@@ -821,7 +825,7 @@
WCHAR szName[SIZ_BUFLEN];
HKEY hKey = NULL;
- if (ERROR_SUCCESS == RegDeleteKey(hKeyRoot, szSubKey)) {
+ if (ERROR_SUCCESS == RegDeleteKeyW(hKeyRoot, szSubKey)) {
return ERROR_SUCCESS;
}
Modified: trunk/utils/windows/native/service/procrun/src/service.c
===================================================================
--- trunk/utils/windows/native/service/procrun/src/service.c 2011-04-14 12:48:57 UTC (rev 2746)
+++ trunk/utils/windows/native/service/procrun/src/service.c 2011-04-20 14:27:25 UTC (rev 2747)
@@ -39,14 +39,21 @@
} APXSERVICE, *LPAPXSERVICE;
+static WCHAR __invalidPathChars[] = L"<>:\"/\\:|?*";
static BOOL __apxIsValidServiceName(LPCWSTR szServiceName)
{
- do {
- if (!IsCharAlphaNumericW(*szServiceName)) {
- apxDisplayError(FALSE, NULL, 0, "NonAlpha %d", *szServiceName);
- return FALSE;
+ WCHAR ch;
+ int i = 0;
+ while ((ch = szServiceName[i++])) {
+ int j = 0;
+ while (__invalidPathChars[j]) {
+ if (ch < 30 || ch == __invalidPathChars[j++]) {
+ apxDisplayError(FALSE, NULL, 0, "Service '%S' contains invalid character '%C'",
+ szServiceName, ch);
+ return FALSE;
+ }
}
- } while( *(++szServiceName));
+ }
return TRUE;
}
@@ -242,7 +249,7 @@
DWORD dwBytesNeeded;
DWORD dwCount;
- LPENUM_SERVICE_STATUS lpDependencies = NULL;
+ LPENUM_SERVICE_STATUSW lpDependencies = NULL;
ENUM_SERVICE_STATUS ess;
SC_HANDLE hDepService;
SERVICE_STATUS_PROCESS ssp;
@@ -253,11 +260,11 @@
/* Pass a zero-length buffer to get the required buffer size.
*/
- if (EnumDependentServices(lpService->hService,
- SERVICE_ACTIVE,
- lpDependencies, 0,
- &dwBytesNeeded,
- &dwCount)) {
+ if (EnumDependentServicesW(lpService->hService,
+ SERVICE_ACTIVE,
+ lpDependencies, 0,
+ &dwBytesNeeded,
+ &dwCount)) {
/* If the Enum call succeeds, then there are no dependent
* services, so do nothing.
*/
@@ -277,24 +284,26 @@
__try {
/* Enumerate the dependencies. */
- if (!EnumDependentServices(lpService->hService,
- SERVICE_ACTIVE,
- lpDependencies,
- dwBytesNeeded,
- &dwBytesNeeded,
- &dwCount))
+ if (!EnumDependentServicesW(lpService->hService,
+ SERVICE_ACTIVE,
+ lpDependencies,
+ dwBytesNeeded,
+ &dwBytesNeeded,
+ &dwCount))
return FALSE;
for (i = 0; i < dwCount; i++) {
ess = *(lpDependencies + i);
/* Open the service. */
- hDepService = OpenService(lpService->hManager,
- ess.lpServiceName,
- SERVICE_STOP | SERVICE_QUERY_STATUS);
+ hDepService = OpenServiceW(lpService->hManager,
+ ess.lpServiceName,
+ SERVICE_STOP | SERVICE_QUERY_STATUS);
if (!hDepService)
- return FALSE;
-
+ continue;
+ if (lstrcmpiW(ess.lpServiceName, L"Tcpip") == 0 ||
+ lstrcmpiW(ess.lpServiceName, L"Afd") == 0)
+ continue;
__try {
/* Send a stop code. */
if (!ControlService(hDepService,
@@ -508,6 +517,11 @@
lpService->stServiceEntry.lpConfig = NULL;
AplZeroMemory(&lpService->stServiceEntry, sizeof(APXSERVENTRY));
+ if (lpDependencies)
+ lpDependencies = apxMultiSzCombine(NULL, lpDependencies,
+ L"Tcpip\0Afd\0", NULL);
+ else
+ lpDependencies = L"Tcpip\0Afd\0";
lpService->hService = CreateServiceW(lpService->hManager,
szServiceName,
szDisplayName,
Modified: trunk/utils/windows/native/service/procrun/src/utils.c
===================================================================
--- trunk/utils/windows/native/service/procrun/src/utils.c 2011-04-14 12:48:57 UTC (rev 2746)
+++ trunk/utils/windows/native/service/procrun/src/utils.c 2011-04-20 14:27:25 UTC (rev 2747)
@@ -256,7 +256,7 @@
if (lb) {
AplMoveMemory(&rv[la], lpStrB, lb * sizeof(WCHAR));
}
- if (*lpdwLength)
+ if (lpdwLength)
*lpdwLength = (la + lb + 1) * sizeof(WCHAR);
return rv;
}
13 years, 9 months
JBoss Native SVN: r2746 - trunk/build/unix.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2011-04-14 08:48:57 -0400 (Thu, 14 Apr 2011)
New Revision: 2746
Modified:
trunk/build/unix/package.list
Log:
Release 1.0.10 :D
Modified: trunk/build/unix/package.list
===================================================================
--- trunk/build/unix/package.list 2011-03-31 09:22:58 UTC (rev 2745)
+++ trunk/build/unix/package.list 2011-04-14 12:48:57 UTC (rev 2746)
@@ -52,5 +52,6 @@
mod_cluster|1.0.9.dev|2.2.15|ssl:v:0.9.8k|zlib:v:1.2.3|jk:v:1.2.30|iconv:v:1.11|expat:v:1.95.8|cluster:t:branches/1.0.x
mod_cluster|1.0.9.GA|2.2.15|ssl:v:0.9.8k|zlib:v:1.2.3|jk:v:1.2.30|iconv:v:1.11|expat:v:1.95.8|cluster:t:1.0.9.GA
mod_cluster|1.1.2.dev|2.2.15|ssl:v:0.9.8k|zlib:v:1.2.3|jk:v:1.2.30|iconv:v:1.11|expat:v:1.95.8|cluster:t:trunk
+mod_cluster|1.0.10.GA|2.2.15|ssl:v:0.9.8k|zlib:v:1.2.3|jk:v:1.2.30|iconv:v:1.11|expat:v:1.95.8|cluster:t:1.0.10.GA
traffic_server|TS_Trunk|trunk
TC7|TC7_Trunk|trunk
13 years, 9 months