• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision6236 (tree)
Time2016-01-02 14:03:56
Author(del#1144)

Log Message

Windows バージョンを判定する関数を追加

Change Summary

Incremental Difference

--- branches/vs2015_warn/teraterm/teraterm/teraterm.manifest (revision 6235)
+++ branches/vs2015_warn/teraterm/teraterm/teraterm.manifest (revision 6236)
@@ -1,18 +1,42 @@
11 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
3-
4-<description></description>
5-<dependency>
2+<assembly manifestVersion="1.0"
3+ xmlns="urn:schemas-microsoft-com:asm.v1"
4+ xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
5+ <description></description>
6+ <dependency>
67 <dependentAssembly>
7- <assemblyIdentity
8- type="win32"
9- name="Microsoft.Windows.Common-Controls"
10- version="6.0.0.0"
11- processorArchitecture="X86"
12- publicKeyToken="6595b64144ccf1df"
13- language="*"
8+ <assemblyIdentity
9+ type="win32"
10+ name="Microsoft.Windows.Common-Controls"
11+ version="6.0.0.0"
12+ processorArchitecture="X86"
13+ publicKeyToken="6595b64144ccf1df"
14+ language="*"
15+ />
16+ <!--assemblyIdentity
17+ type="win32"
18+ name=SXS_ASSEMBLY_NAME
19+ version=SXS_ASSEMBLY_VERSION
20+ processorArchitecture=SXS_PROCESSOR_ARCHITECTURE
21+ /-->
22+ </dependentAssembly>
23+ </dependency>
24+ <!--trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
25+ <security>
26+ <requestedPrivileges>
27+ <requestedExecutionLevel
28+ level="asInvoker"
29+ uiAccess="false"
1430 />
15- </dependentAssembly>
16-</dependency>
31+ </requestedPrivileges>
32+ </security>
33+ </trustInfo-->
34+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
35+ <application>
36+ <!-- This Id value indicates the application supports Windows Blue/Server 2012 R2 functionality-->
37+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
38+ <!-- This Id value indicates the application supports Windows Threshold functionality-->
39+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
40+ </application>
41+ </compatibility>
1742 </assembly>
18-
--- branches/vs2015_warn/teraterm/common/ttlib.c (revision 6235)
+++ branches/vs2015_warn/teraterm/common/ttlib.c (revision 6236)
@@ -978,10 +978,81 @@
978978 OutputDebugString(tmp);
979979 }
980980
981+// OSが Windows95 かどうかを判別する。
982+//
983+// return TRUE: 95
984+// FALSE: Not 95
985+BOOL IsWindows95()
986+{
987+#if (_MSC_VER >= 1800)
988+ OSVERSIONINFOEX osvi;
989+ DWORDLONG dwlConditionMask = 0;
990+ int op = VER_EQUAL;
991+ BOOL ret;
992+
993+ ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
994+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
995+ osvi.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS;
996+ osvi.dwMajorVersion = 4;
997+ osvi.dwMinorVersion = 0;
998+ VER_SET_CONDITION(dwlConditionMask, VER_PLATFORMID, op);
999+ VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, op);
1000+ VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, op);
1001+ ret = VerifyVersionInfo(&osvi, VER_PLATFORMID | VER_MAJORVERSION | VER_MINORVERSION, dwlConditionMask);
1002+ return (ret);
1003+#else
1004+ OSVERSIONINFO osvi;
1005+
1006+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
1007+ GetVersionEx(&osvi);
1008+ if (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS &&
1009+ osvi.dwMajorVersion == 4 &&
1010+ osvi.dwMinorVersion == 0) {
1011+ return TRUE;
1012+ }
1013+ return FALSE;
1014+#endif
1015+}
1016+
1017+// OSが WindowsNT カーネルかどうかを判別する。
1018+//
1019+// return TRUE: NT kernel
1020+// FALSE: Not NT4 kernel
1021+BOOL IsWindowsNTKernel()
1022+{
1023+#if (_MSC_VER >= 1800)
1024+ OSVERSIONINFOEX osvi;
1025+ DWORDLONG dwlConditionMask = 0;
1026+ int op = VER_EQUAL;
1027+ BOOL ret;
1028+
1029+ ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
1030+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
1031+ osvi.dwPlatformId = VER_PLATFORM_WIN32_NT;
1032+ VER_SET_CONDITION(dwlConditionMask, VER_PLATFORMID, op);
1033+ ret = VerifyVersionInfo(&osvi, VER_PLATFORMID, dwlConditionMask);
1034+ return (ret);
1035+#else
1036+ OSVERSIONINFO osvi;
1037+
1038+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
1039+ GetVersionEx(&osvi);
1040+ if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
1041+ return TRUE;
1042+ }
1043+ return FALSE;
1044+#endif
1045+}
1046+
9811047 // OSが WindowsNT4.0 かどうかを判別する。
9821048 //
9831049 // return TRUE: NT4.0
9841050 // FALSE: Not NT4.0
1051+BOOL IsWindowsNT4()
1052+{
1053+ return is_NT4();
1054+}
1055+
9851056 BOOL is_NT4()
9861057 {
9871058 #if (_MSC_VER >= 1800)
@@ -995,9 +1066,11 @@
9951066
9961067 ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
9971068 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
1069+ osvi.dwPlatformId = VER_PLATFORM_WIN32_NT;
9981070 osvi.dwMajorVersion = 4;
1071+ VER_SET_CONDITION(dwlConditionMask, VER_PLATFORMID, op);
9991072 VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, op);
1000- ret = VerifyVersionInfo(&osvi, VER_MAJORVERSION, dwlConditionMask);
1073+ ret = VerifyVersionInfo(&osvi, VER_PLATFORMID | VER_MAJORVERSION, dwlConditionMask);
10011074 return (ret);
10021075 #else
10031076 OSVERSIONINFO osvi;
@@ -1014,8 +1087,8 @@
10141087
10151088 // OSが Windows2000 以降 かどうかを判別する。
10161089 //
1017-// return TRUE:
1018-// FALSE:
1090+// return TRUE: 2000 or later
1091+// FALSE: NT4 or earlier
10191092 BOOL IsWindows2000OrLater(void)
10201093 {
10211094 #if (_MSC_VER >= 1800)
@@ -1046,6 +1119,88 @@
10461119 #endif
10471120 }
10481121
1122+// OSが WindowsVista 以降 かどうかを判別する。
1123+//
1124+// return TRUE: Vista or later
1125+// FALSE: XP or earlier
1126+BOOL IsWindowsVistaOrLater(void)
1127+{
1128+#if (_MSC_VER >= 1800)
1129+ OSVERSIONINFOEX osvi;
1130+ DWORDLONG dwlConditionMask = 0;
1131+ int op = VER_GREATER_EQUAL;
1132+ BOOL ret;
1133+
1134+ ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
1135+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
1136+ osvi.dwMajorVersion = 6;
1137+ VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, op);
1138+ ret = VerifyVersionInfo(&osvi, VER_MAJORVERSION, dwlConditionMask);
1139+ return (ret);
1140+#else
1141+ OSVERSIONINFO osvi;
1142+
1143+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
1144+ GetVersionEx(&osvi);
1145+ if (osvi.dwMajorVersion >= 6) {
1146+ return TRUE;
1147+ }
1148+ return FALSE;
1149+#endif
1150+}
1151+
1152+// OSが Windows7 以降 かどうかを判別する。
1153+//
1154+// return TRUE: 7 or later
1155+// FALSE: Vista or earlier
1156+BOOL IsWindows7OrLater(void)
1157+{
1158+#if (_MSC_VER >= 1800)
1159+ OSVERSIONINFOEX osvi;
1160+ DWORDLONG dwlConditionMask = 0;
1161+ int op = VER_GREATER;
1162+ BOOL ret;
1163+
1164+ ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
1165+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
1166+ osvi.dwMajorVersion = 6;
1167+ VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, op);
1168+ ret = VerifyVersionInfo(&osvi, VER_MAJORVERSION, dwlConditionMask);
1169+ if (ret) {
1170+ return (ret);
1171+ }
1172+
1173+ dwlConditionMask = 0;
1174+ op = VER_EQUAL;
1175+ VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, op);
1176+ ret = VerifyVersionInfo(&osvi, VER_MAJORVERSION, dwlConditionMask);
1177+ if (ret) {
1178+ dwlConditionMask = 0;
1179+ op = VER_GREATER_EQUAL;
1180+ osvi.dwMinorVersion = 1;
1181+ VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, op);
1182+ ret = VerifyVersionInfo(&osvi, VER_MINORVERSION, dwlConditionMask);
1183+ if (ret) {
1184+ return (ret);
1185+ }
1186+ }
1187+
1188+ return FALSE;
1189+#else
1190+ OSVERSIONINFO osvi;
1191+
1192+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
1193+ GetVersionEx(&osvi);
1194+ if (osvi.dwMajorVersion > 6) {
1195+ return TRUE;
1196+ }
1197+ if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion >= 1) {
1198+ return TRUE;
1199+ }
1200+ return FALSE;
1201+#endif
1202+}
1203+
10491204 int get_OPENFILENAME_SIZE()
10501205 {
10511206 if (IsWindows2000OrLater()) {
--- branches/vs2015_warn/teraterm/common/ttlib.h (revision 6235)
+++ branches/vs2015_warn/teraterm/common/ttlib.h (revision 6236)
@@ -46,6 +46,12 @@
4646 void OutputDebugPrintf(char *fmt, ...);
4747 BOOL is_NT4();
4848 int get_OPENFILENAME_SIZE();
49+BOOL IsWindows95();
50+BOOL IsWindowsNT4();
51+BOOL IsWindowsNTKernel();
52+BOOL IsWindows2000OrLater();
53+BOOL IsWindowsVistaOrLater();
54+BOOL IsWindows7OrLater();
4955 int KanjiCode2List(int lang, int kcode);
5056 int List2KanjiCode(int lang, int kcode);
5157 int KanjiCodeTranslate(int lang, int kcode);
Show on old repository browser