Java Launcher
Launcher
- main / WinMain
- env: _JAVA_LAUNCHER_DEBUG
- -> JLI_Launch
JLI_Launch
- CreateExecutionEnvironment
- GetJREPath, jvmcfg, ReadKnownVMs, CheckJvmType, GetJVMPath
- LoadJavaVM
- LoadMSVCRT
- MSVCR, VCRUNTIME, MSVCP
- LoadLibrary
- (void *)GetProcAddress(handle, "JNI_CreateJavaVM")
- (void *)GetProcAddress(handle, "JNI_GetDefaultJavaVMInitArgs")
- JNI_GetCreatedJavaVMs
- LoadMSVCRT
- ParseArguments
- -jar, --module/-m, --source, --class-path/-classpath/-cp, --list-modules, --show-resolved-modules, --validate-modules, describe-module
- <white-space>
- -Xss, -Xmx, -Xms
- --module-path/-p/--upgrade-module-path/--add-modules/--enable-native-access/--limit-modules/--add-exports/--add-opens/--add-reads/--patch-module
- -help/-h/-?/--help/-version/--version/-showversion/--show-version/--dry-run/-X/--help-extra
- -XshowSettings, -Xdiag, --show-module-resolution
- <backward compatibility>
- -fullversion/--full-version, --verbosegc [ -verbose:gc ], -t [ -Xt ] , -tm [ -Xtm ], -debug [ -Xdebug ], -noclassgc [ -Xnoclassgc ], -Xfuture [ -Xverify:all ], -verify [ -Xverify:all ], -verifyremote [ -Xverify:remote ], -noverify [ -Xverify:no ],
- -ss/-oss/-ms/-mx [ -X%s ], -checksource/-cs/-noasyncgc, -splash:, -Djava.class.path=
- JVMInit(&ifn, threadStackSize, argc, argv, mode, what, ret)
JVMInit
- ShowSplashScreen
- ContinueInNewThread
ContinueInNewThread
- [JNI] GetDefaultJavaVMInitArgs
- CallJavaMainInNewThread
CallJavaMainInNewThread
- _beginthreadex(NULL, (unsigned)stack_size, ThreadJavaMain, args, STACK_SIZE_PARAM_IS_A_RESERVATION, &thread_id)
- WaitForSingleObject(thread_handle, INFINITE)
- GetExitCodeThread(thread_handle, &rslt)
- CloseHandle(thread_handle)
ThreadJavaMain
- InitializeJVM
- ?> ShowSettings, ShowResolvedModules, ListModules, DescribeModule, PrintJavaVersion, validateModules, PrintUsage
- LoadMainClass
- GetApplicationClass
- CreateApplicationArgs
- ?> dryRun
- PostJVMInit(env, appClass, vm)
- mainID = (*env)->GetStaticMethodID(env, mainClass, "main", "([Ljava/lang/String;)V");
- (*env)->CallStaticVoidMethod(env, mainClass, mainID, mainArgs)
- LEAVE
附加
Java.exe
- jli.dll
-
(0x0001), JLI_AddArgsFromEnvVar, 0x00001000(0x0002), JLI_CmdToArgs, 0x00001a58(0x0003), JLI_GetAppArgIndex, 0x0000106c(0x0004), JLI_GetStdArgc, 0x00001c54(0x0005), JLI_GetStdArgs, 0x00001c5c(0x0006), JLI_InitArgProcessing, 0x00001074(0x0007), JLI_Launch, 0x00004ba8(0x0008), JLI_List_add, 0x00008dfc(0x0009), JLI_List_new, 0x0000908c(0x000a), JLI_ManifestIterate, 0x00009380(0x000b), JLI_MemAlloc, 0x00009178(0x000c), JLI_MemFree, 0x000091a8(0x000d), JLI_PreprocessArg, 0x000010b0(0x000e), JLI_ReportErrorMessage, 0x000084e4(0x000f), JLI_ReportErrorMessageSys, 0x000085e4(0x0010), JLI_ReportExceptionDescription, 0x000087c8(0x0011), JLI_ReportMessage, 0x00005078(0x0012), JLI_SetTraceLauncher, 0x000091e0(0x0013), JLI_StringDup, 0x0000924c
-
- jvm.dll
- <jni.cpp>
- 3618 (0x0e22), JNI_CreateJavaVM, 0x003efd70
3619 (0x0e23), JNI_GetCreatedJavaVMs, 0x003efd90
3620 (0x0e24), JNI_GetDefaultJavaVMInitArgs, 0x003efdd0
- 3618 (0x0e22), JNI_CreateJavaVM, 0x003efd70
- <jni.cpp>
OptionString
optionString
/*
* optionString may be any option accepted by the JVM, or one of the
* following:
*
* -D<name>=<value> Set a system property.
* -verbose[:class|gc|jni] Enable verbose output, comma-separated. E.g.
* "-verbose:class" or "-verbose:gc,class"
* Standard names include: gc, class, and jni.
* All nonstandard (VM-specific) names must begin
* with "X".
* vfprintf extraInfo is a pointer to the vfprintf hook.
* exit extraInfo is a pointer to the exit hook.
* abort extraInfo is a pointer to the abort hook.
*/
beginthreadex
_beginthreadex
_ACRTIMP uintptr_t __cdecl _beginthreadex(
_In_opt_ void* _Security,
_In_ unsigned _StackSize,
_In_ _beginthreadex_proc_type _StartAddress,
_In_opt_ void* _ArgList,
_In_ unsigned _InitFlag,
_Out_opt_ unsigned* _ThrdAddr
);
ref: c-runtime-library/reference/beginthread-beginthreadex
LaunchMode
LaunchMode
enum LaunchMode { // cf. sun.launcher.LauncherHelper
LM_UNKNOWN = 0,
LM_CLASS,
LM_JAR,
LM_MODULE,
LM_SOURCE
};