[Ttssh2-commit] [6256] バージョンチェックを変更

svnno****@sourc***** svnno****@sourc*****
2016年 1月 7日 (木) 22:09:58 JST


Revision: 6256
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/6256
Author:   maya
Date:     2016-01-07 22:09:58 +0900 (Thu, 07 Jan 2016)
Log Message:
-----------
バージョンチェックを変更
  OS のバージョン番号ではなく関数の有無をチェックする関数を作成
  不要なバージョンチェックを削除

Modified Paths:
--------------
    branches/vs2015_warn/TTXSamples/TTXResizeMenu/TTXResizeMenu.c
    branches/vs2015_warn/teraterm/common/ttlib.c
    branches/vs2015_warn/teraterm/common/ttlib.h
    branches/vs2015_warn/teraterm/teraterm/clipboar.c
    branches/vs2015_warn/teraterm/teraterm/vtdisp.c
    branches/vs2015_warn/teraterm/teraterm/vtwin.cpp
    branches/vs2015_warn/teraterm/ttpcmn/ttcmn.c
    branches/vs2015_warn/teraterm/ttpcmn/ttpcmn.def
    branches/vs2015_warn/teraterm/ttpmacro/ttl.c
    branches/vs2015_warn/teraterm/ttpmacro/ttmlib.c

-------------- next part --------------
Modified: branches/vs2015_warn/TTXSamples/TTXResizeMenu/TTXResizeMenu.c
===================================================================
--- branches/vs2015_warn/TTXSamples/TTXResizeMenu/TTXResizeMenu.c	2016-01-07 08:43:51 UTC (rev 6255)
+++ branches/vs2015_warn/TTXSamples/TTXResizeMenu/TTXResizeMenu.c	2016-01-07 13:09:58 UTC (rev 6256)
@@ -159,7 +159,7 @@
   pvar->ResizeMenu = NULL;
   pvar->MenuItems = 0;
 
-  if (IsWindows95() || IsWindowsNT4()) {
+  if (!HasMultiMonitorSupport()) {
     pvar->useMultiMonitorAPI = FALSE;
   }
   else {

Modified: branches/vs2015_warn/teraterm/common/ttlib.c
===================================================================
--- branches/vs2015_warn/teraterm/common/ttlib.c	2016-01-07 08:43:51 UTC (rev 6255)
+++ branches/vs2015_warn/teraterm/common/ttlib.c	2016-01-07 13:09:58 UTC (rev 6256)
@@ -1201,6 +1201,33 @@
 #endif
 }
 
+// OS \x82\xAA\x83}\x83\x8B\x83`\x83\x82\x83j\x83^ API \x82\xF0\x83T\x83|\x81[\x83g\x82\xB5\x82Ă\xA2\x82邩\x82ǂ\xA4\x82\xA9\x82𔻕ʂ\xB7\x82\xE9\x81B
+//   98 \x88ȍ~/2000 \x88ȍ~\x82\xCD TRUE \x82\xF0\x95Ԃ\xB7
+BOOL HasMultiMonitorSupport()
+{
+	HMODULE mod;
+
+	if (((mod = GetModuleHandle("user32.dll")) != NULL) &&
+	    (GetProcAddress(mod, "MonitorFromPoint") != NULL)) {
+		return TRUE;
+	}
+	return FALSE;
+}
+
+// OS \x82\xAA GetAdaptersAddresses \x82\xF0\x83T\x83|\x81[\x83g\x82\xB5\x82Ă\xA2\x82邩\x82ǂ\xA4\x82\xA9\x82𔻕ʂ\xB7\x82\xE9\x81B
+//   XP \x88ȍ~\x82\xCD TRUE \x82\xF0\x95Ԃ\xB7
+//   2000 \x88ȍ~\x82\xCD IPv6 \x82ɑΉ\x9E\x82\xB5\x82Ă\xA2\x82邪 GetAdaptersAddresses \x82\xAA\x82Ȃ\xA2
+BOOL HasGetAdaptersAddresses()
+{
+	HMODULE mod;
+
+	if (((mod = GetModuleHandle("iphlpapi.dll")) != NULL) &&
+		(GetProcAddress(mod, "GetAdaptersAddresses") != NULL)) {
+		return TRUE;
+	}
+	return FALSE;
+}
+
 int get_OPENFILENAME_SIZE()
 {
 	if (IsWindows2000OrLater()) {

Modified: branches/vs2015_warn/teraterm/common/ttlib.h
===================================================================
--- branches/vs2015_warn/teraterm/common/ttlib.h	2016-01-07 08:43:51 UTC (rev 6255)
+++ branches/vs2015_warn/teraterm/common/ttlib.h	2016-01-07 13:09:58 UTC (rev 6256)
@@ -52,6 +52,8 @@
 BOOL IsWindows2000OrLater();
 BOOL IsWindowsVistaOrLater();
 BOOL IsWindows7OrLater();
+BOOL HasMultiMonitorSupport();
+BOOL HasGetAdaptersAddresses();
 int KanjiCode2List(int lang, int kcode);
 int List2KanjiCode(int lang, int kcode);
 int KanjiCodeTranslate(int lang, int kcode);

Modified: branches/vs2015_warn/teraterm/teraterm/clipboar.c
===================================================================
--- branches/vs2015_warn/teraterm/teraterm/clipboar.c	2016-01-07 08:43:51 UTC (rev 6255)
+++ branches/vs2015_warn/teraterm/teraterm/clipboar.c	2016-01-07 13:09:58 UTC (rev 6256)
@@ -621,7 +621,7 @@
 			// \x83L\x83\x83\x83\x8C\x83b\x83g\x82\xAA\x89\xE6\x96ʂ\xA9\x82\xE7\x82͂ݏo\x82\xB5\x82Ă\xA2\x82\xE9\x82Ƃ\xAB\x82ɓ\\x82\xE8\x95t\x82\xAF\x82\xF0\x82\xB7\x82\xE9\x82\xC6
 			// \x8Am\x94F\x83E\x83C\x83\x93\x83h\x83E\x82\xAA\x8C\xA9\x82\xA6\x82\xE9\x82Ƃ\xB1\x82\xEB\x82ɕ\\x8E\xA6\x82\xB3\x82\xEA\x82Ȃ\xA2\x82\xB1\x82Ƃ\xAA\x82\xA0\x82\xE9\x81B
 			// \x83E\x83C\x83\x93\x83h\x83E\x82\xA9\x82\xE7\x82͂ݏo\x82\xB5\x82\xBD\x8Fꍇ\x82ɒ\xB2\x90߂\xB7\x82\xE9 (2008.4.24 maya)
-			if (IsWindows95() || IsWindowsNT4()) {
+			if (!HasMultiMonitorSupport()) {
 				// NT4.0, 95 \x82̓}\x83\x8B\x83`\x83\x82\x83j\x83^API\x82ɔ\xF1\x91Ή\x9E
 				SystemParametersInfo(SPI_GETWORKAREA, 0, &rc_dsk, 0);
 			}

Modified: branches/vs2015_warn/teraterm/teraterm/vtdisp.c
===================================================================
--- branches/vs2015_warn/teraterm/teraterm/vtdisp.c	2016-01-07 08:43:51 UTC (rev 6255)
+++ branches/vs2015_warn/teraterm/teraterm/vtdisp.c	2016-01-07 13:09:58 UTC (rev 6256)
@@ -1786,7 +1786,7 @@
   /* background paintbrush */
   Background = CreateSolidBrush(ts.VTColor[1]);
   /* CRT width & height */
-  if (!IsWindows95() && !IsWindowsNT4()) {
+  if (HasMultiMonitorSupport()) {
     bMultiDisplaySupport = TRUE;
   }
   if( bMultiDisplaySupport ) {

Modified: branches/vs2015_warn/teraterm/teraterm/vtwin.cpp
===================================================================
--- branches/vs2015_warn/teraterm/teraterm/vtwin.cpp	2016-01-07 08:43:51 UTC (rev 6255)
+++ branches/vs2015_warn/teraterm/teraterm/vtwin.cpp	2016-01-07 13:09:58 UTC (rev 6256)
@@ -2700,7 +2700,6 @@
 		SIZE sz;
 		RECT wr;
 		int ix, iy;
-		HMODULE mod;
 		HMONITOR hm;
 
 		/* calculate the tip's size */
@@ -2714,8 +2713,7 @@
 		ix = wr.left;
 		iy = wr.top - sz.cy;
 
-		if (((mod = GetModuleHandle("user32.dll")) != NULL) &&
-		    (GetProcAddress(mod,"MonitorFromPoint") != NULL)) {
+		if (HasMultiMonitorSupport()) {
 			// \x83}\x83\x8B\x83`\x83\x82\x83j\x83^\x82\xAA\x83T\x83|\x81[\x83g\x82\xB3\x82\xEA\x82Ă\xA2\x82\xE9\x8Fꍇ
 			POINT p;
 			p.x = ix;

Modified: branches/vs2015_warn/teraterm/ttpcmn/ttcmn.c
===================================================================
--- branches/vs2015_warn/teraterm/ttpcmn/ttcmn.c	2016-01-07 08:43:51 UTC (rev 6255)
+++ branches/vs2015_warn/teraterm/ttpcmn/ttcmn.c	2016-01-07 13:09:58 UTC (rev 6256)
@@ -1061,7 +1061,7 @@
 	int stat = SW_RESTORE;
 	int multi_mon = 0;
 
-	if (!IsWindows95() && !IsWindowsNT4()) {
+	if (HasMultiMonitorSupport()) {
 		multi_mon = 1;
 	}
 

Modified: branches/vs2015_warn/teraterm/ttpcmn/ttpcmn.def
===================================================================
--- branches/vs2015_warn/teraterm/ttpcmn/ttpcmn.def	2016-01-07 08:43:51 UTC (rev 6255)
+++ branches/vs2015_warn/teraterm/ttpcmn/ttpcmn.def	2016-01-07 13:09:58 UTC (rev 6256)
@@ -66,3 +66,5 @@
   IsWindows2000OrLater @68
   IsWindowsVistaOrLater @69
   IsWindows7OrLater @70
+  HasMultiMonitorSupport @71
+  HasGetAdaptersAddresses @72

Modified: branches/vs2015_warn/teraterm/ttpmacro/ttl.c
===================================================================
--- branches/vs2015_warn/teraterm/ttpmacro/ttl.c	2016-01-07 08:43:51 UTC (rev 6255)
+++ branches/vs2015_warn/teraterm/ttpmacro/ttl.c	2016-01-07 13:09:58 UTC (rev 6256)
@@ -2393,9 +2393,8 @@
 		Err = ErrSyntax;
 	if (Err!=0) return Err;
 
-	// IPv6 \x82\xAA\x83T\x83|\x81[\x83g\x82\xB3\x82\xEA\x82Ă\xA2\x82Ȃ\xA2 OS \x82͂\xB1\x82\xB1\x82\xC5 return
-	if (!IsWindowsNTKernel() || IsWindowsNT4()) {
-		// 9x, NT4.0 \x82\xCD IPv6 \x94\xF1\x91Ή\x9E
+	// GetAdaptersAddresses \x82\xAA\x83T\x83|\x81[\x83g\x82\xB3\x82\xEA\x82Ă\xA2\x82Ȃ\xA2 OS \x82͂\xB1\x82\xB1\x82\xC5 return
+	if (!HasGetAdaptersAddresses()) {
 		SetResult(-1);
 		SetIntVal(VarId2, 0);
 		return Err;

Modified: branches/vs2015_warn/teraterm/ttpmacro/ttmlib.c
===================================================================
--- branches/vs2015_warn/teraterm/ttpmacro/ttmlib.c	2016-01-07 08:43:51 UTC (rev 6255)
+++ branches/vs2015_warn/teraterm/ttpmacro/ttmlib.c	2016-01-07 13:09:58 UTC (rev 6256)
@@ -104,16 +104,6 @@
 	char Path[MAX_PATH] = "";
 	LPITEMIDLIST pidl;
 
-	if (!IsWindowsNTKernel() || IsWindowsNT4()) {
-		switch (CSIDL) {
-			case CSIDL_COMMON_DESKTOPDIRECTORY:
-			case CSIDL_COMMON_STARTMENU:
-			case CSIDL_COMMON_PROGRAMS:
-			case CSIDL_COMMON_STARTUP:
-				return 0;
-		}
-	}
-
 	if (SHGetSpecialFolderLocation(NULL, CSIDL, &pidl) != S_OK) {
 		return 0;
 	}
@@ -186,7 +176,7 @@
 
 int GetMonitorLeftmost(int PosX, int PosY)
 {
-	if (IsWindows95() || IsWindowsNT4()) {
+	if (!HasMultiMonitorSupport()) {
 		// // NT4.0, 95 \x82̓}\x83\x8B\x83`\x83\x82\x83j\x83^API\x82ɔ\xF1\x91Ή\x9E
 		return 0;
 	}



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