#ifdef CONFIG_MARU
char _msg[] = "Failed to allocate memory in qemu.";
char cmd[JAVA_MAX_COMMAND_LENGTH] = { 0, };
- sprintf(cmd, "%s %s %s %s=\"%s\"", JAVA_EXEFILE_PATH, JAVA_EXEOPTION, JAR_SKINFILE_PATH, "simple.msg", _msg);
+
+ int len = strlen(JAVA_EXEFILE_PATH) + strlen(JAVA_EXEOPTION) + strlen(JAR_SKINFILE_PATH) +
+ strlen(JAVA_SIMPLEMODE_OPTION) + strlen(_msg) + 7;
+ if (len > JAVA_MAX_COMMAND_LENGTH) {
+ len = JAVA_MAX_COMMAND_LENGTH;
+ }
+
+ snprintf(cmd, len, "%s %s %s %s=\"%s\"",
+ JAVA_EXEFILE_PATH, JAVA_EXEOPTION, JAR_SKINFILE_PATH, JAVA_SIMPLEMODE_OPTION, _msg);
int ret = system(cmd);
#endif
#ifdef CONFIG_MARU
char _msg[] = "Failed to allocate memory in qemu.";
char cmd[JAVA_MAX_COMMAND_LENGTH] = { 0, };
- sprintf(cmd, "%s %s %s %s=\"%s\"", JAVA_EXEFILE_PATH, JAVA_EXEOPTION, JAR_SKINFILE_PATH, "simple.msg", _msg);
+
+ int len = strlen(JAVA_EXEFILE_PATH) + strlen(JAVA_EXEOPTION) + strlen(JAR_SKINFILE_PATH) +
+ strlen(JAVA_SIMPLEMODE_OPTION) + strlen(_msg) + 7;
+ if (len > JAVA_MAX_COMMAND_LENGTH) {
+ len = JAVA_MAX_COMMAND_LENGTH;
+ }
+
+ snprintf(cmd, len, "%s %s %s %s=\"%s\"",
+ JAVA_EXEFILE_PATH, JAVA_EXEOPTION, JAR_SKINFILE_PATH, JAVA_SIMPLEMODE_OPTION, _msg);
int ret = WinExec(cmd, SW_SHOW);
#endif
-
abort();
}
return ptr;
if (get_emul_skin_enable() == 1) { //this line is check for debugging, etc..
if ( 0 > start_skin_client(skin_argc, skin_argv) ) {
+ maru_register_exit_msg(MARU_EXIT_SKIN_SERVER_FAILED, NULL);
exit( -1 );
}
}
/* 1 */ "Failed to allocate memory in qemu.", //MARU_EXIT_MEMORY_EXCEPTION
/* 2 */ "Fail to load kernel file. Check if the file is corrupted or missing from the following path.\n\n", //MARU_EXIT_KERNEL_FILE_EXCEPTION
/* 3 */ "Fail to load bios file. Check if the file is corrupted or missing from the following path.\n\n", //MARU_EXIT_BIOS_FILE_EXCEPTION
+ /* 4 */ "Skin process cannot be initialized. Skin server is not ready.",
/* add here.. */
"" //MARU_EXIT_NORMAL
};
maru_exit_status = maru_exit_index;
if (maru_exit_status != MARU_EXIT_UNKNOWN) {
- len = strlen(_maru_string_table[maru_exit_status]) + strlen(additional_msg) + 1;
- if (len >= JAVA_MAX_COMMAND_LENGTH) {
- len = JAVA_MAX_COMMAND_LENGTH;
- }
+ if (additional_msg != NULL) {
+ len = strlen(_maru_string_table[maru_exit_status]) + strlen(additional_msg) + 1;
+ if (len > JAVA_MAX_COMMAND_LENGTH) {
+ len = JAVA_MAX_COMMAND_LENGTH;
+ }
- snprintf(maru_exit_msg, len, "%s%s", _maru_string_table[maru_exit_status], additional_msg);
- } else {
+ snprintf(maru_exit_msg, len, "%s%s", _maru_string_table[maru_exit_status], additional_msg);
+ } else {
+ len = strlen(_maru_string_table[maru_exit_status]) + 1;
+ if (len > JAVA_MAX_COMMAND_LENGTH) {
+ len = JAVA_MAX_COMMAND_LENGTH;
+ }
+
+ snprintf(maru_exit_msg, len, "%s", _maru_string_table[maru_exit_status]);
+ }
+ } else if (additional_msg != NULL) {
len = strlen(additional_msg);
if (len >= JAVA_MAX_COMMAND_LENGTH) {
additional_msg[JAVA_MAX_COMMAND_LENGTH - 1] = '\0';
/* 1 */ MARU_EXIT_MEMORY_EXCEPTION,
/* 2 */ MARU_EXIT_KERNEL_FILE_EXCEPTION,
/* 3 */ MARU_EXIT_BIOS_FILE_EXCEPTION,
+ /* 4 */ MARU_EXIT_SKIN_SERVER_FAILED,
/* add here.. */
MARU_EXIT_NORMAL
};
char* vm_path = tizen_target_path;
//INFO( "vm_path:%s\n", vm_path );
- sprintf( cmd, "%s %s %s %s=\"%d\" %s=\"%d\" %s=\"%s\" %s=\"%d\" %s", JAVA_EXEFILE_PATH, JAVA_EXEOPTION, JAR_SKINFILE_PATH,
+ char buf_skin_server_port[16];
+ char buf_uid[16];
+ char buf_tizen_base_port[16];
+ sprintf(buf_skin_server_port, "%d", skin_server_port);
+ sprintf(buf_uid, "%d", uid);
+ sprintf(buf_tizen_base_port, "%d", tizen_base_port);
+
+ int len = strlen(JAVA_EXEFILE_PATH) + strlen(JAVA_EXEOPTION) + strlen(JAR_SKINFILE_PATH) +
+ strlen(OPT_SVR_PORT) + strlen(buf_skin_server_port) + strlen(OPT_UID) + strlen(buf_uid) +
+ strlen(OPT_VM_PATH) + strlen(vm_path) + strlen(OPT_NET_BASE_PORT) + strlen(buf_tizen_base_port) +
+ strlen(argv) + 20;
+ if (len > JAVA_MAX_COMMAND_LENGTH) {
+ INFO("swt command length is too long! (%d)\n", len);
+ len = JAVA_MAX_COMMAND_LENGTH;
+ }
+
+ snprintf( cmd, len, "%s %s %s %s=\"%d\" %s=\"%d\" %s=\"%s\" %s=\"%d\" %s",
+ JAVA_EXEFILE_PATH, JAVA_EXEOPTION, JAR_SKINFILE_PATH,
OPT_SVR_PORT, skin_server_port,
OPT_UID, uid,
OPT_VM_PATH, vm_path,
&sti,
&pi))
{
- ERR("Unable to generate process!error %u\n", GetLastError());
+ ERR("Unable to generate process! error %u\n", GetLastError());
+ maru_register_exit_msg(MARU_EXIT_UNKNOWN,
+ "CreateProcess function failed. Unable to generate process.");
exit(1);
}
INFO("run simple client\n");
- sprintf(cmd, "%s %s %s %s=\"%s\"", JAVA_EXEFILE_PATH, JAVA_EXEOPTION, JAR_SKINFILE_PATH, "simple.msg", msg);
+ int len = strlen(JAVA_EXEFILE_PATH) + strlen(JAVA_EXEOPTION) + strlen(JAR_SKINFILE_PATH) +
+ strlen(JAVA_SIMPLEMODE_OPTION) + strlen(msg) + 7;
+ if (len > JAVA_MAX_COMMAND_LENGTH) {
+ len = JAVA_MAX_COMMAND_LENGTH;
+ }
+
+ snprintf(cmd, len, "%s %s %s %s=\"%s\"", JAVA_EXEFILE_PATH, JAVA_EXEOPTION, JAR_SKINFILE_PATH, JAVA_SIMPLEMODE_OPTION, msg);
INFO("command for swt : %s\n", cmd);
#ifdef __WIN32
#define JAR_SKINFILE_PATH "emulator-skin.jar"
#define JAVA_EXEFILE_PATH "java"
#define JAVA_EXEOPTION "-jar"
+#define JAVA_SIMPLEMODE_OPTION "simple.msg"
int start_skin_client(int argc, char* argv[]);
int start_simple_client(char* msg);
-
#endif /* MARUSKIN_CLIENT_H_ */