Tera Termの個人的な作業用リポジトリ
修订版 | 54acfb6a8f762c54a1833a6c3e6f87df9d2992ea (tree) |
---|---|
时间 | 2020-04-12 00:57:11 |
作者 | zmatsuo <zmatsuo@user...> |
Commiter | zmatsuo |
_CreateProcessW() を追加
- マクロの exec が動作するのを確認
git-svn-id: svn+ssh://svn.osdn.net/svnroot/ttssh2/trunk@8711 f5f01b69-1e22-0410-acbf-894ab4bd6246
@@ -77,6 +77,11 @@ HWND (WINAPI *pGetConsoleWindow)(void); | ||
77 | 77 | DWORD (WINAPI *pGetPrivateProfileStringW)(LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, |
78 | 78 | LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName); |
79 | 79 | 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); | |
80 | 85 | |
81 | 86 | // gdi32.lib |
82 | 87 | int (WINAPI *pAddFontResourceExW)(LPCWSTR name, DWORD fl, PVOID res); |
@@ -219,6 +224,7 @@ static const APIInfo Lists_kernel32[] = { | ||
219 | 224 | { "SetCurrentDirectoryW", (void **)&pSetCurrentDirectoryW }, |
220 | 225 | { "GetPrivateProfileStringW", (void **)&pGetPrivateProfileStringW }, |
221 | 226 | { "WritePrivateProfileStringW", (void **)&pWritePrivateProfileStringW }, |
227 | + { "CreateProcessW", (void **)&pCreateProcessW }, | |
222 | 228 | #endif |
223 | 229 | { "GetConsoleWindow", (void **)&pGetConsoleWindow }, |
224 | 230 | {}, |
@@ -304,6 +310,9 @@ void WinCompatInit() | ||
304 | 310 | pGetCurrentDirectoryW = NULL; |
305 | 311 | pSetCurrentDirectoryW = NULL; |
306 | 312 | pGetOpenFileNameW = NULL; |
313 | + pSHBrowseForFolderW = NULL; | |
314 | + pSHGetPathFromIDListW = NULL; | |
315 | + pCreateProcessW = NULL; | |
307 | 316 | } |
308 | 317 | |
309 | 318 | // GetConsoleWindow特別処理 |
@@ -129,6 +129,11 @@ extern BOOL (WINAPI *pGetSaveFileNameW)(LPOPENFILENAMEW ofnW); | ||
129 | 129 | extern DWORD (WINAPI *pGetPrivateProfileStringW)(LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, |
130 | 130 | LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName); |
131 | 131 | 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); | |
132 | 137 | |
133 | 138 | // shlobj_core.h |
134 | 139 | extern LPITEMIDLIST (WINAPI *pSHBrowseForFolderW)(LPBROWSEINFOW lpbi); |
@@ -656,3 +656,37 @@ BOOL _WritePrivateProfileStringW(LPCWSTR lpAppName,LPCWSTR lpKeyName,LPCWSTR lpS | ||
656 | 656 | free(fileA); |
657 | 657 | return r; |
658 | 658 | } |
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 | +} |
@@ -120,6 +120,11 @@ void _OutputDebugStringW(LPCWSTR lpOutputString); | ||
120 | 120 | DWORD _GetPrivateProfileStringW(LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, |
121 | 121 | LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName); |
122 | 122 | 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); | |
123 | 128 | |
124 | 129 | // gdi32.lib |
125 | 130 | int _AddFontResourceW(LPCWSTR lpFileName); |