[Ttssh2-commit] [8668] exec を Unicode 対応にした

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2020年 4月 1日 (水) 23:31:14 JST


Revision: 8668
          https://osdn.net/projects/ttssh2/scm/svn/commits/8668
Author:   zmatsuo
Date:     2020-04-01 23:31:14 +0900 (Wed, 01 Apr 2020)
Log Message:
-----------
exec を Unicode 対応にした

Modified Paths:
--------------
    branches/unicode_macro_2/teraterm/ttpmacro/ttl.cpp

-------------- next part --------------
Modified: branches/unicode_macro_2/teraterm/ttpmacro/ttl.cpp
===================================================================
--- branches/unicode_macro_2/teraterm/ttpmacro/ttl.cpp	2020-04-01 14:31:05 UTC (rev 8667)
+++ branches/unicode_macro_2/teraterm/ttpmacro/ttl.cpp	2020-04-01 14:31:14 UTC (rev 8668)
@@ -67,6 +67,7 @@
 #include "win16api.h"
 #include "ttl_gui.h"
 #include "codeconv.h"
+#include "layer_for_unicode.h"
 
 #define TTERMCOMMAND "TTERMPRO /D="
 #define CYGTERMCOMMAND "cyglaunch -o /D="
@@ -1017,7 +1018,7 @@
 	int wait = 0;
 	DWORD ret;
 	WORD Err;
-	STARTUPINFO sui;
+	STARTUPINFOW sui;
 	PROCESS_INFORMATION pi;
 	BOOL bRet;
 
@@ -1060,17 +1061,18 @@
 
 	if (Err!=0) return Err;
 
-	memset(&sui, 0, sizeof(STARTUPINFO));
+	memset(&sui, 0, sizeof(sui));
 	sui.cb = sizeof(STARTUPINFO);
 	sui.wShowWindow = mode;
 	sui.dwFlags = STARTF_USESHOWWINDOW;
-	tc StrT = tc::fromUtf8(Str);
-	tc CurDirT = tc::fromUtf8(CurDir);
-	LPTSTR StrT_NC = (TCHAR *)(const TCHAR *)StrT;
-	if (CurDir[0] == 0)
-		bRet = CreateProcess(NULL, StrT_NC, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &sui, &pi);
-	else
-		bRet = CreateProcess(NULL, StrT_NC, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, CurDirT, &sui, &pi);
+	wc StrW = wc::fromUtf8(Str);
+	wc CurDirW = wc::fromUtf8(CurDir);
+	const wchar_t *pStrW = StrW;
+	const wchar_t *pCurdirW = NULL;
+	if (CurDir[0] != 0) {
+		pCurdirW = CurDirW;
+	}
+	bRet = _CreateProcessW(NULL, (LPWSTR)pStrW, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, pCurdirW, &sui, &pi);
 	if (bRet == FALSE) {
 		// \x8E\xC0\x8Ds\x82ł\xAB\x82Ȃ\xA9\x82\xC1\x82\xBD\x8Fꍇ\x81Aresult\x82\xC9-1\x82\xF0\x95Ԃ\xB7
 		SetResult(-1);


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