Revision: 8712 https://osdn.net/projects/ttssh2/scm/svn/commits/8712 Author: zmatsuo Date: 2020-04-12 00:57:19 +0900 (Sun, 12 Apr 2020) Log Message: ----------- exec を Unicode 対応にした Modified Paths: -------------- trunk/teraterm/ttpmacro/ttl.cpp -------------- next part -------------- Modified: trunk/teraterm/ttpmacro/ttl.cpp =================================================================== --- trunk/teraterm/ttpmacro/ttl.cpp 2020-04-11 15:57:11 UTC (rev 8711) +++ trunk/teraterm/ttpmacro/ttl.cpp 2020-04-11 15:57:19 UTC (rev 8712) @@ -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);