• R/O
  • SSH
  • HTTPS

exewrap: Commit


Commit MetaInfo

Revision48 (tree)
Time2018-03-02 19:13:29
Authorhirukawa_ryo

Log Message

* exewrap 1.2.4
スタックトレース出力の再修正をしました。

Change Summary

Incremental Difference

--- exewrap/trunk/exewrap/src/image_gui.c (revision 47)
+++ exewrap/trunk/exewrap/src/image_gui.c (revision 48)
@@ -22,7 +22,7 @@
2222 #include "include/message.h"
2323
2424 void OutputMessage(const char* text);
25-UINT UncaughtException(const char* thread, const jthrowable throwable);
25+UINT UncaughtException(JNIEnv* env, const char* thread, const jthrowable throwable);
2626
2727 static char** get_args(int* argc);
2828 static char* _w2a(LPCWSTR s);
@@ -163,7 +163,7 @@
163163 jthrowable throwable = (*env)->ExceptionOccurred(env);
164164 if (throwable != NULL)
165165 {
166- UncaughtException("main", throwable);
166+ UncaughtException(env, "main", throwable);
167167 (*env)->DeleteLocalRef(env, throwable);
168168 }
169169 (*env)->ExceptionClear(env);
@@ -209,7 +209,7 @@
209209 MessageBox(NULL, text, filename, MB_ICONEXCLAMATION | MB_APPLMODAL | MB_OK | MB_SETFOREGROUND);
210210 }
211211
212-UINT UncaughtException(const char* thread, const jthrowable throwable)
212+UINT UncaughtException(JNIEnv* env, const char* thread, const jthrowable throwable)
213213 {
214214 jclass System = NULL;
215215 jfieldID System_err = NULL;
@@ -230,66 +230,76 @@
230230 goto EXIT;
231231 }
232232
233+ buf = malloc(65536);
234+ if(buf == NULL)
235+ {
236+ goto EXIT;
237+ }
238+
233239 System = (*env)->FindClass(env, "java/lang/System");
234240 if(System == NULL)
235241 {
236- printf(_(MSG_ID_ERR_FIND_CLASS), "java.lang.System");
242+ sprintf(buf, _(MSG_ID_ERR_FIND_CLASS), "java.lang.System");
243+ OutputMessage(buf);
237244 goto EXIT;
238245 }
239246 System_err = (*env)->GetStaticFieldID(env, System, "err", "Ljava/io/PrintStream;");
240247 if(System_err == NULL)
241248 {
242- printf(_(MSG_ID_ERR_GET_FIELD), "java.lang.System.err");
249+ sprintf(buf, _(MSG_ID_ERR_GET_FIELD), "java.lang.System.err");
250+ OutputMessage(buf);
243251 goto EXIT;
244252 }
245253 printStream = (*env)->GetStaticObjectField(env, System, System_err);
246254 if(printStream == NULL)
247255 {
248- printf(_(MSG_ID_ERR_GET_FIELD), "java.lang.System.err");
256+ sprintf(buf, _(MSG_ID_ERR_GET_FIELD), "java.lang.System.err");
257+ OutputMessage(buf);
249258 goto EXIT;
250259 }
251260 PrintStream = (*env)->FindClass(env, "java/io/PrintStream");
252261 if(PrintStream == NULL)
253262 {
254- printf(_(MSG_ID_ERR_FIND_CLASS), "java.io.PrintStream");
263+ sprintf(buf, _(MSG_ID_ERR_FIND_CLASS), "java.io.PrintStream");
264+ OutputMessage(buf);
255265 goto EXIT;
256266 }
257267 printStream_print = (*env)->GetMethodID(env, PrintStream, "print", "(Ljava/lang/String;)V");
258268 if(printStream_print == NULL)
259269 {
260- printf(_(MSG_ID_ERR_GET_METHOD), "java.io.PrintStream.print(String)");
270+ sprintf(buf, _(MSG_ID_ERR_GET_METHOD), "java.io.PrintStream.print(String)");
271+ OutputMessage(buf);
261272 goto EXIT;
262273 }
263274 printStream_flush = (*env)->GetMethodID(env, PrintStream, "flush", "()V");
264275 if(printStream_flush == NULL)
265276 {
266- printf(_(MSG_ID_ERR_GET_METHOD), "java.io.PrintStream.flush()");
277+ sprintf(buf, _(MSG_ID_ERR_GET_METHOD), "java.io.PrintStream.flush()");
278+ OutputMessage(buf);
267279 goto EXIT;
268280 }
269281 Throwable = (*env)->FindClass(env, "java/lang/Throwable");
270282 if(Throwable == NULL)
271283 {
272- printf(_(MSG_ID_ERR_FIND_CLASS), "java.lang.Throwable");
284+ sprintf(buf, _(MSG_ID_ERR_FIND_CLASS), "java.lang.Throwable");
285+ OutputMessage(buf);
273286 goto EXIT;
274287 }
275288 throwable_printStackTrace = (*env)->GetMethodID(env, Throwable, "printStackTrace", "()V");
276289 if(throwable_printStackTrace == NULL)
277290 {
278- printf(_(MSG_ID_ERR_GET_METHOD), "java.lang.Throwable.printStackTrace()");
291+ sprintf(buf, _(MSG_ID_ERR_GET_METHOD), "java.lang.Throwable.printStackTrace()");
292+ OutputMessage(buf);
279293 goto EXIT;
280294 }
281295 throwable_getMessage = (*env)->GetMethodID(env, Throwable, "getMessage", "()Ljava/lang/String;");
282296 if(throwable_getMessage == NULL)
283297 {
284- printf(_(MSG_ID_ERR_GET_METHOD), "java.lang.Throwable.getMessage()");
298+ sprintf(buf, _(MSG_ID_ERR_GET_METHOD), "java.lang.Throwable.getMessage()");
299+ OutputMessage(buf);
285300 goto EXIT;
286301 }
287302
288- buf = malloc(1024);
289- if(buf == NULL)
290- {
291- goto EXIT;
292- }
293303 strcpy(buf, "Exception in thread \"");
294304 strcat(buf, thread);
295305 strcat(buf, "\" ");
@@ -300,12 +310,11 @@
300310 (*env)->CallObjectMethod(env, printStream, printStream_flush);
301311
302312 message = (*env)->CallObjectMethod(env, throwable, throwable_getMessage);
303- if(message == NULL)
313+ if(message != NULL)
304314 {
305- goto EXIT;
315+ sjis = GetShiftJIS(env, message);
306316 }
307- sjis = GetShiftJIS(env, message);
308- sprintf(buf, "Exception in thread \"%s\"\r\n%s", thread, sjis);
317+ sprintf(buf, "Exception in thread \"%s\"\r\n%s", thread, (sjis != NULL) ? sjis : "");
309318 OutputMessage(buf);
310319
311320 EXIT:
--- exewrap/trunk/exewrap/src/Makefile (revision 47)
+++ exewrap/trunk/exewrap/src/Makefile (revision 48)
@@ -191,31 +191,28 @@
191191 $(JAR) cvfM $(OBJ)\loader.jar -C $(OBJ) Loader.class
192192
193193 $(OBJ)\exewrap-loader\Loader.class : $(OBJ) java\Loader.java
194- $(JAVAC) -Xlint:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\Loader.java
194+ $(JAVAC) -Xlint:none -g:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\Loader.java
195195
196196
197197 ### exewrap.core
198198
199-$(OBJ)\exewrap\core\ExewrapClassLoader.class : $(OBJ) java\exewrap\core\ExewrapClassLoader.java
200- $(JAVAC) -Xlint:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\core\ExewrapClassLoader.java
201-
202199 $(OBJ)\exewrap\core\ByteBufferInputStream.class : $(OBJ) java\exewrap\core\ByteBufferInputStream.java
203- $(JAVAC) -Xlint:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\core\ByteBufferInputStream.java
200+ $(JAVAC) -Xlint:none -g:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\core\ByteBufferInputStream.java
204201
205202 $(OBJ)\exewrap\core\NativeMethods.class : $(OBJ) java\exewrap\core\NativeMethods.java
206- $(JAVAC) -Xlint:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\core\NativeMethods.java
203+ $(JAVAC) -Xlint:none -g:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\core\NativeMethods.java
207204
208205 $(OBJ)\exewrap\core\PackInputStream.class : $(OBJ) java\exewrap\core\PackInputStream.java
209- $(JAVAC) -Xlint:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\core\PackInputStream.java
206+ $(JAVAC) -Xlint:none -g:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\core\PackInputStream.java
210207
211208 $(OBJ)\exewrap\core\URLConnection.class : $(OBJ) java\exewrap\core\URLConnection.java
212- $(JAVAC) -Xlint:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\core\URLConnection.java
209+ $(JAVAC) -Xlint:none -g:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\core\URLConnection.java
213210
214211 $(OBJ)\exewrap\core\URLStreamHandler.class : $(OBJ) java\exewrap\core\URLStreamHandler.java
215- $(JAVAC) -Xlint:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\core\URLStreamHandler.java
212+ $(JAVAC) -Xlint:none -g:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\core\URLStreamHandler.java
216213
217214 $(OBJ)\exewrap\core\URLStreamHandlerFactory.class : $(OBJ) java\exewrap\core\URLStreamHandlerFactory.java
218- $(JAVAC) -Xlint:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\core\URLStreamHandlerFactory.java
215+ $(JAVAC) -Xlint:none -g:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\core\URLStreamHandlerFactory.java
219216
220217 ### exewrap.util
221218
@@ -223,19 +220,19 @@
223220 $(JAR) cvfM $(OBJ)\util.jar -C $(OBJ) exewrap\util
224221
225222 $(OBJ)\exewrap\util\Environment.class : $(OBJ) java\exewrap\util\Environment.java
226- $(JAVAC) -Xlint:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\util\Environment.java
223+ $(JAVAC) -Xlint:none -g:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\util\Environment.java
227224
228225 $(OBJ)\exewrap\util\EventLogHandler.class : $(OBJ) java\exewrap\util\EventLogHandler.java
229- $(JAVAC) -Xlint:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\util\EventLogHandler.java
226+ $(JAVAC) -Xlint:none -g:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\util\EventLogHandler.java
230227
231228 $(OBJ)\exewrap\util\EventLogStream.class : $(OBJ) java\exewrap\util\EventLogStream.java
232- $(JAVAC) -Xlint:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\util\EventLogStream.java
229+ $(JAVAC) -Xlint:none -g:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\util\EventLogStream.java
233230
234231 $(OBJ)\exewrap\util\FileLogStream.class : $(OBJ) java\exewrap\util\FileLogStream.java
235- $(JAVAC) -Xlint:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\util\FileLogStream.java
232+ $(JAVAC) -Xlint:none -g:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\util\FileLogStream.java
236233
237234 $(OBJ)\exewrap\util\UncaughtExceptionHandler.class : $(OBJ) java\exewrap\util\UncaughtExceptionHandler.java
238- $(JAVAC) -Xlint:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\util\UncaughtExceptionHandler.java
235+ $(JAVAC) -Xlint:none -g:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\util\UncaughtExceptionHandler.java
239236
240237 ### exewrap.tool
241238
@@ -243,8 +240,7 @@
243240 $(JAR) cvfe $(OBJ)\tool.jar exewrap.tool.JarProcessor -C $(OBJ) exewrap\tool
244241
245242 $(OBJ)\exewrap\tool\PackOutputStream.class : $(OBJ) java\exewrap\tool\PackOutputStream.java
246- $(JAVAC) -Xlint:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\tool\PackOutputStream.java
243+ $(JAVAC) -Xlint:none -g:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\tool\PackOutputStream.java
247244
248245 $(OBJ)\exewrap\tool\JarProcessor.class : $(OBJ) java\exewrap\tool\JarProcessor.java
249- $(JAVAC) -Xlint:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\tool\JarProcessor.java
250-
246+ $(JAVAC) -Xlint:none -g:none -source 1.5 -target 1.5 -sourcepath java -d $(OBJ) java\exewrap\tool\JarProcessor.java
--- exewrap/trunk/exewrap/src/image_service.c (revision 47)
+++ exewrap/trunk/exewrap/src/image_service.c (revision 48)
@@ -21,7 +21,7 @@
2121 #define SHOW_HELP_MESSAGE 64
2222
2323 void OutputMessage(const char* text);
24-UINT UncaughtException(const char* thread, const jthrowable throwable);
24+UINT UncaughtException(JNIEnv* env, const char* thread, const jthrowable throwable);
2525
2626 static int install_service(char* service_name, int argc, char* argv[], int opt_end);
2727 static int set_service_description(char* service_name, char* description);
@@ -92,7 +92,8 @@
9292 CreateJavaVM(vm_args_opt, "Loader", use_server_vm, use_side_by_side_jre, &err);
9393 if (err != JNI_OK)
9494 {
95- OutputMessage(GetWinErrorMessage(err, &result.msg_id, result.msg));
95+ GetJniErrorMessage(err, &result.msg_id, result.msg);
96+ is_service ? WriteEventLog(EVENTLOG_ERROR_TYPE, result.msg) : OutputMessage(result.msg);
9697 goto EXIT;
9798 }
9899
@@ -105,7 +106,7 @@
105106 char* targetVersionString = (char*)res.buf + 4;
106107 result.msg_id = MSG_ID_ERR_TARGET_VERSION;
107108 sprintf(result.msg, _(MSG_ID_ERR_TARGET_VERSION), targetVersionString);
108- OutputMessage(result.msg);
109+ is_service ? WriteEventLog(EVENTLOG_ERROR_TYPE, result.msg) : OutputMessage(result.msg);
109110 goto EXIT;
110111 }
111112 }
@@ -126,7 +127,7 @@
126127
127128 if (LoadMainClass(argc, argv, utilities, &result) == FALSE)
128129 {
129- OutputMessage(result.msg);
130+ is_service ? WriteEventLog(EVENTLOG_ERROR_TYPE, result.msg) : OutputMessage(result.msg);
130131 goto EXIT;
131132 }
132133 MainClass = result.MainClass;
@@ -136,7 +137,7 @@
136137 {
137138 result.msg_id = MSG_ID_ERR_FIND_METHOD_SERVICE_START;
138139 strcpy(result.msg, _(MSG_ID_ERR_FIND_METHOD_SERVICE_START));
139- OutputMessage(result.msg);
140+ is_service ? WriteEventLog(EVENTLOG_ERROR_TYPE, result.msg) : OutputMessage(result.msg);
140141 goto EXIT;
141142 }
142143 if (is_service && argc > 2)
@@ -164,7 +165,7 @@
164165 {
165166 result.msg_id = MSG_ID_ERR_FIND_METHOD_SERVICE_STOP;
166167 strcpy(result.msg, _(MSG_ID_ERR_FIND_METHOD_SERVICE_STOP));
167- OutputMessage(result.msg);
168+ is_service ? WriteEventLog(EVENTLOG_ERROR_TYPE, result.msg) : OutputMessage(result.msg);
168169 goto EXIT;
169170 }
170171
@@ -186,7 +187,7 @@
186187 jthrowable throwable = (*env)->ExceptionOccurred(env);
187188 if (throwable != NULL)
188189 {
189- UncaughtException("main", throwable);
190+ UncaughtException(env, "main", throwable);
190191 (*env)->DeleteLocalRef(env, throwable);
191192 }
192193 (*env)->ExceptionClear(env);
@@ -235,7 +236,7 @@
235236 WriteConsole(GetStdHandle(STD_ERROR_HANDLE), "\r\n", 2, &written, NULL);
236237 }
237238
238-UINT UncaughtException(const char* thread, const jthrowable throwable)
239+UINT UncaughtException(JNIEnv* env, const char* thread, const jthrowable throwable)
239240 {
240241 BOOL is_service = (flags & SERVICE_START_BY_SCM);
241242
@@ -254,34 +255,50 @@
254255 char* buf = NULL;
255256 char* sjis = NULL;
256257
258+ if(thread == NULL || throwable == NULL)
259+ {
260+ goto EXIT;
261+ }
262+
263+ buf = malloc(65536);
264+ if(buf == NULL)
265+ {
266+ goto EXIT;
267+ }
268+
257269 StringWriter = (*env)->FindClass(env, "java/io/StringWriter");
258270 if(StringWriter == NULL)
259271 {
260- printf(_(MSG_ID_ERR_FIND_CLASS), "java.io.StringWriter");
272+ sprintf(buf, _(MSG_ID_ERR_FIND_CLASS), "java.io.StringWriter");
273+ is_service ? WriteEventLog(EVENTLOG_ERROR_TYPE, buf) : OutputMessage(buf);
261274 goto EXIT;
262275 }
263276 StringWriter_init = (*env)->GetMethodID(env, StringWriter, "<init>","()V");
264277 if(StringWriter_init == NULL)
265278 {
266- printf(_(MSG_ID_ERR_GET_CONSTRUCTOR), "java.io.StringWriter()");
279+ sprintf(buf, _(MSG_ID_ERR_GET_CONSTRUCTOR), "java.io.StringWriter()");
280+ is_service ? WriteEventLog(EVENTLOG_ERROR_TYPE, buf) : OutputMessage(buf);
267281 goto EXIT;
268282 }
269283 stringWriter_flush = (*env)->GetMethodID(env, StringWriter, "flush", "()V");
270284 if(stringWriter_flush == NULL)
271285 {
272- printf(_(MSG_ID_ERR_GET_METHOD), "java.io.StringWriter.flush()");
286+ sprintf(buf, _(MSG_ID_ERR_GET_METHOD), "java.io.StringWriter.flush()");
287+ is_service ? WriteEventLog(EVENTLOG_ERROR_TYPE, buf) : OutputMessage(buf);
273288 goto EXIT;
274289 }
275290 stringWriter_toString = (*env)->GetMethodID(env, StringWriter, "toString", "()Ljava/lang/String;");
276291 if(stringWriter_toString == NULL)
277292 {
278- printf(_(MSG_ID_ERR_GET_METHOD), "java.io.StringWriter.toString()");
293+ sprintf(buf, _(MSG_ID_ERR_GET_METHOD), "java.io.StringWriter.toString()");
294+ is_service ? WriteEventLog(EVENTLOG_ERROR_TYPE, buf) : OutputMessage(buf);
279295 goto EXIT;
280296 }
281297 stringWriter = (*env)->NewObject(env, StringWriter, StringWriter_init);
282298 if(stringWriter == NULL)
283299 {
284- printf(_(MSG_ID_ERR_NEW_OBJECT), "java.io.StringWriter()");
300+ sprintf(buf, _(MSG_ID_ERR_NEW_OBJECT), "java.io.StringWriter()");
301+ is_service ? WriteEventLog(EVENTLOG_ERROR_TYPE, buf) : OutputMessage(buf);
285302 goto EXIT;
286303 }
287304
@@ -288,25 +305,29 @@
288305 PrintWriter = (*env)->FindClass(env, "java/io/PrintWriter");
289306 if(PrintWriter == NULL)
290307 {
291- printf(_(MSG_ID_ERR_FIND_CLASS), "java.io.PrintWriter");
308+ sprintf(buf, _(MSG_ID_ERR_FIND_CLASS), "java.io.PrintWriter");
309+ is_service ? WriteEventLog(EVENTLOG_ERROR_TYPE, buf) : OutputMessage(buf);
292310 goto EXIT;
293311 }
294312 PrintWriter_init = (*env)->GetMethodID(env, PrintWriter, "<init>", "(Ljava/io/Writer;)V");
295313 if(PrintWriter_init == NULL)
296314 {
297- printf(_(MSG_ID_ERR_GET_CONSTRUCTOR), "java.io.PrintWriter(java.io.Writer)");
315+ sprintf(buf, _(MSG_ID_ERR_GET_CONSTRUCTOR), "java.io.PrintWriter(java.io.Writer)");
316+ is_service ? WriteEventLog(EVENTLOG_ERROR_TYPE, buf) : OutputMessage(buf);
298317 goto EXIT;
299318 }
300319 printWriter_flush = (*env)->GetMethodID(env, PrintWriter, "flush", "()V");
301320 if(printWriter_flush == NULL)
302321 {
303- printf(_(MSG_ID_ERR_GET_METHOD), "java.io.PrintWriter.flush()");
322+ sprintf(buf, _(MSG_ID_ERR_GET_METHOD), "java.io.PrintWriter.flush()");
323+ is_service ? WriteEventLog(EVENTLOG_ERROR_TYPE, buf) : OutputMessage(buf);
304324 goto EXIT;
305325 }
306326 printWriter = (*env)->NewObject(env, PrintWriter, PrintWriter_init, stringWriter);
307327 if(printWriter == NULL)
308328 {
309- printf(_(MSG_ID_ERR_NEW_OBJECT), "java.io.PrintWriter(java.io.Writer)");
329+ sprintf(buf, _(MSG_ID_ERR_NEW_OBJECT), "java.io.PrintWriter(java.io.Writer)");
330+ is_service ? WriteEventLog(EVENTLOG_ERROR_TYPE, buf) : OutputMessage(buf);
310331 goto EXIT;
311332 }
312333
@@ -313,21 +334,18 @@
313334 Throwable = (*env)->FindClass(env, "java/lang/Throwable");
314335 if(Throwable == NULL)
315336 {
316- printf(_(MSG_ID_ERR_FIND_CLASS), "java.lang.Throwable");
337+ sprintf(buf, _(MSG_ID_ERR_FIND_CLASS), "java.lang.Throwable");
338+ is_service ? WriteEventLog(EVENTLOG_ERROR_TYPE, buf) : OutputMessage(buf);
317339 goto EXIT;
318340 }
319341 throwable_printStackTrace = (*env)->GetMethodID(env, Throwable, "printStackTrace", "(Ljava/io/PrintWriter;)V");
320342 if(throwable_printStackTrace == NULL)
321343 {
322- printf(_(MSG_ID_ERR_GET_METHOD), "java.lang.Throwable.printStackTrace(java.io.PrintWriter)");
344+ sprintf(buf, _(MSG_ID_ERR_GET_METHOD), "java.lang.Throwable.printStackTrace(java.io.PrintWriter)");
345+ is_service ? WriteEventLog(EVENTLOG_ERROR_TYPE, buf) : OutputMessage(buf);
323346 goto EXIT;
324347 }
325348
326- buf = malloc(65536);
327- if(buf == NULL)
328- {
329- goto EXIT;
330- }
331349 strcpy(buf, "Exception in thread \"");
332350 strcat(buf, thread);
333351 strcat(buf, "\" ");
@@ -338,17 +356,8 @@
338356 stacktrace = (jstring)(*env)->CallObjectMethod(env, stringWriter, stringWriter_toString);
339357 sjis = GetShiftJIS(env, stacktrace);
340358 strcat(buf, sjis);
359+ is_service ? WriteEventLog(EVENTLOG_ERROR_TYPE, buf) : OutputMessage(buf);
341360
342- if (is_service)
343- {
344- WriteEventLog(EVENTLOG_ERROR_TYPE, buf);
345- }
346- else
347- {
348- DWORD written;
349- WriteConsole(GetStdHandle(STD_ERROR_HANDLE), buf, (DWORD)strlen(buf), &written, NULL);
350- }
351-
352361 EXIT:
353362 if(sjis != NULL)
354363 {
@@ -946,7 +955,7 @@
946955 jthrowable throwable = (*env)->ExceptionOccurred(env);
947956 if (throwable != NULL)
948957 {
949- UncaughtException("scm", throwable);
958+ UncaughtException(env, "scm", throwable);
950959 (*env)->DeleteLocalRef(env, throwable);
951960 }
952961 (*env)->ExceptionClear(env);
--- exewrap/trunk/exewrap/src/image_console.c (revision 47)
+++ exewrap/trunk/exewrap/src/image_console.c (revision 48)
@@ -12,7 +12,7 @@
1212 #include "include/message.h"
1313
1414 void OutputMessage(const char* text);
15-UINT UncaughtException(const char* thread, const jthrowable throwable);
15+UINT UncaughtException(JNIEnv* env, const char* thread, const jthrowable throwable);
1616
1717 int main(int argc, char* argv[])
1818 {
@@ -101,7 +101,7 @@
101101 jthrowable throwable = (*env)->ExceptionOccurred(env);
102102 if (throwable != NULL)
103103 {
104- UncaughtException("main", throwable);
104+ UncaughtException(env, "main", throwable);
105105 (*env)->DeleteLocalRef(env, throwable);
106106 }
107107 (*env)->ExceptionClear(env);
@@ -144,7 +144,7 @@
144144 WriteConsole(GetStdHandle(STD_ERROR_HANDLE), "\r\n", 2, &written, NULL);
145145 }
146146
147-UINT UncaughtException(const char* thread, const jthrowable throwable)
147+UINT UncaughtException(JNIEnv* env, const char* thread, const jthrowable throwable)
148148 {
149149 jclass Throwable = NULL;
150150 jmethodID throwable_printStackTrace = NULL;
--- exewrap/trunk/exewrap/src/loader.c (revision 47)
+++ exewrap/trunk/exewrap/src/loader.c (revision 48)
@@ -27,7 +27,7 @@
2727 static char** split_args(char* buffer, int* p_argc);
2828
2929 extern void OutputMessage(const char* text);
30-extern UINT UncaughtException(const char* thread, const jthrowable throwable);
30+extern UINT UncaughtException(JNIEnv* env, const char* thread, const jthrowable throwable);
3131
3232 static jclass Loader = NULL;
3333 static jobject resources = NULL;
@@ -547,7 +547,7 @@
547547 jthrowable throwable = (*env)->ExceptionOccurred(env);
548548 if (throwable != NULL)
549549 {
550- UncaughtException("main", throwable);
550+ UncaughtException(env, "main", throwable);
551551 (*env)->DeleteLocalRef(env, throwable);
552552 }
553553 (*env)->ExceptionClear(env);
@@ -692,7 +692,7 @@
692692
693693 sjis_thread = GetShiftJIS(env, thread);
694694
695- exit_code = UncaughtException(sjis_thread, throwable);
695+ exit_code = UncaughtException(env, sjis_thread, throwable);
696696
697697 if (sjis_thread != NULL)
698698 {
--- exewrap/trunk/exewrap/src/exewrap.c (revision 47)
+++ exewrap/trunk/exewrap/src/exewrap.c (revision 48)
@@ -83,9 +83,9 @@
8383 exe_file = argv[0];
8484 }
8585
86- printf("exewrap 1.2.3 for %s (%d-bit) \r\n"
86+ printf("exewrap 1.2.4 for %s (%d-bit) \r\n"
8787 "Native executable java application wrapper.\r\n"
88- "Copyright (C) 2005-2017 HIRUKAWA Ryo. All rights reserved.\r\n"
88+ "Copyright (C) 2005-2018 HIRUKAWA Ryo. All rights reserved.\r\n"
8989 "\r\n"
9090 "Usage: %s <options> <jar-file>\r\n"
9191 "Options:\r\n"
Show on old repository browser