6596475: (launcher) javaw should call InitCommonControls
Summary: javaw does not show error window after manifest changes.
Reviewed-by: darcy
--- a/jdk/make/java/jli/Makefile Mon Mar 03 15:44:50 2008 +0100
+++ b/jdk/make/java/jli/Makefile Thu Mar 06 07:51:28 2008 -0800
@@ -107,6 +107,7 @@
ifeq ($(PLATFORM), windows)
EXTRA_LIBS = advapi32.lib \
+ comctl32.lib \
user32.lib
JAVALIB =
--- a/jdk/make/java/main/java/Makefile Mon Mar 03 15:44:50 2008 +0100
+++ b/jdk/make/java/main/java/Makefile Thu Mar 06 07:51:28 2008 -0800
@@ -43,7 +43,7 @@
# Override the default version info with our own resource file (see 5106536)
ifeq ($(PLATFORM), windows)
-LDLIBS_COMMON += user32.lib
+LDLIBS_COMMON += user32.lib comctl32.lib
ifdef OPENJDK
RC_FLAGS += -i "$(PLATFORM_SRC)/resource/icons"
else
--- a/jdk/make/java/main/javaw/Makefile Mon Mar 03 15:44:50 2008 +0100
+++ b/jdk/make/java/main/javaw/Makefile Thu Mar 06 07:51:28 2008 -0800
@@ -46,7 +46,7 @@
include $(BUILDDIR)/common/Defs.gmk
OTHER_CPPFLAGS += -DJAVAW
-LDLIBS_COMMON += user32.lib
+LDLIBS_COMMON += user32.lib comctl32.lib
# Override the default version info with our own resource file (see 5106536)
ifeq ($(PLATFORM), windows)
--- a/jdk/src/share/bin/java.c Mon Mar 03 15:44:50 2008 +0100
+++ b/jdk/src/share/bin/java.c Thu Mar 06 07:51:28 2008 -0800
@@ -205,9 +205,7 @@
_wc_enabled = cpwildcard;
_ergo_policy = ergo;
- if (javaw == JNI_TRUE)
- SetJavaw();
-
+ InitLauncher(javaw);
DumpState();
/*
--- a/jdk/src/share/bin/java.h Mon Mar 03 15:44:50 2008 +0100
+++ b/jdk/src/share/bin/java.h Thu Mar 06 07:51:28 2008 -0800
@@ -172,7 +172,6 @@
const char* GetFullVersion();
jboolean IsJavaArgs();
jboolean IsJavaw();
-void SetJavaw();
jint GetErgoPolicy();
jboolean ServerClassMachine();
@@ -180,5 +179,9 @@
static int ContinueInNewThread(InvocationFunctions* ifn, int argc, char** argv,
char* jarfile, char* classname, int ret);
+/*
+ * Initialize platform specific settings
+ */
+void InitLauncher(jboolean javaw);
#endif /* _JAVA_H_ */
--- a/jdk/src/share/bin/main.c Mon Mar 03 15:44:50 2008 +0100
+++ b/jdk/src/share/bin/main.c Thu Mar 06 07:51:28 2008 -0800
@@ -64,8 +64,6 @@
margv = argv;
#endif /* JAVAW */
- JLI_SetTraceLauncher();
-
return JLI_Launch(margc, margv,
sizeof(const_jargs) / sizeof(char *), const_jargs,
sizeof(const_appclasspath) / sizeof(char *), const_appclasspath,
--- a/jdk/src/solaris/bin/java_md.c Mon Mar 03 15:44:50 2008 +0100
+++ b/jdk/src/solaris/bin/java_md.c Thu Mar 06 07:51:28 2008 -0800
@@ -1299,12 +1299,6 @@
AddOption(pid_prop_str, NULL);
#endif
}
-void
-SetJavaw()
-{
- /* noop on UNIX */
- return;
-}
jboolean
IsJavaw()
@@ -1312,3 +1306,9 @@
/* noop on UNIX */
return JNI_FALSE;
}
+
+void
+InitLauncher(jboolean javaw)
+{
+ JLI_SetTraceLauncher();
+}
--- a/jdk/src/windows/bin/java_md.c Mon Mar 03 15:44:50 2008 +0100
+++ b/jdk/src/windows/bin/java_md.c Thu Mar 06 07:51:28 2008 -0800
@@ -33,6 +33,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <wtypes.h>
+#include <commctrl.h>
#include <jni.h>
#include "java.h"
@@ -52,11 +53,6 @@
static jboolean _isjavaw = JNI_FALSE;
-void
-SetJavaw()
-{
- _isjavaw = JNI_TRUE;
-}
jboolean
IsJavaw()
@@ -999,3 +995,20 @@
/* Linux only, empty on windows. */
void SetJavaLauncherPlatformProps() {}
+
+void
+InitLauncher(boolean javaw)
+{
+ INITCOMMONCONTROLSEX icx;
+
+ /*
+ * Required for javaw mode MessageBox output as well as for
+ * HotSpot -XX:+ShowMessageBoxOnError in java mode, an empty
+ * flag field is sufficient to perform the basic UI initialization.
+ */
+ memset(&icx, 0, sizeof(INITCOMMONCONTROLSEX));
+ icx.dwSize = sizeof(INITCOMMONCONTROLSEX);
+ InitCommonControlsEx(&icx);
+ _isjavaw = javaw;
+ JLI_SetTraceLauncher();
+}