• R/O
  • SSH
  • HTTPS

ttssh2: コミット


コミットメタ情報

リビジョン8629 (tree)
日時2020-03-27 00:40:13
作者zmatsuo

ログメッセージ

_SHBrowseForFolderW(), _SHGetPathFromIDListW() を追加

変更サマリ

差分

--- branches/unicode_macro/teraterm/common/compat_win.cpp (revision 8628)
+++ branches/unicode_macro/teraterm/common/compat_win.cpp (revision 8629)
@@ -100,6 +100,8 @@
100100 // shell32
101101 UINT (WINAPI *pDragQueryFileW)(HDROP hDrop, UINT iFile, LPWSTR lpszFile, UINT cch);
102102 BOOL (WINAPI *pShell_NotifyIconW)(DWORD dwMessage, NOTIFYICONDATAW *lpData);
103+PIDLIST_ABSOLUTE (WINAPI *pSHBrowseForFolderW)(LPBROWSEINFOW lpbi);
104+BOOL (WINAPI *pSHGetPathFromIDListW)(PCIDLIST_ABSOLUTE pidl, LPWSTR pszPath);
103105
104106 // comctl32
105107 HPROPSHEETPAGE (WINAPI *pCreatePropertySheetPageW)(LPCPROPSHEETPAGEW constPropSheetPagePointer);
@@ -223,6 +225,8 @@
223225 #ifndef UNICODE_API_DISABLE
224226 { "DragQueryFileW", (void **)&pDragQueryFileW },
225227 { "Shell_NotifyIconW", (void **)&pShell_NotifyIconW },
228+ { "SHBrowseForFolderW", (void **)&pSHBrowseForFolderW },
229+ { "SHGetPathFromIDListW", (void **)&pSHGetPathFromIDListW },
226230 #endif
227231 {},
228232 };
--- branches/unicode_macro/teraterm/common/compat_win.h (revision 8628)
+++ branches/unicode_macro/teraterm/common/compat_win.h (revision 8629)
@@ -36,6 +36,7 @@
3636 #pragma once
3737
3838 #include <windows.h>
39+#include <shlobj.h> // for _SHBrowseForFolderW()
3940
4041 #ifdef __cplusplus
4142 extern "C" {
@@ -126,6 +127,10 @@
126127 extern BOOL (WINAPI *pGetOpenFileNameW)(LPOPENFILENAMEW ofnW);
127128 extern BOOL (WINAPI *pGetSaveFileNameW)(LPOPENFILENAMEW ofnW);
128129
130+// shlobj_core.h
131+extern PIDLIST_ABSOLUTE (WINAPI *pSHBrowseForFolderW)(LPBROWSEINFOW lpbi);
132+extern BOOL (WINAPI *pSHGetPathFromIDListW)(PCIDLIST_ABSOLUTE pidl, LPWSTR pszPath);
133+
129134 void WinCompatInit();
130135
131136 #ifdef __cplusplus
--- branches/unicode_macro/teraterm/common/layer_for_unicode.cpp (revision 8628)
+++ branches/unicode_macro/teraterm/common/layer_for_unicode.cpp (revision 8629)
@@ -581,3 +581,36 @@
581581 free(strA);
582582 return r;
583583 }
584+
585+PIDLIST_ABSOLUTE _SHBrowseForFolderW(LPBROWSEINFOW lpbi)
586+{
587+ if (pSHBrowseForFolderW != NULL) {
588+ return pSHBrowseForFolderW(lpbi);
589+ }
590+
591+ BROWSEINFOA biA;
592+ biA.hwndOwner = lpbi->hwndOwner;
593+ biA.pidlRoot = lpbi->pidlRoot;
594+ biA.pszDisplayName = ToCharW(lpbi->pszDisplayName);
595+ biA.lpszTitle = ToCharW(lpbi->lpszTitle);
596+ biA.ulFlags = lpbi->ulFlags;
597+ biA.lpfn = lpbi->lpfn;
598+ biA.lParam = lpbi->lParam;
599+ PIDLIST_ABSOLUTE pidlBrowse = SHBrowseForFolderA(&biA);
600+ free(biA.pszDisplayName);
601+ free((void *)biA.lpszTitle);
602+
603+ return pidlBrowse;
604+}
605+
606+BOOL _SHGetPathFromIDListW(PCIDLIST_ABSOLUTE pidl, LPWSTR pszPath)
607+{
608+ if (pSHGetPathFromIDListW != NULL) {
609+ return pSHGetPathFromIDListW(pidl, pszPath);
610+ }
611+
612+ char pathA[MAX_PATH];
613+ BOOL r = SHGetPathFromIDListA(pidl, pathA);
614+ ::MultiByteToWideChar(CP_ACP, 0, pathA, -1, pszPath, MAX_PATH);
615+ return r;
616+}
--- branches/unicode_macro/teraterm/common/layer_for_unicode.h (revision 8628)
+++ branches/unicode_macro/teraterm/common/layer_for_unicode.h (revision 8629)
@@ -36,6 +36,7 @@
3636
3737 #include <windows.h>
3838 #include <commdlg.h> // for _GetOpenFileNameW()
39+#include <shlobj.h> // for _SHBrowseForFolderW()
3940
4041 #ifdef __cplusplus
4142 extern "C" {
@@ -135,6 +136,8 @@
135136 // shell32.lib
136137 UINT _DragQueryFileW(HDROP hDrop, UINT iFile, LPWSTR lpszFile, UINT cch);
137138 BOOL _Shell_NotifyIconW(DWORD dwMessage, TT_NOTIFYICONDATAW_V2 *lpData);
139+PIDLIST_ABSOLUTE _SHBrowseForFolderW(LPBROWSEINFOW lpbi);
140+BOOL _SHGetPathFromIDListW(PCIDLIST_ABSOLUTE pidl, LPWSTR pszPath);
138141
139142 HWND _CreateDialogIndirectParamW(HINSTANCE hInstance, LPCDLGTEMPLATEW lpTemplate,
140143 HWND hWndParent, DLGPROC lpDialogFunc,
旧リポジトリブラウザで表示