7410
|
1 |
/*
|
|
2 |
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
|
7 |
* published by the Free Software Foundation.
|
|
8 |
*
|
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
13 |
* accompanied this code).
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License version
|
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 |
*
|
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
20 |
* or visit www.oracle.com if you need additional information or have any
|
|
21 |
* questions.
|
|
22 |
*
|
|
23 |
*/
|
|
24 |
|
|
25 |
#include <windows.h>
|
|
26 |
#include <io.h>
|
|
27 |
#include <process.h>
|
|
28 |
#include <stdlib.h>
|
|
29 |
#include <stdio.h>
|
|
30 |
#include <string.h>
|
|
31 |
#include <sys/types.h>
|
|
32 |
#include <sys/stat.h>
|
|
33 |
|
|
34 |
#include <jni.h>
|
|
35 |
#include "java.h"
|
|
36 |
#ifndef GAMMA
|
|
37 |
#include "version_comp.h"
|
|
38 |
#endif
|
|
39 |
|
|
40 |
#define JVM_DLL "jvm.dll"
|
|
41 |
#define JAVA_DLL "java.dll"
|
|
42 |
#define CRT_DLL "msvcr71.dll"
|
|
43 |
|
|
44 |
/*
|
|
45 |
* Prototypes.
|
|
46 |
*/
|
|
47 |
static jboolean GetPublicJREHome(char *path, jint pathsize);
|
|
48 |
static jboolean GetJVMPath(const char *jrepath, const char *jvmtype,
|
|
49 |
char *jvmpath, jint jvmpathsize);
|
|
50 |
static jboolean GetJREPath(char *path, jint pathsize);
|
|
51 |
static void EnsureJreInstallation(const char *jrepath);
|
|
52 |
|
|
53 |
/* We supports warmup for UI stack that is performed in parallel
|
|
54 |
* to VM initialization.
|
|
55 |
* This helps to improve startup of UI application as warmup phase
|
|
56 |
* might be long due to initialization of OS or hardware resources.
|
|
57 |
* It is not CPU bound and therefore it does not interfere with VM init.
|
|
58 |
* Obviously such warmup only has sense for UI apps and therefore it needs
|
|
59 |
* to be explicitly requested by passing -Dsun.awt.warmup=true property
|
|
60 |
* (this is always the case for plugin/javaws).
|
|
61 |
*
|
|
62 |
* Implementation launches new thread after VM starts and use it to perform
|
|
63 |
* warmup code (platform dependent).
|
|
64 |
* This thread is later reused as AWT toolkit thread as graphics toolkit
|
|
65 |
* often assume that they are used from the same thread they were launched on.
|
|
66 |
*
|
|
67 |
* At the moment we only support warmup for D3D. It only possible on windows
|
|
68 |
* and only if other flags do not prohibit this (e.g. OpenGL support requested).
|
|
69 |
*/
|
|
70 |
#undef ENABLE_AWT_PRELOAD
|
|
71 |
#ifndef JAVA_ARGS /* turn off AWT preloading for javac, jar, etc */
|
|
72 |
#ifdef _X86_ /* for now disable AWT preloading for 64bit */
|
|
73 |
#define ENABLE_AWT_PRELOAD
|
|
74 |
#endif
|
|
75 |
#endif
|
|
76 |
|
|
77 |
#ifdef ENABLE_AWT_PRELOAD
|
|
78 |
/* "AWT was preloaded" flag;
|
|
79 |
* Turned on by AWTPreload().
|
|
80 |
*/
|
|
81 |
int awtPreloaded = 0;
|
|
82 |
|
|
83 |
/* Calls a function with the name specified.
|
|
84 |
* The function must be int(*fn)(void).
|
|
85 |
*/
|
|
86 |
int AWTPreload(const char *funcName);
|
|
87 |
/* Stops AWT preloading. */
|
|
88 |
void AWTPreloadStop();
|
|
89 |
|
|
90 |
/* D3D preloading */
|
|
91 |
/* -1: not initialized; 0: OFF, 1: ON */
|
|
92 |
int awtPreloadD3D = -1;
|
|
93 |
/* Command line parameter to swith D3D preloading on. */
|
|
94 |
#define PARAM_PRELOAD_D3D "-Dsun.awt.warmup"
|
|
95 |
/* D3D/OpenGL management parameters (may disable D3D preloading) */
|
|
96 |
#define PARAM_NODDRAW "-Dsun.java2d.noddraw"
|
|
97 |
#define PARAM_D3D "-Dsun.java2d.d3d"
|
|
98 |
#define PARAM_OPENGL "-Dsun.java2d.opengl"
|
|
99 |
/* funtion in awt.dll (src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp) */
|
|
100 |
#define D3D_PRELOAD_FUNC "preloadD3D"
|
|
101 |
|
|
102 |
|
|
103 |
/* Extracts value of a parameter with the specified name
|
|
104 |
* from command line argument (returns pointer in the argument).
|
|
105 |
* Returns NULL if the argument does not contains the parameter.
|
|
106 |
* e.g.:
|
|
107 |
* GetParamValue("theParam", "theParam=value") returns pointer to "value".
|
|
108 |
*/
|
|
109 |
const char * GetParamValue(const char *paramName, const char *arg) {
|
|
110 |
int nameLen = strlen(paramName);
|
|
111 |
if (strncmp(paramName, arg, nameLen) == 0) {
|
|
112 |
// arg[nameLen] is valid (may contain final NULL)
|
|
113 |
if (arg[nameLen] == '=') {
|
|
114 |
return arg + nameLen + 1;
|
|
115 |
}
|
|
116 |
}
|
|
117 |
return NULL;
|
|
118 |
}
|
|
119 |
|
|
120 |
/* Checks if commandline argument contains property specified
|
|
121 |
* and analyze it as boolean property (true/false).
|
|
122 |
* Returns -1 if the argument does not contain the parameter;
|
|
123 |
* Returns 1 if the argument contains the parameter and its value is "true";
|
|
124 |
* Returns 0 if the argument contains the parameter and its value is "false".
|
|
125 |
*/
|
|
126 |
int GetBoolParamValue(const char *paramName, const char *arg) {
|
|
127 |
const char * paramValue = GetParamValue(paramName, arg);
|
|
128 |
if (paramValue != NULL) {
|
|
129 |
if (stricmp(paramValue, "true") == 0) {
|
|
130 |
return 1;
|
|
131 |
}
|
|
132 |
if (stricmp(paramValue, "false") == 0) {
|
|
133 |
return 0;
|
|
134 |
}
|
|
135 |
}
|
|
136 |
return -1;
|
|
137 |
}
|
|
138 |
#endif /* ENABLE_AWT_PRELOAD */
|
|
139 |
|
|
140 |
|
|
141 |
const char *
|
|
142 |
GetArch()
|
|
143 |
{
|
|
144 |
|
|
145 |
#ifdef _M_AMD64
|
|
146 |
return "amd64";
|
|
147 |
#elif defined(_M_IA64)
|
|
148 |
return "ia64";
|
|
149 |
#else
|
|
150 |
return "i386";
|
|
151 |
#endif
|
|
152 |
}
|
|
153 |
|
|
154 |
/*
|
|
155 |
*
|
|
156 |
*/
|
|
157 |
void
|
|
158 |
CreateExecutionEnvironment(int *_argc,
|
|
159 |
char ***_argv,
|
|
160 |
char jrepath[],
|
|
161 |
jint so_jrepath,
|
|
162 |
char jvmpath[],
|
|
163 |
jint so_jvmpath,
|
|
164 |
char **original_argv) {
|
|
165 |
#ifndef GAMMA
|
|
166 |
char * jvmtype;
|
|
167 |
|
|
168 |
/* Find out where the JRE is that we will be using. */
|
|
169 |
if (!GetJREPath(jrepath, so_jrepath)) {
|
|
170 |
ReportErrorMessage("Error: could not find Java SE Runtime Environment.",
|
|
171 |
JNI_TRUE);
|
|
172 |
exit(2);
|
|
173 |
}
|
|
174 |
|
|
175 |
/* Do this before we read jvm.cfg */
|
|
176 |
EnsureJreInstallation(jrepath);
|
|
177 |
|
|
178 |
/* Find the specified JVM type */
|
|
179 |
if (ReadKnownVMs(jrepath, (char*)GetArch(), JNI_FALSE) < 1) {
|
|
180 |
ReportErrorMessage("Error: no known VMs. (check for corrupt jvm.cfg file)",
|
|
181 |
JNI_TRUE);
|
|
182 |
exit(1);
|
|
183 |
}
|
|
184 |
jvmtype = CheckJvmType(_argc, _argv, JNI_FALSE);
|
|
185 |
|
|
186 |
jvmpath[0] = '\0';
|
|
187 |
if (!GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath)) {
|
|
188 |
char * message=NULL;
|
|
189 |
const char * format = "Error: no `%s' JVM at `%s'.";
|
|
190 |
message = (char *)JLI_MemAlloc((strlen(format)+strlen(jvmtype)+
|
|
191 |
strlen(jvmpath)) * sizeof(char));
|
|
192 |
sprintf(message,format, jvmtype, jvmpath);
|
|
193 |
ReportErrorMessage(message, JNI_TRUE);
|
|
194 |
exit(4);
|
|
195 |
}
|
|
196 |
/* If we got here, jvmpath has been correctly initialized. */
|
|
197 |
|
|
198 |
#else /* ifndef GAMMA */
|
|
199 |
|
|
200 |
/*
|
|
201 |
* gamma launcher is simpler in that it doesn't handle VM flavors, data
|
|
202 |
* model, etc. Assuming everything is set-up correctly
|
|
203 |
* all we need to do here is to return correct path names. See also
|
|
204 |
* GetJVMPath() and GetApplicationHome().
|
|
205 |
*/
|
|
206 |
|
|
207 |
{
|
|
208 |
if (!GetJREPath(jrepath, so_jrepath) ) {
|
|
209 |
ReportErrorMessage("Error: could not find Java SE Runtime Environment.",
|
|
210 |
JNI_TRUE);
|
|
211 |
exit(2);
|
|
212 |
}
|
|
213 |
|
|
214 |
if (!GetJVMPath(jrepath, NULL, jvmpath, so_jvmpath)) {
|
|
215 |
char * message=NULL;
|
|
216 |
const char * format = "Error: no JVM at `%s'.";
|
|
217 |
message = (char *)JLI_MemAlloc((strlen(format)+
|
|
218 |
strlen(jvmpath)) * sizeof(char));
|
|
219 |
sprintf(message, format, jvmpath);
|
|
220 |
ReportErrorMessage(message, JNI_TRUE);
|
|
221 |
exit(4);
|
|
222 |
}
|
|
223 |
}
|
|
224 |
|
|
225 |
#endif /* ifndef GAMMA */
|
|
226 |
|
|
227 |
}
|
|
228 |
|
|
229 |
|
|
230 |
static jboolean
|
|
231 |
LoadMSVCRT()
|
|
232 |
{
|
|
233 |
// Only do this once
|
|
234 |
static int loaded = 0;
|
|
235 |
char crtpath[MAXPATHLEN];
|
|
236 |
|
|
237 |
if (!loaded) {
|
|
238 |
/*
|
|
239 |
* The Microsoft C Runtime Library needs to be loaded first. A copy is
|
|
240 |
* assumed to be present in the "JRE path" directory. If it is not found
|
|
241 |
* there (or "JRE path" fails to resolve), skip the explicit load and let
|
|
242 |
* nature take its course, which is likely to be a failure to execute.
|
|
243 |
*/
|
|
244 |
if (GetJREPath(crtpath, MAXPATHLEN)) {
|
|
245 |
(void)strcat(crtpath, "\\bin\\" CRT_DLL); /* Add crt dll */
|
|
246 |
if (_launcher_debug) {
|
|
247 |
printf("CRT path is %s\n", crtpath);
|
|
248 |
}
|
|
249 |
if (_access(crtpath, 0) == 0) {
|
|
250 |
if (LoadLibrary(crtpath) == 0) {
|
|
251 |
ReportErrorMessage2("Error loading: %s", crtpath, JNI_TRUE);
|
|
252 |
return JNI_FALSE;
|
|
253 |
}
|
|
254 |
}
|
|
255 |
}
|
|
256 |
loaded = 1;
|
|
257 |
}
|
|
258 |
return JNI_TRUE;
|
|
259 |
}
|
|
260 |
|
|
261 |
/*
|
|
262 |
* The preJVMStart is a function in the jkernel.dll, which
|
|
263 |
* performs the final step of synthesizing back the decomposed
|
|
264 |
* modules (partial install) to the full JRE. Any tool which
|
|
265 |
* uses the JRE must peform this step to ensure the complete synthesis.
|
|
266 |
* The EnsureJreInstallation function calls preJVMStart based on
|
|
267 |
* the conditions outlined below, noting that the operation
|
|
268 |
* will fail silently if any of conditions are not met.
|
|
269 |
* NOTE: this call must be made before jvm.dll is loaded, or jvm.cfg
|
|
270 |
* is read, since jvm.cfg will be modified by the preJVMStart.
|
|
271 |
* 1. Are we on a supported platform.
|
|
272 |
* 2. Find the location of the JRE or the Kernel JRE.
|
|
273 |
* 3. check existence of JREHOME/lib/bundles
|
|
274 |
* 4. check jkernel.dll and invoke the entry-point
|
|
275 |
*/
|
|
276 |
typedef VOID (WINAPI *PREJVMSTART)();
|
|
277 |
|
|
278 |
static void
|
|
279 |
EnsureJreInstallation(const char* jrepath)
|
|
280 |
{
|
|
281 |
HINSTANCE handle;
|
|
282 |
char tmpbuf[MAXPATHLEN];
|
|
283 |
PREJVMSTART PreJVMStart;
|
|
284 |
struct stat s;
|
|
285 |
|
|
286 |
/* 32 bit windows only please */
|
|
287 |
if (strcmp(GetArch(), "i386") != 0 ) {
|
|
288 |
if (_launcher_debug) {
|
|
289 |
printf("EnsureJreInstallation:unsupported platform\n");
|
|
290 |
}
|
|
291 |
return;
|
|
292 |
}
|
|
293 |
/* Does our bundle directory exist ? */
|
|
294 |
strcpy(tmpbuf, jrepath);
|
|
295 |
strcat(tmpbuf, "\\lib\\bundles");
|
|
296 |
if (stat(tmpbuf, &s) != 0) {
|
|
297 |
if (_launcher_debug) {
|
|
298 |
printf("EnsureJreInstallation:<%s>:not found\n", tmpbuf);
|
|
299 |
}
|
|
300 |
return;
|
|
301 |
}
|
|
302 |
/* Does our jkernel dll exist ? */
|
|
303 |
strcpy(tmpbuf, jrepath);
|
|
304 |
strcat(tmpbuf, "\\bin\\jkernel.dll");
|
|
305 |
if (stat(tmpbuf, &s) != 0) {
|
|
306 |
if (_launcher_debug) {
|
|
307 |
printf("EnsureJreInstallation:<%s>:not found\n", tmpbuf);
|
|
308 |
}
|
|
309 |
return;
|
|
310 |
}
|
|
311 |
/* The Microsoft C Runtime Library needs to be loaded first. */
|
|
312 |
if (!LoadMSVCRT()) {
|
|
313 |
if (_launcher_debug) {
|
|
314 |
printf("EnsureJreInstallation:could not load C runtime DLL\n");
|
|
315 |
}
|
|
316 |
return;
|
|
317 |
}
|
|
318 |
/* Load the jkernel.dll */
|
|
319 |
if ((handle = LoadLibrary(tmpbuf)) == 0) {
|
|
320 |
if (_launcher_debug) {
|
|
321 |
printf("EnsureJreInstallation:%s:load failed\n", tmpbuf);
|
|
322 |
}
|
|
323 |
return;
|
|
324 |
}
|
|
325 |
/* Get the function address */
|
|
326 |
PreJVMStart = (PREJVMSTART)GetProcAddress(handle, "preJVMStart");
|
|
327 |
if (PreJVMStart == NULL) {
|
|
328 |
if (_launcher_debug) {
|
|
329 |
printf("EnsureJreInstallation:preJVMStart:function lookup failed\n");
|
|
330 |
}
|
|
331 |
FreeLibrary(handle);
|
|
332 |
return;
|
|
333 |
}
|
|
334 |
PreJVMStart();
|
|
335 |
if (_launcher_debug) {
|
|
336 |
printf("EnsureJreInstallation:preJVMStart:called\n");
|
|
337 |
}
|
|
338 |
FreeLibrary(handle);
|
|
339 |
return;
|
|
340 |
}
|
|
341 |
|
|
342 |
/*
|
|
343 |
* Find path to JRE based on .exe's location or registry settings.
|
|
344 |
*/
|
|
345 |
jboolean
|
|
346 |
GetJREPath(char *path, jint pathsize)
|
|
347 |
{
|
|
348 |
char javadll[MAXPATHLEN];
|
|
349 |
struct stat s;
|
|
350 |
|
|
351 |
if (GetApplicationHome(path, pathsize)) {
|
|
352 |
/* Is JRE co-located with the application? */
|
|
353 |
sprintf(javadll, "%s\\bin\\" JAVA_DLL, path);
|
|
354 |
if (stat(javadll, &s) == 0) {
|
|
355 |
goto found;
|
|
356 |
}
|
|
357 |
|
|
358 |
/* Does this app ship a private JRE in <apphome>\jre directory? */
|
|
359 |
sprintf(javadll, "%s\\jre\\bin\\" JAVA_DLL, path);
|
|
360 |
if (stat(javadll, &s) == 0) {
|
|
361 |
strcat(path, "\\jre");
|
|
362 |
goto found;
|
|
363 |
}
|
|
364 |
}
|
|
365 |
|
|
366 |
#ifndef GAMMA
|
|
367 |
/* Look for a public JRE on this machine. */
|
|
368 |
if (GetPublicJREHome(path, pathsize)) {
|
|
369 |
goto found;
|
|
370 |
}
|
|
371 |
#endif
|
|
372 |
|
|
373 |
fprintf(stderr, "Error: could not find " JAVA_DLL "\n");
|
|
374 |
return JNI_FALSE;
|
|
375 |
|
|
376 |
found:
|
|
377 |
if (_launcher_debug)
|
|
378 |
printf("JRE path is %s\n", path);
|
|
379 |
return JNI_TRUE;
|
|
380 |
}
|
|
381 |
|
|
382 |
/*
|
|
383 |
* Given a JRE location and a JVM type, construct what the name the
|
|
384 |
* JVM shared library will be. Return true, if such a library
|
|
385 |
* exists, false otherwise.
|
|
386 |
*/
|
|
387 |
static jboolean
|
|
388 |
GetJVMPath(const char *jrepath, const char *jvmtype,
|
|
389 |
char *jvmpath, jint jvmpathsize)
|
|
390 |
{
|
|
391 |
struct stat s;
|
|
392 |
|
|
393 |
#ifndef GAMMA
|
|
394 |
if (strchr(jvmtype, '/') || strchr(jvmtype, '\\')) {
|
|
395 |
sprintf(jvmpath, "%s\\" JVM_DLL, jvmtype);
|
|
396 |
} else {
|
|
397 |
sprintf(jvmpath, "%s\\bin\\%s\\" JVM_DLL, jrepath, jvmtype);
|
|
398 |
}
|
|
399 |
#else
|
|
400 |
/*
|
|
401 |
* For gamma launcher, JVM is either built-in or in the same directory.
|
|
402 |
* Either way we return "<exe_path>/jvm.dll" where <exe_path> is the
|
|
403 |
* directory where gamma launcher is located.
|
|
404 |
*/
|
|
405 |
|
|
406 |
char *p;
|
|
407 |
GetModuleFileName(0, jvmpath, jvmpathsize);
|
|
408 |
|
|
409 |
p = strrchr(jvmpath, '\\');
|
|
410 |
if (p) {
|
|
411 |
/* replace executable name with libjvm.so */
|
|
412 |
snprintf(p + 1, jvmpathsize - (p + 1 - jvmpath), "%s", JVM_DLL);
|
|
413 |
} else {
|
|
414 |
/* this case shouldn't happen */
|
|
415 |
snprintf(jvmpath, jvmpathsize, "%s", JVM_DLL);
|
|
416 |
}
|
|
417 |
#endif /* ifndef GAMMA */
|
|
418 |
|
|
419 |
if (stat(jvmpath, &s) == 0) {
|
|
420 |
return JNI_TRUE;
|
|
421 |
} else {
|
|
422 |
return JNI_FALSE;
|
|
423 |
}
|
|
424 |
}
|
|
425 |
|
|
426 |
/*
|
|
427 |
* Load a jvm from "jvmpath" and initialize the invocation functions.
|
|
428 |
*/
|
|
429 |
jboolean
|
|
430 |
LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
|
|
431 |
{
|
|
432 |
#ifdef GAMMA
|
|
433 |
/* JVM is directly linked with gamma launcher; no Loadlibrary() */
|
|
434 |
ifn->CreateJavaVM = JNI_CreateJavaVM;
|
|
435 |
ifn->GetDefaultJavaVMInitArgs = JNI_GetDefaultJavaVMInitArgs;
|
|
436 |
return JNI_TRUE;
|
|
437 |
#else
|
|
438 |
HINSTANCE handle;
|
|
439 |
|
|
440 |
if (_launcher_debug) {
|
|
441 |
printf("JVM path is %s\n", jvmpath);
|
|
442 |
}
|
|
443 |
|
|
444 |
/* The Microsoft C Runtime Library needs to be loaded first. */
|
|
445 |
LoadMSVCRT();
|
|
446 |
|
|
447 |
/* Load the Java VM DLL */
|
|
448 |
if ((handle = LoadLibrary(jvmpath)) == 0) {
|
|
449 |
ReportErrorMessage2("Error loading: %s", (char *)jvmpath, JNI_TRUE);
|
|
450 |
return JNI_FALSE;
|
|
451 |
}
|
|
452 |
|
|
453 |
/* Now get the function addresses */
|
|
454 |
ifn->CreateJavaVM =
|
|
455 |
(void *)GetProcAddress(handle, "JNI_CreateJavaVM");
|
|
456 |
ifn->GetDefaultJavaVMInitArgs =
|
|
457 |
(void *)GetProcAddress(handle, "JNI_GetDefaultJavaVMInitArgs");
|
|
458 |
if (ifn->CreateJavaVM == 0 || ifn->GetDefaultJavaVMInitArgs == 0) {
|
|
459 |
ReportErrorMessage2("Error: can't find JNI interfaces in: %s",
|
|
460 |
(char *)jvmpath, JNI_TRUE);
|
|
461 |
return JNI_FALSE;
|
|
462 |
}
|
|
463 |
|
|
464 |
return JNI_TRUE;
|
|
465 |
#endif /* ifndef GAMMA */
|
|
466 |
}
|
|
467 |
|
|
468 |
/*
|
|
469 |
* If app is "c:\foo\bin\javac", then put "c:\foo" into buf.
|
|
470 |
*/
|
|
471 |
jboolean
|
|
472 |
GetApplicationHome(char *buf, jint bufsize)
|
|
473 |
{
|
|
474 |
#ifndef GAMMA
|
|
475 |
char *cp;
|
|
476 |
GetModuleFileName(0, buf, bufsize);
|
|
477 |
*strrchr(buf, '\\') = '\0'; /* remove .exe file name */
|
|
478 |
if ((cp = strrchr(buf, '\\')) == 0) {
|
|
479 |
/* This happens if the application is in a drive root, and
|
|
480 |
* there is no bin directory. */
|
|
481 |
buf[0] = '\0';
|
|
482 |
return JNI_FALSE;
|
|
483 |
}
|
|
484 |
*cp = '\0'; /* remove the bin\ part */
|
|
485 |
return JNI_TRUE;
|
|
486 |
|
|
487 |
#else /* ifndef GAMMA */
|
|
488 |
|
|
489 |
/* gamma launcher uses JAVA_HOME or ALT_JAVA_HOME environment variable to find JDK/JRE */
|
|
490 |
char* java_home_var = getenv("ALT_JAVA_HOME");
|
|
491 |
if (java_home_var == NULL) {
|
|
492 |
java_home_var = getenv("JAVA_HOME");
|
|
493 |
}
|
|
494 |
if (java_home_var == NULL) {
|
|
495 |
printf("JAVA_HOME or ALT_JAVA_HOME must point to a valid JDK/JRE to run gamma\n");
|
|
496 |
return JNI_FALSE;
|
|
497 |
}
|
|
498 |
snprintf(buf, bufsize, "%s", java_home_var);
|
|
499 |
return JNI_TRUE;
|
|
500 |
#endif /* ifndef GAMMA */
|
|
501 |
}
|
|
502 |
|
|
503 |
#ifdef JAVAW
|
|
504 |
__declspec(dllimport) char **__initenv;
|
|
505 |
|
|
506 |
int WINAPI
|
|
507 |
WinMain(HINSTANCE inst, HINSTANCE previnst, LPSTR cmdline, int cmdshow)
|
|
508 |
{
|
|
509 |
int ret;
|
|
510 |
|
|
511 |
__initenv = _environ;
|
|
512 |
ret = main(__argc, __argv);
|
|
513 |
|
|
514 |
return ret;
|
|
515 |
}
|
|
516 |
#endif
|
|
517 |
|
|
518 |
#ifndef GAMMA
|
|
519 |
|
|
520 |
/*
|
|
521 |
* Helpers to look in the registry for a public JRE.
|
|
522 |
*/
|
|
523 |
/* Same for 1.5.0, 1.5.1, 1.5.2 etc. */
|
|
524 |
#define DOTRELEASE JDK_MAJOR_VERSION "." JDK_MINOR_VERSION
|
|
525 |
#define JRE_KEY "Software\\JavaSoft\\Java Runtime Environment"
|
|
526 |
|
|
527 |
static jboolean
|
|
528 |
GetStringFromRegistry(HKEY key, const char *name, char *buf, jint bufsize)
|
|
529 |
{
|
|
530 |
DWORD type, size;
|
|
531 |
|
|
532 |
if (RegQueryValueEx(key, name, 0, &type, 0, &size) == 0
|
|
533 |
&& type == REG_SZ
|
|
534 |
&& (size < (unsigned int)bufsize)) {
|
|
535 |
if (RegQueryValueEx(key, name, 0, 0, buf, &size) == 0) {
|
|
536 |
return JNI_TRUE;
|
|
537 |
}
|
|
538 |
}
|
|
539 |
return JNI_FALSE;
|
|
540 |
}
|
|
541 |
|
|
542 |
static jboolean
|
|
543 |
GetPublicJREHome(char *buf, jint bufsize)
|
|
544 |
{
|
|
545 |
HKEY key, subkey;
|
|
546 |
char version[MAXPATHLEN];
|
|
547 |
|
|
548 |
/*
|
|
549 |
* Note: There is a very similar implementation of the following
|
|
550 |
* registry reading code in the Windows java control panel (javacp.cpl).
|
|
551 |
* If there are bugs here, a similar bug probably exists there. Hence,
|
|
552 |
* changes here require inspection there.
|
|
553 |
*/
|
|
554 |
|
|
555 |
/* Find the current version of the JRE */
|
|
556 |
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, JRE_KEY, 0, KEY_READ, &key) != 0) {
|
|
557 |
fprintf(stderr, "Error opening registry key '" JRE_KEY "'\n");
|
|
558 |
return JNI_FALSE;
|
|
559 |
}
|
|
560 |
|
|
561 |
if (!GetStringFromRegistry(key, "CurrentVersion",
|
|
562 |
version, sizeof(version))) {
|
|
563 |
fprintf(stderr, "Failed reading value of registry key:\n\t"
|
|
564 |
JRE_KEY "\\CurrentVersion\n");
|
|
565 |
RegCloseKey(key);
|
|
566 |
return JNI_FALSE;
|
|
567 |
}
|
|
568 |
|
|
569 |
if (strcmp(version, DOTRELEASE) != 0) {
|
|
570 |
fprintf(stderr, "Registry key '" JRE_KEY "\\CurrentVersion'\nhas "
|
|
571 |
"value '%s', but '" DOTRELEASE "' is required.\n", version);
|
|
572 |
RegCloseKey(key);
|
|
573 |
return JNI_FALSE;
|
|
574 |
}
|
|
575 |
|
|
576 |
/* Find directory where the current version is installed. */
|
|
577 |
if (RegOpenKeyEx(key, version, 0, KEY_READ, &subkey) != 0) {
|
|
578 |
fprintf(stderr, "Error opening registry key '"
|
|
579 |
JRE_KEY "\\%s'\n", version);
|
|
580 |
RegCloseKey(key);
|
|
581 |
return JNI_FALSE;
|
|
582 |
}
|
|
583 |
|
|
584 |
if (!GetStringFromRegistry(subkey, "JavaHome", buf, bufsize)) {
|
|
585 |
fprintf(stderr, "Failed reading value of registry key:\n\t"
|
|
586 |
JRE_KEY "\\%s\\JavaHome\n", version);
|
|
587 |
RegCloseKey(key);
|
|
588 |
RegCloseKey(subkey);
|
|
589 |
return JNI_FALSE;
|
|
590 |
}
|
|
591 |
|
|
592 |
if (_launcher_debug) {
|
|
593 |
char micro[MAXPATHLEN];
|
|
594 |
if (!GetStringFromRegistry(subkey, "MicroVersion", micro,
|
|
595 |
sizeof(micro))) {
|
|
596 |
printf("Warning: Can't read MicroVersion\n");
|
|
597 |
micro[0] = '\0';
|
|
598 |
}
|
|
599 |
printf("Version major.minor.micro = %s.%s\n", version, micro);
|
|
600 |
}
|
|
601 |
|
|
602 |
RegCloseKey(key);
|
|
603 |
RegCloseKey(subkey);
|
|
604 |
return JNI_TRUE;
|
|
605 |
}
|
|
606 |
|
|
607 |
#endif /* ifndef GAMMA */
|
|
608 |
|
|
609 |
/*
|
|
610 |
* Support for doing cheap, accurate interval timing.
|
|
611 |
*/
|
|
612 |
static jboolean counterAvailable = JNI_FALSE;
|
|
613 |
static jboolean counterInitialized = JNI_FALSE;
|
|
614 |
static LARGE_INTEGER counterFrequency;
|
|
615 |
|
|
616 |
jlong CounterGet()
|
|
617 |
{
|
|
618 |
LARGE_INTEGER count;
|
|
619 |
|
|
620 |
if (!counterInitialized) {
|
|
621 |
counterAvailable = QueryPerformanceFrequency(&counterFrequency);
|
|
622 |
counterInitialized = JNI_TRUE;
|
|
623 |
}
|
|
624 |
if (!counterAvailable) {
|
|
625 |
return 0;
|
|
626 |
}
|
|
627 |
QueryPerformanceCounter(&count);
|
|
628 |
return (jlong)(count.QuadPart);
|
|
629 |
}
|
|
630 |
|
|
631 |
jlong Counter2Micros(jlong counts)
|
|
632 |
{
|
|
633 |
if (!counterAvailable || !counterInitialized) {
|
|
634 |
return 0;
|
|
635 |
}
|
|
636 |
return (counts * 1000 * 1000)/counterFrequency.QuadPart;
|
|
637 |
}
|
|
638 |
|
|
639 |
void ReportErrorMessage(char * message, jboolean always) {
|
|
640 |
#ifdef JAVAW
|
|
641 |
if (message != NULL) {
|
|
642 |
MessageBox(NULL, message, "Java Virtual Machine Launcher",
|
|
643 |
(MB_OK|MB_ICONSTOP|MB_APPLMODAL));
|
|
644 |
}
|
|
645 |
#else
|
|
646 |
if (always) {
|
|
647 |
fprintf(stderr, "%s\n", message);
|
|
648 |
}
|
|
649 |
#endif
|
|
650 |
}
|
|
651 |
|
|
652 |
void ReportErrorMessage2(char * format, char * string, jboolean always) {
|
|
653 |
/*
|
|
654 |
* The format argument must be a printf format string with one %s
|
|
655 |
* argument, which is passed the string argument.
|
|
656 |
*/
|
|
657 |
#ifdef JAVAW
|
|
658 |
size_t size;
|
|
659 |
char * message;
|
|
660 |
size = strlen(format) + strlen(string);
|
|
661 |
message = (char*)JLI_MemAlloc(size*sizeof(char));
|
|
662 |
sprintf(message, (const char *)format, string);
|
|
663 |
|
|
664 |
if (message != NULL) {
|
|
665 |
MessageBox(NULL, message, "Java Virtual Machine Launcher",
|
|
666 |
(MB_OK|MB_ICONSTOP|MB_APPLMODAL));
|
|
667 |
JLI_MemFree(message);
|
|
668 |
}
|
|
669 |
#else
|
|
670 |
if (always) {
|
|
671 |
fprintf(stderr, (const char *)format, string);
|
|
672 |
fprintf(stderr, "\n");
|
|
673 |
}
|
|
674 |
#endif
|
|
675 |
}
|
|
676 |
|
|
677 |
/*
|
|
678 |
* As ReportErrorMessage2 (above) except the system message (if any)
|
|
679 |
* associated with this error is written to a second %s format specifier
|
|
680 |
* in the format argument.
|
|
681 |
*/
|
|
682 |
void ReportSysErrorMessage2(char * format, char * string, jboolean always) {
|
|
683 |
int save_errno = errno;
|
|
684 |
DWORD errval;
|
|
685 |
int freeit = 0;
|
|
686 |
char *errtext = NULL;
|
|
687 |
|
|
688 |
if ((errval = GetLastError()) != 0) { /* Platform SDK / DOS Error */
|
|
689 |
int n = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|
|
|
690 |
FORMAT_MESSAGE_IGNORE_INSERTS|FORMAT_MESSAGE_ALLOCATE_BUFFER,
|
|
691 |
NULL, errval, 0, (LPTSTR)&errtext, 0, NULL);
|
|
692 |
if (errtext == NULL || n == 0) { /* Paranoia check */
|
|
693 |
errtext = "";
|
|
694 |
n = 0;
|
|
695 |
} else {
|
|
696 |
freeit = 1;
|
|
697 |
if (n > 2) { /* Drop final CR, LF */
|
|
698 |
if (errtext[n - 1] == '\n') n--;
|
|
699 |
if (errtext[n - 1] == '\r') n--;
|
|
700 |
errtext[n] = '\0';
|
|
701 |
}
|
|
702 |
}
|
|
703 |
} else /* C runtime error that has no corresponding DOS error code */
|
|
704 |
errtext = strerror(save_errno);
|
|
705 |
|
|
706 |
#ifdef JAVAW
|
|
707 |
{
|
|
708 |
size_t size;
|
|
709 |
char * message;
|
|
710 |
size = strlen(format) + strlen(string) + strlen(errtext);
|
|
711 |
message = (char*)JLI_MemAlloc(size*sizeof(char));
|
|
712 |
sprintf(message, (const char *)format, string, errtext);
|
|
713 |
|
|
714 |
if (message != NULL) {
|
|
715 |
MessageBox(NULL, message, "Java Virtual Machine Launcher",
|
|
716 |
(MB_OK|MB_ICONSTOP|MB_APPLMODAL));
|
|
717 |
JLI_MemFree(message);
|
|
718 |
}
|
|
719 |
}
|
|
720 |
#else
|
|
721 |
if (always) {
|
|
722 |
fprintf(stderr, (const char *)format, string, errtext);
|
|
723 |
fprintf(stderr, "\n");
|
|
724 |
}
|
|
725 |
#endif
|
|
726 |
if (freeit)
|
|
727 |
(void)LocalFree((HLOCAL)errtext);
|
|
728 |
}
|
|
729 |
|
|
730 |
void ReportExceptionDescription(JNIEnv * env) {
|
|
731 |
#ifdef JAVAW
|
|
732 |
/*
|
|
733 |
* This code should be replaced by code which opens a window with
|
|
734 |
* the exception detail message.
|
|
735 |
*/
|
|
736 |
(*env)->ExceptionDescribe(env);
|
|
737 |
#else
|
|
738 |
(*env)->ExceptionDescribe(env);
|
|
739 |
#endif
|
|
740 |
}
|
|
741 |
|
|
742 |
|
|
743 |
/*
|
|
744 |
* Return JNI_TRUE for an option string that has no effect but should
|
|
745 |
* _not_ be passed on to the vm; return JNI_FALSE otherwise. On
|
|
746 |
* windows, there are no options that should be screened in this
|
|
747 |
* manner.
|
|
748 |
*/
|
|
749 |
jboolean RemovableMachineDependentOption(char * option) {
|
|
750 |
#ifdef ENABLE_AWT_PRELOAD
|
|
751 |
if (awtPreloadD3D < 0) {
|
|
752 |
/* Tests the command line parameter only if not set yet. */
|
|
753 |
if (GetBoolParamValue(PARAM_PRELOAD_D3D, option) == 1) {
|
|
754 |
awtPreloadD3D = 1;
|
|
755 |
}
|
|
756 |
}
|
|
757 |
if (awtPreloadD3D != 0) {
|
|
758 |
/* Don't test the command line parameters if already disabled. */
|
|
759 |
if (GetBoolParamValue(PARAM_NODDRAW, option) == 1
|
|
760 |
|| GetBoolParamValue(PARAM_D3D, option) == 0
|
|
761 |
|| GetBoolParamValue(PARAM_OPENGL, option) == 1)
|
|
762 |
{
|
|
763 |
awtPreloadD3D = 0;
|
|
764 |
}
|
|
765 |
}
|
|
766 |
#endif /* ENABLE_AWT_PRELOAD */
|
|
767 |
|
|
768 |
return JNI_FALSE;
|
|
769 |
}
|
|
770 |
|
|
771 |
void PrintMachineDependentOptions() {
|
|
772 |
return;
|
|
773 |
}
|
|
774 |
|
|
775 |
#ifndef GAMMA
|
|
776 |
|
|
777 |
jboolean
|
|
778 |
ServerClassMachine() {
|
|
779 |
jboolean result = JNI_FALSE;
|
|
780 |
#if defined(NEVER_ACT_AS_SERVER_CLASS_MACHINE)
|
|
781 |
result = JNI_FALSE;
|
|
782 |
#elif defined(ALWAYS_ACT_AS_SERVER_CLASS_MACHINE)
|
|
783 |
result = JNI_TRUE;
|
|
784 |
#endif
|
|
785 |
return result;
|
|
786 |
}
|
|
787 |
|
|
788 |
/*
|
|
789 |
* Determine if there is an acceptable JRE in the registry directory top_key.
|
|
790 |
* Upon locating the "best" one, return a fully qualified path to it.
|
|
791 |
* "Best" is defined as the most advanced JRE meeting the constraints
|
|
792 |
* contained in the manifest_info. If no JRE in this directory meets the
|
|
793 |
* constraints, return NULL.
|
|
794 |
*
|
|
795 |
* It doesn't matter if we get an error reading the registry, or we just
|
|
796 |
* don't find anything interesting in the directory. We just return NULL
|
|
797 |
* in either case.
|
|
798 |
*/
|
|
799 |
static char *
|
|
800 |
ProcessDir(manifest_info* info, HKEY top_key) {
|
|
801 |
DWORD index = 0;
|
|
802 |
HKEY ver_key;
|
|
803 |
char name[MAXNAMELEN];
|
|
804 |
int len;
|
|
805 |
char *best = NULL;
|
|
806 |
|
|
807 |
/*
|
|
808 |
* Enumerate "<top_key>/SOFTWARE/JavaSoft/Java Runtime Environment"
|
|
809 |
* searching for the best available version.
|
|
810 |
*/
|
|
811 |
while (RegEnumKey(top_key, index, name, MAXNAMELEN) == ERROR_SUCCESS) {
|
|
812 |
index++;
|
|
813 |
if (JLI_AcceptableRelease(name, info->jre_version))
|
|
814 |
if ((best == NULL) || (JLI_ExactVersionId(name, best) > 0)) {
|
|
815 |
if (best != NULL)
|
|
816 |
JLI_MemFree(best);
|
|
817 |
best = JLI_StringDup(name);
|
|
818 |
}
|
|
819 |
}
|
|
820 |
|
|
821 |
/*
|
|
822 |
* Extract "JavaHome" from the "best" registry directory and return
|
|
823 |
* that path. If no appropriate version was located, or there is an
|
|
824 |
* error in extracting the "JavaHome" string, return null.
|
|
825 |
*/
|
|
826 |
if (best == NULL)
|
|
827 |
return (NULL);
|
|
828 |
else {
|
|
829 |
if (RegOpenKeyEx(top_key, best, 0, KEY_READ, &ver_key)
|
|
830 |
!= ERROR_SUCCESS) {
|
|
831 |
JLI_MemFree(best);
|
|
832 |
if (ver_key != NULL)
|
|
833 |
RegCloseKey(ver_key);
|
|
834 |
return (NULL);
|
|
835 |
}
|
|
836 |
JLI_MemFree(best);
|
|
837 |
len = MAXNAMELEN;
|
|
838 |
if (RegQueryValueEx(ver_key, "JavaHome", NULL, NULL, (LPBYTE)name, &len)
|
|
839 |
!= ERROR_SUCCESS) {
|
|
840 |
if (ver_key != NULL)
|
|
841 |
RegCloseKey(ver_key);
|
|
842 |
return (NULL);
|
|
843 |
}
|
|
844 |
if (ver_key != NULL)
|
|
845 |
RegCloseKey(ver_key);
|
|
846 |
return (JLI_StringDup(name));
|
|
847 |
}
|
|
848 |
}
|
|
849 |
|
|
850 |
/*
|
|
851 |
* This is the global entry point. It examines the host for the optimal
|
|
852 |
* JRE to be used by scanning a set of registry entries. This set of entries
|
|
853 |
* is hardwired on Windows as "Software\JavaSoft\Java Runtime Environment"
|
|
854 |
* under the set of roots "{ HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE }".
|
|
855 |
*
|
|
856 |
* This routine simply opens each of these registry directories before passing
|
|
857 |
* control onto ProcessDir().
|
|
858 |
*/
|
|
859 |
char *
|
|
860 |
LocateJRE(manifest_info* info) {
|
|
861 |
HKEY key = NULL;
|
|
862 |
char *path;
|
|
863 |
int key_index;
|
|
864 |
HKEY root_keys[2] = { HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE };
|
|
865 |
|
|
866 |
for (key_index = 0; key_index <= 1; key_index++) {
|
|
867 |
if (RegOpenKeyEx(root_keys[key_index], JRE_KEY, 0, KEY_READ, &key)
|
|
868 |
== ERROR_SUCCESS)
|
|
869 |
if ((path = ProcessDir(info, key)) != NULL) {
|
|
870 |
if (key != NULL)
|
|
871 |
RegCloseKey(key);
|
|
872 |
return (path);
|
|
873 |
}
|
|
874 |
if (key != NULL)
|
|
875 |
RegCloseKey(key);
|
|
876 |
}
|
|
877 |
return NULL;
|
|
878 |
}
|
|
879 |
|
|
880 |
|
|
881 |
/*
|
|
882 |
* Local helper routine to isolate a single token (option or argument)
|
|
883 |
* from the command line.
|
|
884 |
*
|
|
885 |
* This routine accepts a pointer to a character pointer. The first
|
|
886 |
* token (as defined by MSDN command-line argument syntax) is isolated
|
|
887 |
* from that string.
|
|
888 |
*
|
|
889 |
* Upon return, the input character pointer pointed to by the parameter s
|
|
890 |
* is updated to point to the remainding, unscanned, portion of the string,
|
|
891 |
* or to a null character if the entire string has been consummed.
|
|
892 |
*
|
|
893 |
* This function returns a pointer to a null-terminated string which
|
|
894 |
* contains the isolated first token, or to the null character if no
|
|
895 |
* token could be isolated.
|
|
896 |
*
|
|
897 |
* Note the side effect of modifying the input string s by the insertion
|
|
898 |
* of a null character, making it two strings.
|
|
899 |
*
|
|
900 |
* See "Parsing C Command-Line Arguments" in the MSDN Library for the
|
|
901 |
* parsing rule details. The rule summary from that specification is:
|
|
902 |
*
|
|
903 |
* * Arguments are delimited by white space, which is either a space or a tab.
|
|
904 |
*
|
|
905 |
* * A string surrounded by double quotation marks is interpreted as a single
|
|
906 |
* argument, regardless of white space contained within. A quoted string can
|
|
907 |
* be embedded in an argument. Note that the caret (^) is not recognized as
|
|
908 |
* an escape character or delimiter.
|
|
909 |
*
|
|
910 |
* * A double quotation mark preceded by a backslash, \", is interpreted as a
|
|
911 |
* literal double quotation mark (").
|
|
912 |
*
|
|
913 |
* * Backslashes are interpreted literally, unless they immediately precede a
|
|
914 |
* double quotation mark.
|
|
915 |
*
|
|
916 |
* * If an even number of backslashes is followed by a double quotation mark,
|
|
917 |
* then one backslash (\) is placed in the argv array for every pair of
|
|
918 |
* backslashes (\\), and the double quotation mark (") is interpreted as a
|
|
919 |
* string delimiter.
|
|
920 |
*
|
|
921 |
* * If an odd number of backslashes is followed by a double quotation mark,
|
|
922 |
* then one backslash (\) is placed in the argv array for every pair of
|
|
923 |
* backslashes (\\) and the double quotation mark is interpreted as an
|
|
924 |
* escape sequence by the remaining backslash, causing a literal double
|
|
925 |
* quotation mark (") to be placed in argv.
|
|
926 |
*/
|
|
927 |
static char*
|
|
928 |
nextarg(char** s) {
|
|
929 |
char *p = *s;
|
|
930 |
char *head;
|
|
931 |
int slashes = 0;
|
|
932 |
int inquote = 0;
|
|
933 |
|
|
934 |
/*
|
|
935 |
* Strip leading whitespace, which MSDN defines as only space or tab.
|
|
936 |
* (Hence, no locale specific "isspace" here.)
|
|
937 |
*/
|
|
938 |
while (*p != (char)0 && (*p == ' ' || *p == '\t'))
|
|
939 |
p++;
|
|
940 |
head = p; /* Save the start of the token to return */
|
|
941 |
|
|
942 |
/*
|
|
943 |
* Isolate a token from the command line.
|
|
944 |
*/
|
|
945 |
while (*p != (char)0 && (inquote || !(*p == ' ' || *p == '\t'))) {
|
|
946 |
if (*p == '\\' && *(p+1) == '"' && slashes % 2 == 0)
|
|
947 |
p++;
|
|
948 |
else if (*p == '"')
|
|
949 |
inquote = !inquote;
|
|
950 |
slashes = (*p++ == '\\') ? slashes + 1 : 0;
|
|
951 |
}
|
|
952 |
|
|
953 |
/*
|
|
954 |
* If the token isolated isn't already terminated in a "char zero",
|
|
955 |
* then replace the whitespace character with one and move to the
|
|
956 |
* next character.
|
|
957 |
*/
|
|
958 |
if (*p != (char)0)
|
|
959 |
*p++ = (char)0;
|
|
960 |
|
|
961 |
/*
|
|
962 |
* Update the parameter to point to the head of the remaining string
|
|
963 |
* reflecting the command line and return a pointer to the leading
|
|
964 |
* token which was isolated from the command line.
|
|
965 |
*/
|
|
966 |
*s = p;
|
|
967 |
return (head);
|
|
968 |
}
|
|
969 |
|
|
970 |
/*
|
|
971 |
* Local helper routine to return a string equivalent to the input string
|
|
972 |
* s, but with quotes removed so the result is a string as would be found
|
|
973 |
* in argv[]. The returned string should be freed by a call to JLI_MemFree().
|
|
974 |
*
|
|
975 |
* The rules for quoting (and escaped quotes) are:
|
|
976 |
*
|
|
977 |
* 1 A double quotation mark preceded by a backslash, \", is interpreted as a
|
|
978 |
* literal double quotation mark (").
|
|
979 |
*
|
|
980 |
* 2 Backslashes are interpreted literally, unless they immediately precede a
|
|
981 |
* double quotation mark.
|
|
982 |
*
|
|
983 |
* 3 If an even number of backslashes is followed by a double quotation mark,
|
|
984 |
* then one backslash (\) is placed in the argv array for every pair of
|
|
985 |
* backslashes (\\), and the double quotation mark (") is interpreted as a
|
|
986 |
* string delimiter.
|
|
987 |
*
|
|
988 |
* 4 If an odd number of backslashes is followed by a double quotation mark,
|
|
989 |
* then one backslash (\) is placed in the argv array for every pair of
|
|
990 |
* backslashes (\\) and the double quotation mark is interpreted as an
|
|
991 |
* escape sequence by the remaining backslash, causing a literal double
|
|
992 |
* quotation mark (") to be placed in argv.
|
|
993 |
*/
|
|
994 |
static char*
|
|
995 |
unquote(const char *s) {
|
|
996 |
const char *p = s; /* Pointer to the tail of the original string */
|
|
997 |
char *un = (char*)JLI_MemAlloc(strlen(s) + 1); /* Ptr to unquoted string */
|
|
998 |
char *pun = un; /* Pointer to the tail of the unquoted string */
|
|
999 |
|
|
1000 |
while (*p != '\0') {
|
|
1001 |
if (*p == '"') {
|
|
1002 |
p++;
|
|
1003 |
} else if (*p == '\\') {
|
|
1004 |
const char *q = p + strspn(p,"\\");
|
|
1005 |
if (*q == '"')
|
|
1006 |
do {
|
|
1007 |
*pun++ = '\\';
|
|
1008 |
p += 2;
|
|
1009 |
} while (*p == '\\' && p < q);
|
|
1010 |
else
|
|
1011 |
while (p < q)
|
|
1012 |
*pun++ = *p++;
|
|
1013 |
} else {
|
|
1014 |
*pun++ = *p++;
|
|
1015 |
}
|
|
1016 |
}
|
|
1017 |
*pun = '\0';
|
|
1018 |
return un;
|
|
1019 |
}
|
|
1020 |
|
|
1021 |
/*
|
|
1022 |
* Given a path to a jre to execute, this routine checks if this process
|
|
1023 |
* is indeed that jre. If not, it exec's that jre.
|
|
1024 |
*
|
|
1025 |
* We want to actually check the paths rather than just the version string
|
|
1026 |
* built into the executable, so that given version specification will yield
|
|
1027 |
* the exact same Java environment, regardless of the version of the arbitrary
|
|
1028 |
* launcher we start with.
|
|
1029 |
*/
|
|
1030 |
void
|
|
1031 |
ExecJRE(char *jre, char **argv) {
|
|
1032 |
int len;
|
|
1033 |
char *progname;
|
|
1034 |
char path[MAXPATHLEN + 1];
|
|
1035 |
|
|
1036 |
/*
|
|
1037 |
* Determine the executable we are building (or in the rare case, running).
|
|
1038 |
*/
|
|
1039 |
#ifdef JAVA_ARGS /* javac, jar and friends. */
|
|
1040 |
progname = "java";
|
|
1041 |
#else /* java, oldjava, javaw and friends */
|
|
1042 |
#ifdef PROGNAME
|
|
1043 |
progname = PROGNAME;
|
|
1044 |
#else
|
|
1045 |
{
|
|
1046 |
char *s;
|
|
1047 |
progname = *argv;
|
|
1048 |
if ((s = strrchr(progname, FILE_SEPARATOR)) != 0) {
|
|
1049 |
progname = s + 1;
|
|
1050 |
}
|
|
1051 |
}
|
|
1052 |
#endif /* PROGNAME */
|
|
1053 |
#endif /* JAVA_ARGS */
|
|
1054 |
|
|
1055 |
/*
|
|
1056 |
* Resolve the real path to the currently running launcher.
|
|
1057 |
*/
|
|
1058 |
len = GetModuleFileName(NULL, path, MAXPATHLEN + 1);
|
|
1059 |
if (len == 0 || len > MAXPATHLEN) {
|
|
1060 |
ReportSysErrorMessage2(
|
|
1061 |
"Unable to resolve path to current %s executable: %s",
|
|
1062 |
progname, JNI_TRUE);
|
|
1063 |
exit(1);
|
|
1064 |
}
|
|
1065 |
|
|
1066 |
if (_launcher_debug) {
|
|
1067 |
printf("ExecJRE: old: %s\n", path);
|
|
1068 |
printf("ExecJRE: new: %s\n", jre);
|
|
1069 |
}
|
|
1070 |
|
|
1071 |
/*
|
|
1072 |
* If the path to the selected JRE directory is a match to the initial
|
|
1073 |
* portion of the path to the currently executing JRE, we have a winner!
|
|
1074 |
* If so, just return. (strnicmp() is the Windows equiv. of strncasecmp().)
|
|
1075 |
*/
|
|
1076 |
if (strnicmp(jre, path, strlen(jre)) == 0)
|
|
1077 |
return; /* I am the droid you were looking for */
|
|
1078 |
|
|
1079 |
/*
|
|
1080 |
* If this isn't the selected version, exec the selected version.
|
|
1081 |
*/
|
|
1082 |
(void)strcat(strcat(strcpy(path, jre), "\\bin\\"), progname);
|
|
1083 |
(void)strcat(path, ".exe");
|
|
1084 |
|
|
1085 |
/*
|
|
1086 |
* Although Windows has an execv() entrypoint, it doesn't actually
|
|
1087 |
* overlay a process: it can only create a new process and terminate
|
|
1088 |
* the old process. Therefore, any processes waiting on the initial
|
|
1089 |
* process wake up and they shouldn't. Hence, a chain of pseudo-zombie
|
|
1090 |
* processes must be retained to maintain the proper wait semantics.
|
|
1091 |
* Fortunately the image size of the launcher isn't too large at this
|
|
1092 |
* time.
|
|
1093 |
*
|
|
1094 |
* If it weren't for this semantic flaw, the code below would be ...
|
|
1095 |
*
|
|
1096 |
* execv(path, argv);
|
|
1097 |
* ReportErrorMessage2("Exec of %s failed\n", path, JNI_TRUE);
|
|
1098 |
* exit(1);
|
|
1099 |
*
|
|
1100 |
* The incorrect exec semantics could be addressed by:
|
|
1101 |
*
|
|
1102 |
* exit((int)spawnv(_P_WAIT, path, argv));
|
|
1103 |
*
|
|
1104 |
* Unfortunately, a bug in Windows spawn/exec impementation prevents
|
|
1105 |
* this from completely working. All the Windows POSIX process creation
|
|
1106 |
* interfaces are implemented as wrappers around the native Windows
|
|
1107 |
* function CreateProcess(). CreateProcess() takes a single string
|
|
1108 |
* to specify command line options and arguments, so the POSIX routine
|
|
1109 |
* wrappers build a single string from the argv[] array and in the
|
|
1110 |
* process, any quoting information is lost.
|
|
1111 |
*
|
|
1112 |
* The solution to this to get the original command line, to process it
|
|
1113 |
* to remove the new multiple JRE options (if any) as was done for argv
|
|
1114 |
* in the common SelectVersion() routine and finally to pass it directly
|
|
1115 |
* to the native CreateProcess() Windows process control interface.
|
|
1116 |
*/
|
|
1117 |
{
|
|
1118 |
char *cmdline;
|
|
1119 |
char *p;
|
|
1120 |
char *np;
|
|
1121 |
char *ocl;
|
|
1122 |
char *ccl;
|
|
1123 |
char *unquoted;
|
|
1124 |
DWORD exitCode;
|
|
1125 |
STARTUPINFO si;
|
|
1126 |
PROCESS_INFORMATION pi;
|
|
1127 |
|
|
1128 |
/*
|
|
1129 |
* The following code block gets and processes the original command
|
|
1130 |
* line, replacing the argv[0] equivalent in the command line with
|
|
1131 |
* the path to the new executable and removing the appropriate
|
|
1132 |
* Multiple JRE support options. Note that similar logic exists
|
|
1133 |
* in the platform independent SelectVersion routine, but is
|
|
1134 |
* replicated here due to the syntax of CreateProcess().
|
|
1135 |
*
|
|
1136 |
* The magic "+ 4" characters added to the command line length are
|
|
1137 |
* 2 possible quotes around the path (argv[0]), a space after the
|
|
1138 |
* path and a terminating null character.
|
|
1139 |
*/
|
|
1140 |
ocl = GetCommandLine();
|
|
1141 |
np = ccl = JLI_StringDup(ocl);
|
|
1142 |
p = nextarg(&np); /* Discard argv[0] */
|
|
1143 |
cmdline = (char *)JLI_MemAlloc(strlen(path) + strlen(np) + 4);
|
|
1144 |
if (strchr(path, (int)' ') == NULL && strchr(path, (int)'\t') == NULL)
|
|
1145 |
cmdline = strcpy(cmdline, path);
|
|
1146 |
else
|
|
1147 |
cmdline = strcat(strcat(strcpy(cmdline, "\""), path), "\"");
|
|
1148 |
|
|
1149 |
while (*np != (char)0) { /* While more command-line */
|
|
1150 |
p = nextarg(&np);
|
|
1151 |
if (*p != (char)0) { /* If a token was isolated */
|
|
1152 |
unquoted = unquote(p);
|
|
1153 |
if (*unquoted == '-') { /* Looks like an option */
|
|
1154 |
if (strcmp(unquoted, "-classpath") == 0 ||
|
|
1155 |
strcmp(unquoted, "-cp") == 0) { /* Unique cp syntax */
|
|
1156 |
cmdline = strcat(strcat(cmdline, " "), p);
|
|
1157 |
p = nextarg(&np);
|
|
1158 |
if (*p != (char)0) /* If a token was isolated */
|
|
1159 |
cmdline = strcat(strcat(cmdline, " "), p);
|
|
1160 |
} else if (strncmp(unquoted, "-version:", 9) != 0 &&
|
|
1161 |
strcmp(unquoted, "-jre-restrict-search") != 0 &&
|
|
1162 |
strcmp(unquoted, "-no-jre-restrict-search") != 0) {
|
|
1163 |
cmdline = strcat(strcat(cmdline, " "), p);
|
|
1164 |
}
|
|
1165 |
} else { /* End of options */
|
|
1166 |
cmdline = strcat(strcat(cmdline, " "), p);
|
|
1167 |
cmdline = strcat(strcat(cmdline, " "), np);
|
|
1168 |
JLI_MemFree((void *)unquoted);
|
|
1169 |
break;
|
|
1170 |
}
|
|
1171 |
JLI_MemFree((void *)unquoted);
|
|
1172 |
}
|
|
1173 |
}
|
|
1174 |
JLI_MemFree((void *)ccl);
|
|
1175 |
|
|
1176 |
if (_launcher_debug) {
|
|
1177 |
np = ccl = JLI_StringDup(cmdline);
|
|
1178 |
p = nextarg(&np);
|
|
1179 |
printf("ReExec Command: %s (%s)\n", path, p);
|
|
1180 |
printf("ReExec Args: %s\n", np);
|
|
1181 |
JLI_MemFree((void *)ccl);
|
|
1182 |
}
|
|
1183 |
(void)fflush(stdout);
|
|
1184 |
(void)fflush(stderr);
|
|
1185 |
|
|
1186 |
/*
|
|
1187 |
* The following code is modeled after a model presented in the
|
|
1188 |
* Microsoft Technical Article "Moving Unix Applications to
|
|
1189 |
* Windows NT" (March 6, 1994) and "Creating Processes" on MSDN
|
|
1190 |
* (Februrary 2005). It approximates UNIX spawn semantics with
|
|
1191 |
* the parent waiting for termination of the child.
|
|
1192 |
*/
|
|
1193 |
memset(&si, 0, sizeof(si));
|
|
1194 |
si.cb =sizeof(STARTUPINFO);
|
|
1195 |
memset(&pi, 0, sizeof(pi));
|
|
1196 |
|
|
1197 |
if (!CreateProcess((LPCTSTR)path, /* executable name */
|
|
1198 |
(LPTSTR)cmdline, /* command line */
|
|
1199 |
(LPSECURITY_ATTRIBUTES)NULL, /* process security attr. */
|
|
1200 |
(LPSECURITY_ATTRIBUTES)NULL, /* thread security attr. */
|
|
1201 |
(BOOL)TRUE, /* inherits system handles */
|
|
1202 |
(DWORD)0, /* creation flags */
|
|
1203 |
(LPVOID)NULL, /* environment block */
|
|
1204 |
(LPCTSTR)NULL, /* current directory */
|
|
1205 |
(LPSTARTUPINFO)&si, /* (in) startup information */
|
|
1206 |
(LPPROCESS_INFORMATION)&pi)) { /* (out) process information */
|
|
1207 |
ReportSysErrorMessage2("CreateProcess(%s, ...) failed: %s",
|
|
1208 |
path, JNI_TRUE);
|
|
1209 |
exit(1);
|
|
1210 |
}
|
|
1211 |
|
|
1212 |
if (WaitForSingleObject(pi.hProcess, INFINITE) != WAIT_FAILED) {
|
|
1213 |
if (GetExitCodeProcess(pi.hProcess, &exitCode) == FALSE)
|
|
1214 |
exitCode = 1;
|
|
1215 |
} else {
|
|
1216 |
ReportErrorMessage("WaitForSingleObject() failed.", JNI_TRUE);
|
|
1217 |
exitCode = 1;
|
|
1218 |
}
|
|
1219 |
|
|
1220 |
CloseHandle(pi.hThread);
|
|
1221 |
CloseHandle(pi.hProcess);
|
|
1222 |
|
|
1223 |
exit(exitCode);
|
|
1224 |
}
|
|
1225 |
|
|
1226 |
}
|
|
1227 |
|
|
1228 |
#endif /* ifndef GAMMA */
|
|
1229 |
|
|
1230 |
|
|
1231 |
/*
|
|
1232 |
* Wrapper for platform dependent unsetenv function.
|
|
1233 |
*/
|
|
1234 |
int
|
|
1235 |
UnsetEnv(char *name)
|
|
1236 |
{
|
|
1237 |
int ret;
|
|
1238 |
char *buf = JLI_MemAlloc(strlen(name) + 2);
|
|
1239 |
buf = strcat(strcpy(buf, name), "=");
|
|
1240 |
ret = _putenv(buf);
|
|
1241 |
JLI_MemFree(buf);
|
|
1242 |
return (ret);
|
|
1243 |
}
|
|
1244 |
|
|
1245 |
/* --- Splash Screen shared library support --- */
|
|
1246 |
|
|
1247 |
static const char* SPLASHSCREEN_SO = "\\bin\\splashscreen.dll";
|
|
1248 |
|
|
1249 |
static HMODULE hSplashLib = NULL;
|
|
1250 |
|
|
1251 |
void* SplashProcAddress(const char* name) {
|
|
1252 |
char libraryPath[MAXPATHLEN]; /* some extra space for strcat'ing SPLASHSCREEN_SO */
|
|
1253 |
|
|
1254 |
if (!GetJREPath(libraryPath, MAXPATHLEN)) {
|
|
1255 |
return NULL;
|
|
1256 |
}
|
|
1257 |
if (strlen(libraryPath)+strlen(SPLASHSCREEN_SO) >= MAXPATHLEN) {
|
|
1258 |
return NULL;
|
|
1259 |
}
|
|
1260 |
strcat(libraryPath, SPLASHSCREEN_SO);
|
|
1261 |
|
|
1262 |
if (!hSplashLib) {
|
|
1263 |
hSplashLib = LoadLibrary(libraryPath);
|
|
1264 |
}
|
|
1265 |
if (hSplashLib) {
|
|
1266 |
return GetProcAddress(hSplashLib, name);
|
|
1267 |
} else {
|
|
1268 |
return NULL;
|
|
1269 |
}
|
|
1270 |
}
|
|
1271 |
|
|
1272 |
void SplashFreeLibrary() {
|
|
1273 |
if (hSplashLib) {
|
|
1274 |
FreeLibrary(hSplashLib);
|
|
1275 |
hSplashLib = NULL;
|
|
1276 |
}
|
|
1277 |
}
|
|
1278 |
|
|
1279 |
const char *
|
|
1280 |
jlong_format_specifier() {
|
|
1281 |
return "%I64d";
|
|
1282 |
}
|
|
1283 |
|
|
1284 |
/*
|
|
1285 |
* Block current thread and continue execution in a new thread
|
|
1286 |
*/
|
|
1287 |
int
|
|
1288 |
ContinueInNewThread(int (JNICALL *continuation)(void *), jlong stack_size, void * args) {
|
|
1289 |
int rslt = 0;
|
|
1290 |
unsigned thread_id;
|
|
1291 |
|
|
1292 |
#ifndef STACK_SIZE_PARAM_IS_A_RESERVATION
|
|
1293 |
#define STACK_SIZE_PARAM_IS_A_RESERVATION (0x10000)
|
|
1294 |
#endif
|
|
1295 |
|
|
1296 |
/*
|
|
1297 |
* STACK_SIZE_PARAM_IS_A_RESERVATION is what we want, but it's not
|
|
1298 |
* supported on older version of Windows. Try first with the flag; and
|
|
1299 |
* if that fails try again without the flag. See MSDN document or HotSpot
|
|
1300 |
* source (os_win32.cpp) for details.
|
|
1301 |
*/
|
|
1302 |
HANDLE thread_handle =
|
|
1303 |
(HANDLE)_beginthreadex(NULL,
|
|
1304 |
(unsigned)stack_size,
|
|
1305 |
continuation,
|
|
1306 |
args,
|
|
1307 |
STACK_SIZE_PARAM_IS_A_RESERVATION,
|
|
1308 |
&thread_id);
|
|
1309 |
if (thread_handle == NULL) {
|
|
1310 |
thread_handle =
|
|
1311 |
(HANDLE)_beginthreadex(NULL,
|
|
1312 |
(unsigned)stack_size,
|
|
1313 |
continuation,
|
|
1314 |
args,
|
|
1315 |
0,
|
|
1316 |
&thread_id);
|
|
1317 |
}
|
|
1318 |
|
|
1319 |
/* AWT preloading (AFTER main thread start) */
|
|
1320 |
#ifdef ENABLE_AWT_PRELOAD
|
|
1321 |
/* D3D preloading */
|
|
1322 |
if (awtPreloadD3D != 0) {
|
|
1323 |
char *envValue;
|
|
1324 |
/* D3D routines checks env.var J2D_D3D if no appropriate
|
|
1325 |
* command line params was specified
|
|
1326 |
*/
|
|
1327 |
envValue = getenv("J2D_D3D");
|
|
1328 |
if (envValue != NULL && stricmp(envValue, "false") == 0) {
|
|
1329 |
awtPreloadD3D = 0;
|
|
1330 |
}
|
|
1331 |
/* Test that AWT preloading isn't disabled by J2D_D3D_PRELOAD env.var */
|
|
1332 |
envValue = getenv("J2D_D3D_PRELOAD");
|
|
1333 |
if (envValue != NULL && stricmp(envValue, "false") == 0) {
|
|
1334 |
awtPreloadD3D = 0;
|
|
1335 |
}
|
|
1336 |
if (awtPreloadD3D < 0) {
|
|
1337 |
/* If awtPreloadD3D is still undefined (-1), test
|
|
1338 |
* if it is turned on by J2D_D3D_PRELOAD env.var.
|
|
1339 |
* By default it's turned OFF.
|
|
1340 |
*/
|
|
1341 |
awtPreloadD3D = 0;
|
|
1342 |
if (envValue != NULL && stricmp(envValue, "true") == 0) {
|
|
1343 |
awtPreloadD3D = 1;
|
|
1344 |
}
|
|
1345 |
}
|
|
1346 |
}
|
|
1347 |
if (awtPreloadD3D) {
|
|
1348 |
AWTPreload(D3D_PRELOAD_FUNC);
|
|
1349 |
}
|
|
1350 |
#endif /* ENABLE_AWT_PRELOAD */
|
|
1351 |
|
|
1352 |
if (thread_handle) {
|
|
1353 |
WaitForSingleObject(thread_handle, INFINITE);
|
|
1354 |
GetExitCodeThread(thread_handle, &rslt);
|
|
1355 |
CloseHandle(thread_handle);
|
|
1356 |
} else {
|
|
1357 |
rslt = continuation(args);
|
|
1358 |
}
|
|
1359 |
|
|
1360 |
#ifdef ENABLE_AWT_PRELOAD
|
|
1361 |
if (awtPreloaded) {
|
|
1362 |
AWTPreloadStop();
|
|
1363 |
}
|
|
1364 |
#endif /* ENABLE_AWT_PRELOAD */
|
|
1365 |
|
|
1366 |
return rslt;
|
|
1367 |
}
|
|
1368 |
|
|
1369 |
/* Linux only, empty on windows. */
|
|
1370 |
void SetJavaLauncherPlatformProps() {}
|
|
1371 |
|
|
1372 |
|
|
1373 |
//==============================
|
|
1374 |
// AWT preloading
|
|
1375 |
#ifdef ENABLE_AWT_PRELOAD
|
|
1376 |
|
|
1377 |
typedef int FnPreloadStart(void);
|
|
1378 |
typedef void FnPreloadStop(void);
|
|
1379 |
static FnPreloadStop *fnPreloadStop = NULL;
|
|
1380 |
static HMODULE hPreloadAwt = NULL;
|
|
1381 |
|
|
1382 |
/*
|
|
1383 |
* Starts AWT preloading
|
|
1384 |
*/
|
|
1385 |
int AWTPreload(const char *funcName)
|
|
1386 |
{
|
|
1387 |
int result = -1;
|
|
1388 |
|
|
1389 |
// load AWT library once (if several preload function should be called)
|
|
1390 |
if (hPreloadAwt == NULL) {
|
|
1391 |
// awt.dll is not loaded yet
|
|
1392 |
char libraryPath[MAXPATHLEN];
|
|
1393 |
int jrePathLen = 0;
|
|
1394 |
HMODULE hJava = NULL;
|
|
1395 |
HMODULE hVerify = NULL;
|
|
1396 |
|
|
1397 |
while (1) {
|
|
1398 |
// awt.dll depends on jvm.dll & java.dll;
|
|
1399 |
// jvm.dll is already loaded, so we need only java.dll;
|
|
1400 |
// java.dll depends on MSVCRT lib & verify.dll.
|
|
1401 |
if (!GetJREPath(libraryPath, MAXPATHLEN)) {
|
|
1402 |
break;
|
|
1403 |
}
|
|
1404 |
|
|
1405 |
// save path length
|
|
1406 |
jrePathLen = strlen(libraryPath);
|
|
1407 |
|
|
1408 |
// load msvcrt 1st
|
|
1409 |
LoadMSVCRT();
|
|
1410 |
|
|
1411 |
// load verify.dll
|
|
1412 |
strcat(libraryPath, "\\bin\\verify.dll");
|
|
1413 |
hVerify = LoadLibrary(libraryPath);
|
|
1414 |
if (hVerify == NULL) {
|
|
1415 |
break;
|
|
1416 |
}
|
|
1417 |
|
|
1418 |
// restore jrePath
|
|
1419 |
libraryPath[jrePathLen] = 0;
|
|
1420 |
// load java.dll
|
|
1421 |
strcat(libraryPath, "\\bin\\" JAVA_DLL);
|
|
1422 |
hJava = LoadLibrary(libraryPath);
|
|
1423 |
if (hJava == NULL) {
|
|
1424 |
break;
|
|
1425 |
}
|
|
1426 |
|
|
1427 |
// restore jrePath
|
|
1428 |
libraryPath[jrePathLen] = 0;
|
|
1429 |
// load awt.dll
|
|
1430 |
strcat(libraryPath, "\\bin\\awt.dll");
|
|
1431 |
hPreloadAwt = LoadLibrary(libraryPath);
|
|
1432 |
if (hPreloadAwt == NULL) {
|
|
1433 |
break;
|
|
1434 |
}
|
|
1435 |
|
|
1436 |
// get "preloadStop" func ptr
|
|
1437 |
fnPreloadStop = (FnPreloadStop *)GetProcAddress(hPreloadAwt, "preloadStop");
|
|
1438 |
|
|
1439 |
break;
|
|
1440 |
}
|
|
1441 |
}
|
|
1442 |
|
|
1443 |
if (hPreloadAwt != NULL) {
|
|
1444 |
FnPreloadStart *fnInit = (FnPreloadStart *)GetProcAddress(hPreloadAwt, funcName);
|
|
1445 |
if (fnInit != NULL) {
|
|
1446 |
// don't forget to stop preloading
|
|
1447 |
awtPreloaded = 1;
|
|
1448 |
|
|
1449 |
result = fnInit();
|
|
1450 |
}
|
|
1451 |
}
|
|
1452 |
|
|
1453 |
return result;
|
|
1454 |
}
|
|
1455 |
|
|
1456 |
/*
|
|
1457 |
* Terminates AWT preloading
|
|
1458 |
*/
|
|
1459 |
void AWTPreloadStop() {
|
|
1460 |
if (fnPreloadStop != NULL) {
|
|
1461 |
fnPreloadStop();
|
|
1462 |
}
|
|
1463 |
}
|
|
1464 |
|
|
1465 |
#endif /* ENABLE_AWT_PRELOAD */
|