[ttssh2-commit] [9568] RestartTeraTerm() を Unicode化

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2021年 12月 5日 (日) 22:07:54 JST


Revision: 9568
          https://osdn.net/projects/ttssh2/scm/svn/commits/9568
Author:   zmatsuo
Date:     2021-12-05 22:07:54 +0900 (Sun, 05 Dec 2021)
Log Message:
-----------
RestartTeraTerm() を Unicode化

- ハンドルリークを修正

Modified Paths:
--------------
    trunk/teraterm/ttpcmn/ttcmn.c

-------------- next part --------------
Modified: trunk/teraterm/ttpcmn/ttcmn.c
===================================================================
--- trunk/teraterm/ttpcmn/ttcmn.c	2021-12-05 12:12:25 UTC (rev 9567)
+++ trunk/teraterm/ttpcmn/ttcmn.c	2021-12-05 13:07:54 UTC (rev 9568)
@@ -47,6 +47,7 @@
 #include "tt_res.h"
 #include "codeconv.h"
 #include "compat_win.h"
+#include "win32helper.h"
 #include "asprintf.h"
 
 #include "ttcmn_dup.h"
@@ -238,11 +239,10 @@
 
 // \x90ݒ\xE8\x83t\x83@\x83C\x83\x8B\x82\xF0\x83f\x83B\x83X\x83N\x82ɕۑ\xB6\x82\xB5\x81ATera Term\x96{\x91̂\xF0\x8DċN\x93\xAE\x82\xB7\x82\xE9\x81B
 // (2012.4.30 yutaka)
+// \x8Eg\x82\xC1\x82Ă\xA2\x82Ȃ\xA2?
 void WINAPI RestartTeraTerm(HWND hwnd, PTTSet ts)
 {
-	char path[1024];
-	STARTUPINFO si;
-	PROCESS_INFORMATION pi;
+	wchar_t *path;
 	int ret;
 
 	static const TTMessageBoxInfoW info = {
@@ -263,15 +263,10 @@
 	PostQuitMessage(0);
 
 	// \x8E\xA9\x83v\x83\x8D\x83Z\x83X\x82̍ċN\x93\xAE\x81B
-	if (GetModuleFileName(NULL, path, sizeof(path)) == 0) {
-		return;
+	if (hGetModuleFileNameW(NULL, &path) == 0) {
+		TTWinExec(path);
+		free(path);
 	}
-	memset(&si, 0, sizeof(si));
-	GetStartupInfo(&si);
-	memset(&pi, 0, sizeof(pi));
-	if (CreateProcess(NULL, path, NULL, NULL, FALSE, 0,
-	                  NULL, NULL, &si, &pi) == 0) {
-	}
 }
 
 void WINAPI SetCOMFlag(int Com)


ttssh2-commit メーリングリストの案内
Back to archive index