• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythongamewindowsbathyscaphephpguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

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


Commit MetaInfo

修订版1d2271d98702cd1d4b5b9f8aadf8c7d267fac08c (tree)
时间2020-03-22 01:00:28
作者zmatsuo <zmatsuo@user...>
Commiterzmatsuo

Log Message

OutputDebugPrintfW() を利用可能にした

- 無効化されていた
- ttlib.c から ttlib_static.c へ移動
- _OutputDebugStringW() を layer_for_unicode に追加

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

更改概述

差异

--- a/teraterm/common/compat_win.cpp
+++ b/teraterm/common/compat_win.cpp
@@ -73,6 +73,7 @@ LRESULT (WINAPI *pCallWindowProcW)(WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, W
7373 // kernel32.dll
7474 DWORD (WINAPI *pGetFileAttributesW)(LPCWSTR lpFileName);
7575 DWORD (WINAPI *pGetPrivateProfileStringW)(LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName);
76+void (WINAPI *pOutputDebugStringW)(LPCWSTR lpOutputString);
7677 HWND (WINAPI *pGetConsoleWindow)(void);
7778
7879 // gdi32.lib
@@ -202,6 +203,7 @@ static const APIInfo Lists_kernel32[] = {
202203 #ifndef UNICODE_API_DISABLE
203204 { "GetFileAttributesW", (void **)&pGetFileAttributesW },
204205 { "GetPrivateProfileStringW", (void **)&pGetPrivateProfileStringW },
206+ { "OutputDebugStringW", (void **)&pOutputDebugStringW },
205207 #endif
206208 { "GetConsoleWindow", (void **)&pGetConsoleWindow },
207209 {},
@@ -269,6 +271,7 @@ void WinCompatInit()
269271 pGetWindowTextLengthW = NULL;
270272 pShell_NotifyIconW = NULL;
271273 pGetFileAttributesW = NULL;
274+ pOutputDebugStringW = NULL;
272275 pDragQueryFileW = NULL;
273276 }
274277
--- a/teraterm/common/compat_win.h
+++ b/teraterm/common/compat_win.h
@@ -120,6 +120,7 @@ extern LONG_PTR (WINAPI *pSetWindowLongPtrW)(HWND hWnd, int nIndex, LONG_PTR dwN
120120 #endif
121121 extern LRESULT (WINAPI *pCallWindowProcW)(WNDPROC lpPrevWndFunc,
122122 HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
123+extern void (WINAPI *pOutputDebugStringW)(LPCWSTR lpOutputString);
123124
124125 void WinCompatInit();
125126
--- a/teraterm/common/layer_for_unicode.cpp
+++ b/teraterm/common/layer_for_unicode.cpp
@@ -545,3 +545,14 @@ LRESULT _CallWindowProcW(WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, WPARAM wPar
545545 }
546546 return CallWindowProcA(lpPrevWndFunc, hWnd, Msg, wParam, lParam);
547547 }
548+
549+void _OutputDebugStringW(LPCWSTR lpOutputString)
550+{
551+ if (pOutputDebugStringW != NULL) {
552+ return pOutputDebugStringW(lpOutputString);
553+ }
554+
555+ char *strA = ToCharW(lpOutputString);
556+ OutputDebugStringA(strA);
557+ free(strA);
558+}
--- a/teraterm/common/layer_for_unicode.h
+++ b/teraterm/common/layer_for_unicode.h
@@ -94,7 +94,6 @@ typedef struct {
9494 BOOL _SetWindowTextW(HWND hWnd, LPCWSTR lpString);
9595 BOOL _SetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPCWSTR lpString);
9696 UINT _GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int cchMax);
97-DWORD _GetFileAttributesW(LPCWSTR lpFileName);
9897 LRESULT _SendDlgItemMessageW(HWND hDlg, int nIDDlgItem, UINT Msg, WPARAM wParam, LPARAM lParam);
9998 LRESULT _SendMessageW(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
10099 HWND _CreateWindowExW(DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, int X, int Y,
@@ -111,6 +110,10 @@ int _GetWindowTextLengthW(HWND hWnd);
111110 LONG_PTR _SetWindowLongPtrW(HWND hWnd, int nIndex, LONG_PTR dwNewLong);
112111 LRESULT _CallWindowProcW(WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
113112
113+// kernel32.dll
114+DWORD _GetFileAttributesW(LPCWSTR lpFileName);
115+void _OutputDebugStringW(LPCWSTR lpOutputString);
116+
114117 // gdi32.lib
115118 int _AddFontResourceW(LPCWSTR lpFileName);
116119 BOOL _RemoveFontResourceW(LPCWSTR lpFileName);
--- a/teraterm/common/ttlib.c
+++ b/teraterm/common/ttlib.c
@@ -1133,18 +1133,6 @@ void OutputDebugPrintf(const char *fmt, ...)
11331133 OutputDebugStringA(tmp);
11341134 }
11351135
1136-#if UNICODE_API // defined(UNICODE)
1137-void OutputDebugPrintfW(const wchar_t *fmt, ...)
1138-{
1139- wchar_t tmp[1024];
1140- va_list arg;
1141- va_start(arg, fmt);
1142- _vsnwprintf_s(tmp, _countof(tmp), _TRUNCATE, fmt, arg);
1143- va_end(arg);
1144- OutputDebugStringW(tmp);
1145-}
1146-#endif
1147-
11481136 #if (_MSC_VER < 1800)
11491137 BOOL vercmp(
11501138 DWORD cond_val,
--- a/teraterm/common/ttlib.h
+++ b/teraterm/common/ttlib.h
@@ -84,7 +84,7 @@ void get_lang_msgW(const char *key, wchar_t *buf, int buf_len, const wchar_t *de
8484 int get_lang_font(PCHAR key, HWND dlg, PLOGFONT logfont, HFONT *font, const char *iniFile);
8585 DllExport BOOL doSelectFolder(HWND hWnd, char *path, int pathlen, const char *def, const char *msg);
8686 DllExport void OutputDebugPrintf(const char *fmt, ...);
87-DllExport void OutputDebugPrintfW(const wchar_t *fmt, ...);
87+void OutputDebugPrintfW(const wchar_t *fmt, ...);
8888 DllExport DWORD get_OPENFILENAME_SIZEA();
8989 DllExport DWORD get_OPENFILENAME_SIZEW();
9090 DllExport BOOL IsWindows95();
--- a/teraterm/common/ttlib_static.c
+++ b/teraterm/common/ttlib_static.c
@@ -43,6 +43,7 @@
4343 #include "teraterm.h"
4444 #include "tttypes.h"
4545 #include "compat_win.h"
46+#include "layer_for_unicode.h"
4647
4748 #include "../teraterm/unicode_test.h"
4849
@@ -279,4 +280,14 @@ int GetMonitorDpiFromWindow(HWND hWnd)
279280 }
280281 }
281282
283+void OutputDebugPrintfW(const wchar_t *fmt, ...)
284+{
285+ wchar_t tmp[1024];
286+ va_list arg;
287+ va_start(arg, fmt);
288+ _vsnwprintf_s(tmp, _countof(tmp), _TRUNCATE, fmt, arg);
289+ va_end(arg);
290+ _OutputDebugStringW(tmp);
291+}
292+
282293 /* vim: set ts=4 sw=4 ff=dos : */