[Ttssh2-commit] [7177] 警告など対策

scmno****@osdn***** scmno****@osdn*****
2018年 8月 16日 (木) 00:02:54 JST


Revision: 7177
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/7177
Author:   zmatsuo
Date:     2018-08-16 00:02:54 +0900 (Thu, 16 Aug 2018)
Log Message:
-----------
警告など対策
- _CRT_SECURE_NO_DEPRECATEをdefineした
- _WIN32_WINNT=0x0a00をdefineした(_WIN32_WINNT_WIN10=0x0A00)
- C89対応(VS2008以前)
- 警告対応
    - PCHAR→const char *
    - 左辺式のキャスト削除(VSの言語拡張)
- 新しい書式対応
    - PASCAL→WINAPI (一部)
- ダイアログテンプレート書き換え
    - teraterm/ のダイアログをすべて修正
    - lngファイルからフォント情報を得るようにした

Modified Paths:
--------------
    branches/cmake/CMakeLists.txt
    branches/cmake/mingw.toolchain.cmake
    branches/cmake/teraterm/common/dlglib.c
    branches/cmake/teraterm/common/dlglib.h
    branches/cmake/teraterm/common/dlglib_cpp.cpp
    branches/cmake/teraterm/common/dlglib_tmpl.cpp
    branches/cmake/teraterm/common/i18n.c
    branches/cmake/teraterm/common/i18n.h
    branches/cmake/teraterm/common/servicenames.c
    branches/cmake/teraterm/common/servicenames.h
    branches/cmake/teraterm/common/ttcommon.h
    branches/cmake/teraterm/common/ttlib.h
    branches/cmake/teraterm/teraterm/addsetting.cpp
    branches/cmake/teraterm/teraterm/addsetting.h
    branches/cmake/teraterm/teraterm/clipboar.c
    branches/cmake/teraterm/teraterm/filesys.cpp
    branches/cmake/teraterm/teraterm/sizetip.c
    branches/cmake/teraterm/teraterm/tmfc.cpp
    branches/cmake/teraterm/teraterm/vtdisp.c
    branches/cmake/teraterm/teraterm/vtwin.cpp
    branches/cmake/teraterm/teraterm/winjump.c
    branches/cmake/teraterm/ttpcmn/language.h
    branches/cmake/teraterm/ttpcmn/ttcmn.c
    branches/cmake/teraterm/ttpdlg/ttdlg.c
    branches/cmake/teraterm/ttpfile/bplus.c
    branches/cmake/teraterm/ttptek/CMakeLists.txt
    branches/cmake/ttssh2/putty/CMakeLists.txt
    branches/cmake/ttssh2/ttxssh/fwdui.c

-------------- next part --------------
Modified: branches/cmake/CMakeLists.txt
===================================================================
--- branches/cmake/CMakeLists.txt	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/CMakeLists.txt	2018-08-15 15:02:54 UTC (rev 7177)
@@ -12,9 +12,17 @@
 string(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
 string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
 string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
-if(${CMAKE_GENERATOR} MATCHES "Visual Studio 15 2017")
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
+
+if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_CRT_SECURE_NO_DEPRECATE /W3")
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D_CRT_SECURE_NO_DEPRECATE /W3")
+  # _WIN32_WINNT_WIN10 0x0A00
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_WIN32_WINNT=0x0a00")
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D_WIN32_WINNT=0x0a00")
+  if(${CMAKE_GENERATOR} MATCHES "Visual Studio 15 2017")
+	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
+	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
+  endif()
 endif()
 
 add_subdirectory(teraterm)

Modified: branches/cmake/mingw.toolchain.cmake
===================================================================
--- branches/cmake/mingw.toolchain.cmake	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/mingw.toolchain.cmake	2018-08-15 15:02:54 UTC (rev 7177)
@@ -23,9 +23,9 @@
   set(CMAKE_RC_COMPILER i686-w64-mingw32-windres)
 endif()
 
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -ffunction-sections" CACHE STRING "")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -ffunction-sections" CACHE STRING "")
-set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" CACHE STRING "")
-set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -s" CACHE STRING "")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -ffunction-sections -fdata-sections" CACHE STRING "")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter -ffunction-sections -fdata-sections" CACHE STRING "")
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s -Wl,--gc-sections" CACHE STRING "")
+set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -s -Wl,--gc-sections -Wl,--add-stdcall-alias -Wl,--enable-stdcall-fixup" CACHE STRING "")
 
 set(CMAKE_TOOLCHAIN_FILE ${CMAKE_TOOLCHAIN_FILE} CACHE PATH "toolchain file")

Modified: branches/cmake/teraterm/common/dlglib.c
===================================================================
--- branches/cmake/teraterm/common/dlglib.c	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/teraterm/common/dlglib.c	2018-08-15 15:02:54 UTC (rev 7177)
@@ -353,13 +353,14 @@
 	data->OrigProc = (WNDPROC)GetWindowLong(hWndEdit, GWLP_WNDPROC);
 	data->OrigUser = (LONG_PTR)GetWindowLong(hWndEdit, GWLP_USERDATA);
 	data->ComboBox = ComboBox;
-	SetWindowLongPtr(hWndEdit, GWL_WNDPROC, (LONG_PTR)HostnameEditProc);
+	SetWindowLongPtr(hWndEdit, GWLP_WNDPROC, (LONG_PTR)HostnameEditProc);
 	SetWindowLongPtr(hWndEdit, GWLP_USERDATA, (LONG_PTR)data);
 }
 
 void SetDlgTexts(HWND hDlgWnd, const DlgTextInfo *infos, int infoCount, const char *UILanguageFile)
 {
-	for (int i = 0 ; i < infoCount; i++) {
+	int i;
+	for (i = 0 ; i < infoCount; i++) {
 		char *key = infos[i].key;
 		char uimsg[MAX_UIMSG];
 		get_lang_msg(key, uimsg, sizeof(uimsg), "", UILanguageFile);
@@ -377,13 +378,14 @@
 HFONT SetDlgFonts(HWND hDlg, const int nIDDlgItems[], int nIDDlgItemCount,
 				  const char *UILanguageFile, PCHAR key)
 {
-	if (key == NULL) key = "DLG_TAHOMA_FONT";
 	HFONT hPrevFont = (HFONT)SendMessage(hDlg, WM_GETFONT, 0, 0);
 	LOGFONT logfont;
+	HFONT hNewFont;
+	if (key == NULL) key = "DLG_TAHOMA_FONT";
 	GetObject(hPrevFont, sizeof(LOGFONT), &logfont);
-	HFONT hNewFont;
 	if (get_lang_font(key, hDlg, &logfont, &hNewFont, UILanguageFile)) {
-		for (int i = 0 ; i < nIDDlgItemCount ; i++) {
+		int i;
+		for (i = 0 ; i < nIDDlgItemCount ; i++) {
 			const int nIDDlgItem = nIDDlgItems[i];
 			SendDlgItemMessage(hDlg, nIDDlgItem, WM_SETFONT, (WPARAM)hNewFont, MAKELPARAM(TRUE,0));
 		}

Modified: branches/cmake/teraterm/common/dlglib.h
===================================================================
--- branches/cmake/teraterm/common/dlglib.h	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/teraterm/common/dlglib.h	2018-08-15 15:02:54 UTC (rev 7177)
@@ -64,10 +64,15 @@
 BOOL TTEndDialog(HWND hDlgWnd, INT_PTR nResult);
 HWND TTCreateDialogIndirectParam(
 	HINSTANCE hInstance,
-	LPCTSTR lpTemplateName,
+	LPCDLGTEMPLATE lpTemplate,
 	HWND hWndParent,
 	DLGPROC lpDialogFunc,
 	LPARAM lParamInit);
+HWND TTCreateDialog(
+	HINSTANCE hInstance,
+	LPCTSTR lpTemplateName,
+	HWND hWndParent,
+	DLGPROC lpDialogFunc);
 int TTDialogBoxParam(
 	HINSTANCE hInstance,
 	LPCTSTR lpTemplateName,
@@ -74,6 +79,11 @@
 	HWND hWndParent,
 	DLGPROC lpDialogFunc,
 	LPARAM lParamInit);
+int TTDialogBox(
+	HINSTANCE hInstance,
+	LPCTSTR lpTemplateName,
+	HWND hWndParent,
+	DLGPROC lpDialogFunc);
 
 #ifdef __cplusplus
 }

Modified: branches/cmake/teraterm/common/dlglib_cpp.cpp
===================================================================
--- branches/cmake/teraterm/common/dlglib_cpp.cpp	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/teraterm/common/dlglib_cpp.cpp	2018-08-15 15:02:54 UTC (rev 7177)
@@ -1,7 +1,39 @@
-
+/*
+ * (C) 2005-2018 TeraTerm Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Routines for dialog boxes */
+
 #include <windows.h>
 #include "dlglib.h"
 
+// ダイアログモーダル状態の時、OnIdle()を実行する
+//#define ENABLE_CALL_IDLE_MODAL	1
+
 extern BOOL CallOnIdle(LONG lCount);
 
 typedef struct {
@@ -9,10 +41,12 @@
 	LONG_PTR OrigUser;	// DWLP_USER
 	LPARAM ParamInit;
 	int DlgResult;
+	bool EndDialogFlag;
 } TTDialogData;
 
 static TTDialogData *TTDialogTmpData;
 
+#if ENABLE_CALL_IDLE_MODAL
 static int TTDoModal(HWND hDlgWnd)
 {
 	LONG lIdleCount = 0;
@@ -31,10 +65,9 @@
 			::ShowWindow(hDlgWnd, SW_SHOWNORMAL);
 		}
 #endif
-		int DlgRet = data->DlgResult;
-		if (DlgRet != 0) {
+		if (data->EndDialogFlag) {
 			// TTEndDialog()が呼ばれた
-			return DlgRet;
+			return data->DlgResult;
 		}
 
 		if(!::PeekMessage(&Msg, NULL, NULL, NULL, PM_NOREMOVE))
@@ -71,6 +104,7 @@
 	// ここには来ない
 	return IDOK;
 }
+#endif
 
 static INT_PTR CALLBACK TTDialogProc(
 	HWND hDlgWnd, UINT msg,
@@ -115,9 +149,14 @@
  */
 BOOL TTEndDialog(HWND hDlgWnd, INT_PTR nResult)
 {
+#if ENABLE_CALL_IDLE_MODAL
 	TTDialogData *data = TTDialogTmpData;
 	data->DlgResult = nResult;
+	data->EndDialogFlag = true;
 	return TRUE;
+#else
+	return EndDialog(hDlgWnd, nResult);
+#endif
 }
 
 /**
@@ -134,14 +173,9 @@
 	data->OrigProc = lpDialogFunc;
 	data->OrigUser = 0;
 	data->ParamInit = lParamInit;
+	data->EndDialogFlag = false;
 	data->DlgResult = 0;
-#if 0
-	HRSRC hResource = ::FindResource(hInstance, lpTemplateName, RT_DIALOG);
-	HANDLE hDlgTemplate = ::LoadResource(hInstance, hResource);
-	DLGTEMPLATE *lpTemplate = (DLGTEMPLATE *)::LockResource(hDlgTemplate);
-#else
 	DLGTEMPLATE *lpTemplate = TTGetDlgTemplate(hInstance, lpTemplateName);
-#endif
 	TTDialogTmpData = data;
 	HWND hDlgWnd = CreateDialogIndirectParam(
 		hInstance, lpTemplate, hWndParent, TTDialogProc, (LPARAM)data);
@@ -148,13 +182,24 @@
 	TTDialogTmpData = NULL;
 	ShowWindow(hDlgWnd, SW_SHOW);
     UpdateWindow(hDlgWnd);
-#if 1
 	free(lpTemplate);
-#endif
 	return hDlgWnd;
 }
 
 /**
+ *	CreateDialog() 互換関数
+ */
+HWND TTCreateDialog(
+	HINSTANCE hInstance,
+	LPCTSTR lpTemplateName,
+	HWND hWndParent,
+	DLGPROC lpDialogFunc)
+{
+	return TTCreateDialogIndirectParam(hInstance, lpTemplateName,
+									   hWndParent, lpDialogFunc, NULL);
+}
+
+/**
  *	DialogBoxParam() 互換関数
  *		EndDialog()ではなく、TTEndDialog()を使用すること
  */
@@ -165,6 +210,7 @@
 	DLGPROC lpDialogFunc,		// ダイアログボックスプロシージャへのポインタ
 	LPARAM lParamInit)			// 初期化値
 {
+#if ENABLE_CALL_IDLE_MODAL
 	HWND hDlgWnd = TTCreateDialogIndirectParam(
 		hInstance, lpTemplateName,
 		hWndParent, lpDialogFunc, lParamInit);
@@ -173,5 +219,27 @@
 	::DestroyWindow(hDlgWnd);
 	EnableWindow(hWndParent, TRUE);
 	return DlgResult;
+#else
+	DLGTEMPLATE *lpTemplate = TTGetDlgTemplate(hInstance, lpTemplateName);
+	int DlgResult = DialogBoxIndirectParam(
+		hInstance, lpTemplate, hWndParent,
+		lpDialogFunc, lParamInit);
+	free(lpTemplate);
+	return DlgResult;
+#endif
 }
 
+/**
+ *	DialogBoxParam() 互換関数
+ *		EndDialog()ではなく、TTEndDialog()を使用すること
+ */
+int TTDialogBox(
+	HINSTANCE hInstance,
+	LPCTSTR lpTemplateName,
+	HWND hWndParent,
+	DLGPROC lpDialogFunc)
+{
+	return TTDialogBoxParam(
+		hInstance, lpTemplateName,
+		hWndParent, lpDialogFunc, (LPARAM)NULL);
+}

Modified: branches/cmake/teraterm/common/dlglib_tmpl.cpp
===================================================================
--- branches/cmake/teraterm/common/dlglib_tmpl.cpp	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/teraterm/common/dlglib_tmpl.cpp	2018-08-15 15:02:54 UTC (rev 7177)
@@ -1,7 +1,39 @@
-
+/*
+ * (C) 2005-2018 TeraTerm Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Routines for dialog boxes */
+
 #include "dlglib.h"
+#include "tttypes.h"		// for TTSet
+#include "ttwinman.h"		// for ts
 
 #include <wchar.h>
+#include <assert.h>
 
 //#define	_countof(ary)	(sizeof(ary)/sizeof(ary[0]))
 
@@ -337,7 +369,7 @@
 	return size * sizeof(WORD);
 }
 
-DLGTEMPLATE *GetNewDlgTemplate(
+static DLGTEMPLATE *GetDlgTemplate(
 	HINSTANCE hInst, const DLGTEMPLATE *src,
 	const WCHAR *FontFaceName, LONG FontHeight, BYTE FontCharSet,
 	size_t *PrevTemplSize, size_t *NewTemplSize)
@@ -346,7 +378,7 @@
 	const size_t prev_size = CopyDlgTemplateEx(src, NULL, &logfont);
 	DLGTEMPLATE *dest;
 	size_t new_size = 0;
-	if (FontFaceName == NULL) {
+	if (FontFaceName == NULL || FontFaceName[0] == '\0') {
 		// simple copy
 		dest = (DLGTEMPLATE *)malloc(prev_size);
 		CopyDlgTemplateEx(src, dest, NULL);
@@ -353,9 +385,12 @@
 		new_size = prev_size;
 	} else {
 		// copy with replacing font
-		const size_t new_size_forcast = prev_size +
-			((wcslen(FontFaceName) - wcslen(logfont.lfFaceName)) *
-			 sizeof(WCHAR)) + 4;
+		size_t size_namediff =
+			wcslen(FontFaceName) - wcslen(logfont.lfFaceName);
+		size_namediff *= sizeof(WCHAR);
+		size_namediff += 3;		// テキスト、フォント名長でalignが変化する
+		size_t new_size_forcast = prev_size + size_namediff;
+		new_size_forcast = (new_size_forcast + 3) & ~3;
 		dest = (DLGTEMPLATE *)malloc(new_size_forcast);
 		logfont.lfCharSet = FontCharSet;
 		logfont.lfHeight = FontHeight;
@@ -362,6 +397,7 @@
 		wcscpy_s(logfont.lfFaceName, _countof(logfont.lfFaceName),
 				 FontFaceName);
 		new_size = CopyDlgTemplateEx(src, dest, &logfont);
+		assert(new_size <= new_size_forcast);
 	}
 
 	if (PrevTemplSize != NULL) {
@@ -373,18 +409,19 @@
 	return dest;
 }
 
-DLGTEMPLATE *GetDlgTemplate(
+static DLGTEMPLATE *GetDlgTemplate(
 	HINSTANCE hInst, LPCSTR lpTemplateName,
-	const WCHAR *FontFaceName, LONG FontHeight, BYTE FontCharSet)
+	const WCHAR *FontFaceName, LONG FontHeight, BYTE FontCharSet,
+	size_t *PrevTemplSize, size_t *NewTemplSize)
 {
 	HRSRC hResource = ::FindResource(hInst, lpTemplateName, RT_DIALOG);
 	HANDLE hDlgTemplate = ::LoadResource(hInst, hResource);
 	const DLGTEMPLATE *src = (DLGTEMPLATE *)::LockResource(hDlgTemplate);
 
-	DLGTEMPLATE *dest = GetNewDlgTemplate(
+	DLGTEMPLATE *dest = GetDlgTemplate(
 		hInst, src,
 		FontFaceName, FontHeight, FontCharSet,
-		NULL, NULL);
+		PrevTemplSize, NewTemplSize);
 
 	::FreeResource(hDlgTemplate);
 
@@ -391,19 +428,57 @@
 	return dest;
 }
 
+static wchar_t FontFaceName[LF_FACESIZE];
+static LONG FontHeight;
+static BYTE FontCharSet;
+
+void TTSetDlgFont(const wchar_t *face, int height, int charset)
+{
+	if (face != NULL) {
+		wcscpy_s(FontFaceName, face);
+	} else {
+		FontFaceName[0] = L'\0';
+	}
+	FontHeight = height;
+	FontCharSet = charset;
+}
+
+void TTSetDlgFont(const char *face, int height, int charset)
+{
+	if (face != NULL) {
+		mbstowcs(FontFaceName, face, LF_FACESIZE);
+	} else {
+		FontFaceName[0] = L'\0';
+	}
+	FontHeight = height;
+	FontCharSet = charset;
+}
+
+static void initFont()
+{
+	LOGFONT logfont;
+	BOOL result;
+	result = GetI18nLogfont("Tera Term", "DLG_TAHOMA_FONT", &logfont, 72, ts.UILanguageFile);
+	if (!result) {
+		result = GetI18nLogfont("Tera Term", "DLG_SYSTEM_FONT", &logfont, 72, ts.UILanguageFile);
+	}
+
+	if (result) {
+		TTSetDlgFont(logfont.lfFaceName, logfont.lfHeight, logfont.lfCharSet);
+	} else {
+		TTSetDlgFont((wchar_t *)NULL, 0, 0);
+	}
+}
+
 DLGTEMPLATE *TTGetNewDlgTemplate(
 	HINSTANCE hInst, const DLGTEMPLATE *src,
 	size_t *PrevTemplSize, size_t *NewTemplSize)
 {
-	const WCHAR *FontFaceName = L"Meiryo UI";
-//	const WCHAR *FontFaceName = L"Tahoma";
-	LONG FontHeight = 20;
-	BYTE FontCharSet = 128;
-
+	initFont();
 	DLGTEMPLATE *DlgTemplate =
-		GetNewDlgTemplate(hInst, src,
-						  FontFaceName, FontHeight, FontCharSet,
-						  PrevTemplSize, NewTemplSize);
+		GetDlgTemplate(hInst, src,
+					   FontFaceName, FontHeight, FontCharSet,
+					   PrevTemplSize, NewTemplSize);
 
 	return DlgTemplate;
 }
@@ -410,13 +485,10 @@
 
 DLGTEMPLATE *TTGetDlgTemplate(HINSTANCE hInst, LPCSTR lpTemplateName)
 {
-	const WCHAR *FontFaceName = L"Meiryo UI";
-	LONG FontHeight = 20;
-	BYTE FontCharSet = 128;
-
+	initFont();
 	DLGTEMPLATE *DlgTemplate =
 		GetDlgTemplate(hInst, lpTemplateName,
-					   FontFaceName, FontHeight, FontCharSet);
-
+					   FontFaceName, FontHeight, FontCharSet,
+					   NULL, NULL);
 	return DlgTemplate;
 }

Modified: branches/cmake/teraterm/common/i18n.c
===================================================================
--- branches/cmake/teraterm/common/i18n.c	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/teraterm/common/i18n.c	2018-08-15 15:02:54 UTC (rev 7177)
@@ -28,13 +28,13 @@
 
 #include "i18n.h"
 
-void GetI18nStr(PCHAR section, PCHAR key, PCHAR buf, int buf_len, PCHAR def, const char *iniFile)
+void GetI18nStr(const char *section, const char *key, PCHAR buf, int buf_len, const char *def, const char *iniFile)
 {
 	GetPrivateProfileString(section, key, def, buf, buf_len, iniFile);
 	RestoreNewLine(buf);
 }
 
-int GetI18nLogfont(PCHAR section, PCHAR key, PLOGFONT logfont, int ppi, const char *iniFile)
+int GetI18nLogfont(const char *section, const char *key, PLOGFONT logfont, int ppi, const char *iniFile)
 {
 	static char tmp[MAX_UIMSG];
 	static char font[LF_FACESIZE];

Modified: branches/cmake/teraterm/common/i18n.h
===================================================================
--- branches/cmake/teraterm/common/i18n.h	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/teraterm/common/i18n.h	2018-08-15 15:02:54 UTC (rev 7177)
@@ -38,8 +38,8 @@
 extern "C" {
 #endif
 
-void GetI18nStr(PCHAR section, PCHAR key, PCHAR buf, int buf_len, PCHAR def, const char *iniFile);
-int GetI18nLogfont(PCHAR section, PCHAR key, PLOGFONT logfont, int ppi, const char *iniFile);
+void GetI18nStr(const char *section, const char *key, PCHAR buf, int buf_len, const char *def, const char *iniFile);
+int GetI18nLogfont(const char *section, const char *key, PLOGFONT logfont, int ppi, const char *iniFile);
 
 #ifdef __cplusplus
 }

Modified: branches/cmake/teraterm/common/servicenames.c
===================================================================
--- branches/cmake/teraterm/common/servicenames.c	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/teraterm/common/servicenames.c	2018-08-15 15:02:54 UTC (rev 7177)
@@ -43,10 +43,10 @@
 
 typedef struct {
 	int port;
-	char *name;
+	const char *name;
 } TCP_service_name;
 
-static TCP_service_name service_DB[] = {
+static const TCP_service_name service_DB[] = {
 	{384, "arns"},
 	{204, "at-echo"},
 	{202, "at-nbp"},
@@ -379,7 +379,7 @@
 	return (isalnum(ch) || ch == '_' || ch == '-');
 }
 
-int PASCAL parse_port_from_buf(char * buf)
+int WINAPI parse_port_from_buf(char * buf)
 {
 	int i;
 	char lower_buf[32];
@@ -409,7 +409,7 @@
 	return -1;
 }
 
-int PASCAL parse_port(char *str, char *buf, int bufsize)
+int WINAPI parse_port(char *str, char *buf, int bufsize)
 {
 	int i = 0;
 
@@ -423,7 +423,7 @@
 	return parse_port_from_buf(buf);
 }
 
-char * PASCAL service_name(int num) {
+const char * WINAPI service_name(int num) {
 	if (num < 0 || num >= NUM_ELEM(service_DB))
 		return NULL;
 	return (service_DB[num].name);

Modified: branches/cmake/teraterm/common/servicenames.h
===================================================================
--- branches/cmake/teraterm/common/servicenames.h	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/teraterm/common/servicenames.h	2018-08-15 15:02:54 UTC (rev 7177)
@@ -28,14 +28,16 @@
 
 /* TTCMN.DLL, service name conversion */
 
+#pragma once
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 /* proto types */
-int PASCAL parse_port(char *str, char *buf, int bufsize);
-int PASCAL parse_port_from_buf(char *buf);
-char * PASCAL service_name(int num);
+int WINAPI parse_port(char *str, char *buf, int bufsize);
+int WINAPI parse_port_from_buf(char *buf);
+const char * WINAPI service_name(int num);
 
 #ifdef __cplusplus
 }

Modified: branches/cmake/teraterm/common/ttcommon.h
===================================================================
--- branches/cmake/teraterm/common/ttcommon.h	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/teraterm/common/ttcommon.h	2018-08-15 15:02:54 UTC (rev 7177)
@@ -34,69 +34,69 @@
 extern "C" {
 #endif
 
-int PASCAL DetectComPorts(LPWORD ComPortTable, int ComPortMax, char **ComPortDesc);
-int PASCAL CheckComPort(WORD ComPort);
-void PASCAL CopyShmemToTTSet(PTTSet ts);
-void PASCAL CopyTTSetToShmem(PTTSet ts);
-BOOL PASCAL StartTeraTerm(PTTSet ts);
-void PASCAL RestartTeraTerm(HWND hwnd, PTTSet ts);
-void PASCAL ChangeDefaultSet(PTTSet ts, PKeyMap km);
-void PASCAL GetDefaultSet(PTTSet ts);
-// void PASCAL LoadDefaultSet(PCHAR SetupFName);
-WORD PASCAL GetKeyCode(PKeyMap KeyMap, WORD Scan);
-void PASCAL GetKeyStr(HWND HWin, PKeyMap KeyMap, WORD KeyCode,
+int WINAPI DetectComPorts(LPWORD ComPortTable, int ComPortMax, char **ComPortDesc);
+int WINAPI CheckComPort(WORD ComPort);
+void WINAPI CopyShmemToTTSet(PTTSet ts);
+void WINAPI CopyTTSetToShmem(PTTSet ts);
+BOOL WINAPI StartTeraTerm(PTTSet ts);
+void WINAPI RestartTeraTerm(HWND hwnd, PTTSet ts);
+void WINAPI ChangeDefaultSet(PTTSet ts, PKeyMap km);
+void WINAPI GetDefaultSet(PTTSet ts);
+// void WINAPI LoadDefaultSet(PCHAR SetupFName);
+WORD WINAPI GetKeyCode(PKeyMap KeyMap, WORD Scan);
+void WINAPI GetKeyStr(HWND HWin, PKeyMap KeyMap, WORD KeyCode,
                           BOOL AppliKeyMode, BOOL AppliCursorMode,
                           BOOL Send8BitMode, PCHAR KeyStr,
                           int destlen, LPINT Len, LPWORD Type);
 
-void PASCAL SetCOMFlag(int com);
-void PASCAL ClearCOMFlag(int com);
-int PASCAL CheckCOMFlag(int com);
+void WINAPI SetCOMFlag(int com);
+void WINAPI ClearCOMFlag(int com);
+int WINAPI CheckCOMFlag(int com);
 
-int PASCAL RegWin(HWND HWinVT, HWND HWinTEK);
-void PASCAL UnregWin(HWND HWin);
-void PASCAL SetWinMenu(HMENU menu, PCHAR buf, int buflen, PCHAR langFile, int VTFlag);
-void PASCAL SetWinList(HWND HWin, HWND HDlg, int IList);
-void PASCAL SelectWin(int WinId);
-void PASCAL SelectNextWin(HWND HWin, int Next, BOOL SkipIconic);
-HWND PASCAL GetNthWin(int n);
-int PASCAL GetRegisteredWindowCount();
-void PASCAL ShowAllWin(int stat);
-void PASCAL ShowAllWinSidebySide(HWND);
-void PASCAL ShowAllWinStacked(HWND);
-void PASCAL ShowAllWinCascade(HWND);
-void PASCAL BroadcastClosingMessage(HWND myhwnd);
-void PASCAL UndoAllWin();
-void PASCAL OpenHelp(UINT Command, DWORD Data, char *UILanguageFile);
+int WINAPI RegWin(HWND HWinVT, HWND HWinTEK);
+void WINAPI UnregWin(HWND HWin);
+void WINAPI SetWinMenu(HMENU menu, PCHAR buf, int buflen, PCHAR langFile, int VTFlag);
+void WINAPI SetWinList(HWND HWin, HWND HDlg, int IList);
+void WINAPI SelectWin(int WinId);
+void WINAPI SelectNextWin(HWND HWin, int Next, BOOL SkipIconic);
+HWND WINAPI GetNthWin(int n);
+int WINAPI GetRegisteredWindowCount();
+void WINAPI ShowAllWin(int stat);
+void WINAPI ShowAllWinSidebySide(HWND);
+void WINAPI ShowAllWinStacked(HWND);
+void WINAPI ShowAllWinCascade(HWND);
+void WINAPI BroadcastClosingMessage(HWND myhwnd);
+void WINAPI UndoAllWin();
+void WINAPI OpenHelp(UINT Command, DWORD Data, char *UILanguageFile);
 
-int PASCAL CommReadRawByte(PComVar cv, LPBYTE b);
-int PASCAL CommRead1Byte(PComVar cv, LPBYTE b);
-void PASCAL CommInsert1Byte(PComVar cv, BYTE b);
-int PASCAL CommRawOut(PComVar cv, PCHAR B, int C);
-int PASCAL CommBinaryOut(PComVar cv, PCHAR B, int C);
-int PASCAL CommBinaryBuffOut(PComVar cv, PCHAR B, int C);
-int PASCAL CommTextOut(PComVar cv, PCHAR B, int C);
-int PASCAL CommBinaryEcho(PComVar cv, PCHAR B, int C);
-int PASCAL CommTextEcho(PComVar cv, PCHAR B, int C);
+int WINAPI CommReadRawByte(PComVar cv, LPBYTE b);
+int WINAPI CommRead1Byte(PComVar cv, LPBYTE b);
+void WINAPI CommInsert1Byte(PComVar cv, BYTE b);
+int WINAPI CommRawOut(PComVar cv, PCHAR B, int C);
+int WINAPI CommBinaryOut(PComVar cv, PCHAR B, int C);
+int WINAPI CommBinaryBuffOut(PComVar cv, PCHAR B, int C);
+int WINAPI CommTextOut(PComVar cv, PCHAR B, int C);
+int WINAPI CommBinaryEcho(PComVar cv, PCHAR B, int C);
+int WINAPI CommTextEcho(PComVar cv, PCHAR B, int C);
 
-void PASCAL CreateNotifyIcon(PComVar cv);
-void PASCAL DeleteNotifyIcon(PComVar cv);
-void PASCAL NotifyMessage(PComVar cv, PCHAR message, PCHAR title, DWORD flag);
-void PASCAL ShowNotifyIcon(PComVar cv);
-void PASCAL HideNotifyIcon(PComVar cv);
-void PASCAL SetVerNotifyIcon(PComVar cv, unsigned int ver);
-void PASCAL SetCustomNotifyIcon(HICON icon);
-HICON PASCAL GetCustomNotifyIcon();
+void WINAPI CreateNotifyIcon(PComVar cv);
+void WINAPI DeleteNotifyIcon(PComVar cv);
+void WINAPI NotifyMessage(PComVar cv, PCHAR message, PCHAR title, DWORD flag);
+void WINAPI ShowNotifyIcon(PComVar cv);
+void WINAPI HideNotifyIcon(PComVar cv);
+void WINAPI SetVerNotifyIcon(PComVar cv, unsigned int ver);
+void WINAPI SetCustomNotifyIcon(HICON icon);
+HICON WINAPI GetCustomNotifyIcon();
 
 #define NotifyInfoMessage(cv, msg, title) NotifyMessage(cv, msg, title, 1)
 #define NotifyWarnMessage(cv, msg, title) NotifyMessage(cv, msg, title, 2)
 #define NotifyErrorMessage(cv, msg, title) NotifyMessage(cv, msg, title, 3)
 
-WORD PASCAL SJIS2JIS(WORD KCode);
-WORD PASCAL SJIS2EUC(WORD KCode);
-WORD PASCAL JIS2SJIS(WORD KCode);
-BYTE PASCAL RussConv(int cin, int cout, BYTE b);
-void PASCAL RussConvStr
+WORD WINAPI SJIS2JIS(WORD KCode);
+WORD WINAPI SJIS2EUC(WORD KCode);
+WORD WINAPI JIS2SJIS(WORD KCode);
+BYTE WINAPI RussConv(int cin, int cout, BYTE b);
+void WINAPI RussConvStr
   (int cin, int cout, PCHAR Str, int count);
 
 #ifdef __cplusplus

Modified: branches/cmake/teraterm/common/ttlib.h
===================================================================
--- branches/cmake/teraterm/common/ttlib.h	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/teraterm/common/ttlib.h	2018-08-15 15:02:54 UTC (rev 7177)
@@ -29,6 +29,8 @@
 
 /* useful routines */
 
+#pragma once
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -94,9 +96,9 @@
 void b64encode(PCHAR dst, int dsize, PCHAR src, int len);
 int b64decode(PCHAR dst, int dsize, PCHAR src);
 
-PCHAR PASCAL GetParam(PCHAR buff, int size, PCHAR param);
-void PASCAL DequoteParam(PCHAR dest, int dest_len, PCHAR src);
-void PASCAL DeleteComment(PCHAR dest, int dest_size, PCHAR src);
+PCHAR WINAPI GetParam(PCHAR buff, int size, PCHAR param);
+void WINAPI DequoteParam(PCHAR dest, int dest_len, PCHAR src);
+void WINAPI DeleteComment(PCHAR dest, int dest_size, PCHAR src);
 
 void split_buffer(char *buffer, int delimiter, char **head, char **body);
 

Modified: branches/cmake/teraterm/teraterm/addsetting.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/addsetting.cpp	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/teraterm/teraterm/addsetting.cpp	2018-08-15 15:02:54 UTC (rev 7177)
@@ -39,7 +39,7 @@
 #include "addsetting.h"
 #include "teraterm.h"
 #include "tttypes.h"
-#include "ttwinman.h"
+#include "ttwinman.h"	// for ts
 #include "ttcommon.h"
 #include "ttftypes.h"
 #include "dlglib.h"
@@ -1476,7 +1476,8 @@
 }
 
 // CAddSettingPropSheetDlg
-CAddSettingPropSheetDlg::CAddSettingPropSheetDlg(HINSTANCE hInstance, LPCTSTR pszCaption, HWND hParentWnd) :
+CAddSettingPropSheetDlg::CAddSettingPropSheetDlg(
+	HINSTANCE hInstance, LPCTSTR pszCaption, HWND hParentWnd) :
 	TTCPropertySheet(hInstance, pszCaption, hParentWnd)
 {
 	m_GeneralPage = new CGeneralPropPageDlg(hInstance, this);
@@ -1496,7 +1497,7 @@
 	m_psh.phpage = hPsp;
 
 	get_lang_msg("DLG_TABSHEET_TITLE", ts.UIMsg, sizeof(ts.UIMsg),
-	             "Tera Term: Additional settings", ts.UILanguageFile);
+				 pszCaption, ts.UILanguageFile);
 	m_psh.pszCaption = _tcsdup(ts.UIMsg);
 }
 
@@ -1511,6 +1512,3 @@
 	delete m_CygwinPage;
 }
 
-void CAddSettingPropSheetDlg::OnInitDialog()
-{
-}

Modified: branches/cmake/teraterm/teraterm/addsetting.h
===================================================================
--- branches/cmake/teraterm/teraterm/addsetting.h	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/teraterm/teraterm/addsetting.h	2018-08-15 15:02:54 UTC (rev 7177)
@@ -120,11 +120,9 @@
 class CAddSettingPropSheetDlg : public TTCPropertySheet
 {
 public:
-	CAddSettingPropSheetDlg(HINSTANCE hInstance, LPCTSTR pszCaption, HWND hParentWnd = NULL);
+	CAddSettingPropSheetDlg(HINSTANCE hInstance, LPCTSTR pszCaption, HWND hParentWnd);
 	virtual ~CAddSettingPropSheetDlg();
 private:
-	void OnInitDialog();
-
 	HPROPSHEETPAGE hPsp[6];
 	
 	CGeneralPropPageDlg   *m_GeneralPage;

Modified: branches/cmake/teraterm/teraterm/clipboar.c
===================================================================
--- branches/cmake/teraterm/teraterm/clipboar.c	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/teraterm/teraterm/clipboar.c	2018-08-15 15:02:54 UTC (rev 7177)
@@ -40,6 +40,7 @@
 #include "ttwinman.h"
 #include "ttcommon.h"
 #include "ttlib.h"
+#include "dlglib.h"
 
 #include "clipboar.h"
 #include "tt_res.h"
@@ -61,8 +62,6 @@
 static BOOL CBEchoOnly;
 static BOOL CBInsertDelay = FALSE;
 
-static HFONT DlgClipboardFont;
-
 static LRESULT CALLBACK OnClipboardDlgProc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp);
 
 PCHAR CBOpen(LONG MemSize)
@@ -358,8 +357,8 @@
 	}
 
 	if (confirm) {
-		ret = DialogBox(hInst, MAKEINTRESOURCE(IDD_CLIPBOARD_DIALOG),
-		                HWin, (DLGPROC)OnClipboardDlgProc);
+		ret = TTDialogBox(hInst, MAKEINTRESOURCE(IDD_CLIPBOARD_DIALOG),
+						  HWin, (DLGPROC)OnClipboardDlgProc);
 		/*
 		 * \x88ȑO\x82̓_\x83C\x83A\x83\x8D\x83O\x82̓\xE0\x97e\x82\xF0\x83N\x83\x8A\x83b\x83v\x83{\x81[\x83h\x82ɏ\x91\x82\xAB\x96߂\xB5\x82Ă\xA2\x82\xBD\x82\xAF\x82\xEA\x82ǁA\x95K\x97v?
 		 */
@@ -861,8 +860,6 @@
 
 static LRESULT CALLBACK OnClipboardDlgProc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp)
 {
-	LOGFONT logfont;
-	HFONT font;
 	char uimsg[MAX_UIMSG];
 	POINT p;
 	RECT rc_dsk, rc_dlg;
@@ -875,17 +872,6 @@
 
 	switch (msg) {
 		case WM_INITDIALOG:
-			font = (HFONT)SendMessage(hDlgWnd, WM_GETFONT, 0, 0);
-			GetObject(font, sizeof(LOGFONT), &logfont);
-			if (get_lang_font("DLG_TAHOMA_FONT", hDlgWnd, &logfont, &DlgClipboardFont, ts.UILanguageFile)) {
-				SendDlgItemMessage(hDlgWnd, IDC_EDIT, WM_SETFONT, (WPARAM)DlgClipboardFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(hDlgWnd, IDOK, WM_SETFONT, (WPARAM)DlgClipboardFont, MAKELPARAM(TRUE,0));
-				SendDlgItemMessage(hDlgWnd, IDCANCEL, WM_SETFONT, (WPARAM)DlgClipboardFont, MAKELPARAM(TRUE,0));
-			}
-			else {
-				DlgClipboardFont = NULL;
-			}
-
 			GetWindowText(hDlgWnd, uimsg, sizeof(uimsg));
 			get_lang_msg("DLG_CLIPBOARD_TITLE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
 			SetWindowText(hDlgWnd, ts.UIMsg);
@@ -1037,22 +1023,14 @@
 						result = IDOK;
 					}
 
-					if (DlgClipboardFont != NULL) {
-						DeleteObject(DlgClipboardFont);
-					}
-
 					DestroyWindow(hStatus);
-					EndDialog(hDlgWnd, result);
+					TTEndDialog(hDlgWnd, result);
 				}
 					break;
 
 				case IDCANCEL:
-					if (DlgClipboardFont != NULL) {
-						DeleteObject(DlgClipboardFont);
-					}
-
 					DestroyWindow(hStatus);
-					EndDialog(hDlgWnd, IDCANCEL);
+					TTEndDialog(hDlgWnd, IDCANCEL);
 					break;
 
 				default:

Modified: branches/cmake/teraterm/teraterm/filesys.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/filesys.cpp	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/teraterm/teraterm/filesys.cpp	2018-08-15 15:02:54 UTC (rev 7177)
@@ -28,7 +28,10 @@
  */
 
 /* TERATERM.EXE, file transfer routines */
-#include "stdafx.h"
+#include <stdio.h>
+#include <io.h>
+#include <process.h>
+
 #include "teraterm.h"
 #include "tttypes.h"
 #include "ttftypes.h"
@@ -49,9 +52,6 @@
 
 #include "buffer.h"
 
-#include <io.h>
-#include <process.h>
-
 #define FS_BRACKET_NONE  0
 #define FS_BRACKET_START 1
 #define FS_BRACKET_END   2

Modified: branches/cmake/teraterm/teraterm/sizetip.c
===================================================================
--- branches/cmake/teraterm/teraterm/sizetip.c	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/teraterm/teraterm/sizetip.c	2018-08-15 15:02:54 UTC (rev 7177)
@@ -197,7 +197,7 @@
 
 	/* Generate the tip text */
 
-	sprintf(str, "%dx%d", cx, cy);
+	sprintf_s(str, sizeof(str), "%dx%d", cx, cy);
 
 	if (!tip_wnd) {
 		HDC hdc;

Modified: branches/cmake/teraterm/teraterm/tmfc.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/tmfc.cpp	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/teraterm/teraterm/tmfc.cpp	2018-08-15 15:02:54 UTC (rev 7177)
@@ -325,7 +325,11 @@
 	m_hInst = hInstance;
 	memset(&m_psh, 0, sizeof(m_psh));
 	m_psh.dwSize = sizeof(m_psh);
-	m_psh.dwFlags = PSH_DEFAULT | PSH_NOAPPLYNOW | PSH_USECALLBACK;	// | PSH_MODELESS 
+	m_psh.dwFlags = PSH_DEFAULT | PSH_NOAPPLYNOW | PSH_USECALLBACK;	// | PSH_MODELESS
+	if (pszCaption != NULL) {
+		m_psh.pszCaption = pszCaption;
+		//m_psh.dwFlags |= PSH_PROPTITLE;		// 「のプロパティー」が追加される?
+	}
 	m_psh.hwndParent = hParentWnd;
 	m_psh.pfnCallback = PropSheetProc;
 }

Modified: branches/cmake/teraterm/teraterm/vtdisp.c
===================================================================
--- branches/cmake/teraterm/teraterm/vtdisp.c	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/teraterm/teraterm/vtdisp.c	2018-08-15 15:02:54 UTC (rev 7177)
@@ -181,9 +181,9 @@
 BOOL   BGInSizeMove;
 HBRUSH BGBrushInSizeMove;
 
-HDC hdcBGWork;
-HDC hdcBGBuffer;
-HDC hdcBG;
+static HDC hdcBGWork;
+static HDC hdcBGBuffer;
+static HDC hdcBG;
 
 typedef struct tagWallpaperInfo
 {
@@ -199,9 +199,12 @@
     BYTE     AlphaFormat;
 }BGBLENDFUNCTION;
 
-BOOL (WINAPI *BGAlphaBlend)(HDC,int,int,int,int,HDC,int,int,int,int,BGBLENDFUNCTION);
-BOOL (WINAPI *BGEnumDisplayMonitors)(HDC,LPCRECT,MONITORENUMPROC,LPARAM);
+typedef BOOL (WINAPI *TBGAlphaBlend)(HDC,int,int,int,int,HDC,int,int,int,int,BGBLENDFUNCTION);
+typedef BOOL (WINAPI *TBGEnumDisplayMonitors)(HDC,LPCRECT,MONITORENUMPROC,LPARAM);
 
+static TBGAlphaBlend BGAlphaBlend;
+static TBGEnumDisplayMonitors BGEnumDisplayMonitors;
+
 static HBITMAP GetBitmapHandle(char *File);
 
 
@@ -435,13 +438,18 @@
   strncat_s(filename,destlen,fd.cFileName,_TRUNCATE);
 }
 
+// Susie Plug-in
 BOOL LoadPictureWithSPI(char *nameSPI,char *nameFile,unsigned char *bufFile,long sizeFile,HLOCAL *hbuf,HLOCAL *hbmi)
 {
   HINSTANCE hSPI;
   char spiVersion[8];
-  int (PASCAL *SPI_IsSupported)(LPSTR,DWORD);
-  int (PASCAL *SPI_GetPicture)(LPSTR,long,unsigned int,HANDLE *,HANDLE *,FARPROC,long);
-  int (PASCAL *SPI_GetPluginInfo)(int,LPSTR,int);
+  typedef int (WINAPI *SPI_GetPluginInfo_t)(int infono, LPSTR buf, int buflen); 
+  typedef int (WINAPI *SPI_IsSupported_t)(LPSTR filename, DWORD dw);
+  typedef int (WINAPI *SPI_GetPicture_t)(LPSTR buf, long len, unsigned int flag, HANDLE *pHBInfo, HANDLE *pHBm, FARPROC lpPrgressCallback, long lData);
+
+  SPI_GetPluginInfo_t SPI_GetPluginInfo;
+  SPI_IsSupported_t SPI_IsSupported;
+  SPI_GetPicture_t SPI_GetPicture;
   int ret;
 
   ret  = FALSE;
@@ -453,9 +461,9 @@
   if(!hSPI)
     goto error;
 
-  (FARPROC)SPI_GetPluginInfo = GetProcAddress(hSPI,"GetPluginInfo");
-  (FARPROC)SPI_IsSupported   = GetProcAddress(hSPI,"IsSupported");
-  (FARPROC)SPI_GetPicture    = GetProcAddress(hSPI,"GetPicture");
+  SPI_GetPluginInfo = (SPI_GetPluginInfo_t)GetProcAddress(hSPI,"GetPluginInfo");
+  SPI_IsSupported   = (SPI_IsSupported_t)GetProcAddress(hSPI,"IsSupported");
+  SPI_GetPicture    = (SPI_GetPicture_t)GetProcAddress(hSPI,"GetPicture");
 
   if(!SPI_GetPluginInfo || !SPI_IsSupported || !SPI_GetPicture)
     goto error;
@@ -1620,7 +1628,7 @@
   if(BGUseAlphaBlendAPI) {
     GetSystemDirectory(msimg32_dll, sizeof(msimg32_dll));
     strncat_s(msimg32_dll, sizeof(msimg32_dll), "\\msimg32.dll", _TRUNCATE);
-    (FARPROC)BGAlphaBlend = GetProcAddressWithDllName(msimg32_dll,"AlphaBlend");
+    BGAlphaBlend = (TBGAlphaBlend)GetProcAddressWithDllName(msimg32_dll,"AlphaBlend");
   }
   else {
     BGAlphaBlend = NULL;
@@ -1632,7 +1640,7 @@
   //EnumDisplayMonitors \x82\xF0\x92T\x82\xB7
   GetSystemDirectory(user32_dll, sizeof(user32_dll));
   strncat_s(user32_dll, sizeof(user32_dll), "\\user32.dll", _TRUNCATE);
-  (FARPROC)BGEnumDisplayMonitors = GetProcAddressWithDllName(user32_dll,"EnumDisplayMonitors");
+  BGEnumDisplayMonitors = (TBGEnumDisplayMonitors)GetProcAddressWithDllName(user32_dll,"EnumDisplayMonitors");
 }
 
 void BGExchangeColor() {

Modified: branches/cmake/teraterm/teraterm/vtwin.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/vtwin.cpp	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/teraterm/teraterm/vtwin.cpp	2018-08-15 15:02:54 UTC (rev 7177)
@@ -31,6 +31,8 @@
 /* TERATERM.EXE, VT window */
 
 #include "stdafx.h"
+#include <winsock2.h>
+#include <ws2tcpip.h>
 #include "teraterm.h"
 #include "tttypes.h"
 
@@ -52,10 +54,9 @@
 #include "tekwin.h"
 #include "ttdde.h"
 #include "ttlib.h"
+#include "dlglib.h"
 #include "helpid.h"
 #include "teraprn.h"
-#include <winsock2.h>
-#include <ws2tcpip.h>
 #include "ttplug.h"  /* TTPLUG */
 
 #include <stdio.h>
@@ -4525,8 +4526,7 @@
 {
 	DWORD ret;
 
-	CAddSettingPropSheetDlg CAddSetting(hInst, "", HVTWin);
-//	CAddSetting.EnableStackedTabs(FALSE);
+	CAddSettingPropSheetDlg CAddSetting(hInst, "Tera Term: Additional settings", HVTWin);
 	ret = CAddSetting.DoModal();
 	switch (ret) {
 		case -1:
@@ -4988,44 +4988,11 @@
 	BOOL open_dir, ret;
 	int button_pressed;
 	HWND hWnd;
-	LOGFONT logfont;
-	HFONT font;
 	char uimsg[MAX_UIMSG];
 
 	switch (msg) {
 	case WM_INITDIALOG:
 		// I18N
-		font = (HFONT)SendMessage(hDlgWnd, WM_GETFONT, 0, 0);
-		GetObject(font, sizeof(LOGFONT), &logfont);
-		if (get_lang_font("DLG_TAHOMA_FONT", hDlgWnd, &logfont, &DlgSetupdirFont, ts.UILanguageFile)) {
-			SendDlgItemMessage(hDlgWnd, IDC_INI_SETUPDIR_GROUP, WM_SETFONT, (WPARAM)DlgSetupdirFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(hDlgWnd, IDC_INI_SETUPDIR_EDIT, WM_SETFONT, (WPARAM)DlgSetupdirFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(hDlgWnd, IDC_INI_SETUPDIR_BUTTON, WM_SETFONT, (WPARAM)DlgSetupdirFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(hDlgWnd, IDC_INI_SETUPDIR_BUTTON_FILE, WM_SETFONT, (WPARAM)DlgSetupdirFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(hDlgWnd, IDC_INI_SETUPDIR_STATIC_VSTORE, WM_SETFONT, (WPARAM)DlgSetupdirFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(hDlgWnd, IDC_INI_SETUPDIR_EDIT_VSTORE, WM_SETFONT, (WPARAM)DlgSetupdirFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(hDlgWnd, IDC_KEYCNF_SETUPDIR_GROUP, WM_SETFONT, (WPARAM)DlgSetupdirFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(hDlgWnd, IDC_KEYCNF_SETUPDIR_EDIT, WM_SETFONT, (WPARAM)DlgSetupdirFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(hDlgWnd, IDC_KEYCNF_SETUPDIR_BUTTON, WM_SETFONT, (WPARAM)DlgSetupdirFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(hDlgWnd, IDC_KEYCNF_SETUPDIR_BUTTON_FILE, WM_SETFONT, (WPARAM)DlgSetupdirFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(hDlgWnd, IDC_KEYCNF_SETUPDIR_STATIC_VSTORE, WM_SETFONT, (WPARAM)DlgSetupdirFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(hDlgWnd, IDC_KEYCNF_SETUPDIR_EDIT_VSTORE, WM_SETFONT, (WPARAM)DlgSetupdirFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(hDlgWnd, IDC_CYGTERM_SETUPDIR_GROUP, WM_SETFONT, (WPARAM)DlgSetupdirFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(hDlgWnd, IDC_CYGTERM_SETUPDIR_EDIT, WM_SETFONT, (WPARAM)DlgSetupdirFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(hDlgWnd, IDC_CYGTERM_SETUPDIR_BUTTON, WM_SETFONT, (WPARAM)DlgSetupdirFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(hDlgWnd, IDC_CYGTERM_SETUPDIR_BUTTON_FILE, WM_SETFONT, (WPARAM)DlgSetupdirFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(hDlgWnd, IDC_CYGTERM_SETUPDIR_STATIC_VSTORE, WM_SETFONT, (WPARAM)DlgSetupdirFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(hDlgWnd, IDC_CYGTERM_SETUPDIR_EDIT_VSTORE, WM_SETFONT, (WPARAM)DlgSetupdirFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(hDlgWnd, IDC_SSH_SETUPDIR_GROUP, WM_SETFONT, (WPARAM)DlgSetupdirFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(hDlgWnd, IDC_SSH_SETUPDIR_EDIT, WM_SETFONT, (WPARAM)DlgSetupdirFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(hDlgWnd, IDC_SSH_SETUPDIR_BUTTON, WM_SETFONT, (WPARAM)DlgSetupdirFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(hDlgWnd, IDC_SSH_SETUPDIR_BUTTON_FILE, WM_SETFONT, (WPARAM)DlgSetupdirFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(hDlgWnd, IDC_SSH_SETUPDIR_STATIC_VSTORE, WM_SETFONT, (WPARAM)DlgSetupdirFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(hDlgWnd, IDC_SSH_SETUPDIR_EDIT_VSTORE, WM_SETFONT, (WPARAM)DlgSetupdirFont, MAKELPARAM(TRUE,0));
-		} else {
-			DlgSetupdirFont = NULL;
-		}
-
 		GetWindowText(hDlgWnd, uimsg, sizeof(uimsg));
 		get_lang_msg("DLG_SETUPDIR_TITLE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
 		SetWindowText(hDlgWnd, ts.UIMsg);
@@ -5263,7 +5230,7 @@
 			if (DlgSetupdirFont != NULL) {
 				DeleteObject(DlgSetupdirFont);
 			}
-			EndDialog(hDlgWnd, IDCANCEL);
+			TTEndDialog(hDlgWnd, IDCANCEL);
 			break;
 
 		default:
@@ -5283,7 +5250,7 @@
 		}
 
 	case WM_CLOSE:
-		EndDialog(hDlgWnd, 0);
+		TTEndDialog(hDlgWnd, 0);
 		return TRUE;
 
 	default:
@@ -5300,11 +5267,8 @@
 //
 void CVTWindow::OnOpenSetupDirectory()
 {
-	int ret;
-
-	ret = DialogBox(hInst, MAKEINTRESOURCE(IDD_SETUP_DIR_DIALOG),
-		HVTWin, (DLGPROC)OnSetupDirectoryDlgProc);
-
+	TTDialogBox(hInst, MAKEINTRESOURCE(IDD_SETUP_DIR_DIALOG),
+	            HVTWin, (DLGPROC)OnSetupDirectoryDlgProc);
 }
 
 void CVTWindow::OnSetupLoadKeyMap()
@@ -6044,8 +6008,9 @@
 		goto activate;
 	}
 
-	hDlgWnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_BROADCAST_DIALOG),
-	                       HVTWin, (DLGPROC)BroadcastCommandDlgProc);
+	hDlgWnd = TTCreateDialog(
+		hInst, MAKEINTRESOURCE(IDD_BROADCAST_DIALOG),
+		HVTWin, (DLGPROC)BroadcastCommandDlgProc);
 
 	if (hDlgWnd == NULL) {
 		return;

Modified: branches/cmake/teraterm/teraterm/winjump.c
===================================================================
--- branches/cmake/teraterm/teraterm/winjump.c	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/teraterm/teraterm/winjump.c	2018-08-15 15:02:54 UTC (rev 7177)
@@ -368,6 +368,7 @@
 } IPropertyStore;
 #endif
 
+#if !defined(__MINGW32__)
 static const CLSID CLSID_DestinationList = {
     0x77f10cf0, 0x3db5, 0x4966, {0xb5,0x20,0xb7,0xc5,0x4f,0xd3,0x5e,0xd6}
 };
@@ -383,9 +384,11 @@
 static const IID IID_IShellLink = {
     0x000214ee, 0x0000, 0x0000, {0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}
 };
+#endif
 static const IID IID_ICustomDestinationList = {
     0x6332debf, 0x87b5, 0x4670, {0x90,0xc0,0x5e,0x57,0xb4,0x08,0xa4,0x9e}
 };
+#if !defined(__MINGW32__)
 static const IID IID_IObjectArray = {
     0x92ca9dcd, 0x5622, 0x4bba, {0xa8,0x05,0x5e,0x9f,0x54,0x1b,0xd8,0xc9}
 };
@@ -392,6 +395,7 @@
 static const IID IID_IPropertyStore = {
     0x886d8eeb, 0x8cf2, 0x4446, {0x8d,0x02,0xcd,0xba,0x1d,0xbd,0xcf,0x99}
 };
+#endif
 static const PROPERTYKEY PKEY_Title = {
     {0xf29f85e0, 0x4ff9, 0x1068, {0xab,0x91,0x08,0x00,0x2b,0x27,0xb3,0xd9}},
     0x00000002

Modified: branches/cmake/teraterm/ttpcmn/language.h
===================================================================
--- branches/cmake/teraterm/ttpcmn/language.h	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/teraterm/ttpcmn/language.h	2018-08-15 15:02:54 UTC (rev 7177)
@@ -29,17 +29,19 @@
 
 /* TTCMN.DLL, character code conversion */
 
+#pragma once
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 /* proto types */
-unsigned int PASCAL SJIS2UTF8(WORD KCode, int *byte, char *locale);
-WORD PASCAL SJIS2JIS(WORD KCode);
-WORD PASCAL SJIS2EUC(WORD KCode);
-WORD PASCAL JIS2SJIS(WORD KCode);
-BYTE PASCAL RussConv(int cin, int cout, BYTE b);
-void PASCAL RussConvStr
+unsigned int WINAPI SJIS2UTF8(WORD KCode, int *byte, char *locale);
+WORD WINAPI SJIS2JIS(WORD KCode);
+WORD WINAPI SJIS2EUC(WORD KCode);
+WORD WINAPI JIS2SJIS(WORD KCode);
+BYTE WINAPI RussConv(int cin, int cout, BYTE b);
+void WINAPI RussConvStr
   (int cin, int cout, PCHAR Str, int count);
 
 #ifdef __cplusplus

Modified: branches/cmake/teraterm/ttpcmn/ttcmn.c
===================================================================
--- branches/cmake/teraterm/ttpcmn/ttcmn.c	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/teraterm/ttpcmn/ttcmn.c	2018-08-15 15:02:54 UTC (rev 7177)
@@ -32,13 +32,8 @@
 #endif
 
 /* TTCMN.DLL, main */
-#include "teraterm.h"
-#include "tttypes.h"
 #include <direct.h>
 #include <string.h>
-#include "ttftypes.h"
-#include "ttlib.h"
-#include "language.h"
 #include <stdio.h>
 #include <windows.h>
 #include <tchar.h>
@@ -46,8 +41,14 @@
 #include <locale.h>
 #include <htmlhelp.h>
 
+#include "teraterm.h"
+#include "tttypes.h"
+#include "ttftypes.h"
+#include "ttlib.h"
+#include "language.h"
 #include "compat_w95.h"
 #include "tt_res.h"
+#include "ttcommon.h"
 
 /* first instance flag */
 static BOOL FirstInstance = TRUE;
@@ -68,13 +69,13 @@
 };
 
 
-void PASCAL CopyShmemToTTSet(PTTSet ts)
+void WINAPI CopyShmemToTTSet(PTTSet ts)
 {
 	// \x8C\xBB\x8D݂̐ݒ\xE8\x82\xF0\x8B\xA4\x97L\x83\x81\x83\x82\x83\x8A\x82\xA9\x82\xE7\x83R\x83s\x81[\x82\xB7\x82\xE9
 	memcpy(ts, &pm->ts, sizeof(TTTSet));
 }
 
-void PASCAL CopyTTSetToShmem(PTTSet ts)
+void WINAPI CopyTTSetToShmem(PTTSet ts)
 {
 	// \x8C\xBB\x8D݂̐ݒ\xE8\x82\xF0\x8B\xA4\x97L\x83\x81\x83\x82\x83\x8A\x82փR\x83s\x81[\x82\xB7\x82\xE9
 	memcpy(&pm->ts, ts, sizeof(TTTSet));
@@ -81,7 +82,7 @@
 }
 
 
-BOOL PASCAL StartTeraTerm(PTTSet ts)
+BOOL WINAPI StartTeraTerm(PTTSet ts)
 {
 	char Temp[MAX_PATH];
 
@@ -124,7 +125,7 @@
 
 // \x90ݒ\xE8\x83t\x83@\x83C\x83\x8B\x82\xF0\x83f\x83B\x83X\x83N\x82ɕۑ\xB6\x82\xB5\x81ATera Term\x96{\x91̂\xF0\x8DċN\x93\xAE\x82\xB7\x82\xE9\x81B
 // (2012.4.30 yutaka)
-void PASCAL RestartTeraTerm(HWND hwnd, PTTSet ts)
+void WINAPI RestartTeraTerm(HWND hwnd, PTTSet ts)
 {
 	char path[1024];
 	STARTUPINFO si;
@@ -157,7 +158,7 @@
 	}
 }
 
-void PASCAL ChangeDefaultSet(PTTSet ts, PKeyMap km)
+void WINAPI ChangeDefaultSet(PTTSet ts, PKeyMap km)
 {
 	if ((ts!=NULL) &&
 		(_stricmp(ts->SetupFName, pm->ts.SetupFName) == 0)) {
@@ -168,7 +169,7 @@
 	}
 }
 
-void PASCAL GetDefaultSet(PTTSet ts)
+void WINAPI GetDefaultSet(PTTSet ts)
 {
 	memcpy(ts,&(pm->ts),sizeof(TTTSet));
 }
@@ -175,7 +176,7 @@
 
 
 /* Key scan code -> Tera Term key code */
-WORD PASCAL GetKeyCode(PKeyMap KeyMap, WORD Scan)
+WORD WINAPI GetKeyCode(PKeyMap KeyMap, WORD Scan)
 {
 	WORD Key;
 
@@ -189,7 +190,7 @@
 	return Key;
 }
 
-void PASCAL GetKeyStr(HWND HWin, PKeyMap KeyMap, WORD KeyCode,
+void WINAPI GetKeyStr(HWND HWin, PKeyMap KeyMap, WORD KeyCode,
                           BOOL AppliKeyMode, BOOL AppliCursorMode,
                           BOOL Send8BitMode, PCHAR KeyStr, int destlen,
                           LPINT Len, LPWORD Type)
@@ -843,22 +844,22 @@
 	PeekMessage(&Msg,HWin, WM_CHAR, WM_CHAR,PM_REMOVE);
 }
 
-void PASCAL SetCOMFlag(int Com)
+void WINAPI SetCOMFlag(int Com)
 {
 	pm->ComFlag[(Com-1)/CHAR_BIT] |= 1 << ((Com-1)%CHAR_BIT);
 }
 
-void PASCAL ClearCOMFlag(int Com)
+void WINAPI ClearCOMFlag(int Com)
 {
 	pm->ComFlag[(Com-1)/CHAR_BIT] &= ~(1 << ((Com-1)%CHAR_BIT));
 }
 
-int PASCAL CheckCOMFlag(int Com)
+int WINAPI CheckCOMFlag(int Com)
 {
 	return ((pm->ComFlag[(Com-1)/CHAR_BIT] & 1 << (Com-1)%CHAR_BIT) > 0);
 }
 
-int PASCAL RegWin(HWND HWinVT, HWND HWinTEK)
+int WINAPI RegWin(HWND HWinVT, HWND HWinTEK)
 {
 	int i, j;
 
@@ -889,7 +890,7 @@
 	}
 }
 
-void PASCAL UnregWin(HWND HWin)
+void WINAPI UnregWin(HWND HWin)
 {
 	int i, j;
 
@@ -927,7 +928,7 @@
 		return '+';
 }
 
-void PASCAL SetWinMenu(HMENU menu, PCHAR buf, int buflen, PCHAR langFile, int VTFlag)
+void WINAPI SetWinMenu(HMENU menu, PCHAR buf, int buflen, PCHAR langFile, int VTFlag)
 {
 	int i;
 	char Temp[MAXPATHLEN];
@@ -999,7 +1000,7 @@
 	}
 }
 
-void PASCAL SetWinList(HWND HWin, HWND HDlg, int IList)
+void WINAPI SetWinList(HWND HWin, HWND HDlg, int IList)
 {
 	int i;
 	char Temp[MAXPATHLEN];
@@ -1025,7 +1026,7 @@
 	}
 }
 
-void PASCAL SelectWin(int WinId)
+void WINAPI SelectWin(int WinId)
 {
 	if ((WinId>=0) && (WinId<pm->NWin)) {
 		/* \x83E\x83B\x83\x93\x83h\x83E\x82\xAA\x8Dő剻\x82\xA8\x82\xE6\x82эŏ\xAC\x89\xBB\x82\xB3\x82\xEA\x82Ă\xA2\x82\xBD\x8Fꍇ\x81A\x82\xBB\x82̏\xF3\x91Ԃ\xF0\x88ێ\x9D\x82ł\xAB\x82\xE9\x82悤\x82ɁA
@@ -1044,7 +1045,7 @@
 	}
 }
 
-void PASCAL SelectNextWin(HWND HWin, int Next, BOOL SkipIconic)
+void WINAPI SelectNextWin(HWND HWin, int Next, BOOL SkipIconic)
 {
 	int i;
 
@@ -1073,7 +1074,7 @@
 	SelectWin(i);
 }
 
-void PASCAL ShowAllWin(int stat) {
+void WINAPI ShowAllWin(int stat) {
 	int i;
 
 	for (i=0; i < pm->NWin; i++) {
@@ -1081,7 +1082,7 @@
 	}
 }
 
-void PASCAL UndoAllWin(void) {
+void WINAPI UndoAllWin(void) {
 	int i;
 	WINDOWPLACEMENT rc0;
 	RECT rc;
@@ -1148,7 +1149,7 @@
 	}
 }
 
-void PASCAL OpenHelp(UINT Command, DWORD Data, char *UILanguageFile)
+void WINAPI OpenHelp(UINT Command, DWORD Data, char *UILanguageFile)
 {
 	char HomeDir[MAX_PATH];
 	char Temp[MAX_PATH];
@@ -1177,7 +1178,7 @@
 	}
 }
 
-HWND PASCAL GetNthWin(int n)
+HWND WINAPI GetNthWin(int n)
 {
 	if (n<pm->NWin) {
 		return pm->WinList[n];
@@ -1187,7 +1188,7 @@
 	}
 }
 
-int PASCAL GetRegisteredWindowCount()
+int WINAPI GetRegisteredWindowCount()
 {
 	return (pm->NWin);
 }
@@ -1231,7 +1232,7 @@
 }
 
 // \x83E\x83B\x83\x93\x83h\x83E\x82\xF0\x8D\xB6\x89E\x82ɕ\xC0\x82ׂĕ\\x8E\xA6\x82\xB7\x82\xE9(Show Windows Side by Side)
-void PASCAL ShowAllWinSidebySide(HWND myhwnd)
+void WINAPI ShowAllWinSidebySide(HWND myhwnd)
 {
 	int n;
 	HWND hwnd[MAXNWIN];
@@ -1241,7 +1242,7 @@
 }
 
 // \x83E\x83B\x83\x93\x83h\x83E\x82\xF0\x8F㉺\x82ɕ\xC0\x82ׂĕ\\x8E\xA6\x82\xB7\x82\xE9(Show Windows Stacked)
-void PASCAL ShowAllWinStacked(HWND myhwnd)
+void WINAPI ShowAllWinStacked(HWND myhwnd)
 {
 	int n;
 	HWND hwnd[MAXNWIN];
@@ -1251,7 +1252,7 @@
 }
 
 // \x83E\x83B\x83\x93\x83h\x83E\x82\xF0\x8Fd\x82˂ĕ\\x8E\xA6\x82\xB7\x82\xE9(Cascade)
-void PASCAL ShowAllWinCascade(HWND myhwnd)
+void WINAPI ShowAllWinCascade(HWND myhwnd)
 {
 	int n;
 	HWND hwnd[MAXNWIN];
@@ -1261,7 +1262,7 @@
 }
 
 // \x91STera Term\x82ɏI\x97\xB9\x8Ew\x8E\xA6\x82\xF0\x8Fo\x82\xB7\x81B
-void PASCAL BroadcastClosingMessage(HWND myhwnd)
+void WINAPI BroadcastClosingMessage(HWND myhwnd)
 {
 	int i, max;
 	HWND hwnd[MAXNWIN];
@@ -1284,7 +1285,7 @@
 }
 
 
-int PASCAL CommReadRawByte(PComVar cv, LPBYTE b)
+int WINAPI CommReadRawByte(PComVar cv, LPBYTE b)
 {
 	if ( ! cv->Ready ) {
 		return 0;
@@ -1305,7 +1306,7 @@
 	}
 }
 
-void PASCAL CommInsert1Byte(PComVar cv, BYTE b)
+void WINAPI CommInsert1Byte(PComVar cv, BYTE b)
 {
 	if ( ! cv->Ready ) {
 		return;
@@ -1348,7 +1349,7 @@
 	}
 }
 
-int PASCAL CommRead1Byte(PComVar cv, LPBYTE b)
+int WINAPI CommRead1Byte(PComVar cv, LPBYTE b)
 {
 	int c;
 
@@ -1418,7 +1419,7 @@
 	return c;
 }
 
-int PASCAL CommRawOut(PComVar cv, PCHAR B, int C)
+int WINAPI CommRawOut(PComVar cv, PCHAR B, int C)
 {
 	int a;
 
@@ -1441,7 +1442,7 @@
 	return a;
 }
 
-int PASCAL CommBinaryOut(PComVar cv, PCHAR B, int C)
+int WINAPI CommBinaryOut(PComVar cv, PCHAR B, int C)
 {
 	int a, i, Len;
 	char d[3];
@@ -1478,7 +1479,7 @@
 	return i;
 }
 
-int PASCAL CommBinaryBuffOut(PComVar cv, PCHAR B, int C)
+int WINAPI CommBinaryBuffOut(PComVar cv, PCHAR B, int C)
 {
 	int a, i, Len, OutLen;
 	char d[3];
@@ -1780,7 +1781,7 @@
 	return i;
 }
 
-int PASCAL CommTextOut(PComVar cv, PCHAR B, int C)
+int WINAPI CommTextOut(PComVar cv, PCHAR B, int C)
 {
 	int i, TempLen, OutLen;
 	char TempStr[12];
@@ -1883,7 +1884,7 @@
 	return i;
 }
 
-int PASCAL CommBinaryEcho(PComVar cv, PCHAR B, int C)
+int WINAPI CommBinaryEcho(PComVar cv, PCHAR B, int C)
 {
 	int a, i, Len;
 	char d[3];
@@ -1927,7 +1928,7 @@
 	return i;
 }
 
-int PASCAL TextEchoMBCS(PComVar cv, PCHAR B, int C)
+int WINAPI TextEchoMBCS(PComVar cv, PCHAR B, int C)
 {
 	int i, TempLen;
 	WORD K;
@@ -2102,7 +2103,7 @@
 	return i;
 }
 
-int PASCAL CommTextEcho(PComVar cv, PCHAR B, int C)
+int WINAPI CommTextEcho(PComVar cv, PCHAR B, int C)
 {
 	int i, TempLen;
 	char TempStr[11];
@@ -2284,7 +2285,7 @@
 }
 
 
-int PASCAL DetectComPorts(LPWORD ComPortTable, int ComPortMax, char **ComPortDesc)
+int WINAPI DetectComPorts(LPWORD ComPortTable, int ComPortMax, char **ComPortDesc)
 {
 	HMODULE h;
 	TCHAR   devicesBuff[65535];
@@ -2326,7 +2327,7 @@
 			FILE *fp;
 			char buf[12]; // \\.\COMxxxx + NULL
 			_snprintf_s(buf, sizeof(buf), _TRUNCATE, "\\\\.\\COM%d", i);
-			if ((fp = fopen(buf, "r")) != NULL) {
+			if (fopen_s(&fp, buf, "r") == 0) {
 				fclose(fp);
 				ComPortTable[comports++] = i;
 			}
@@ -2341,7 +2342,7 @@
 	return comports;
 }
 
-int PASCAL CheckComPort(WORD ComPort)
+int WINAPI CheckComPort(WORD ComPort)
 {
 	HMODULE h;
 	TCHAR   devicesBuff[65535];
@@ -2415,17 +2416,17 @@
 static int NotifyIconShowCount = 0;
 static HICON CustomIcon = NULL;
 
-void PASCAL SetCustomNotifyIcon(HICON icon)
+void WINAPI SetCustomNotifyIcon(HICON icon)
 {
 	CustomIcon = icon;
 }
 
-HICON PASCAL GetCustomNotifyIcon()
+HICON WINAPI GetCustomNotifyIcon()
 {
 	return CustomIcon;
 }
 
-void PASCAL CreateNotifyIcon(PComVar cv)
+void WINAPI CreateNotifyIcon(PComVar cv)
 {
 	if (cv->NotifyIcon == NULL) {
 		notify_icon.cbSize = sizeof(notify_icon);
@@ -2457,7 +2458,7 @@
 	return;
 }
 
-void PASCAL DeleteNotifyIcon(PComVar cv)
+void WINAPI DeleteNotifyIcon(PComVar cv)
 {
 	if (cv->NotifyIcon) {
 		Shell_NotifyIcon(NIM_DELETE, cv->NotifyIcon);
@@ -2468,7 +2469,7 @@
 	return;
 }
 
-void PASCAL ShowNotifyIcon(PComVar cv)
+void WINAPI ShowNotifyIcon(PComVar cv)
 {
 	if (cv->NotifyIcon == NULL) {
 		CreateNotifyIcon(cv);
@@ -2483,7 +2484,7 @@
 	return;
 }
 
-void PASCAL HideNotifyIcon(PComVar cv)
+void WINAPI HideNotifyIcon(PComVar cv)
 {
 	if (NotifyIconShowCount > 1) {
 		NotifyIconShowCount -= 1;
@@ -2501,7 +2502,7 @@
 	return;
 }
 
-void PASCAL SetVerNotifyIcon(PComVar cv, unsigned int ver)
+void WINAPI SetVerNotifyIcon(PComVar cv, unsigned int ver)
 {
 	if (cv->NotifyIcon) {
 		cv->NotifyIcon->uVersion = ver;
@@ -2510,7 +2511,7 @@
 	return;
 }
 
-void PASCAL NotifyMessage(PComVar cv, char *msg, char *title, DWORD flag)
+void WINAPI NotifyMessage(PComVar cv, char *msg, char *title, DWORD flag)
 {
 	if (msg == NULL) {
 		return;

Modified: branches/cmake/teraterm/ttpdlg/ttdlg.c
===================================================================
--- branches/cmake/teraterm/ttpdlg/ttdlg.c	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/teraterm/ttpdlg/ttdlg.c	2018-08-15 15:02:54 UTC (rev 7177)
@@ -29,7 +29,7 @@
 /* IPv6 modification is Copyright(C) 2000 Jun-ya Kato <kato****@win6*****> */
 
 /* TTDLG.DLL, dialog boxes */
-#include "teraterm.h"
+#include <winsock2.h>
 #include <stdio.h>
 #include <string.h>
 #include <time.h>
@@ -37,6 +37,7 @@
 #include <direct.h>
 #include <commdlg.h>
 #include <Dlgs.h>
+#include "teraterm.h"
 #include "tttypes.h"
 #include "ttlib.h"
 #include "dlglib.h"
@@ -49,7 +50,6 @@
 #include "oniguruma.h"
 #undef ONIG_EXTERN
 
-#include <winsock2.h>
 static char * ProtocolFamilyList[] = { "UNSPEC", "IPv6", "IPv4", NULL };
 
 #undef EFFECT_ENABLED	// \x83G\x83t\x83F\x83N\x83g\x82̗L\x8C\xF8\x89”\xDB
@@ -72,9 +72,9 @@
 
 char UILanguageFile[MAX_PATH];
 
-static PCHAR NLListRcv[] = {"CR","CR+LF", "LF", "AUTO", NULL};
-static PCHAR NLList[] = {"CR","CR+LF", "LF", NULL};
-static PCHAR TermList[] =
+static const TCHAR *NLListRcv[] = {"CR","CR+LF", "LF", "AUTO", NULL};
+static const TCHAR *NLList[] = {"CR","CR+LF", "LF", NULL};
+static const TCHAR *TermList[] =
 	{"VT100", "VT101", "VT102", "VT282", "VT320", "VT382",
 	 "VT420", "VT520", "VT525", NULL};
 static WORD Term_TermJ[] =
@@ -81,29 +81,29 @@
 	{IdVT100, IdVT101, IdVT102, IdVT282, IdVT320, IdVT382,
 	 IdVT420, IdVT520, IdVT525};
 static WORD TermJ_Term[] = {1, 1, 2, 3, 3, 4, 4, 5, 6, 7, 8, 9};
-static PCHAR TermListJ[] =
+static const TCHAR *TermListJ[] =
 	{"VT100", "VT100J", "VT101", "VT102", "VT102J", "VT220J", "VT282",
 	 "VT320", "VT382", "VT420", "VT520", "VT525", NULL};
-static PCHAR KanjiList[] = {"SJIS","EUC","JIS", "UTF-8", "UTF-8m", NULL};
-static PCHAR KanjiListSend[] = {"SJIS","EUC","JIS", "UTF-8", NULL};
-static PCHAR KanjiInList[] = {"^[$@","^[$B",NULL};
-static PCHAR KanjiOutList[] = {"^[(B","^[(J",NULL};
-static PCHAR KanjiOutList2[] = {"^[(B","^[(J","^[(H",NULL};
-static PCHAR RussList[] = {"Windows","KOI8-R","CP 866","ISO 8859-5",NULL};
-static PCHAR RussList2[] = {"Windows","KOI8-R",NULL};
-static PCHAR LocaleList[] = {"japanese","chinese", "chinese-simplified", "chinese-traditional", NULL};
-static PCHAR MetaList[] = {"off", "on", "left", "right", NULL};
-static PCHAR MetaList2[] = {"off", "on", NULL};
+static const TCHAR *KanjiList[] = {"SJIS","EUC","JIS", "UTF-8", "UTF-8m", NULL};
+static const TCHAR *KanjiListSend[] = {"SJIS","EUC","JIS", "UTF-8", NULL};
+static const TCHAR *KanjiInList[] = {"^[$@","^[$B",NULL};
+static const TCHAR *KanjiOutList[] = {"^[(B","^[(J",NULL};
+static const TCHAR *KanjiOutList2[] = {"^[(B","^[(J","^[(H",NULL};
+static const TCHAR *RussList[] = {"Windows","KOI8-R","CP 866","ISO 8859-5",NULL};
+static const TCHAR *RussList2[] = {"Windows","KOI8-R",NULL};
+static const TCHAR *LocaleList[] = {"japanese","chinese", "chinese-simplified", "chinese-traditional", NULL};
+static const TCHAR *MetaList[] = {"off", "on", "left", "right", NULL};
+static const TCHAR *MetaList2[] = {"off", "on", NULL};
 
 // HKS
-static PCHAR KoreanList[] = {"KS5601", "UTF-8", "UTF-8m", NULL};
-static PCHAR KoreanListSend[] = {"KS5601", "UTF-8", NULL};
+static const TCHAR *KoreanList[] = {"KS5601", "UTF-8", "UTF-8m", NULL};
+static const TCHAR *KoreanListSend[] = {"KS5601", "UTF-8", NULL};
 
 // UTF-8
-static PCHAR Utf8List[] = {"UTF-8", "UTF-8m", NULL};
-static PCHAR Utf8ListSend[] = {"UTF-8", NULL};
+static const TCHAR *Utf8List[] = {"UTF-8", "UTF-8m", NULL};
+static const TCHAR *Utf8ListSend[] = {"UTF-8", NULL};
 
-static PCHAR BaudList[] =
+static const TCHAR *BaudList[] =
 	{"110","300","600","1200","2400","4800","9600",
 	 "14400","19200","38400","57600","115200",
 	 "230400", "460800", "921600", NULL};
@@ -1364,10 +1364,10 @@
 	return FALSE;
 }
 
-static PCHAR DataList[] = {"7 bit","8 bit",NULL};
-static PCHAR ParityList[] = {"none", "odd", "even", "mark", "space", NULL};
-static PCHAR StopList[] = {"1 bit", "1.5 bit", "2 bit", NULL};
-static PCHAR FlowList[] = {"Xon/Xoff","hardware","none",NULL};
+static const TCHAR *DataList[] = {"7 bit","8 bit",NULL};
+static const TCHAR *ParityList[] = {"none", "odd", "even", "mark", "space", NULL};
+static const TCHAR *StopList[] = {"1 bit", "1.5 bit", "2 bit", NULL};
+static const TCHAR *FlowList[] = {"Xon/Xoff","hardware","none",NULL};
 
 BOOL CALLBACK SerialDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
 {
@@ -2926,8 +2926,8 @@
 	return FALSE;
 }
 
-static PCHAR LangList[] = {"English","Japanese","Russian","Korean","UTF-8",NULL};
-static char **LangUIList = NULL;
+static const TCHAR *LangList[] = {"English","Japanese","Russian","Korean","UTF-8",NULL};
+static TCHAR **LangUIList = NULL;
 #define LANG_PATH "lang"
 #define LANG_EXT ".lng"
 

Modified: branches/cmake/teraterm/ttpfile/bplus.c
===================================================================
--- branches/cmake/teraterm/ttpfile/bplus.c	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/teraterm/ttpfile/bplus.c	2018-08-15 15:02:54 UTC (rev 7177)
@@ -40,7 +40,7 @@
 #include "ttlib.h"
 
 /* proto type */
-BOOL PASCAL GetTransFname
+BOOL WINAPI GetTransFname
   (PFileVar fv, PCHAR CurDir, WORD FuncId, LPLONG Option);
 
 #define BPTimeOut 10

Modified: branches/cmake/teraterm/ttptek/CMakeLists.txt
===================================================================
--- branches/cmake/teraterm/ttptek/CMakeLists.txt	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/teraterm/ttptek/CMakeLists.txt	2018-08-15 15:02:54 UTC (rev 7177)
@@ -41,6 +41,12 @@
   ${SFMT_LIBRARY_DIRS}
   )
 
+if(${MINGW})
+  link_directories(
+	${CMAKE_CURRENT_SOURCE_DIR}/../htmlhelp
+	)
+endif()
+
 add_library(
   ttptek SHARED
   ${SRC}
@@ -49,11 +55,10 @@
 target_link_libraries(
   ttptek
   ttpcmn
-#  optimized onig.lib
-#  debug onigd.lib
   debug sfmtd.lib
   optimized sfmt.lib
   iphlpapi.lib
+  htmlhelp.lib
   )
 
 add_dependencies(

Modified: branches/cmake/ttssh2/putty/CMakeLists.txt
===================================================================
--- branches/cmake/ttssh2/putty/CMakeLists.txt	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/ttssh2/putty/CMakeLists.txt	2018-08-15 15:02:54 UTC (rev 7177)
@@ -2,14 +2,18 @@
 
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/")
 
+if(${MINGW})
+  add_definitions("-D_WINDOWS")
+endif()
+
 set(SRC
-  ../../libs/putty/CONF.C
-  ../../libs/putty/MISC.C
-  ../../libs/putty/TREE234.C
-  ../../libs/putty/VERSION.C
-  ../../libs/putty/WINDOWS/WINMISC.C
-  ../../libs/putty/WINDOWS/WINPGNTC.C
-  ../../libs/putty/WINDOWS/WINSECUR.C
+  ../../libs/putty/conf.c
+  ../../libs/putty/misc.c
+  ../../libs/putty/tree234.c
+  ../../libs/putty/version.c
+  ../../libs/putty/windows/winmisc.c
+  ../../libs/putty/windows/winpgntc.c
+  ../../libs/putty/windows/winsecur.c
   libputty.c
   libputty.h
   )

Modified: branches/cmake/ttssh2/ttxssh/fwdui.c
===================================================================
--- branches/cmake/ttssh2/ttxssh/fwdui.c	2018-08-10 15:12:13 UTC (rev 7176)
+++ branches/cmake/ttssh2/ttxssh/fwdui.c	2018-08-15 15:02:54 UTC (rev 7177)
@@ -647,7 +647,7 @@
 {
 	HWND cbox = GetDlgItem(dlg, item);
 	int i;
-	char *svc;
+	const char *svc;
 
 	for (i=0; (svc = service_name(i)) != NULL; i++) {
 		SendMessage(cbox, CB_ADDSTRING, 0, (LPARAM) svc);



Ttssh2-commit メーリングリストの案内