|
|
1.1 ! root 1: #include <windows.h> ! 2: #include "setupapi.h" ! 3: #include "msdetect.h" ! 4: #include <string.h> ! 5: #include <stdlib.h> ! 6: ! 7: ! 8: #define cchNum 10 ! 9: ! 10: ! 11: // ************************************************************************* ! 12: LPSTR lstrncpy(LPSTR szDst, LPSTR szSrc, INT n) ! 13: { ! 14: LPSTR szSav = szDst; ! 15: ! 16: while (n-- && (*szDst++ = *szSrc++) != '\0') ! 17: ; ! 18: ! 19: while (n--) ! 20: *szDst++ = '\0'; ! 21: ! 22: return(szSav); ! 23: } ! 24: ! 25: ! 26: // ************************************************************************* ! 27: INT IsDriveValid(LPSTR szDrive) ! 28: { ! 29: #ifdef DEBUG ! 30: if (FValidDrive(szDrive) == 0) ! 31: BadArgErr(1, "IsDriveValid", szDrive); ! 32: #endif // DEBUG ! 33: ! 34: AnsiUpperBuff(szDrive, 1); ! 35: ! 36: return(FIsValidDrive(*szDrive - 'A' + 1)); ! 37: } ! 38: ! 39: ! 40: // ************************************************************************* ! 41: INT IsDriveLocalHard(LPSTR szDrive) ! 42: { ! 43: #ifdef DEBUG ! 44: if (FValidDrive(szDrive) == 0) ! 45: BadArgErr(1, "IsDriveLocalHard", szDrive); ! 46: #endif // DEBUG ! 47: ! 48: return(FIsLocalHardDrive((*AnsiUpper(szDrive)) - 'A' + 1)); ! 49: } ! 50: ! 51: ! 52: // ************************************************************************* ! 53: INT IsDriveRemovable(LPSTR szDrive) ! 54: { ! 55: #ifdef DEBUG ! 56: if (FValidDrive(szDrive) == 0) ! 57: BadArgErr(1, "IsDriveRemovable", szDrive); ! 58: #endif // DEBUG ! 59: ! 60: AnsiUpperBuff(szDrive, 1); ! 61: ! 62: return(FIsRemoveDrive(*szDrive - 'A' + 1)); ! 63: } ! 64: ! 65: ! 66: // ************************************************************************* ! 67: INT IsDriveNetwork(LPSTR szDrive) ! 68: { ! 69: CHAR ch; ! 70: ! 71: #ifdef DEBUG ! 72: if (FValidDrive(szDrive) == 0) ! 73: BadArgErr(1, "IsDriveNetwork", szDrive); ! 74: #endif // DEBUG ! 75: ! 76: ch = *szDrive; ! 77: AnsiUpperBuff(&ch, 1); ! 78: ! 79: return(FIsRemoteDrive(ch - 'A' + 1)); ! 80: } ! 81: ! 82: ! 83: // ************************************************************************* ! 84: LONG GetTotalSpaceForDrive(LPSTR szDrive) ! 85: { ! 86: LONG totalspc; ! 87: #ifdef DEBUG ! 88: if (FValidDrive(szDrive) == 0) ! 89: BadArgErr(1, "GetTotalSpaceForDrive", szDrive); ! 90: #endif // DEBUG ! 91: ! 92: AnsiUpperBuff(szDrive, 1); ! 93: totalspc=LcbTotalDrive(*szDrive - 'A' + 1); ! 94: return(totalspc); ! 95: } ! 96: ! 97: ! 98: // ************************************************************************* ! 99: LONG GetFreeSpaceForDrive(LPSTR szDrive) ! 100: { ! 101: CHAR ch; ! 102: LONG freespc; ! 103: ! 104: #ifdef DEBUG ! 105: if (FValidDrive(szDrive) == 0) ! 106: BadArgErr(1, "GetFreeSpaceForDrive", szDrive); ! 107: #endif // DEBUG ! 108: ! 109: ch = *szDrive; ! 110: AnsiUpperBuff(&ch, 1); ! 111: ! 112: freespc = LcbFreeDrive(ch - 'A' + 1); ! 113: return(freespc); ! 114: } ! 115: ! 116: ! 117: // ************************************************************************* ! 118: void GetValidDrivesList(LPSTR szSymbol) ! 119: { ! 120: #ifdef DEBUG ! 121: if (FEmptySz(szSymbol)) ! 122: BadArgErr(1, "GetValidDrivesList", szSymbol); ! 123: #endif // DEBUG ! 124: ! 125: if (FGetValidDrivesList(szSymbol) == 0) ! 126: { ! 127: #ifdef DEBUG ! 128: StfApiErr(saeFail, "GetValidDrivesList", szSymbol); ! 129: #endif // DEBUG ! 130: SetupError(STFERR); ! 131: } ! 132: } ! 133: ! 134: ! 135: // ************************************************************************* ! 136: void GetLocalHardDrivesList(LPSTR szSymbol) ! 137: { ! 138: #ifdef DEBUG ! 139: if (FEmptySz(szSymbol)) ! 140: BadArgErr(1, "GetLocalHardDrivesList", szSymbol); ! 141: #endif // DEBUG ! 142: ! 143: if (FGetLocalHardDrivesList(szSymbol) == 0) ! 144: { ! 145: #ifdef DEBUG ! 146: StfApiErr(saeFail, "GetLocalHardDrivesList", szSymbol); ! 147: #endif // DEBUG ! 148: SetupError(STFERR); ! 149: } ! 150: } ! 151: ! 152: ! 153: #ifndef STF_LITE ! 154: // ************************************************************************* ! 155: void GetRemovableDrivesList(LPSTR szSymbol) ! 156: { ! 157: #ifdef DEBUG ! 158: if (FEmptySz(szSymbol)) ! 159: BadArgErr(1, "GetRemovableDrivesList", szSymbol); ! 160: #endif // DEBUG ! 161: ! 162: if (FGetRemovableDrivesList(szSymbol) == 0) ! 163: { ! 164: #ifdef DEBUG ! 165: StfApiErr(saeFail, "GetRemovableDrivesList", szSymbol); ! 166: #endif // DEBUG ! 167: SetupError(STFERR); ! 168: } ! 169: } ! 170: ! 171: #endif /* !STF_LITE */ ! 172: ! 173: // ************************************************************************* ! 174: void GetNetworkDrivesList(LPSTR szSymbol) ! 175: { ! 176: #ifdef DEBUG ! 177: if (FEmptySz(szSymbol)) ! 178: BadArgErr(1, "GetNetworkDrivesList", szSymbol); ! 179: #endif // DEBUG ! 180: ! 181: if (FGetNetworkDrivesList(szSymbol) == 0) ! 182: { ! 183: #ifdef DEBUG ! 184: StfApiErr(saeFail, "GetNetworkDrivesList", szSymbol); ! 185: #endif // DEBUG ! 186: SetupError(STFERR); ! 187: } ! 188: } ! 189: ! 190: ! 191: #ifndef STF_LITE ! 192: // ************************************************************************* ! 193: INT GetDOSMajorVersion(void) ! 194: { ! 195: #ifndef WIN32 ! 196: return(WGetDOSMajorVersion()); ! 197: #else ! 198: return(0); ! 199: #endif ! 200: } ! 201: ! 202: ! 203: // ************************************************************************* ! 204: INT GetDOSMinorVersion(void) ! 205: { ! 206: #ifndef WIN32 ! 207: return(WGetDOSMinorVersion()); ! 208: #else ! 209: return(0); ! 210: #endif ! 211: } ! 212: ! 213: ! 214: // ************************************************************************* ! 215: LPSTR GetEnvVariableValue(LPSTR szEnvVar, LPSTR szBuf, INT cbBuf) ! 216: { ! 217: INT cbRet; ! 218: ! 219: if ((szBuf != NULL) && (cbBuf > 0)) ! 220: *szBuf = '\0'; ! 221: ! 222: #ifdef DEBUG ! 223: if (FEmptySz(szEnvVar)) ! 224: BadArgErr(1, "GetEnvVariableValue", szEnvVar); ! 225: #endif // DEBUG ! 226: ! 227: cbRet = CbGetEnvVariableValue(szEnvVar, szBuf, cbBuf); ! 228: ! 229: if (cbRet >= cbBuf) ! 230: { ! 231: #ifdef DEBUG ! 232: StfApiErr(saeOvfl, "GetEnvVariableValue", szEnvVar); ! 233: #endif // DEBUG ! 234: SetupError(STFERR); ! 235: } ! 236: ! 237: return(szBuf); ! 238: } ! 239: ! 240: ! 241: // ************************************************************************* ! 242: INT GetNumWinApps(void) ! 243: { ! 244: #ifndef WIN32 ! 245: return(WGetNumWinApps()); ! 246: #else ! 247: return(0); ! 248: #endif ! 249: } ! 250: #endif /* !STF_LITE */ ! 251: ! 252: ! 253: // ************************************************************************* ! 254: INT DoesFileExist(LPSTR szFileName, INT mode) ! 255: { ! 256: if (FValidPath(szFileName) == 0) ! 257: return(0); ! 258: ! 259: return(FDoesFileExist(szFileName, mode)); ! 260: } ! 261: ! 262: ! 263: // ************************************************************************* ! 264: LPSTR GetDateOfFile(LPSTR szFile, LPSTR szBuf, INT cbBuf) ! 265: { ! 266: INT cbRet; ! 267: ! 268: #ifdef DEBUG ! 269: if (FValidPath(szFile) == 0) ! 270: BadArgErr(1, "GetDateOfFile", szFile); ! 271: #endif // DEBUG ! 272: ! 273: cbRet = CbGetDateOfFile(szFile, szBuf, cbBuf); ! 274: ! 275: if (cbRet >= cbBuf) ! 276: { ! 277: #ifdef DEBUG ! 278: StfApiErr(saeOvfl, "GetDateOfFile", szFile); ! 279: #endif // DEBUG ! 280: SetupError(STFERR); ! 281: } ! 282: ! 283: return(szBuf); ! 284: } ! 285: ! 286: ! 287: // ************************************************************************* ! 288: INT GetYearFromDate(LPSTR szDate) ! 289: { ! 290: CHAR szYear[5]; ! 291: ! 292: #ifdef DEBUG ! 293: if (FEmptySz(szDate)) ! 294: BadArgErr(1, "GetYearFromDate", szDate); ! 295: #endif // DEBUG ! 296: ! 297: lstrncpy(szYear, szDate, 4); ! 298: ! 299: return(atoi(szYear)); ! 300: } ! 301: ! 302: ! 303: // ************************************************************************* ! 304: INT GetMonthFromDate(LPSTR szDate) ! 305: { ! 306: CHAR szMonth[3]; ! 307: ! 308: #ifdef DEBUG ! 309: if (FEmptySz(szDate)) ! 310: BadArgErr(1, "GetMonthFromDate", szDate); ! 311: #endif // DEBUG ! 312: ! 313: lstrncpy(szMonth, szDate + 5, 2); ! 314: ! 315: return(atoi(szMonth)); ! 316: } ! 317: ! 318: ! 319: // ************************************************************************* ! 320: INT GetDayFromDate(LPSTR szDate) ! 321: { ! 322: CHAR szDay[3]; ! 323: ! 324: #ifdef DEBUG ! 325: if (FEmptySz(szDate)) ! 326: BadArgErr(1, "GetDayFromDate", szDate); ! 327: #endif // DEBUG ! 328: ! 329: lstrncpy(szDay, szDate + 8, 2); ! 330: ! 331: return(atoi(szDay)); ! 332: } ! 333: ! 334: #ifndef STF_LITE ! 335: ! 336: // ************************************************************************* ! 337: INT GetHourFromDate(LPSTR szDate) ! 338: { ! 339: CHAR szHour[2]; ! 340: ! 341: #ifdef DEBUG ! 342: if (FEmptySz(szDate)) ! 343: BadArgErr(1, "GetHourFromDate", szDate); ! 344: #endif // DEBUG ! 345: ! 346: lstrncpy(szHour, szDate + 11, 2); ! 347: ! 348: return(atoi(szHour)); ! 349: } ! 350: ! 351: ! 352: // ************************************************************************* ! 353: INT GetMinuteFromDate(LPSTR szDate) ! 354: { ! 355: CHAR szMinute[3]; ! 356: ! 357: #ifdef DEBUG ! 358: if (FEmptySz(szDate)) ! 359: BadArgErr(1, "GetMinuteFromDate", szDate); ! 360: #endif // DEBUG ! 361: ! 362: lstrncpy(szMinute, szDate + 14, 2); ! 363: ! 364: return(atoi(szMinute)); ! 365: } ! 366: ! 367: ! 368: // ************************************************************************* ! 369: INT GetSecondFromDate(LPSTR szDate) ! 370: { ! 371: CHAR szSecond[3]; ! 372: ! 373: #ifdef DEBUG ! 374: if (FEmptySz(szDate)) ! 375: BadArgErr(1, "GetSecondFromDate", szDate); ! 376: #endif // DEBUG ! 377: ! 378: lstrncpy(szSecond, szDate + 17, 2); ! 379: ! 380: return(atoi(szSecond)); ! 381: } ! 382: ! 383: ! 384: // ************************************************************************* ! 385: LPSTR GetVersionOfFile(LPSTR szFile, LPSTR szBuf, INT cbBuf) ! 386: { ! 387: INT cbRet; ! 388: ! 389: if (szBuf != NULL && cbBuf > 0) ! 390: *szBuf = '\0'; ! 391: ! 392: #ifdef DEBUG ! 393: if (FValidPath(szFile) == 0) ! 394: BadArgErr(1, "GetVersionOfFile", szFile); ! 395: #endif // DEBUG ! 396: ! 397: cbRet = CbGetVersionOfFile(szFile, szBuf, cbBuf); ! 398: ! 399: if (cbRet >= cbBuf) ! 400: { ! 401: #ifdef DEBUG ! 402: StfApiErr(saeOvfl, "GetVersionOfFile", szFile); ! 403: #endif // DEBUG ! 404: SetupError(STFERR); ! 405: } ! 406: ! 407: return(szBuf); ! 408: } ! 409: ! 410: ! 411: // ************************************************************************* ! 412: LONG GetVersionNthField(LPSTR szVersion, INT nField) ! 413: { ! 414: #ifdef DEBUG ! 415: CHAR szField[cchNum]; ! 416: ! 417: if ((nField < 1) || (nField > 4)) ! 418: { ! 419: wsprintf(szField, "%d", nField); ! 420: BadArgErr(2, "GetVersionNthField",SzCat2Str(szVersion,", ",szField)); ! 421: } ! 422: #endif // DEBUG ! 423: ! 424: return(LGetVersionNthField(szVersion, nField)); ! 425: } ! 426: #endif /* !STF_LITE */ ! 427: ! 428: ! 429: // ************************************************************************* ! 430: LONG GetSizeOfFile(LPSTR szFile) ! 431: { ! 432: #ifdef DEBUG ! 433: if (FValidPath(szFile) == 0) ! 434: BadArgErr(1, "GetSizeOfFile", szFile); ! 435: #endif // DEBUG ! 436: ! 437: return(LcbGetSizeOfFile(szFile)); ! 438: } ! 439: ! 440: ! 441: #ifndef STF_LITE ! 442: // ************************************************************************* ! 443: LPSTR FindTargetOnEnvVar(LPSTR szFile, LPSTR szEnvVar, LPSTR szBuf, ! 444: INT cbBuf) ! 445: { ! 446: INT cbRet; ! 447: #ifdef DEBUG ! 448: INT n; ! 449: #endif /* DEBUG */ ! 450: ! 451: if (szBuf != NULL && cbBuf > 0) ! 452: *szBuf = '\0'; ! 453: ! 454: #ifdef DEBUG ! 455: if (CchlValidSubPath(szFile) == 0) ! 456: n = 1; ! 457: else if (FEmptySz(szEnvVar)) ! 458: n = 2; ! 459: else ! 460: n = 0; ! 461: if (n > 0) ! 462: BadArgErr(n, "FindTargetOnEnvVar",SzCat2Str(szFile,", ",szEnvVar)); ! 463: #endif // DEBUG ! 464: ! 465: cbRet = CbFindTargetOnEnvVar(szFile, szEnvVar, szBuf, cbBuf); ! 466: ! 467: if (cbRet >= cbBuf) ! 468: { ! 469: #ifdef DEBUG ! 470: StfApiErr(saeOvfl,"FindTargetOnEnvVar",SzCat2Str(szFile,", ",szEnvVar)); ! 471: #endif // DEBUG ! 472: SetupError(STFERR); ! 473: } ! 474: ! 475: return(szBuf); ! 476: } ! 477: ! 478: ! 479: // ************************************************************************* ! 480: LPSTR FindFileInTree(LPSTR szFile, LPSTR szDir, LPSTR szBuf, ! 481: INT cbBuf) ! 482: { ! 483: INT cbRet; ! 484: #ifdef DEBUG ! 485: INT n; ! 486: ! 487: if (CchlValidSubPath(szFile) == 0) ! 488: n = 1; ! 489: else if (FValidDir(szDir) == 0) ! 490: n = 2; ! 491: else ! 492: n = 0; ! 493: if (n > 0) ! 494: BadArgErr(n, "FindFileInTree",SzCat2Str(szFile,", ",szDir)); ! 495: #endif // DEBUG ! 496: ! 497: cbRet = CbFindFileInTree(szFile, szDir, szBuf, cbBuf); ! 498: ! 499: if (cbRet >= cbBuf) ! 500: { ! 501: #ifdef DEBUG ! 502: StfApiErr(saeOvfl, "FindFileInTree",SzCat2Str(szFile,", ",szDir)); ! 503: #endif // DEBUG ! 504: SetupError(STFERR); ! 505: } ! 506: ! 507: return(szBuf); ! 508: } ! 509: ! 510: ! 511: #ifdef WIN16 ! 512: // ************************************************************************* ! 513: INT GetConfigSmartdrvSize(void) ! 514: { ! 515: return(WGetConfigSmartdrvSize()); ! 516: } ! 517: ! 518: ! 519: // ************************************************************************* ! 520: INT GetConfigRamdriveSize(void) ! 521: { ! 522: return(WGetConfigRamdriveSize()); ! 523: } ! 524: ! 525: ! 526: // ************************************************************************* ! 527: INT GetConfigNumBuffers(void) ! 528: { ! 529: return(WGetConfigNumBuffers()); ! 530: } ! 531: ! 532: ! 533: // ************************************************************************* ! 534: INT GetConfigNumFiles(void) ! 535: { ! 536: return(WGetConfigNumFiles()); ! 537: } ! 538: ! 539: ! 540: // ************************************************************************* ! 541: LPSTR GetConfigLastDrive(LPSTR szBuf, INT cbBuf) ! 542: { ! 543: INT chRet = WGetConfigLastDrive(); ! 544: ! 545: if (chRet == 0) ! 546: lstrcpy(szBuf, ""); ! 547: else ! 548: wsprintf(szBuf, "%c", chRet); ! 549: ! 550: return(szBuf); ! 551: } ! 552: #endif ! 553: ! 554: // ************************************************************************* ! 555: INT IsDriverInConfig(LPSTR szDrv) ! 556: { ! 557: #ifdef DEBUG ! 558: if (FEmptySz(szDrv)) ! 559: BadArgErr(1, "IsDriverInConfig", szDrv); ! 560: #endif // DEBUG ! 561: ! 562: return(FIsDriverInConfig(szDrv)); ! 563: } ! 564: ! 565: ! 566: // ************************************************************************* ! 567: INT GetProcessorType(void) ! 568: { ! 569: #if defined(WIN16) ! 570: LONG longTmp = GetWinFlags(); ! 571: ! 572: if (longTmp && WF_CPUR4000) ! 573: return(5); ! 574: else if (longTmp && WF_CPU486) ! 575: return(4); ! 576: else if (longTmp && WF_CPU386) ! 577: return(3); ! 578: else if (longTmp && WF_CPU286) ! 579: return(2); ! 580: else if (longTmp && WF_CPU186) ! 581: return(1); ! 582: else ! 583: return(0); ! 584: #elif defined(WIN32) ! 585: CHAR szResult[32]; ! 586: unsigned cb=32; ! 587: ! 588: if (FGetProcessorType("", 0, szResult, cb)) { ! 589: if (lstrcmpi(szResult, "C400") == 0) ! 590: return(400) ; ! 591: if (lstrcmpi(szResult, "AXP21064") == 0) ! 592: return(21064) ; ! 593: if (lstrcmpi(szResult, "R4000") == 0) ! 594: return(4000) ; ! 595: if (lstrcmpi(szResult, "R3000") == 0) ! 596: return(3000) ; ! 597: if (lstrcmpi(szResult, "R2000") == 0) ! 598: return(2000) ; ! 599: if (lstrcmpi(szResult, "80486") == 0) ! 600: return(4) ; ! 601: if (lstrcmpi(szResult, "80386") == 0) ! 602: return(3) ; ! 603: if (lstrcmpi(szResult, "80286") == 0) ! 604: return(2) ; ! 605: if (lstrcmpi(szResult, "80186") == 0) ! 606: return(1) ; ! 607: if (lstrcmpi(szResult, "8086") == 0) ! 608: return(0); ! 609: } ! 610: else ! 611: return(0); ! 612: #endif ! 613: } ! 614: ! 615: ! 616: // ************************************************************************* ! 617: void GetParallelPortsList(LPSTR szSymbol) ! 618: { ! 619: #ifdef DEBUG ! 620: if (FEmptySz(szSymbol)) ! 621: BadArgErr(1, "GetParallelPortsList", szSymbol); ! 622: #endif // DEBUG ! 623: ! 624: if (FGetParallelPortsList(szSymbol) == 0) ! 625: { ! 626: #ifdef DEBUG ! 627: StfApiErr(saeFail, "GetParallelPortsList", szSymbol); ! 628: #endif // DEBUG ! 629: SetupError(STFERR); ! 630: } ! 631: } ! 632: ! 633: ! 634: // ************************************************************************* ! 635: void GetSerialPortsList(LPSTR szSymbol) ! 636: { ! 637: #ifdef DEBUG ! 638: if (FEmptySz(szSymbol)) ! 639: BadArgErr(1, "GetSerialPortsList", szSymbol); ! 640: #endif // DEBUG ! 641: ! 642: if (FGetSerialPortsList(szSymbol) == 0) ! 643: { ! 644: #ifdef DEBUG ! 645: StfApiErr(saeFail, "GetSerialPortsList", szSymbol); ! 646: #endif // DEBUG ! 647: SetupError(STFERR); ! 648: } ! 649: } ! 650: ! 651: ! 652: // ************************************************************************* ! 653: INT Has87MathChip(void) ! 654: { ! 655: return(FHas87MathChip()); ! 656: } ! 657: ! 658: #ifdef WIN32 ! 659: INT HasFPPMathChip(void) ! 660: { ! 661: return(FHas87MathChip()); ! 662: } ! 663: #endif ! 664: ! 665: // ************************************************************************* ! 666: INT HasMonochromeDisplay(void) ! 667: { ! 668: return(FHasMonochromeDisplay()); ! 669: } ! 670: ! 671: ! 672: // ************************************************************************* ! 673: INT HasMouseInstalled(void) ! 674: { ! 675: return(FHasMouseInstalled()); ! 676: } ! 677: #endif /* !STF_LITE */ ! 678: ! 679: ! 680: // ************************************************************************* ! 681: INT DoesDirExist(LPSTR szDir) ! 682: { ! 683: #ifdef DEBUG ! 684: if (FValidDir(szDir) == 0) ! 685: BadArgErr(1, "DoesDirExist", szDir); ! 686: #endif // DEBUG ! 687: ! 688: return(FDirExists(szDir)); ! 689: } ! 690: ! 691: ! 692: #ifndef STF_LITE ! 693: // ************************************************************************* ! 694: INT DoesIniSectionExist(LPSTR szFile, LPSTR szSect) ! 695: { ! 696: #ifdef DEBUG ! 697: if (FValidIniFile(szFile) == 0) ! 698: BadArgErr(1, "DoesIniSectionExist",SzCat2Str(szFile,", ",szSect)); ! 699: #endif // DEBUG ! 700: ! 701: return(FDoesIniSectionExist(szFile, szSect)); ! 702: } ! 703: ! 704: ! 705: // ************************************************************************* ! 706: INT DoesIniKeyExist(LPSTR szFile, LPSTR szSect, LPSTR szKey) ! 707: { ! 708: #ifdef DEBUG ! 709: INT n; ! 710: LPSTR szTmp; ! 711: ! 712: if (FValidIniFile(szFile) == 0) ! 713: n = 1; ! 714: else if (FEmptySz(szKey)) ! 715: n = 3; ! 716: else ! 717: n = 0; ! 718: if (n > 0) ! 719: { ! 720: szTmp = SzCat3Str(szFile, ", ", szSect, ", "); ! 721: BadArgErr(n, "DoesIniKeyExist",SzCatStr(szTmp, szKey)); ! 722: } ! 723: #endif // DEBUG ! 724: ! 725: return(FDoesIniKeyExist(szFile, szSect, szKey)); ! 726: } ! 727: #endif /* !STF_LITE */ ! 728: ! 729: ! 730: // ************************************************************************* ! 731: LPSTR GetIniKeyString(LPSTR szFile, LPSTR szSect, LPSTR szKey, ! 732: LPSTR szBuf, INT cbBuf) ! 733: { ! 734: INT cbRet; ! 735: #ifdef DEBUG ! 736: INT n; ! 737: LPSTR szTmp; ! 738: #endif // DEBUG ! 739: ! 740: if (szBuf != NULL && cbBuf > 0) ! 741: *szBuf = '\0'; ! 742: ! 743: #ifdef DEBUG ! 744: if (FValidIniFile(szFile) == 0) ! 745: n = 1; ! 746: else if (FEmptySz(szKey)) ! 747: n = 3; ! 748: else ! 749: n = 0; ! 750: if (n > 0) ! 751: { ! 752: szTmp = SzCat3Str(szFile, ", ", szSect, ", "); ! 753: BadArgErr(n, "GetIniKeyString", SzCatStr(szTmp, szKey)); ! 754: } ! 755: #endif // DEBUG ! 756: ! 757: cbRet = CbGetIniKeyString(szFile, szSect, szKey, szBuf, cbBuf); ! 758: ! 759: if (cbRet >= cbBuf) ! 760: { ! 761: #ifdef DEBUG ! 762: szTmp = SzCat3Str(szFile, ", ", szSect, ", "); ! 763: StfApiErr(saeOvfl, "GetIniKeyString",SzCatStr(szTmp,szKey)); ! 764: #endif // DEBUG ! 765: SetupError(STFERR); ! 766: } ! 767: ! 768: return(szBuf); ! 769: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.