示例#1
0
static jint launchJVM(int argc, char** argv) {
    logArgs(argc, argv);

   void* libjli = dlopen("libjli.so", RTLD_LAZY | RTLD_GLOBAL);
        __android_log_print(3,"JVM", "JLI lib = %x", (int)libjli);
   if (NULL == libjli) {
       return 0;
   }
        __android_log_print(3,"JVM", "Found JLI lib");

   JLI_Launch_func *pJLI_Launch =
          (JLI_Launch_func *)dlsym(libjli, "JLI_Launch");

        __android_log_print(3,"JVM", "JLI_Launch = 0x%x", *(int*)&pJLI_Launch);

   if (NULL == pJLI_Launch) {
        __android_log_print(3,"JVM", "JLI_Launch = NULL");
       return 0;
   }

        __android_log_print(3,"JVM", "Calling JLI_Launch");
   return pJLI_Launch(argc, argv, 0, NULL, 0, NULL, FULL_VERSION,
                          DOT_VERSION, *argv, *argv, JNI_FALSE, JNI_FALSE,
                          JNI_FALSE, 0);
}
示例#2
0
int WINAPI wWinMain(
	HINSTANCE hInstance,
	HINSTANCE hPrevInstance,
	PWSTR pCmdLine,
	int nCmdShow) {

	// 附加到上级控制台
	AttachConsole(ATTACH_PARENT_PROCESS);

	// 将命令行参数分解开
	argv = CommandLineToArgvW(pCmdLine, &argc);

	// 解析输入的参数
	logParseArgs();
	if (!parseArgs()) {
		logParseArgsFailure();
		return 1;
	}
	logParseArgsSuccess();
	logArgs();

	// 根据指令不同执行不同的操作
	if (action == ActionSetProxy) {
		// 设置代理
		logSetProxy();
		if (!setProxy()) {
			logSetProxyFailure();
			return 1;
		}
		logSetProxySuccess();
	} else if (action == ActionUnsetProxy) {
		// 取消代理
		logUnsetProxy();
		if (!unsetProxy()) {
			logUnsetProxyFailure();
			return 1;
		}
		logUnsetProxySuccess();
	}

	return 0;
}