Revision: 9379 https://osdn.net/projects/ttssh2/scm/svn/commits/9379 Author: zmatsuo Date: 2021-08-21 01:31:43 +0900 (Sat, 21 Aug 2021) Log Message: ----------- マルチモニター系などのAPIが使えない状態になっていたので修正 - 実際はWindows 98, 2000以降のWin32 APIがすべて使用できない状態になっていた - compat_winの初期化が行われていなかった - マルチモニター系などのWin32 APIへのポインタが初期化されず使用されなかった - compat_winの初期化がexe(dll)がロードされた直後に行われるよう修正 - 従来は layer_for_unicode を通して初期化が行われていた - r9325 で layer_for_unicode を使用しなくなったため初期化が行われなくなった - layer_for_unicode に関連するコードを変更 - ttlib_static.c - doSelectFolderW() のコールバック setDefaultFolder() で 9x判定を行うようにした - tmfc - Unicode環境判定変数 m_WindowUnicode を削除 - layer_for_unicode では compat_win を使用しないよう修正 - TT_NOTIFYICONDATAW_V2 (compat_win.h) は共有 - コード(API)の分類 - compat_win.h - Windows 98, 2000 以降から増えたAPI - layer_for_unicode - Windows NT系では動作するが、9x系では動作しないAPI Revision Links: -------------- https://osdn.net/projects/ttssh2/scm/svn/commits/9325 Modified Paths: -------------- trunk/teraterm/common/compat_win.cpp trunk/teraterm/common/compat_win.h trunk/teraterm/common/tmfc.cpp trunk/teraterm/common/tmfc.h trunk/teraterm/common/tmfc_frame.cpp trunk/teraterm/common/ttlib_static.c trunk/teraterm/layer_for_unicode/CMakeLists.txt trunk/teraterm/layer_for_unicode/layer_for_unicode.cpp trunk/teraterm/layer_for_unicode/layer_for_unicode_comctl32.cpp -------------- next part -------------- Modified: trunk/teraterm/common/compat_win.cpp =================================================================== --- trunk/teraterm/common/compat_win.cpp 2021-08-20 16:31:30 UTC (rev 9378) +++ trunk/teraterm/common/compat_win.cpp 2021-08-20 16:31:43 UTC (rev 9379) @@ -41,17 +41,6 @@ // for debug //#define UNICODE_API_DISABLE 1 -ATOM (WINAPI *pRegisterClassW)(const WNDCLASSW *lpWndClass); -HWND (WINAPI *pCreateWindowExW)(DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, - HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam); -LRESULT (WINAPI *pDefWindowProcW)(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); -LRESULT (WINAPI *pSendMessageW)(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); -LRESULT (WINAPI *pSendDlgItemMessageW)(HWND hDlg, int nIDDlgItem, UINT Msg, WPARAM wParam, LPARAM lParam); -BOOL (WINAPI *pModifyMenuW)(HMENU hMnu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem); -int(WINAPI *pGetMenuStringW)(HMENU hMenu, UINT uIDItem, LPWSTR lpString, int cchMax, UINT flags); -BOOL(WINAPI *pSetWindowTextW)(HWND hWnd, LPCWSTR lpString); -BOOL (WINAPI *pSetDlgItemTextW)(HWND hDlg, int nIDDlgItem, LPCWSTR lpString); -BOOL (WINAPI *pGetDlgItemTextW)(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int cchMax); BOOL (WINAPI *pAlphaBlend)(HDC,int,int,int,int,HDC,int,int,int,int,BLENDFUNCTION); DPI_AWARENESS_CONTEXT (WINAPI *pSetThreadDpiAwarenessContext)(DPI_AWARENESS_CONTEXT dpiContext); BOOL (WINAPI *pIsValidDpiAwarenessContext)(DPI_AWARENESS_CONTEXT dpiContext); @@ -60,52 +49,18 @@ HRESULT (WINAPI *pGetDpiForMonitor)(HMONITOR hmonitor, MONITOR_DPI_TYPE dpiType, UINT *dpiX, UINT *dpiY); BOOL (WINAPI *pAdjustWindowRectEx)(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle); BOOL (WINAPI *pAdjustWindowRectExForDpi)(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle, UINT dpi); -int (WINAPI *pMessageBoxW)(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType); -INT_PTR (WINAPI *pDialogBoxIndirectParamW)(HINSTANCE hInstance, LPCDLGTEMPLATEW hDialogTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam); -HWND (WINAPI *pCreateDialogIndirectParamW)(HINSTANCE hInstance, LPCDLGTEMPLATEW lpTemplate, - HWND hWndParent, DLGPROC lpDialogFunc, - LPARAM dwInitParam); -LONG (WINAPI *pSetWindowLongW)(HWND hWnd, int nIndex, LONG dwNewLong); -LONG (WINAPI *pGetWindowLongW)(HWND hWnd, int nIndex); #ifdef _WIN64 LONG_PTR (WINAPI *pSetWindowLongPtrW)(HWND hWnd, int nIndex, LONG_PTR dwNewLong); LONG_PTR (WINAPI *pGetWindowLongPtrW)(HWND hWnd, int nIndex); #endif -LRESULT (WINAPI *pCallWindowProcW)(WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); -DWORD (WINAPI *pGetCurrentDirectoryW)(DWORD nBufferLength, LPWSTR lpBuffer); -BOOL (WINAPI *pSetCurrentDirectoryW)(LPCWSTR lpPathName); // user32 int (WINAPI *pGetSystemMetricsForDpi)(int nIndex, UINT dpi); // kernel32 -DWORD (WINAPI *pGetFileAttributesW)(LPCWSTR lpFileName); void (WINAPI *pOutputDebugStringW)(LPCWSTR lpOutputString); HWND (WINAPI *pGetConsoleWindow)(void); -DWORD (WINAPI *pGetPrivateProfileStringW)(LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, - LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName); -BOOL (WINAPI *pWritePrivateProfileStringW)(LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpString, LPCWSTR lpFileName); -UINT (WINAPI *pGetPrivateProfileIntW)(LPCWSTR lpAppName, LPCWSTR lpKeyName, INT nDefault, LPCWSTR lpFileName); -BOOL (WINAPI *pCreateProcessW)(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, - LPSECURITY_ATTRIBUTES lpProcessAttributes, - LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, - DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, - LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation); -BOOL (WINAPI *pCopyFileW)(LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, BOOL bFailIfExists); -BOOL (WINAPI *pDeleteFileW)(LPCWSTR lpFileName); -BOOL (WINAPI *pMoveFileW)(LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName); -HANDLE (WINAPI *pCreateFileW)(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, - LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, - DWORD dwFlagsAndAttributes, HANDLE hTemplateFile); -HANDLE (WINAPI *pFindFirstFileW)(LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData); -BOOL (WINAPI *pFindNextFileW)(HANDLE hFindFile, LPWIN32_FIND_DATAW lpFindFileData); -BOOL (WINAPI *pRemoveDirectoryW)(LPCWSTR lpPathName); -DWORD (WINAPI *pGetFullPathNameW)(LPCWSTR lpFileName, DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR *lpFilePart); -HMODULE (WINAPI *pLoadLibraryW)(LPCWSTR lpLibFileName); -DWORD (WINAPI *pGetModuleFileNameW)(HMODULE hModule, LPWSTR lpFilename, DWORD nSize); DWORD (WINAPI *pExpandEnvironmentStringsW)(LPCWSTR lpSrc, LPWSTR lpDst, DWORD nSize); -DWORD (WINAPI *pGetTempPathW)(DWORD nBufferLength, LPWSTR lpBuffer); -UINT (WINAPI *pGetTempFileNameW)(LPCWSTR lpPathName, LPCWSTR lpPrefixString, UINT uUnique, LPWSTR lpTempFileName); static ULONGLONG (WINAPI *pVerSetConditionMask)(ULONGLONG dwlConditionMask, DWORD dwTypeBitMask, BYTE dwConditionMask); static BOOL (WINAPI *pVerifyVersionInfoA)(LPOSVERSIONINFOEX lpVersionInformation, DWORD dwTypeMask, DWORDLONG dwlConditionMask); @@ -117,9 +72,6 @@ static HWND (WINAPI *pHtmlHelpW)(HWND hwndCaller, LPCWSTR pszFile, UINT uCommand, DWORD_PTR dwData); static HWND (WINAPI *pHtmlHelpA)(HWND hwndCaller, LPCSTR pszFile, UINT uCommand, DWORD_PTR dwData); -BOOL (WINAPI *pInsertMenuW)(HMENU hMenu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem); -BOOL (WINAPI *pAppendMenuW)(HMENU hMenu, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem); - // multi monitor Windows98+/Windows2000+ BOOL (WINAPI *pEnumDisplayMonitors)(HDC,LPCRECT,MONITORENUMPROC,LPARAM); HMONITOR (WINAPI *pMonitorFromWindow)(HWND hwnd, DWORD dwFlags); @@ -127,27 +79,23 @@ HMONITOR (WINAPI *pMonitorFromRect)(LPCRECT lprc, DWORD dwFlags); BOOL (WINAPI *pGetMonitorInfoA)(HMONITOR hMonitor, LPMONITORINFO lpmi); -int (WINAPI *pGetWindowTextW)(HWND hWnd, LPWSTR lpString, int nMaxCount); -int (WINAPI *pGetWindowTextLengthW)(HWND hWnd); - -// shell32 -UINT (WINAPI *pDragQueryFileW)(HDROP hDrop, UINT iFile, LPWSTR lpszFile, UINT cch); -BOOL (WINAPI *pShell_NotifyIconW)(DWORD dwMessage, NOTIFYICONDATAW *lpData); -LPITEMIDLIST (WINAPI *pSHBrowseForFolderW)(LPBROWSEINFOW lpbi); -BOOL (WINAPI *pSHGetPathFromIDListW)(LPITEMIDLIST pidl, LPWSTR pszPath); - -// comctl32 -HPROPSHEETPAGE (WINAPI *pCreatePropertySheetPageW)(LPCPROPSHEETPAGEW constPropSheetPagePointer); -INT_PTR (WINAPI *pPropertySheetW)(LPCPROPSHEETHEADERW constPropSheetHeaderPointer); - -// comdlg32 -BOOL (WINAPI *pGetOpenFileNameW)(LPOPENFILENAMEW ofnW); -BOOL (WINAPI *pGetSaveFileNameW)(LPOPENFILENAMEW ofnW); - // dnsapi DNS_STATUS (WINAPI *pDnsQuery_A)(PCSTR pszName, WORD wType, DWORD Options, PVOID pExtra, PDNS_RECORD *ppQueryResults, PVOID *pReserved); VOID (WINAPI *pDnsFree)(PVOID pData, DNS_FREE_TYPE FreeType); +class Initializer { +public: + Initializer() { + DLLInit(); + WinCompatInit(); + } + ~Initializer() { + DLLExit(); + } +}; + +static Initializer initializer; + /** * GetConsoleWindow() \x82Ɠ\xAF\x82\xB6\x93\xAE\x8D\xEC\x82\xF0\x82\xB7\x82\xE9 * https://support.microsoft.com/ja-jp/help/124103/how-to-obtain-a-console-window-handle-hwnd @@ -188,11 +136,6 @@ } static const APIInfo Lists_user32[] = { -#ifndef UNICODE_API_DISABLE - { "RegisterClassW", (void **)&pRegisterClassW }, - { "CreateWindowExW", (void **)&pCreateWindowExW }, - { "DefWindowProcW", (void **)&pDefWindowProcW }, -#endif { "SetLayeredWindowAttributes", (void **)&pSetLayeredWindowAttributes }, { "SetThreadDpiAwarenessContext", (void **)&pSetThreadDpiAwarenessContext }, { "IsValidDpiAwarenessContext", (void **)&pIsValidDpiAwarenessContext }, @@ -200,27 +143,10 @@ { "AdjustWindowRectEx", (void **)&pAdjustWindowRectEx }, { "AdjustWindowRectExForDpi", (void **)&pAdjustWindowRectExForDpi }, #ifndef UNICODE_API_DISABLE - { "SetDlgItemTextW", (void **)&pSetDlgItemTextW }, - { "GetDlgItemTextW", (void **)&pGetDlgItemTextW }, - { "SetWindowTextW", (void **)&pSetWindowTextW }, - { "ModifyMenuW", (void **)&pModifyMenuW }, - { "GetMenuStringW", (void **)&pGetMenuStringW }, - { "SendDlgItemMessageW", (void **)&pSendDlgItemMessageW }, - { "MessageBoxW", (void **)&pMessageBoxW }, - { "DialogBoxIndirectParamW", (void **)&pDialogBoxIndirectParamW }, - { "CreateDialogIndirectParamW", (void **)&pCreateDialogIndirectParamW }, - { "InsertMenuW", (void **)&pInsertMenuW }, - { "AppendMenuW", (void **)&pAppendMenuW }, - { "SendMessageW", (void **)&pSendMessageW }, - { "GetWindowTextW", (void **)&pGetWindowTextW }, - { "GetWindowTextLengthW", (void **)&pGetWindowTextLengthW }, - { "SetWindowLongW", (void **)&pSetWindowLongW }, - { "GetWindowLongW", (void **)&pGetWindowLongW }, #ifdef _WIN64 { "SetWindowLongPtrW", (void **)&pSetWindowLongPtrW }, { "GetWindowLongPtrW", (void **)&pGetWindowLongPtrW }, #endif - { "CallWindowProcW", (void **)&pCallWindowProcW }, #endif { "EnumDisplayMonitors", (void **)&pEnumDisplayMonitors }, { "MonitorFromWindow", (void **)&pMonitorFromWindow }, @@ -251,27 +177,8 @@ static const APIInfo Lists_kernel32[] = { #ifndef UNICODE_API_DISABLE - { "GetFileAttributesW", (void **)&pGetFileAttributesW }, { "OutputDebugStringW", (void **)&pOutputDebugStringW }, - { "GetCurrentDirectoryW", (void **)&pGetCurrentDirectoryW }, - { "SetCurrentDirectoryW", (void **)&pSetCurrentDirectoryW }, - { "GetPrivateProfileStringW", (void **)&pGetPrivateProfileStringW }, - { "WritePrivateProfileStringW", (void **)&pWritePrivateProfileStringW }, - { "GetPrivateProfileIntW", (void **)&pGetPrivateProfileIntW }, - { "CreateProcessW", (void **)&pCreateProcessW }, - { "CopyFileW", (void **)&pCopyFileW }, - { "DeleteFileW", (void **)&pDeleteFileW }, - { "MoveFileW", (void **)&pMoveFileW }, - { "CreateFileW", (void **)&pCreateFileW }, - { "FindFirstFileW", (void **)&pFindFirstFileW }, - { "FindNextFileW", (void **)&pFindNextFileW }, - { "RemoveDirectoryW", (void **)&pRemoveDirectoryW }, - { "GetFullPathNameW", (void **)&pGetFullPathNameW }, - { "LoadLibraryW", (void **)&pLoadLibraryW }, - { "GetModuleFileNameW", (void **)&pGetModuleFileNameW }, { "ExpandEnvironmentStringsW", (void **)&pExpandEnvironmentStringsW }, - { "GetTempPathW", (void **)&pGetTempPathW }, - { "GetTempFileNameW", (void **)&pGetTempFileNameW }, #endif { "GetConsoleWindow", (void **)&pGetConsoleWindow }, { "VerSetConditionMask", (void **)&pVerSetConditionMask }, @@ -279,24 +186,6 @@ {}, }; -static const APIInfo Lists_shell32[] = { -#ifndef UNICODE_API_DISABLE - { "DragQueryFileW", (void **)&pDragQueryFileW }, - { "Shell_NotifyIconW", (void **)&pShell_NotifyIconW }, - { "SHBrowseForFolderW", (void **)&pSHBrowseForFolderW }, - { "SHGetPathFromIDListW", (void **)&pSHGetPathFromIDListW }, -#endif - {}, -}; - -static const APIInfo Lists_comctl32[] = { -#ifndef UNICODE_API_DISABLE - { "CreatePropertySheetPageW", (void **)&pCreatePropertySheetPageW }, - { "PropertySheetW", (void **)&pPropertySheetW }, -#endif - {}, -}; - static const APIInfo Lists_hhctrl[] = { #ifndef UNICODE_API_DISABLE { "HtmlHelpW", (void **)&pHtmlHelpW }, @@ -305,14 +194,6 @@ {}, }; -static const APIInfo Lists_comdlg32[] = { -#ifndef UNICODE_API_DISABLE - { "GetOpenFileNameW", (void **)&pGetOpenFileNameW }, - { "GetSaveFileNameW", (void **)&pGetSaveFileNameW }, -#endif - {}, -}; - static const APIInfo Lists_dnsapi[] = { { "DnsQuery_A", (void **)&pDnsQuery_A }, { "DnsFree", (void **)&pDnsFree }, @@ -325,10 +206,7 @@ { L"gdi32.dll", DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_gdi32 }, { L"Shcore.dll", DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_Shcore }, { L"kernel32.dll", DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_kernel32 }, - { L"shell32.dll", DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_shell32 }, - { L"Comctl32.dll", DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_comctl32 }, { L"hhctrl.ocx", DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_hhctrl }, - { L"comdlg32.dll", DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_comdlg32 }, { L"dnsapi.dll", DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_dnsapi }, {}, }; @@ -373,43 +251,8 @@ // 9x\x93\xC1\x95ʏ\x88\x97\x9D if (!IsWindowsNTKernel()) { // Windows 9x \x82ɑ\xB6\x8D݂\xB5\x82Ă\xA2\x82邪\x90\xB3\x82\xB5\x82\xAD\x93\xAE\x8D삵\x82Ȃ\xA2\x82\xBD\x82ߖ\xB3\x8C\x{27B0B7}\x82\xE9 - pGetPrivateProfileStringW = NULL; - pSetWindowTextW = NULL; - pSetDlgItemTextW = NULL; - pGetDlgItemTextW = NULL; - pDialogBoxIndirectParamW = NULL; - pCreateDialogIndirectParamW = NULL; - pCreateWindowExW = NULL; - pRegisterClassW = NULL; - pDefWindowProcW = NULL; - pSendMessageW = NULL; - pSendDlgItemMessageW = NULL; - pGetWindowTextW = NULL; - pGetWindowTextLengthW = NULL; - pShell_NotifyIconW = NULL; - pGetFileAttributesW = NULL; pOutputDebugStringW = NULL; - pDragQueryFileW = NULL; - pGetCurrentDirectoryW = NULL; - pSetCurrentDirectoryW = NULL; - pGetOpenFileNameW = NULL; - pSHBrowseForFolderW = NULL; - pSHGetPathFromIDListW = NULL; - pCreateProcessW = NULL; - pCopyFileW = NULL; - pDeleteFileW = NULL; - pMoveFileW = NULL; - pCreateFileW = NULL; - pFindFirstFileW = NULL; - pFindNextFileW = NULL; - pRemoveDirectoryW = NULL; - pGetFullPathNameW = NULL; - pGetPrivateProfileIntW = NULL; - pGetModuleFileNameW = NULL; - pLoadLibraryW = NULL; pExpandEnvironmentStringsW = NULL; - pGetTempPathW = NULL; - pGetTempFileNameW = NULL; } // GetConsoleWindow\x93\xC1\x95ʏ\x88\x97\x9D Modified: trunk/teraterm/common/compat_win.h =================================================================== --- trunk/teraterm/common/compat_win.h 2021-08-20 16:31:30 UTC (rev 9378) +++ trunk/teraterm/common/compat_win.h 2021-08-20 16:31:43 UTC (rev 9379) @@ -125,20 +125,6 @@ #include <poppack.h> #endif -extern ATOM (WINAPI *pRegisterClassW)(const WNDCLASSW *lpWndClass); -extern HWND (WINAPI *pCreateWindowExW)(DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, int X, - int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, - LPVOID lpParam); -extern LRESULT (WINAPI *pDefWindowProcW)(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); -extern HPROPSHEETPAGE (WINAPI * pCreatePropertySheetPageW)(LPCPROPSHEETPAGEW constPropSheetPagePointer); -extern INT_PTR (WINAPI *pPropertySheetW)(LPCPROPSHEETHEADERW constPropSheetHeaderPointer); -extern LRESULT (WINAPI *pSendDlgItemMessageW)(HWND hDlg, int nIDDlgItem, UINT Msg, WPARAM wParam, LPARAM lParam); -extern BOOL(WINAPI *pModifyMenuW)(HMENU hMnu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem); -extern int(WINAPI *pGetMenuStringW)(HMENU hMenu, UINT uIDItem, LPWSTR lpString, int cchMax, UINT flags); -extern BOOL(WINAPI *pSetWindowTextW)(HWND hWnd, LPCWSTR lpString); -extern UINT(WINAPI *pDragQueryFileW)(HDROP hDrop, UINT iFile, LPWSTR lpszFile, UINT cch); -extern BOOL (WINAPI *pSetDlgItemTextW)(HWND hDlg, int nIDDlgItem, LPCWSTR lpString); -extern BOOL (WINAPI *pGetDlgItemTextW)(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int cchMax); extern BOOL (WINAPI *pAlphaBlend)(HDC,int,int,int,int,HDC,int,int,int,int,BLENDFUNCTION); extern BOOL (WINAPI *pEnumDisplayMonitors)(HDC,LPCRECT,MONITORENUMPROC,LPARAM); extern HMONITOR (WINAPI *pMonitorFromRect)(LPCRECT lprc, DWORD dwFlags); @@ -151,78 +137,22 @@ extern BOOL (WINAPI *pSetLayeredWindowAttributes)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags); extern int (WINAPI *pAddFontResourceExW)(LPCWSTR name, DWORD fl, PVOID res); extern BOOL (WINAPI *pRemoveFontResourceExW)(LPCWSTR name, DWORD fl, PVOID pdv); -extern int (WINAPI *pMessageBoxW)(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType); -extern INT_PTR (WINAPI *pDialogBoxIndirectParamW)(HINSTANCE hInstance, LPCDLGTEMPLATEW hDialogTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam); -extern HWND (WINAPI *pCreateDialogIndirectParamW)(HINSTANCE hInstance, LPCDLGTEMPLATEW lpTemplate, - HWND hWndParent, DLGPROC lpDialogFunc, - LPARAM dwInitParam); -extern BOOL (WINAPI *pInsertMenuW)(HMENU hMenu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem); -extern BOOL (WINAPI *pAppendMenuW)(HMENU hMenu, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem); extern HMONITOR (WINAPI *pMonitorFromWindow)(HWND hwnd, DWORD dwFlags); extern HMONITOR (WINAPI *pMonitorFromPoint)(POINT pt, DWORD dwFlags); extern HMONITOR (WINAPI *pMonitorFromRect)(LPCRECT lprc, DWORD dwFlags); extern BOOL (WINAPI *pGetMonitorInfoA)(HMONITOR hMonitor, LPMONITORINFO lpmi); -extern LRESULT (WINAPI *pSendMessageW)(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); -extern int (WINAPI *pGetWindowTextW)(HWND hWnd, LPWSTR lpString, int nMaxCount); -extern int (WINAPI *pGetWindowTextLengthW)(HWND hWnd); -extern BOOL (WINAPI *pShell_NotifyIconW)(DWORD dwMessage, NOTIFYICONDATAW *lpData); -extern LONG (WINAPI *pSetWindowLongW)(HWND hWnd, int nIndex, LONG dwNewLong); -extern LONG (WINAPI *pGetWindowLongW)(HWND hWnd, int nIndex); #ifdef _WIN64 extern LONG_PTR (WINAPI *pSetWindowLongPtrW)(HWND hWnd, int nIndex, LONG_PTR dwNewLong); extern LONG_PTR (WINAPI *pGetWindowLongPtrW)(HWND hWnd, int nIndex); #endif -extern LRESULT (WINAPI *pCallWindowProcW)(WNDPROC lpPrevWndFunc, - HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); -extern DWORD (WINAPI *pGetCurrentDirectoryW)(DWORD nBufferLength, LPWSTR lpBuffer); -extern BOOL (WINAPI *pSetCurrentDirectoryW)(LPCWSTR lpPathName); -extern BOOL (WINAPI *pGetOpenFileNameW)(LPOPENFILENAMEW ofnW); -extern BOOL (WINAPI *pGetSaveFileNameW)(LPOPENFILENAMEW ofnW); -extern DWORD (WINAPI *pGetPrivateProfileStringW)(LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, - LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName); -extern BOOL (WINAPI *pWritePrivateProfileStringW)(LPCWSTR lpAppName,LPCWSTR lpKeyName,LPCWSTR lpString,LPCWSTR lpFileName); -extern UINT (WINAPI *pGetPrivateProfileIntW)(LPCWSTR lpAppName, LPCWSTR lpKeyName, INT nDefault, LPCWSTR lpFileName); -extern BOOL (WINAPI *pCreateProcessW)(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, - LPSECURITY_ATTRIBUTES lpProcessAttributes, - LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, - DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, - LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation); extern int (WINAPI *pGetSystemMetricsForDpi)(int nIndex, UINT dpi); // kernel32 -extern DWORD (WINAPI *pGetFileAttributesW)(LPCWSTR lpFileName); extern void (WINAPI *pOutputDebugStringW)(LPCWSTR lpOutputString); extern HWND (WINAPI *pGetConsoleWindow)(void); -extern DWORD (WINAPI *pGetPrivateProfileStringW)(LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, - LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName); -extern BOOL (WINAPI *pWritePrivateProfileStringW)(LPCWSTR lpAppName,LPCWSTR lpKeyName,LPCWSTR lpString,LPCWSTR lpFileName); -extern BOOL (WINAPI *pCreateProcessW)(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, - LPSECURITY_ATTRIBUTES lpProcessAttributes, - LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, - DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, - LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation); -extern BOOL (WINAPI *pCopyFileW)(LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, BOOL bFailIfExists); -extern BOOL (WINAPI *pDeleteFileW)(LPCWSTR lpFileName); -extern BOOL (WINAPI *pMoveFileW)(LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName); -extern HANDLE (WINAPI *pCreateFileW)(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, - LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, - DWORD dwFlagsAndAttributes, HANDLE hTemplateFile); -extern HANDLE (WINAPI *pFindFirstFileW)(LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData); -extern BOOL (WINAPI *pFindNextFileW)(HANDLE hFindFile, LPWIN32_FIND_DATAW lpFindFileData); -extern BOOL (WINAPI *pRemoveDirectoryW)(LPCWSTR lpPathName); -extern DWORD (WINAPI *pGetFullPathNameW)(LPCWSTR lpFileName, DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR *lpFilePart); -extern HMODULE (WINAPI *pLoadLibraryW)(LPCWSTR lpLibFileName); -extern DWORD (WINAPI *pGetModuleFileNameW)(HMODULE hModule, LPWSTR lpFilename, DWORD nSize); -extern DWORD (WINAPI *pExpandEnvironmentStringsW)(LPCWSTR lpSrc, LPWSTR lpDst, DWORD nSize); -extern DWORD (WINAPI *pGetTempPathW)(DWORD nBufferLength, LPWSTR lpBuffer); -extern UINT (WINAPI *pGetTempFileNameW)(LPCWSTR lpPathName, LPCWSTR lpPrefixString, UINT uUnique, LPWSTR lpTempFileName); ULONGLONG _VerSetConditionMask(ULONGLONG dwlConditionMask, DWORD dwTypeBitMask, BYTE dwConditionMask); BOOL _VerifyVersionInfoA(LPOSVERSIONINFOEXA lpVersionInformation, DWORD dwTypeMask, DWORDLONG dwlConditionMask); -// shlobj_core.h -extern LPITEMIDLIST (WINAPI *pSHBrowseForFolderW)(LPBROWSEINFOW lpbi); -extern BOOL (WINAPI *pSHGetPathFromIDListW)(LPITEMIDLIST pidl, LPWSTR pszPath); - // htmlhelp.dll (hhctrl.ocx) HWND _HtmlHelpW(HWND hwndCaller, LPCWSTR pszFile, UINT uCommand, DWORD_PTR dwData); Modified: trunk/teraterm/common/tmfc.cpp =================================================================== --- trunk/teraterm/common/tmfc.cpp 2021-08-20 16:31:30 UTC (rev 9378) +++ trunk/teraterm/common/tmfc.cpp 2021-08-20 16:31:43 UTC (rev 9379) @@ -51,7 +51,6 @@ m_hInst = nullptr; m_hAccel = nullptr; m_hParentWnd = nullptr; - m_WindowUnicode = FALSE; } LRESULT TTCWnd::SendMessage(UINT msg, WPARAM wp, LPARAM lp) @@ -260,16 +259,10 @@ LRESULT TTCWnd::DefWindowProc(UINT msg, WPARAM wParam, LPARAM lParam) { - if (m_WindowUnicode && pDefWindowProcW != NULL) { - // Unicode API \x82\xA0\x82\xE8 && Unicode Window - return pDefWindowProcW(m_hWnd, msg, wParam, lParam); - } - else { - return ::DefWindowProcA(m_hWnd, msg, wParam, lParam); - } + return DefWindowProcW(m_hWnd, msg, wParam, lParam); } -//////////////////////////////////////// +//////////////////////////////////////// TTCDialog *TTCDialog::pseudoPtr; Modified: trunk/teraterm/common/tmfc.h =================================================================== --- trunk/teraterm/common/tmfc.h 2021-08-20 16:31:30 UTC (rev 9378) +++ trunk/teraterm/common/tmfc.h 2021-08-20 16:31:43 UTC (rev 9379) @@ -79,8 +79,6 @@ void SetDlgItemInt(int id, UINT val, BOOL bSigned = TRUE); UINT GetDlgItemInt(int id, BOOL* lpTrans = NULL, BOOL bSigned = TRUE) const; void EnableDlgItem(int id, BOOL enable); -protected: - BOOL m_WindowUnicode; private: void ModifyStyleCom(int nStyleOffset, DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0); }; @@ -163,4 +161,3 @@ private: static INT_PTR CALLBACK Proc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp); }; - Modified: trunk/teraterm/common/tmfc_frame.cpp =================================================================== --- trunk/teraterm/common/tmfc_frame.cpp 2021-08-20 16:31:30 UTC (rev 9378) +++ trunk/teraterm/common/tmfc_frame.cpp 2021-08-20 16:31:43 UTC (rev 9379) @@ -118,10 +118,6 @@ return FALSE; } else { m_hWnd = hWnd; - if (pCreateWindowExW != NULL) { - // Unicode API\x82\xAA\x91\xB6\x8D݂\xB7\x82\xE9 - m_WindowUnicode = TRUE; - } SetWindowLongPtr(GWLP_USERDATA, (LONG_PTR)this); return TRUE; } Modified: trunk/teraterm/common/ttlib_static.c =================================================================== --- trunk/teraterm/common/ttlib_static.c 2021-08-20 16:31:30 UTC (rev 9378) +++ trunk/teraterm/common/ttlib_static.c 2021-08-20 16:31:43 UTC (rev 9379) @@ -300,12 +300,12 @@ static int CALLBACK setDefaultFolder(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData) { if(uMsg == BFFM_INITIALIZED) { - if (pSHBrowseForFolderW == NULL) { + if (IsWindowsNTKernel()) { + SendMessageW(hwnd, BFFM_SETSELECTIONW, (WPARAM)TRUE, lpData); + } else { + // NT\x8Cn\x82ł͂Ȃ\xA2\x82Ƃ\xAB\x81ALayer for unicode \x82\xAA\x8Eg\x97p\x82\xB3\x82\xEA\x82Ă\xA2\x82\xE9\x82Ǝv\x82\xED\x82\xEA\x82\xE9 SendMessageA(hwnd, BFFM_SETSELECTIONA, (WPARAM)TRUE, lpData); } - else { - SendMessageW(hwnd, BFFM_SETSELECTIONW, (WPARAM)TRUE, lpData); - } } return 0; } Modified: trunk/teraterm/layer_for_unicode/CMakeLists.txt =================================================================== --- trunk/teraterm/layer_for_unicode/CMakeLists.txt 2021-08-20 16:31:30 UTC (rev 9378) +++ trunk/teraterm/layer_for_unicode/CMakeLists.txt 2021-08-20 16:31:43 UTC (rev 9379) @@ -84,7 +84,7 @@ $<$<CONFIG:Release>:libucrt.lib libvcruntime.lib libcmt.lib libcpmt.lib> $<$<CONFIG:Debug>:libucrtd.lib libvcruntimed.lib libcmtd.lib libcpmtd.lib> ) -else() +elseif(MSVC) target_link_libraries( ${PACKAGE_NAME} PUBLIC @@ -91,6 +91,8 @@ $<$<CONFIG:Release>:libcmt.lib libcpmt.lib> $<$<CONFIG:Debug>:libcmtd.lib libcpmtd.lib> ) +elseif(MINGW) +else() endif() target_link_libraries( Modified: trunk/teraterm/layer_for_unicode/layer_for_unicode.cpp =================================================================== --- trunk/teraterm/layer_for_unicode/layer_for_unicode.cpp 2021-08-20 16:31:30 UTC (rev 9378) +++ trunk/teraterm/layer_for_unicode/layer_for_unicode.cpp 2021-08-20 16:31:43 UTC (rev 9379) @@ -42,29 +42,11 @@ #include "codeconv.h" #include "compat_win.h" -#include "dllutil.h" #include "layer_for_unicode.h" -class Initializer { -public: - Initializer() { - DLLInit(); - WinCompatInit(); - } - ~Initializer() { - DLLExit(); - } -}; - -static Initializer initializer; - BOOL WINAPI _SetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPCWSTR lpString) { - if (pSetDlgItemTextW != NULL) { - return pSetDlgItemTextW(hDlg, nIDDlgItem, lpString); - } - char *strA = ToCharW(lpString); BOOL retval = SetDlgItemTextA(hDlg, nIDDlgItem, strA); free(strA); @@ -73,10 +55,6 @@ UINT WINAPI _DragQueryFileW(HDROP hDrop, UINT iFile, LPWSTR lpszFile, UINT cch) { - if (pDragQueryFileW != NULL) { - return pDragQueryFileW(hDrop, iFile, lpszFile, cch); - } - UINT retval; if (iFile == 0xffffffff) { // \x83t\x83@\x83C\x83\x8B\x90\x94\x96₢\x8D\x87\x82킹 @@ -107,10 +85,6 @@ DWORD WINAPI _GetFileAttributesW(LPCWSTR lpFileName) { - if (pGetFileAttributesW != NULL) { - return pGetFileAttributesW(lpFileName); - } - char *FileNameA; if (lpFileName == NULL) { FileNameA = NULL; @@ -180,10 +154,6 @@ int WINAPI _GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount) { - if (pGetWindowTextW != NULL) { - return pGetWindowTextW(hWnd, lpString, nMaxCount); - } - size_t lenW; wchar_t *strW = SendMessageAFromW_WM_GETTEXT(hWnd, &lenW); wchar_t *dest_ptr = (wchar_t *)lpString; @@ -195,10 +165,6 @@ int WINAPI _GetWindowTextLengthW(HWND hWnd) { - if (pGetWindowTextLengthW != NULL) { - return pGetWindowTextLengthW(hWnd); - } - size_t lenW; wchar_t *strW = SendMessageAFromW_WM_GETTEXT(hWnd, &lenW); free(strW); @@ -258,18 +224,11 @@ LRESULT WINAPI _SendMessageW(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { - if (pSendMessageW != NULL) { - return pSendMessageW(hWnd, Msg, wParam, lParam); - } return SendMessageAFromW(hWnd, Msg, wParam, lParam); } LRESULT WINAPI _SendDlgItemMessageW(HWND hDlg, int nIDDlgItem, UINT Msg, WPARAM wParam, LPARAM lParam) { - if (pSendDlgItemMessageW != NULL) { - return pSendDlgItemMessageW(hDlg, nIDDlgItem, Msg, wParam, lParam); - } - HWND hWnd = GetDlgItem(hDlg, nIDDlgItem); return SendMessageAFromW(hWnd, Msg, wParam, lParam); } @@ -278,11 +237,6 @@ int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam) { - if (pCreateWindowExW != NULL) { - return pCreateWindowExW(dwExStyle, lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hMenu, - hInstance, lpParam); - } - char *lpClassNameA = ToCharW(lpClassName); char *lpWindowNameA = ToCharW(lpWindowName); HWND hWnd = CreateWindowExA(dwExStyle, lpClassNameA, lpWindowNameA, dwStyle, X, Y, nWidth, nHeight, hWndParent, @@ -296,10 +250,6 @@ ATOM WINAPI _RegisterClassW(const WNDCLASSW *lpWndClass) { - if (pRegisterClassW != NULL) { - return pRegisterClassW(lpWndClass); - } - char *menu_nameA = ToCharW(lpWndClass->lpszMenuName); char *class_nameA = ToCharW(lpWndClass->lpszClassName); @@ -327,10 +277,6 @@ BOOL WINAPI _SetWindowTextW(HWND hWnd, LPCWSTR lpString) { - if (pSetWindowTextW != NULL) { - return pSetWindowTextW(hWnd, lpString); - } - char *strA = ToCharW(lpString); BOOL retval = SetWindowTextA(hWnd, strA); free(strA); @@ -339,10 +285,6 @@ UINT WINAPI _GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int cchMax) { - if (pGetDlgItemTextW != NULL) { - return pGetDlgItemTextW(hDlg, nIDDlgItem, lpString, cchMax); - } - if (cchMax <= 1) { return 0; } @@ -376,10 +318,6 @@ int WINAPI _MessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType) { - if (pMessageBoxW != NULL) { - return pMessageBoxW(hWnd, lpText, lpCaption, uType); - } - char *textA = ToCharW(lpText); char *captionA = ToCharW(lpCaption); int result = MessageBoxA(hWnd, textA, captionA, uType); @@ -390,10 +328,6 @@ BOOL WINAPI _InsertMenuW(HMENU hMenu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem) { - if (pInsertMenuW != NULL) { - return pInsertMenuW(hMenu, uPosition, uFlags, uIDNewItem, lpNewItem); - } - char *itemA = ToCharW(lpNewItem); int result = InsertMenuA(hMenu, uPosition, uFlags, uIDNewItem, itemA); free(itemA); @@ -402,9 +336,6 @@ BOOL WINAPI _AppendMenuW(HMENU hMenu, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem) { - if (pAppendMenuW != NULL) { - return pAppendMenuW(hMenu, uFlags, uIDNewItem, lpNewItem); - } char *itemA = ToCharW(lpNewItem); BOOL result = AppendMenuA(hMenu, uFlags, uIDNewItem, itemA); free(itemA); @@ -465,9 +396,6 @@ HWND WINAPI _CreateDialogIndirectParamW(HINSTANCE hInstance, LPCDLGTEMPLATEW lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam) { - if (pCreateDialogIndirectParamW != NULL) { - return pCreateDialogIndirectParamW(hInstance, lpTemplate, hWndParent, lpDialogFunc, dwInitParam); - } return CreateDialogIndirectParamA(hInstance, lpTemplate, hWndParent, lpDialogFunc, dwInitParam); } @@ -474,17 +402,11 @@ INT_PTR WINAPI _DialogBoxIndirectParamW(HINSTANCE hInstance, LPCDLGTEMPLATEA hDialogTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM lParamInit) { - if (pDialogBoxIndirectParamW != NULL) { - return pDialogBoxIndirectParamW(hInstance, hDialogTemplate, hWndParent, lpDialogFunc, lParamInit); - } return DialogBoxIndirectParamA(hInstance, hDialogTemplate, hWndParent, lpDialogFunc, lParamInit); } LONG WINAPI _SetWindowLongW(HWND hWnd, int nIndex, LONG dwNewLong) { - if (pSetWindowLongW != NULL) { - return pSetWindowLongW(hWnd, nIndex, dwNewLong); - } return SetWindowLongA(hWnd, nIndex, dwNewLong); } @@ -502,9 +424,6 @@ LONG WINAPI _GetWindowLongW(HWND hWnd, int nIndex) { - if (pGetWindowLongW != NULL) { - return pGetWindowLongW(hWnd, nIndex); - } return GetWindowLongA(hWnd, nIndex); } @@ -522,9 +441,6 @@ LRESULT WINAPI _CallWindowProcW(WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { - if (pCallWindowProcW != NULL) { - return pCallWindowProcW(lpPrevWndFunc, hWnd, Msg, wParam, lParam); - } return CallWindowProcA(lpPrevWndFunc, hWnd, Msg, wParam, lParam); } @@ -541,9 +457,6 @@ DWORD WINAPI _GetCurrentDirectoryW(DWORD nBufferLength, LPWSTR lpBuffer) { - if (pGetCurrentDirectoryW != NULL) { - return pGetCurrentDirectoryW(nBufferLength, lpBuffer); - } char dir[MAX_PATH]; GetCurrentDirectoryA(_countof(dir), dir); wchar_t *strW = ToWcharA(dir); @@ -555,9 +468,6 @@ BOOL WINAPI _SetCurrentDirectoryW(LPCWSTR lpPathName) { - if (pSetCurrentDirectoryW != NULL) { - return pSetCurrentDirectoryW(lpPathName); - } char *strA = ToCharW(lpPathName); BOOL r = SetCurrentDirectoryA(strA); free(strA); @@ -566,10 +476,6 @@ LPITEMIDLIST WINAPI _SHBrowseForFolderW(LPBROWSEINFOW lpbi) { - if (pSHBrowseForFolderW != NULL) { - return pSHBrowseForFolderW(lpbi); - } - BROWSEINFOA biA; biA.hwndOwner = lpbi->hwndOwner; biA.pidlRoot = lpbi->pidlRoot; @@ -587,10 +493,6 @@ BOOL WINAPI _SHGetPathFromIDListW(LPITEMIDLIST pidl, LPWSTR pszPath) { - if (pSHGetPathFromIDListW != NULL) { - return pSHGetPathFromIDListW(pidl, pszPath); - } - char pathA[MAX_PATH]; BOOL r = SHGetPathFromIDListA(pidl, pathA); ::MultiByteToWideChar(CP_ACP, 0, pathA, -1, pszPath, MAX_PATH); @@ -600,11 +502,6 @@ DWORD WINAPI _GetPrivateProfileStringW(LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName) { - if (pGetPrivateProfileStringW != NULL) { - return pGetPrivateProfileStringW(lpAppName, lpKeyName, lpDefault, - lpReturnedString, nSize, lpFileName); - } - if (lpDefault == NULL) { lpDefault = L""; } @@ -631,10 +528,6 @@ BOOL WINAPI _WritePrivateProfileStringW(LPCWSTR lpAppName,LPCWSTR lpKeyName,LPCWSTR lpString,LPCWSTR lpFileName) { - if (pWritePrivateProfileStringW != NULL) { - return pWritePrivateProfileStringW(lpAppName, lpKeyName, lpString, lpFileName); - } - char *appA = ToCharW(lpAppName); char *keyA = ToCharW(lpKeyName); char *strA = ToCharW(lpString); @@ -649,10 +542,6 @@ UINT WINAPI _GetPrivateProfileIntW(LPCWSTR lpAppName, LPCWSTR lpKeyName, INT nDefault, LPCWSTR lpFileName) { - if (pGetPrivateProfileIntW != NULL) { - return pGetPrivateProfileIntW(lpAppName, lpKeyName, nDefault, lpFileName); - } - char *appA = ToCharW(lpAppName); char *keyA = ToCharW(lpKeyName); char *fileA = ToCharW(lpFileName); @@ -669,14 +558,6 @@ DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation) { - if (pCreateProcessW != NULL) { - return pCreateProcessW(lpApplicationName, lpCommandLine, - lpProcessAttributes, - lpThreadAttributes, bInheritHandles, - dwCreationFlags, lpEnvironment, lpCurrentDirectory, - lpStartupInfo, lpProcessInformation); - } - STARTUPINFOA suiA = {}; suiA.cb = sizeof(suiA); suiA.lpReserved = NULL; @@ -714,9 +595,6 @@ BOOL WINAPI _CopyFileW(LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, BOOL bFailIfExists) { - if (pCopyFileW != NULL) { - return pCopyFileW(lpExistingFileName, lpNewFileName, bFailIfExists); - } char *lpExistingFileNameA = ToCharW(lpExistingFileName); char *lpNewFileNameA = ToCharW(lpNewFileName); BOOL r = CopyFileA(lpExistingFileNameA, lpNewFileNameA, bFailIfExists); @@ -727,9 +605,6 @@ BOOL WINAPI _DeleteFileW(LPCWSTR lpFileName) { - if (pDeleteFileW != NULL) { - return pDeleteFileW(lpFileName); - } char *lpFileNameA = ToCharW(lpFileName); BOOL r = DeleteFileA(lpFileNameA); free(lpFileNameA); @@ -738,9 +613,6 @@ BOOL WINAPI _MoveFileW(LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName) { - if (pMoveFileW != NULL) { - return pMoveFileW(lpExistingFileName, lpNewFileName); - } char *lpExistingFileNameA = ToCharW(lpExistingFileName); char *lpNewFileNameA = ToCharW(lpNewFileName); BOOL r = MoveFileA(lpExistingFileNameA, lpNewFileNameA); @@ -753,11 +625,6 @@ LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) { - if (pCreateFileW != NULL) { - return pCreateFileW(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, - dwFlagsAndAttributes, hTemplateFile); - } - char *lpFileNameA = ToCharW(lpFileName); HANDLE handle = CreateFileA(lpFileNameA, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); @@ -781,10 +648,6 @@ HANDLE WINAPI _FindFirstFileW(LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData) { - if (pFindFirstFileW != NULL) { - return pFindFirstFileW(lpFileName, lpFindFileData); - } - WIN32_FIND_DATAA find_file_data; char *lpFileNameA = ToCharW(lpFileName); HANDLE handle = FindFirstFileA(lpFileNameA, &find_file_data); @@ -795,9 +658,6 @@ BOOL WINAPI _FindNextFileW(HANDLE hFindFile, LPWIN32_FIND_DATAW lpFindFileData) { - if (pFindNextFileW != NULL) { - return pFindNextFileW(hFindFile, lpFindFileData); - } WIN32_FIND_DATAA find_file_data; BOOL r = FindNextFileA(hFindFile, &find_file_data); FindDataAW(&find_file_data, lpFindFileData); @@ -806,9 +666,6 @@ BOOL WINAPI _RemoveDirectoryW(LPCWSTR lpPathName) { - if (pRemoveDirectoryW != NULL) { - return pRemoveDirectoryW(lpPathName); - } char *lpPathNameA = ToCharW(lpPathName); BOOL r = RemoveDirectoryA(lpPathNameA); free(lpPathNameA); @@ -817,10 +674,6 @@ DWORD WINAPI _GetFullPathNameW(LPCWSTR lpFileName, DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR *lpFilePart) { - if (pGetFullPathNameW != NULL) { - return pGetFullPathNameW(lpFileName, nBufferLength, lpBuffer, lpFilePart); - } - if (nBufferLength == 0 || lpBuffer == NULL) { char *filenameA = ToCharW(lpFileName); DWORD r = GetFullPathNameA(filenameA, 0, NULL, NULL); @@ -857,9 +710,6 @@ HMODULE WINAPI _LoadLibraryW(LPCWSTR lpLibFileName) { - if (pLoadLibraryW != NULL) { - return pLoadLibraryW(lpLibFileName); - } char *LibFileNameA = ToCharW(lpLibFileName); HMODULE r = LoadLibraryA(LibFileNameA); free(LibFileNameA); @@ -868,10 +718,6 @@ DWORD WINAPI _GetModuleFileNameW(HMODULE hModule, LPWSTR lpFilename, DWORD nSize) { - if (pGetModuleFileNameW != NULL) { - return pGetModuleFileNameW(hModule, lpFilename, nSize); - } - char filenameA[MAX_PATH]; DWORD r = GetModuleFileNameA(hModule, filenameA, sizeof(filenameA)); if (r == 0) { @@ -883,10 +729,6 @@ DWORD WINAPI _ExpandEnvironmentStringsW(LPCWSTR lpSrc, LPWSTR lpDst, DWORD nSize) { - if (pExpandEnvironmentStringsW != NULL) { - return pExpandEnvironmentStringsW(lpSrc, lpDst, nSize); - } - char *srcA = ToCharW(lpSrc); char dstA[MAX_PATH]; // MAX_PATH? DWORD r = ExpandEnvironmentStringsA(srcA, dstA, sizeof(dstA)); @@ -919,10 +761,6 @@ DWORD WINAPI _GetTempPathW(DWORD nBufferLength, LPWSTR lpBuffer) { - if (pGetTempPathW != NULL) { - return pGetTempPathW(nBufferLength, lpBuffer); - } - char buf[MAX_PATH]; DWORD r = GetTempPathA(_countof(buf), buf); if (r == 0) { @@ -934,10 +772,6 @@ UINT WINAPI _GetTempFileNameW(LPCWSTR lpPathName, LPCWSTR lpPrefixString, UINT uUnique, LPWSTR lpTempFileName) { - if (pGetTempFileNameW != NULL) { - return pGetTempFileNameW(lpPathName, lpPrefixString, uUnique, lpTempFileName); - } - char buf[MAX_PATH]; char *lpPathNameA = ToCharW(lpPathName); char *lpPrefixStringA = ToCharW(lpPrefixString); Modified: trunk/teraterm/layer_for_unicode/layer_for_unicode_comctl32.cpp =================================================================== --- trunk/teraterm/layer_for_unicode/layer_for_unicode_comctl32.cpp 2021-08-20 16:31:30 UTC (rev 9378) +++ trunk/teraterm/layer_for_unicode/layer_for_unicode_comctl32.cpp 2021-08-20 16:31:43 UTC (rev 9379) @@ -42,10 +42,6 @@ HPROPSHEETPAGE WINAPI _CreatePropertySheetPageW(LPCPROPSHEETPAGEW_V1 psp) { - if (pCreatePropertySheetPageW != NULL) { - return pCreatePropertySheetPageW((LPCPROPSHEETPAGEW)psp); - } - char *titleA = ToCharW(psp->pszTitle); PROPSHEETPAGEA_V1 pspA; @@ -72,10 +68,6 @@ //INT_PTR _PropertySheetW(PROPSHEETHEADERW_V1 *psh) INT_PTR WINAPI _PropertySheetW(PROPSHEETHEADERW *psh) { - if (pPropertySheetW != NULL) { - return pPropertySheetW((PROPSHEETHEADERW *)psh); - } - char *captionA = ToCharW(psh->pszCaption); // PROPSHEETHEADERA_V1 pshA; @@ -152,18 +144,10 @@ BOOL WINAPI _GetOpenFileNameW(LPOPENFILENAMEW ofnW) { - if (pGetOpenFileNameW != NULL) { - return pGetOpenFileNameW(ofnW); - } - return GetOpenSaveFileNameA(GetOpenFileNameA, ofnW); } BOOL WINAPI _GetSaveFileNameW(LPOPENFILENAMEW ofnW) { - if (pGetSaveFileNameW != NULL) { - return pGetSaveFileNameW(ofnW); - } - return GetOpenSaveFileNameA(GetSaveFileNameA, ofnW); }