void readLauncherProperties(LauncherProperties * props) { DWORD i=0; char * str = NULL; readWCHARList(props, &(props->jvmArguments), "jvm arguments"); if(!isOK(props)) return; readWCHARList(props, &(props->appArguments), "app arguments"); if(!isOK(props)) return; readStringWithDebugW(props, &(props->mainClass), "Main Class"); if(!isOK(props)) return; readStringWithDebugW(props, &(props->testJVMClass), "TestJVM Class"); if(!isOK(props)) return; readNumberWithDebug( props, &(props->compatibleJavaNumber), "compatible java"); if(!isOK(props)) return; if ( props->compatibleJavaNumber > 0 ) { props->compatibleJava = (JavaCompatible **) LocalAlloc(LPTR, sizeof(JavaCompatible *) * props->compatibleJavaNumber); for(i=0;i<props->compatibleJavaNumber;i++) { props->compatibleJava [i] = newJavaCompatible() ; readStringWithDebugA(props, &str, "min java version"); if(!isOK(props)) return; props->compatibleJava[i]->minVersion = getJavaVersionFromString(str, &props->status); FREE(str); if(!isOK(props)) return; str = NULL; readStringWithDebugA(props, &str, "max java version"); if(!isOK(props)) return; props->compatibleJava[i]->maxVersion = getJavaVersionFromString(str, &props->status); FREE(str); if(!isOK(props)) return; readStringWithDebugA(props, &(props->compatibleJava[i]->vendor) , "vendor"); if(!isOK(props)) return; readStringWithDebugA(props, &(props->compatibleJava[i]->osName) , "os name"); if(!isOK(props)) return; readStringWithDebugA(props, &(props->compatibleJava[i]->osArch) , "os arch"); if(!isOK(props)) return; } } readNumberWithDebug( props, &props->bundledNumber, "bundled files"); readBigNumberWithDebug(props, props->bundledSize, "bundled size"); }
DWORD getJavaPropertiesFromOutput(LauncherProperties * props, char *str, JavaProperties ** javaProps) { DWORD separators = getLineSeparatorNumber(str); DWORD result = ERROR_INPUTOUPUT; * javaProps = NULL; if(separators == TEST_JAVA_PARAMETERS) { char * start; char * end; char * javaVersion; char * javaVmVersion; char * javaVendor; char * osName; char * osArch; char * string; JavaVersion * vers; start = str; end = searchA(start, "\n"); javaVersion = appendStringN(NULL, 0, start, getLengthA(start) - getLengthA(end)-1); writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, " java.version = ", 0); writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, javaVersion, 1); start = end + 1; end = searchA(start, "\n"); javaVmVersion = appendStringN(NULL, 0, start, getLengthA(start) - getLengthA(end)-1); writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, " java.vm.version = ", 0); writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, javaVmVersion, 1); start = end + 1; end = searchA(start, "\n"); javaVendor = appendStringN(NULL, 0, start, getLengthA(start) - getLengthA(end)-1); writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, " java.vendor = ", 0); writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, javaVendor, 1); start = end + 1; end = searchA(start, "\n"); osName = appendStringN(NULL, 0, start, getLengthA(start) - getLengthA(end)-1); writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, " os.name = ", 0); writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, osName, 1); start = end + 1; end = searchA(start, "\n"); osArch = appendStringN(NULL, 0, start, getLengthA(start) - getLengthA(end)-1); writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, " os.arch = ", 0); writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, osArch, 2); string = javaVersion; if(javaVmVersion!=NULL) { string = searchA(javaVmVersion, javaVersion); if(string==NULL) { string = javaVersion; } } writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, "... getting java version from string : ", 0); writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, string, 1); vers = getJavaVersionFromString(string, & result); if(javaProps != NULL) { writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, "... some java there", 1); * javaProps = (JavaProperties *) LocalAlloc(LPTR, sizeof(JavaProperties)); (*javaProps)->version = vers; (*javaProps)->vendor = javaVendor; (*javaProps)->osName = osName; (*javaProps)->osArch = osArch; (*javaProps)->javaHome = NULL; (*javaProps)->javaExe = NULL; } else { writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, "... no java there", 1); FREE(javaVendor); FREE(osName); FREE(osArch); } FREE(javaVmVersion); FREE(javaVersion); } return result; }