Changeset 1109 for trunk/src/corelib/global
- Timestamp:
- Nov 19, 2012, 6:11:27 PM (13 years ago)
- Location:
- trunk/src/corelib/global
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/corelib/global/qglobal.cpp
r1099 r1109 1272 1272 \value OV_ECS_1_2 eComStation 1.2 1273 1273 \value OV_ECS_2_0 eComStation 2.0 (either any of RCs or GA) 1274 1275 1274 1276 1275 1277 The following masks can be used for detecting properties common to a group … … 1972 1974 // file (see http://www.edm2.com/index.php/Using_SYSLEVEL_Files_in_Your_Applications 1973 1975 // for more information about SYSLEVEL file internals) 1974 static bool getSyslevelVersion(const QByteArray &fileName, char (*version)[2]) 1976 // beginning from ecs 2.1 they changed the detection scheme once more 1977 // the information is now in the ecs_inst.flg file as plain text 1978 // the below function deals with both 1979 enum FileType { 1980 SysLevel, 1981 eCSFlg }; 1982 1983 static bool getSyslevelVersion(const QByteArray &fileName, FileType ft, char *version) 1975 1984 { 1976 1985 bool success = false; 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1977 1998 FILE *f = fopen(fileName, "rb"); 1978 1999 if (!f) 1979 2000 return success; 1980 // go to the char d_version[2] field of the SYSLEVELdata structure1981 if ((success = fseek(f, 0x28, SEEK_SET) == 0)) {1982 // read in twobytes1983 success = fread( *version, 1, 2, f) == 2;2001 // go to the data structure 2002 if ((success = fseek(f, , SEEK_SET) == 0)) { 2003 // read in bytes 2004 success = fread(; 1984 2005 } 1985 2006 fclose(f); … … 2026 2047 fn.data()[0] += buf[0] - 1; 2027 2048 char sys_os2_ver[2]; 2028 if (!getSyslevelVersion(fn, &sys_os2_ver))2049 if (!getSyslevelVersion(fn, sys_os2_ver)) 2029 2050 return os2ver; 2030 2051 … … 2033 2054 fn.data()[0] += buf[0] - 1; 2034 2055 char sys_ecs_ver[2]; 2035 if (!getSyslevelVersion(fn, &sys_ecs_ver)) {2056 if (!getSyslevelVersion(fn, sys_ecs_ver)) { 2036 2057 // no or broken SYSLEVEL.ECS, it's either eCS 1.1 or below or non-eCS 2037 2058 bool have_ecsreg = false; … … 2050 2071 return os2ver = OV_ECS_1_0; 2051 2072 // detect WSeB (4.52) 2052 if (sys_os2_ver[0] == 0x45 && sys_os2_ver[1] == 0x02)2073 if (sys_os2_ver[0] == 0x45 &&sys_os2_ver[1] == 0x02) 2053 2074 return os2ver = OV_4_52; 2054 2075 // fallback to Aurora (QSV_VERSION_MINOR is 45 here) … … 2059 2080 if (sys_ecs_ver[0] == 0x12 && sys_ecs_ver[1] == 0x00) 2060 2081 return os2ver = OV_ECS_1_2; 2061 if (sys_ecs_ver[0] == 0x20 && sys_ecs_ver[1] == 0x00) 2062 return os2ver = OV_ECS_2_0; 2082 if (sys_ecs_ver[0] >= 0x20 && sys_ecs_ver[1] == 0x00) 2083 { 2084 os2ver = OV_ECS_2_0; 2085 // read ecs_inst.flg 2086 char flg_ecs_ver[3]; 2087 fn = QByteArray("A:\\ECS\\ECS_INST.FLG"); 2088 fn.data()[0] += buf[0] - 1; 2089 if (getSyslevelVersion(fn, eCSFlg, flg_ecs_ver)) { 2090 if (flg_ecs_ver[0] == '2' && flg_ecs_ver[2] == '1') 2091 os2ver = OV_ECS_2_1; 2092 if (flg_ecs_ver[0] == '2' && flg_ecs_ver[2] == '2') 2093 os2ver = OV_ECS_2_2; 2094 } 2095 return os2ver; 2096 } 2063 2097 2064 2098 return os2ver = OV_ECS_Unknown; -
trunk/src/corelib/global/qglobal.h
r991 r1109 1567 1567 OV_ECS_1_2 = 0x06010200, 1568 1568 OV_ECS_2_0 = 0x06020000, 1569 1570 1569 1571 1570 1572 /* version masks */
Note:
See TracChangeset
for help on using the changeset viewer.