• R/O
  • SSH
  • HTTPS

ttssh2: コミット


コミットメタ情報

リビジョン8627 (tree)
日時2020-03-27 00:39:51
作者zmatsuo

ログメッセージ

_GetSaveFileNameW() を追加

変更サマリ

差分

--- branches/unicode_macro/teraterm/common/compat_win.cpp (revision 8626)
+++ branches/unicode_macro/teraterm/common/compat_win.cpp (revision 8627)
@@ -106,7 +106,8 @@
106106 INT_PTR (WINAPI *pPropertySheetW)(LPCPROPSHEETHEADERW constPropSheetHeaderPointer);
107107
108108 // comdlg32
109-BOOL (WINAPI *pGetOpenFileNameW)(LPOPENFILENAMEW Arg1);
109+BOOL (WINAPI *pGetOpenFileNameW)(LPOPENFILENAMEW ofnW);
110+BOOL (WINAPI *pGetSaveFileNameW)(LPOPENFILENAMEW ofnW);
110111
111112 /**
112113 * GetConsoleWindow() と同じ動作をする
@@ -245,6 +246,7 @@
245246 static const APIInfo Lists_comdlg32[] = {
246247 #ifndef UNICODE_API_DISABLE
247248 { "GetOpenFileNameW", (void **)&pGetOpenFileNameW },
249+ { "GetSaveFileNameW", (void **)&pGetSaveFileNameW },
248250 #endif
249251 {},
250252 };
--- branches/unicode_macro/teraterm/common/compat_win.h (revision 8626)
+++ branches/unicode_macro/teraterm/common/compat_win.h (revision 8627)
@@ -123,7 +123,8 @@
123123 extern void (WINAPI *pOutputDebugStringW)(LPCWSTR lpOutputString);
124124 extern DWORD (WINAPI *pGetCurrentDirectoryW)(DWORD nBufferLength, LPWSTR lpBuffer);
125125 extern BOOL (WINAPI *pSetCurrentDirectoryW)(LPCWSTR lpPathName);
126-extern BOOL (WINAPI *pGetOpenFileNameW)(LPOPENFILENAMEW Arg1);
126+extern BOOL (WINAPI *pGetOpenFileNameW)(LPOPENFILENAMEW ofnW);
127+extern BOOL (WINAPI *pGetSaveFileNameW)(LPOPENFILENAMEW ofnW);
127128
128129 void WinCompatInit();
129130
--- branches/unicode_macro/teraterm/common/layer_for_unicode.h (revision 8626)
+++ branches/unicode_macro/teraterm/common/layer_for_unicode.h (revision 8627)
@@ -129,7 +129,8 @@
129129 //INT_PTR _PropertySheetW(PROPSHEETHEADERW_V1 *constPropSheetHeaderPointer);
130130
131131 // Comdlg32.lib
132-BOOL _GetOpenFileNameW(LPOPENFILENAMEW Arg1);
132+BOOL _GetOpenFileNameW(LPOPENFILENAMEW ofnW);
133+BOOL _GetSaveFileNameW(LPOPENFILENAMEW ofnW);
133134
134135 // shell32.lib
135136 UINT _DragQueryFileW(HDROP hDrop, UINT iFile, LPWSTR lpszFile, UINT cch);
--- branches/unicode_macro/teraterm/common/layer_for_unicode_comctl32.cpp (revision 8626)
+++ branches/unicode_macro/teraterm/common/layer_for_unicode_comctl32.cpp (revision 8627)
@@ -114,12 +114,8 @@
114114 return filterA;
115115 }
116116
117-BOOL _GetOpenFileNameW(LPOPENFILENAMEW ofnW)
117+static BOOL GetOpenSaveFileNameA(BOOL (WINAPI *fn)(LPOPENFILENAMEA ofnA), LPOPENFILENAMEW ofnW)
118118 {
119- if (pGetOpenFileNameW != NULL) {
120- return pGetOpenFileNameW(ofnW);
121- }
122-
123119 char fileA[MAX_PATH];
124120 WideCharToMultiByte(CP_ACP, 0, ofnW->lpstrFile, -1, fileA, _countof(fileA), NULL,NULL);
125121
@@ -131,8 +127,8 @@
131127 ofnA.lpstrFile = fileA;
132128 ofnA.nMaxFile = _countof(fileA);
133129 ofnA.lpstrTitle = ToCharW(ofnW->lpstrTitle);
134- ofnA.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
135- BOOL result = GetOpenFileNameA(&ofnA);
130+ ofnA.Flags = ofnW->Flags;
131+ BOOL result = fn(&ofnA);
136132 if (result) {
137133 MultiByteToWideChar(CP_ACP, 0, fileA, _countof(fileA), ofnW->lpstrFile, ofnW->nMaxFile);
138134 }
@@ -140,3 +136,21 @@
140136 free((void *)ofnA.lpstrTitle);
141137 return result;
142138 }
139+
140+BOOL _GetOpenFileNameW(LPOPENFILENAMEW ofnW)
141+{
142+ if (pGetOpenFileNameW != NULL) {
143+ return pGetOpenFileNameW(ofnW);
144+ }
145+
146+ return GetOpenSaveFileNameA(GetOpenFileNameA, ofnW);
147+}
148+
149+BOOL _GetSaveFileNameW(LPOPENFILENAMEW ofnW)
150+{
151+ if (pGetSaveFileNameW != NULL) {
152+ return pGetSaveFileNameW(ofnW);
153+ }
154+
155+ return GetOpenSaveFileNameA(GetSaveFileNameA, ofnW);
156+}
旧リポジトリブラウザで表示