wxArrayString SerialPortMac::GetSerialPortList(void) { wxArrayString ret; io_iterator_t iterator; kern_return_t result = createSerialIterator(&iterator); if (result == KERN_SUCCESS) { io_object_t port; while ((port = IOIteratorNext(iterator)) != 0) { const char* name = getRegistryString(port,kIOCalloutDeviceKey); if (name) { ret.Add(name); } IOObjectRelease(port); } IOObjectRelease(iterator); } return ret; }
/** * Attempt to find and load a jvm.dll file. Find the createVM() * function's address and return it */ static CreateVMFunc getCreateVMFunc() { bool found = false; String libname; /** * First, look for an embedded jre in the .exe's dir. * This allows us to package our own JRE if we want to. */ String inkscapeHome = getExePath(); inkscapeHome.append("\\jre"); msg("INKSCAPE_HOME='%s'", inkscapeHome.c_str()); String path = checkPathUnderRoot(inkscapeHome); if (path.size() > 0) { libname = path; found = true; } /** * Next, look for JAVA_HOME. This will allow the user * to override what's in the registry */ if (!found) { const char *envStr = getenv("JAVA_HOME"); if (envStr) { String javaHome = cleanPath(envStr); msg("JAVA_HOME='%s'", javaHome.c_str()); path = checkPathUnderRoot(javaHome); if (path.size() > 0) { libname = path; found = true; } } } //not at JAVA_HOME. check the registry if (!found) { char verbuf[16]; char regpath[80]; strcpy(regpath, "SOFTWARE\\JavaSoft\\Java Runtime Environment"); bool ret = getRegistryString(HKEY_LOCAL_MACHINE, regpath, "CurrentVersion", verbuf, 15); if (!ret) { msg("JVM CurrentVersion not found in registry at '%s'", regpath); } else { strcat(regpath, "\\"); strcat(regpath, verbuf); //msg("reg path: %s\n", regpath); char valbuf[80]; ret = getRegistryString(HKEY_LOCAL_MACHINE, regpath, "RuntimeLib", valbuf, 79); if (ret) { found = true; libname = valbuf; } else { msg("JVM RuntimeLib not found in registry at '%s'", regpath); } } } if (!found) { err("JVM not found at JAVA_HOME or in registry"); return NULL; } /** * If we are here, then we seem to have a valid path for jvm.dll * Give it a try */ msg("getCreateVMFunc: Loading JVM: %s", libname.c_str()); HMODULE lib = LoadLibrary(libname.c_str()); if (!lib) { err("Java VM not found at '%s'", libname.c_str()); return NULL; } CreateVMFunc createVM = (CreateVMFunc)GetProcAddress(lib, "JNI_CreateJavaVM"); if (!createVM) { err("Could not find 'JNI_CreateJavaVM' in shared library '%s'", libname.c_str()); return NULL; } return createVM; }
int commandLineRead(int argc, char *argv[]) { int i; // char *parm; // char *argvptr; #define CheckCommand(x) !strncmp(argv[i], x, strlen(x)) for (i = 1; i < argc; i++) { // version, quit if (CheckCommand("--version") || CheckCommand("-v")) { conAdd(LLOW, GRAVIT_VERSION); conAdd(LLOW, GRAVIT_COPYRIGHT); cmdQuit(0); return 0; } // --help or -h if (CheckCommand("--help") || CheckCommand("-h")) { usage(); return 0; } // -n or --noscript if (CheckCommand("--noscript") || CheckCommand("-n")) { state.dontExecuteDefaultScript = 1; continue; } #ifdef WIN32SCREENSAVER if (CheckCommand("/S") || CheckCommand("/s")/* || CheckCommand("/P") || CheckCommand("/p")*/) { char *path; path = getRegistryString(REGISTRY_NAME_PATH); if (!path || strlen(path) == 0) { MessageBox(NULL, "Can't work out where Gravit lives!\nTry running Gravit by itself first", "Gravit Screensaver Error", MB_OK); cmdQuit(0); return 0; } SetCurrentDirectory(path); configRead(findFile(SCREENSAVER_FILE), 0); state.dontExecuteDefaultScript = 1; view.screenSaver = 1; continue; } // just ignore preview mode, configure dialog and change password if (CheckCommand("/P") || CheckCommand("/p") || CheckCommand("/C") || CheckCommand("/c") || CheckCommand("/A") || CheckCommand("/a")) { cmdQuit(0); return 0; } #endif cmdExecute(argv[i]); } return 1; }