Ignore:
Timestamp:
May 31, 2006, 12:12:26 AM (19 years ago)
Author:
pr
Message:

Move doshIsWarp4 to dosh2 and query Syslevel to determine W4/MCP difference

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/dosh2.c

    r286 r318  
    2828
    2929/*
    30  *      This file Copyright (C) 1997-2000 Ulrich M”ller,
     30 *      This file Copyright (C) 1997-2006 Ulrich M”ller,
    3131 *                                        Dmitry A. Steklenev.
    3232 *      This file is part of the "XWorkplace helpers" source package.
     
    6565#include "helpers\dosh.h"
    6666#include "helpers\ensure.h"
     67#include "helpers\level.h"
    6768#include "helpers\nls.h"
    6869#include "helpers\standards.h"
     
    8081 *
    8182 ********************************************************************/
     83
     84/*
     85 *@@ doshIsWarp4:
     86 *      checks the OS/2 system version number.
     87 *
     88 *      Returns:
     89 *
     90 *      -- 0 (FALSE): OS/2 2.x or Warp 3 is running.
     91 *
     92 *      -- 1: Warp 4.0 is running.
     93 *
     94 *      -- 2: Warp 4.5 kernel is running on Warp 4.0 (Warp 4 FP 13+).
     95 *
     96 *      -- 3: Warp 4.5 is running (WSeB or eCS or ACP/MCP), or even something newer.
     97 *
     98 *@@changed V0.9.2 (2000-03-05) [umoeller]: reported TRUE on Warp 3 also; fixed
     99 *@@changed V0.9.6 (2000-10-16) [umoeller]: patched for speed
     100 *@@changed V0.9.9 (2001-04-04) [umoeller]: now returning 2 for Warp 4.5 and above
     101 *@@changed V1.0.5 (2006-05-29) [pr]: now returning 3 for Warp 4.5 and above and 2 for
     102 *   Warp 4.0 FP13+; moved here from dosh.c
     103 */
     104
     105ULONG doshIsWarp4(VOID)
     106{
     107    static BOOL     s_fQueried = FALSE;
     108    static ULONG    s_ulrc = 0;
     109
     110    if (!s_fQueried)
     111    {
     112        // first call:
     113        ULONG       aulBuf[3];
     114
     115        DosQuerySysInfo(QSV_VERSION_MAJOR,      // 11
     116                        QSV_VERSION_MINOR,      // 12
     117                        &aulBuf, sizeof(aulBuf));
     118        // Warp 3 is reported as 20.30
     119        // Warp 4 is reported as 20.40
     120        // Aurora is reported as 20.45 (regardless of convenience packs)
     121
     122        if (aulBuf[0] > 20)        // major > 20; not the case with Warp 3, 4, 5
     123            s_ulrc = 3;
     124        else
     125            if (aulBuf[0] == 20)   // major == 20
     126                if (aulBuf[1] >= 45)   // minor >= 45  Warp 4 FP13 or later
     127                    s_ulrc = 2;
     128                else
     129                    if (aulBuf[1] == 40)   // minor == 40  Warp 4 pre-FP13
     130                        s_ulrc = 1;
     131
     132        // Now check SYSLEVEL.OS2 to detect between Warp 4 and MCP
     133        if (s_ulrc == 2)
     134        {
     135            CHAR szName[CCHMAXPATH] = "?:\\OS2\\INSTALL\\SYSLEVEL.OS2";
     136            ULONG cbFile;
     137            PXFILE pFile;
     138
     139            szName[0] = doshQueryBootDrive();
     140            if (!doshOpen(szName,
     141                          XOPEN_READ_EXISTING | XOPEN_BINARY,
     142                          &cbFile,
     143                          &pFile))
     144            {
     145                CHAR szVersion[2];
     146                ULONG ulSize;
     147
     148                if (   !lvlQueryLevelFileData(pFile->hf,
     149                                              QLD_MINORVERSION,
     150                                              szVersion,
     151                                              sizeof(szVersion),
     152                                              &ulSize)
     153                    && (szVersion[0] >= '5'))   // minor >= 5  is MCP
     154                        s_ulrc = 3;
     155
     156                doshClose(&pFile);
     157            }
     158        }
     159
     160        s_fQueried = TRUE;
     161    }
     162
     163    return (s_ulrc);
     164}
    82165
    83166/*
Note: See TracChangeset for help on using the changeset viewer.