Ticket #277: 277.diff

File 277.diff, 2.6 KB (added by Silvan Scherrer, 11 years ago)
  • src/corelib/global/qglobal.cpp

     
    12711271    \value OV_ECS_1_1           eComStation 1.1
    12721272    \value OV_ECS_1_2           eComStation 1.2
    12731273    \value OV_ECS_2_0           eComStation 2.0 (either any of RCs or GA)
     1274    \value OV_ECS_2_1           eComStation 2.1 (either any of RCs or GA)
     1275    \value OV_ECS_2_2           eComStation 2.2 (either any of RCs or GA)
    12741276
    12751277    The following masks can be used for detecting properties common to a group
    12761278    of versions:
     
    19861988    return success;
    19871989}
    19881990
     1991// beginning from ecs 2.1 they changed the detection scheme once more
     1992// the information is now in the ecs_inst.flg file as plain text
     1993static bool getFLGVersion(const QByteArray &fileName, char (*version)[3])
     1994{
     1995    bool success = false;
     1996    FILE *f = fopen(fileName, "rb");
     1997    if (!f)
     1998        return success;
     1999    // skip eComStation_ and read then
     2000    if ((success = fseek(f, 0x0C, SEEK_SET) == 0)) {
     2001        // read in tree bytes
     2002        success = fread(*version, 1, 3, f) == 3;
     2003    }
     2004    fclose(f);
     2005    return success;
     2006}
     2007
    19892008QSysInfo::Os2Version QSysInfo::os2Version()
    19902009{
    19912010    static QSysInfo::Os2Version os2ver = OV_Unknown;
     
    20582077    // detect eCS >= 1.2
    20592078    if (sys_ecs_ver[0] == 0x12 && sys_ecs_ver[1] == 0x00)
    20602079        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;
     2080    if (sys_ecs_ver[0] >= 0x20 && sys_ecs_ver[1] == 0x00)
     2081    {
     2082        os2ver = OV_ECS_2_0;
     2083        // read ecs_inst.flg
     2084        char flg_ecs_ver[3];
     2085        fn = QByteArray("A:\\ECS\\ECS_INST.FLG");
     2086        fn.data()[0] += buf[0] - 1;
     2087        if (getFLGVersion(fn, &flg_ecs_ver)) {
     2088           if (flg_ecs_ver[0] == '2' && flg_ecs_ver[2] == '1')
     2089               os2ver = OV_ECS_2_1;
     2090           if (flg_ecs_ver[0] == '2' && flg_ecs_ver[2] == '2')
     2091               os2ver = OV_ECS_2_2;
     2092        }
     2093        return os2ver;
     2094    }
    20632095
    20642096    return os2ver = OV_ECS_Unknown;
    20652097}
  • src/corelib/global/qglobal.h

     
    15661566        OV_ECS_1_1      = 0x06010100,
    15671567        OV_ECS_1_2      = 0x06010200,
    15681568        OV_ECS_2_0      = 0x06020000,
     1569        OV_ECS_2_1      = 0x06020100,
     1570        OV_ECS_2_2      = 0x06020200,
    15691571
    15701572        /* version masks */
    15711573        OV_WARP3        = 0x01000000,