Changeset 317 for branches/branch-1-0/src
- Timestamp:
- May 31, 2006, 12:03:38 AM (19 years ago)
- Location:
- branches/branch-1-0/src/helpers
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/branch-1-0/src/helpers/dosh.c
r311 r317 30 30 31 31 /* 32 * This file Copyright (C) 1997-200 0Ulrich Mller.32 * This file Copyright (C) 1997-2006 Ulrich Mller. 33 33 * This file is part of the "XWorkplace helpers" source package. 34 34 * This is free software; you can redistribute it and/or modify … … 233 233 234 234 return brc; 235 }236 237 /*238 *@@ doshIsWarp4:239 * checks the OS/2 system version number.240 *241 * Returns:242 *243 * -- 0 (FALSE): OS/2 2.x or Warp 3 is running.244 *245 * -- 1: Warp 4.0 is running.246 *247 * -- 2: Warp 4.5 is running (WSeB or Warp 4 FP 13+ or eCS248 * or ACP/MCP), or even something newer.249 *250 *@@changed V0.9.2 (2000-03-05) [umoeller]: reported TRUE on Warp 3 also; fixed251 *@@changed V0.9.6 (2000-10-16) [umoeller]: patched for speed252 *@@changed V0.9.9 (2001-04-04) [umoeller]: now returning 2 for Warp 4.5 and above253 */254 255 ULONG doshIsWarp4(VOID)256 {257 static BOOL s_fQueried = FALSE;258 static ULONG s_ulrc = 0;259 260 if (!s_fQueried)261 {262 // first call:263 ULONG aulBuf[3];264 265 DosQuerySysInfo(QSV_VERSION_MAJOR, // 11266 QSV_VERSION_MINOR, // 12267 &aulBuf, sizeof(aulBuf));268 // Warp 3 is reported as 20.30269 // Warp 4 is reported as 20.40270 // Aurora is reported as 20.45 (regardless of convenience packs)271 272 if ( (aulBuf[0] > 20) // major > 20; not the case with Warp 3, 4, 5273 || ( (aulBuf[0] == 20) // major == 20 and minor >= 45274 && (aulBuf[1] >= 45)275 )276 )277 // Warp 4.5 or newer:278 s_ulrc = 2;279 else if ( (aulBuf[0] == 20) // major == 20 and minor == 40280 && (aulBuf[1] == 40)281 )282 // Warp 4:283 s_ulrc = 1;284 285 s_fQueried = TRUE;286 }287 288 return (s_ulrc);289 235 } 290 236 -
branches/branch-1-0/src/helpers/dosh2.c
r286 r317 28 28 29 29 /* 30 * This file Copyright (C) 1997-200 0Ulrich Mller,30 * This file Copyright (C) 1997-2006 Ulrich Mller, 31 31 * Dmitry A. Steklenev. 32 32 * This file is part of the "XWorkplace helpers" source package. … … 65 65 #include "helpers\dosh.h" 66 66 #include "helpers\ensure.h" 67 #include "helpers\level.h" 67 68 #include "helpers\nls.h" 68 69 #include "helpers\standards.h" … … 80 81 * 81 82 ********************************************************************/ 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 105 ULONG 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 } 82 165 83 166 /* -
branches/branch-1-0/src/helpers/nls.c
r304 r317 375 375 *@@changed V1.0.4 (2005-10-15) [bvl]: Added support for Locale object settings on MCP systems @@fixes 614 376 376 *@@changed V1.0.4 (2005-10-29) [pr]: Rewritten to prevent memory leaks and errors 377 *@@changed V1.0.5 (2006-05-29) [pr]: Read Country rather than Locale settings on Warp 4 FP13+ @@fixes 614 377 378 */ 378 379 … … 381 382 if (pcs) 382 383 { 383 pcs->ulDateFormat = PrfQueryProfileInt(HINI_USER, 384 (PSZ)PMINIAPP_NATIONAL, 385 "iDate", 386 0); 387 pcs->ulTimeFormat = PrfQueryProfileInt(HINI_USER, 388 (PSZ)PMINIAPP_NATIONAL, 389 "iTime", 390 0); 391 pcs->cDateSep = prfhQueryProfileChar(HINI_USER, 392 (PSZ)PMINIAPP_NATIONAL, 393 "sDate", 394 '/'); 395 pcs->cTimeSep = prfhQueryProfileChar(HINI_USER, 396 (PSZ)PMINIAPP_NATIONAL, 397 "sTime", 398 ':'); 399 pcs->cDecimal = prfhQueryProfileChar(HINI_USER, 400 (PSZ)PMINIAPP_NATIONAL, 401 "sDecimal", 402 '.'); 403 pcs->cThousands = prfhQueryProfileChar(HINI_USER, 404 (PSZ)PMINIAPP_NATIONAL, 405 "sThousand", 406 ','); 407 if (doshIsWarp4()==2) 384 if (doshIsWarp4()==3) // V1.0.5 (2006-05-29) [pr] 408 385 { 409 386 UconvObject uconv_object; … … 473 450 UniFreeUconvObject(uconv_object); 474 451 } 452 } 453 else 454 { 455 pcs->ulDateFormat = PrfQueryProfileInt(HINI_USER, 456 (PSZ)PMINIAPP_NATIONAL, 457 "iDate", 458 0); 459 pcs->ulTimeFormat = PrfQueryProfileInt(HINI_USER, 460 (PSZ)PMINIAPP_NATIONAL, 461 "iTime", 462 0); 463 pcs->cDateSep = prfhQueryProfileChar(HINI_USER, 464 (PSZ)PMINIAPP_NATIONAL, 465 "sDate", 466 '/'); 467 pcs->cTimeSep = prfhQueryProfileChar(HINI_USER, 468 (PSZ)PMINIAPP_NATIONAL, 469 "sTime", 470 ':'); 471 pcs->cDecimal = prfhQueryProfileChar(HINI_USER, 472 (PSZ)PMINIAPP_NATIONAL, 473 "sDecimal", 474 '.'); 475 pcs->cThousands = prfhQueryProfileChar(HINI_USER, 476 (PSZ)PMINIAPP_NATIONAL, 477 "sThousand", 478 ','); 475 479 } 476 480 }
Note:
See TracChangeset
for help on using the changeset viewer.