• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Tera Termの個人的な作業用リポジトリ


Commit MetaInfo

修订版54acfb6a8f762c54a1833a6c3e6f87df9d2992ea (tree)
时间2020-04-12 00:57:11
作者zmatsuo <zmatsuo@user...>
Commiterzmatsuo

Log Message

_CreateProcessW() を追加

- マクロの exec が動作するのを確認

git-svn-id: svn+ssh://svn.osdn.net/svnroot/ttssh2/trunk@8711 f5f01b69-1e22-0410-acbf-894ab4bd6246

更改概述

差异

--- a/teraterm/common/compat_win.cpp
+++ b/teraterm/common/compat_win.cpp
@@ -77,6 +77,11 @@ HWND (WINAPI *pGetConsoleWindow)(void);
7777 DWORD (WINAPI *pGetPrivateProfileStringW)(LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault,
7878 LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName);
7979 BOOL (WINAPI *pWritePrivateProfileStringW)(LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpString, LPCWSTR lpFileName);
80+BOOL (WINAPI *pCreateProcessW)(LPCWSTR lpApplicationName, LPWSTR lpCommandLine,
81+ LPSECURITY_ATTRIBUTES lpProcessAttributes,
82+ LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles,
83+ DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory,
84+ LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation);
8085
8186 // gdi32.lib
8287 int (WINAPI *pAddFontResourceExW)(LPCWSTR name, DWORD fl, PVOID res);
@@ -219,6 +224,7 @@ static const APIInfo Lists_kernel32[] = {
219224 { "SetCurrentDirectoryW", (void **)&pSetCurrentDirectoryW },
220225 { "GetPrivateProfileStringW", (void **)&pGetPrivateProfileStringW },
221226 { "WritePrivateProfileStringW", (void **)&pWritePrivateProfileStringW },
227+ { "CreateProcessW", (void **)&pCreateProcessW },
222228 #endif
223229 { "GetConsoleWindow", (void **)&pGetConsoleWindow },
224230 {},
@@ -304,6 +310,9 @@ void WinCompatInit()
304310 pGetCurrentDirectoryW = NULL;
305311 pSetCurrentDirectoryW = NULL;
306312 pGetOpenFileNameW = NULL;
313+ pSHBrowseForFolderW = NULL;
314+ pSHGetPathFromIDListW = NULL;
315+ pCreateProcessW = NULL;
307316 }
308317
309318 // GetConsoleWindow特別処理
--- a/teraterm/common/compat_win.h
+++ b/teraterm/common/compat_win.h
@@ -129,6 +129,11 @@ extern BOOL (WINAPI *pGetSaveFileNameW)(LPOPENFILENAMEW ofnW);
129129 extern DWORD (WINAPI *pGetPrivateProfileStringW)(LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault,
130130 LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName);
131131 extern BOOL (WINAPI *pWritePrivateProfileStringW)(LPCWSTR lpAppName,LPCWSTR lpKeyName,LPCWSTR lpString,LPCWSTR lpFileName);
132+extern BOOL (WINAPI *pCreateProcessW)(LPCWSTR lpApplicationName, LPWSTR lpCommandLine,
133+ LPSECURITY_ATTRIBUTES lpProcessAttributes,
134+ LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles,
135+ DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory,
136+ LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation);
132137
133138 // shlobj_core.h
134139 extern LPITEMIDLIST (WINAPI *pSHBrowseForFolderW)(LPBROWSEINFOW lpbi);
--- a/teraterm/common/layer_for_unicode.cpp
+++ b/teraterm/common/layer_for_unicode.cpp
@@ -656,3 +656,37 @@ BOOL _WritePrivateProfileStringW(LPCWSTR lpAppName,LPCWSTR lpKeyName,LPCWSTR lpS
656656 free(fileA);
657657 return r;
658658 }
659+
660+BOOL _CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine,
661+ LPSECURITY_ATTRIBUTES lpProcessAttributes,
662+ LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles,
663+ DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory,
664+ LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
665+{
666+ if (pCreateProcessW != NULL) {
667+ return pCreateProcessW(lpApplicationName, lpCommandLine,
668+ lpProcessAttributes,
669+ lpThreadAttributes, bInheritHandles,
670+ dwCreationFlags, lpEnvironment, lpCurrentDirectory,
671+ lpStartupInfo, lpProcessInformation);
672+ }
673+
674+ // 取り合えず、ttl.cppで使っている分だけ
675+ STARTUPINFOA suiA;
676+ memset(&suiA, 0, sizeof(suiA));
677+ suiA.cb = lpStartupInfo->cb;
678+ suiA.wShowWindow = lpStartupInfo->wShowWindow;
679+ suiA.dwFlags = suiA.dwFlags;
680+
681+ char *appA = ToCharW(lpApplicationName);
682+ char *cmdA = ToCharW(lpCommandLine);
683+ char *curA = ToCharW(lpCurrentDirectory);
684+ BOOL r =
685+ CreateProcessA(appA, cmdA, lpProcessAttributes, lpThreadAttributes, bInheritHandles,
686+ dwCreationFlags, lpEnvironment, curA, &suiA, lpProcessInformation);
687+ free(appA);
688+ free(cmdA);
689+ free(curA);
690+
691+ return r;
692+}
--- a/teraterm/common/layer_for_unicode.h
+++ b/teraterm/common/layer_for_unicode.h
@@ -120,6 +120,11 @@ void _OutputDebugStringW(LPCWSTR lpOutputString);
120120 DWORD _GetPrivateProfileStringW(LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault,
121121 LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName);
122122 BOOL _WritePrivateProfileStringW(LPCWSTR lpAppName,LPCWSTR lpKeyName,LPCWSTR lpString,LPCWSTR lpFileName);
123+BOOL _CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine,
124+ LPSECURITY_ATTRIBUTES lpProcessAttributes,
125+ LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles,
126+ DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory,
127+ LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation);
123128
124129 // gdi32.lib
125130 int _AddFontResourceW(LPCWSTR lpFileName);