|
|
1.1 ! root 1: '************************************************************************** ! 2: '******************************* Windows API's ************************** ! 3: '************************************************************************** ! 4: GLOBAL hSetup AS INTEGER ! 5: GLOBAL fFrameInit AS INTEGER ! 6: GLOBAL fInstallInit AS INTEGER ! 7: ! 8: CONST SM_CXSCREEN = 0 ! 9: CONST SM_CYSCREEN = 1 ! 10: ! 11: CONST WF_80x87 = 1024 ! 12: CONST WF_CPU186 = 128 ! 13: CONST WF_CPU286 = 2 ! 14: CONST WF_CPU386 = 4 ! 15: CONST WF_CPU486 = 8 ! 16: CONST WF_STANDARD = 16 ! 17: CONST WF_ENHANCED = 32 ! 18: ! 19: ! 20: '' DoMsgBox Flags ! 21: ! 22: CONST MB_OK = 0 ! 23: CONST MB_ICONHAND = 16 ! 24: CONST MB_TASKMODAL = 8192 ! 25: ! 26: ! 27: DECLARE FUNCTION DoMsgBox LIB "mscomstf.dll" (lpText$,lpCaption$,wType%) As INTEGER ! 28: DECLARE FUNCTION GetWindowsDirectory LIB "kernel" (szBuf$, cbBuf%) AS INTEGER ! 29: DECLARE FUNCTION GetSystemDirectory LIB "kernel" (szBuf$, cbBuf%) AS INTEGER ! 30: DECLARE FUNCTION GetProfileString LIB "kernel" (szSect$, szKey$, szDefault$, szBuf$, cbBuf%) AS INTEGER ! 31: DECLARE FUNCTION GetVersion LIB "kernel" AS INTEGER ! 32: DECLARE FUNCTION GetSystemMetrics LIB "user" (nIndex%) AS INTEGER ! 33: DECLARE FUNCTION GetWinFlags LIB "kernel" AS LONG ! 34: ! 35: ! 36: ! 37: ! 38: '************************************************************************** ! 39: '****************************** Setup Constants *************************** ! 40: '************************************************************************** ! 41: ! 42: ! 43: ''Command Option Flags ! 44: ! 45: CONST cmoVital = 1 ! 46: CONST cmoCopy = 2 ! 47: CONST cmoUndo = 4 ! 48: CONST cmoRoot = 8 ! 49: CONST cmoDecompress = 16 ! 50: CONST cmoTimeStamp = 32 ! 51: CONST cmoReadOnly = 64 ! 52: CONST cmoBackup = 128 ! 53: CONST cmoForce = 256 ! 54: CONST cmoRemove = 512 ! 55: CONST cmoOverwrite = 1024 ! 56: CONST cmoAppend = 2048 ! 57: CONST cmoPrepend = 4096 ! 58: CONST cmoNone = 0 ! 59: CONST cmoAll = 65535 ! 60: ! 61: ! 62: ''File Exist Modes ! 63: ! 64: CONST femExists = 0 ! 65: CONST femRead = 1 ! 66: CONST femWrite = 2 ! 67: CONST femReadWrite = 3 ! 68: ! 69: ! 70: ''Read-Only Return Code ! 71: ! 72: CONST ynrcNo = 0 ! 73: CONST ynrcYes = 1 ! 74: CONST ynrcErr1 = 2 ! 75: CONST ynrcErr2 = 3 ! 76: CONST ynrcErr3 = 4 ! 77: CONST ynrcErr4 = 5 ! 78: CONST ynrcErr5 = 6 ! 79: CONST ynrcErr6 = 7 ! 80: CONST ynrcErr7 = 8 ! 81: CONST ynrcErr8 = 9 ! 82: CONST ynrcErr9 = 10 ! 83: ! 84: ! 85: ''General Return Codes ! 86: ! 87: CONST grcOkay = 0 ! 88: CONST grcNotOkay = 1 ! 89: CONST grcUserQuit = 48 ! 90: ! 91: ! 92: ''Ranges ! 93: ! 94: ''CONST cbSymValMax = 8192 ! 95: CONST cbSymValMax = 512 ! 96: ''REVIEW: symbol table will allow strings up to 8192 bytes ! 97: '' but we get Out of String Space wattdrvr error if we alloc ! 98: '' STRING$() that big. (See GetSymbolValue and GetListItem) ! 99: '' We should look into using dynamic far alloc instead of ! 100: '' STRING$ for large buffers. ! 101: '' NOTE: 8192 works okay with runtime wattdrvr, however. ! 102: ! 103: ! 104: ''ON ERROR Error Codes ! 105: CONST STFERR = 1024 ''setup system error ! 106: CONST STFQUIT = 1025 ''user quit ! 107: ! 108: CONST scmOff = 0 ! 109: CONST scmOnIgnore = 1 ! 110: CONST scmOnFatal = 2 ! 111: ! 112: ! 113: '************************************************************************** ! 114: '******************************** Setup API's *************************** ! 115: '************************************************************************** ! 116: ! 117: '' common ! 118: ! 119: DECLARE FUNCTION FParseFATPathIntoPieces LIB "mscomstf.dll" (szPath$, szVol$, cbVol%, szDir$, cbDir%, szFile$, cbFile%) AS INTEGER ! 120: DECLARE FUNCTION FOpenInf LIB "mscomstf.dll" (szFile$, fCheck%, fCheckSyms%) AS INTEGER ! 121: DECLARE FUNCTION FSetSilent LIB "mscomstf.dll" (mode%) AS INTEGER ! 122: DECLARE FUNCTION FSetBeepingMode LIB "mscomstf.dll" (mode%) AS INTEGER ! 123: DECLARE FUNCTION HShowWaitCursor LIB "msshlstf.dll" AS INTEGER ! 124: DECLARE FUNCTION FRestoreCursor LIB "msshlstf.dll" (hPrev%) AS INTEGER ! 125: DECLARE FUNCTION FOpenLogFile LIB "mscomstf.dll" (szFile$, fAppend%) AS INTEGER ! 126: DECLARE FUNCTION FCloseLogFile LIB "mscomstf.dll" AS INTEGER ! 127: DECLARE FUNCTION FWriteToLogFile LIB "mscomstf.dll" (sz$, fRequire%) AS INTEGER ! 128: DECLARE FUNCTION CbGetInfSectionKeyField LIB "mscomstf.dll" (szSect$, szKey$, iField%, szBuf$, cbBuf%) AS INTEGER ! 129: DECLARE FUNCTION FMakeListInfSectionField LIB "mscomstf.dll" (szSym$, szSect$, iField%) AS INTEGER ! 130: ! 131: ! 132: ''shell ! 133: ! 134: DECLARE FUNCTION FSetBitmap LIB "msshlstf.dll" (szDll$, Bitmap%) AS INTEGER ! 135: DECLARE FUNCTION FSetAbout LIB "msshlstf.dll" (szAbout1$, szAbout2$) AS INTEGER ! 136: DECLARE FUNCTION FDoDialog LIB "msuilstf.dll" (hwnd%, szDll$, Dlg%, szDlgProc$, HelpDlg%, szHelpProc$) AS INTEGER ! 137: DECLARE FUNCTION FKillNDialogs LIB "msuilstf.dll" (n%) AS INTEGER ! 138: DECLARE SUB SetWindowText LIB "User" (hwnd%, lpString$) ! 139: DECLARE FUNCTION FSetSymbolValue LIB "msshlstf.dll" (szSymbol$, szValue$) AS INTEGER ! 140: DECLARE FUNCTION FRemoveSymbol LIB "mscomstf.dll" (szSym$) AS INTEGER ! 141: DECLARE FUNCTION CbGetSymbolValue LIB "mscomstf.dll" (szSymbol$, szValue$, Length%) AS INTEGER ! 142: DECLARE FUNCTION UsGetListLength LIB "mscomstf.dll" (szSymbol$) AS INTEGER ! 143: DECLARE FUNCTION CbGetListItem LIB "mscomstf.dll" (szListSymbol$, n%, szListItem$, cbMax%) AS INTEGER ! 144: DECLARE FUNCTION FAddListItem LIB "mscomstf.dll" (szListSymbol$, szListItem$) AS INTEGER ! 145: DECLARE FUNCTION FReplaceListItem LIB "mscomstf.dll" (szListSymbol$, n%, szListItem$) AS INTEGER ! 146: DECLARE FUNCTION FSetSymbolToListOfInfKeys LIB "mscomstf.dll" (szSym$, szSect$, fNulls%) AS INTEGER ! 147: ! 148: ! 149: ''shell ! 150: ! 151: DECLARE FUNCTION InitializeFrame LIB "msshlstf.dll" (szCmdLine$) AS INTEGER ! 152: DECLARE FUNCTION HwndFrame LIB "msshlstf.dll" AS INTEGER ! 153: DECLARE FUNCTION HinstFrame LIB "msshlstf.dll" AS INTEGER ! 154: ! 155: ! 156: ! 157: ''install ! 158: ! 159: DECLARE SUB ProSetPos LIB "msinsstf.dll" (x%, y%) ! 160: DECLARE FUNCTION FCreateDir LIB "msinsstf.dll" (szDir$, cmo%) AS INTEGER ! 161: DECLARE FUNCTION FRemoveDir LIB "msinsstf.dll" (szDir$, cmo%) AS INTEGER ! 162: DECLARE FUNCTION FAddSectionFilesToCopyList LIB "mscomstf.dll" (szSect$, szSrc$, szDest$) AS INTEGER ! 163: DECLARE FUNCTION FAddSectionKeyFileToCopyList LIB "mscomstf.dll" (szSect$, szKey$, szSrc$, szDest$) AS INTEGER ! 164: DECLARE FUNCTION FAddSpecialFileToCopyList LIB "mscomstf.dll" (szSect$, szKey$, szSrc$, szDest$) AS INTEGER ! 165: DECLARE FUNCTION GrcCopyFilesInCopyList LIB "msinsstf.dll" (hInstance%) AS INTEGER ! 166: DECLARE FUNCTION FRemoveIniSection LIB "msinsstf.dll" (szFile$, szSect$, cmo%) AS INTEGER ! 167: DECLARE FUNCTION FCreateIniKeyValue LIB "msinsstf.dll" (szFile$, szSect$, szKey$, szValue$, cmo%) AS INTEGER ! 168: DECLARE FUNCTION FRemoveIniKey LIB "msinsstf.dll" (szFile$, szSect$, szKey$, cmo%) AS INTEGER ! 169: DECLARE FUNCTION FCreateSysIniKeyValue LIB "msinsstf.dll" (szFile$, szSect$, szKey$, szValue$, cmo%) AS INTEGER ! 170: DECLARE FUNCTION FCreateProgManGroup LIB "msinsstf.dll" (szGroup$, szPath$, cmo%) AS INTEGER ! 171: DECLARE FUNCTION FCreateProgManItem LIB "msinsstf.dll" (szGroup$, szItem$, szCmd$, cmo%) AS INTEGER ! 172: DECLARE FUNCTION FShowProgManGroup LIB "msinsstf.dll" (szGroup$, szCmd$, cmo%) AS INTEGER ! 173: DECLARE FUNCTION FStampResource LIB "msinsstf.dll" (szSect$, szKey$, szDst$, wResType%, wResId%, szData$, cbData%) AS INTEGER ! 174: DECLARE FUNCTION FDumpCopyListToFile LIB "msinsstf.dll" (szFile$) AS INTEGER ! 175: DECLARE SUB ResetCopyList LIB "msinsstf.dll" ! 176: DECLARE FUNCTION LcbGetCopyListCost LIB "msinsstf.dll" (szExtraList$, szCostList$, szNeedList$) AS LONG ! 177: DECLARE FUNCTION FAddDos5Help LIB "msinsstf.dll" (szProgName$, szProgHelp$, cmo%) AS INTEGER ! 178: DECLARE FUNCTION FCopyOneFile LIB "msinsstf.dll" (szSrc$, szDest$, cmo%, fAppend%) AS INTEGER ! 179: DECLARE FUNCTION YnrcRemoveFile LIB "msinsstf.dll" (szFullPathSrc$, cmo%) AS INTEGER ! 180: DECLARE FUNCTION YnrcBackupFile LIB "msinsstf.dll" (szFullPath$, szBackup$, cmo%) AS INTEGER ! 181: DECLARE FUNCTION FInitializeInstall LIB "msinsstf.dll" (hinst%, hwndFrame%) AS INTEGER ! 182: DECLARE FUNCTION WFindFileUsingFileOpen LIB "msinsstf.dll" (szFile$, szBuf$, cbBuf%) AS INTEGER ! 183: DECLARE FUNCTION FIsDirWritable LIB "msinsstf.dll" (szDir$) AS INTEGER ! 184: DECLARE FUNCTION FIsFileWritable LIB "msinsstf.dll" (szFile$) AS INTEGER ! 185: DECLARE FUNCTION FAddToBillboardList LIB "msinsstf.dll" (szDll$, idDlg%, szProc$, lTicks&) AS INTEGER ! 186: DECLARE FUNCTION FClearBillboardList LIB "msinsstf.dll" AS INTEGER ! 187: DECLARE FUNCTION FSetRestartDir LIB "msinsstf.dll" (szDir$) AS INTEGER ! 188: DECLARE FUNCTION FRestartListEmpty LIB "msinsstf.dll" AS INTEGER ! 189: DECLARE FUNCTION FExitExecRestart LIB "msinsstf.dll" AS INTEGER ! 190: DECLARE FUNCTION SetCopyMode LIB "msinsstf.dll" (fMode%) AS INTEGER ! 191: DECLARE FUNCTION GetCopyMode LIB "msinsstf.dll" AS INTEGER ! 192: DECLARE FUNCTION SetDecompMode LIB "msinsstf.dll" (fMode%) AS INTEGER ! 193: DECLARE FUNCTION GetDecompMode LIB "msinsstf.dll" AS INTEGER ! 194: DECLARE FUNCTION SetSizeCheckMode LIB "msinsstf.dll" (scmMode%) AS INTEGER ! 195: DECLARE FUNCTION FPrependToPath LIB "msinsstf.dll" (szSrc$, szDst$, szDir$, cmo%) AS INTEGER ! 196: ! 197: DECLARE FUNCTION SetTimeValue LIB "msinsstf.dll" (usHours%, usMinutes%, usSeconds%) AS INTEGER ! 198: ! 199: ! 200: ! 201: '************************************************************************* ! 202: '**************** Setup Basic Wrapper Declarations ********************* ! 203: '************************************************************************* ! 204: ! 205: ! 206: ''shell ! 207: ! 208: DECLARE SUB SetBitmap(szDll$, Bitmap%) ! 209: DECLARE SUB SetAbout(szAbout1$, szAbout2$) ! 210: DECLARE FUNCTION UIStartDlg(szDll$, Dlg%, szDlgProc$, HelpDlg%, szHelpProc$) AS STRING ! 211: DECLARE SUB UIPop (n%) ! 212: DECLARE SUB UIPopAll ! 213: DECLARE SUB SetTitle (sz$) ! 214: DECLARE SUB ReadInfFile (szFile$) ! 215: DECLARE SUB SetSymbolValue (szSymbol$, szValue$) ! 216: DECLARE SUB RemoveSymbol (szSym$) ! 217: DECLARE FUNCTION GetSymbolValue (szSymbol$) AS STRING ! 218: DECLARE FUNCTION GetListLength(szSymbol$) AS INTEGER ! 219: DECLARE SUB MakeListFromSectionKeys (szSymbol$, szSect$) ! 220: DECLARE FUNCTION GetListItem(szSymbol$, n%) AS STRING ! 221: DECLARE SUB AddListItem(szSymbol$, szItem$) ! 222: DECLARE SUB ReplaceListItem(szSymbol$, n%, szItem$) ! 223: ! 224: DECLARE FUNCTION InitFrame (szCmdLine$) AS INTEGER ! 225: DECLARE FUNCTION InitSetup (szCmdLine$) AS INTEGER ! 226: ! 227: DECLARE FUNCTION ShowWaitCursor AS INTEGER ! 228: DECLARE SUB RestoreCursor (hPrev%) ! 229: ! 230: DECLARE FUNCTION SetBeepingMode (mode%) AS INTEGER ! 231: DECLARE FUNCTION SetSilentMode (mode%) AS INTEGER ! 232: ! 233: DECLARE FUNCTION GetSectionKeyDate (szSect$, szKey$) AS STRING ! 234: DECLARE FUNCTION GetSectionKeyFilename (szSect$, szKey$) AS STRING ! 235: DECLARE FUNCTION GetSectionKeySize (szSect$, szKey$) AS LONG ! 236: DECLARE FUNCTION GetSectionKeyVersion (szSect$, szKey$) AS STRING ! 237: ! 238: DECLARE SUB MakeListFromSectionDate (szSym$, szSect$) ! 239: DECLARE SUB MakeListFromSectionFilename (szSym$, szSect$) ! 240: DECLARE SUB MakeListFromSectionSize (szSym$, szSect$) ! 241: DECLARE SUB MakeListFromSectionVersion (szSym$, szSect$) ! 242: ! 243: ! 244: ''install ! 245: ! 246: ! 247: DECLARE SUB CreateDir (szDir$, cmo%) ! 248: DECLARE SUB RemoveDir (szDir$, cmo%) ! 249: DECLARE SUB AddSectionFilesToCopyList (szSect$, szSrc$, szDest$) ! 250: DECLARE SUB AddSectionKeyFileToCopyList (szSect$, szKey$, szSrc$, szDest$) ! 251: DECLARE SUB AddSpecialFileToCopyList (szSect$, szKey$, szSrc$, szDest$) ! 252: DECLARE SUB CopyFilesInCopyList ! 253: DECLARE SUB RemoveIniSection (szFile$, szSect$, cmo%) ! 254: DECLARE SUB CreateIniKeyValue (szFile$, szSect$, szKey$, szValue$, cmo%) ! 255: DECLARE SUB RemoveIniKey (szFile$, szSect$, szKey$, cmo%) ! 256: DECLARE SUB CreateSysIniKeyValue (szFile$, szSect$, szKey$, szValue$, cmo%) ! 257: DECLARE SUB CreateProgmanGroup (szGroup$, szPath$, cmo%) ! 258: DECLARE SUB CreateProgmanItem (szGroup$, szItem$, szCmd$, szOther$, cmo%) ! 259: DECLARE SUB ShowProgmanGroup (szGroup$, Cmd%, cmo%) ! 260: DECLARE SUB StampResource (szSect$, szKey$, szDst$, wResType%, wResId%, szData$, cbData%) ! 261: DECLARE SUB DumpCopyList (szFile$) ! 262: DECLARE SUB ClearCopyList ! 263: DECLARE FUNCTION GetCopyListCost (szExtraList$, szCostList$, szNeedList$) AS LONG ! 264: DECLARE SUB AddDos5Help (szProgName$, szProgHelp$, cmo%) ! 265: DECLARE SUB CopyFile (szFullPathSrc$, szFullPathDst$, cmo%, fAppend%) ! 266: DECLARE SUB RemoveFile (szFullPathSrc$, cmo%) ! 267: DECLARE SUB BackupFile (szFullPath$, szBackup$) ! 268: DECLARE SUB RenameFile (szFullPath$, szBackup$) ! 269: DECLARE SUB InitInstall ! 270: DECLARE SUB AddToBillboardList (szDll$, idDlg%, szProc$, lTicks&) ! 271: DECLARE SUB AddBlankToBillboardList (lTicks&) ! 272: DECLARE SUB ClearBillboardList ! 273: DECLARE SUB OpenLogFile (szFile$, fAppend%) ! 274: DECLARE SUB CloseLogFile ! 275: DECLARE SUB WriteToLogFile (szStr$) ! 276: DECLARE SUB SetCopyGaugePosition (x%, y%) ! 277: DECLARE SUB SetRestartDir(szDir$) ! 278: DECLARE FUNCTION RestartListEmpty AS INTEGER ! 279: DECLARE FUNCTION ExitExecRestart AS INTEGER ! 280: DECLARE FUNCTION FindFileUsingFileOpen (szFile$) AS STRING ! 281: DECLARE FUNCTION IsDirWritable (szDir$) AS INTEGER ! 282: DECLARE FUNCTION IsFileWritable (szFile$) AS INTEGER ! 283: DECLARE FUNCTION GetNthFieldFromIniString (szLine$, iField%) AS STRING ! 284: DECLARE SUB PrependToPath (szSrc$, szDst$, szDir$, cmo%) ! 285: ! 286: ! 287: '' Error Handling ! 288: ! 289: '$ifdef DEBUG ! 290: ! 291: '' Setup API Errors ! 292: CONST saeFail = 0 ! 293: CONST saeInit = 1 ! 294: CONST saeNYI = 3 ! 295: CONST saeArg = 4 ''must be max sae value ! 296: ! 297: DECLARE SUB StfApiErr (nMsg%, szApi$, szArgs$) ! 298: DECLARE SUB BadArgErr (nArg%, szApi$, szArgs$) ! 299: ! 300: '' chk arg ! 301: DECLARE FUNCTION FValidFATDir LIB "mscomstf.dll" (szDir$) AS INTEGER ! 302: DECLARE FUNCTION CchlValidFATSubPath LIB "mscomstf.dll" (szPath$) AS INTEGER ! 303: DECLARE FUNCTION FValidFATPath LIB "mscomstf.dll" (szPath$) AS INTEGER ! 304: DECLARE FUNCTION FValidDrive (szDrive$) AS INTEGER ! 305: ! 306: DECLARE FUNCTION FValidInfSect (szSect$) AS INTEGER ! 307: DECLARE FUNCTION FValidIniFile (szFile$) AS INTEGER ! 308: ! 309: '$endif ''DEBUG ! 310: ! 311: ! 312: ! 313: '' Windows system detect ! 314: ! 315: DECLARE FUNCTION GetWindowsMajorVersion AS INTEGER ! 316: DECLARE FUNCTION GetWindowsMinorVersion AS INTEGER ! 317: DECLARE FUNCTION GetWindowsMode AS INTEGER ! 318: DECLARE FUNCTION GetWindowsDir AS STRING ! 319: DECLARE FUNCTION GetWindowsSysDir AS STRING ! 320: DECLARE FUNCTION IsWindowsShared AS INTEGER ! 321: DECLARE FUNCTION GetScreenWidth AS INTEGER ! 322: DECLARE FUNCTION GetScreenHeight AS INTEGER ! 323: ! 324: ! 325: '************************************************************************* ! 326: '***************** Setup Basic Wrapper Definitions ********************* ! 327: '************************************************************************* ! 328: FUNCTION InitSetup(szCmdLine$) STATIC AS INTEGER ! 329: fFrameInit = 0 ! 330: fInstallInit = 0 ! 331: ! 332: IF hSetup > 0 THEN ! 333: '$ifdef DEBUG ! 334: StfApiErr saeInit, "InitSetup", szCmdLine$ ! 335: '$endif ''DEBUG ! 336: END IF ! 337: ! 338: i% = InitFrame(szCmdLine$) ! 339: fFrameInit = 1 ! 340: ! 341: InitInstall ! 342: fInstallInit = 1 ! 343: ! 344: InitSetup = i% ! 345: END FUNCTION ! 346: ! 347: ! 348: ! 349: '************************************************************************** ! 350: FUNCTION InitFrame(szCmdLine$) STATIC AS INTEGER ! 351: IF hSetup > 0 THEN ! 352: '$ifdef DEBUG ! 353: StfApiErr saeInit, "InitFrame", szCmdLine$ ! 354: '$endif ''DEBUG ! 355: ELSE ! 356: i% = InitializeFrame(szCmdLine$) ! 357: IF i% = -1 THEN ! 358: END '' NOT an error - Usage (/?) or Command line copy operation ! 359: ELSEIF i% = 0 THEN ! 360: '$ifdef DEBUG ! 361: StfApiErr saeFail, "InitFrame", szCmdLine$ ! 362: '$endif ''DEBUG ! 363: END ! 364: ELSE ! 365: InitFrame = i% ! 366: END IF ! 367: END IF ! 368: END FUNCTION ! 369: ! 370: ! 371: '************************************************************************** ! 372: SUB SetBitmap(szDll$, Bitmap%) STATIC ! 373: IF FSetBitmap(szDll$, Bitmap%) = 0 THEN ! 374: '$ifdef DEBUG ! 375: StfApiErr saeFail, "SetBitmap", szDll$+","+STR$(Bitmap%) ! 376: '$endif ''DEBUG ! 377: ERROR STFERR ! 378: END IF ! 379: END SUB ! 380: ! 381: ! 382: '************************************************************************** ! 383: SUB SetAbout(szAbout1$, szAbout2$) STATIC ! 384: IF FSetAbout(szAbout1$, szAbout2$) = 0 THEN ! 385: '$ifdef DEBUG ! 386: StfApiErr saeFail, "SetAbout", szAbout1$ + "," + szAbout2$ ! 387: '$endif ''DEBUG ! 388: ERROR STFERR ! 389: END IF ! 390: END SUB ! 391: ! 392: ! 393: '************************************************************************* ! 394: SUB SetTitle(sz$) STATIC ! 395: SetWindowText HwndFrame(), sz$ ! 396: END SUB ! 397: ! 398: ! 399: '************************************************************************* ! 400: SUB ReadInfFile (szFile$) STATIC ! 401: '$ifdef DEBUG ! 402: if FValidFATPath(szFile$) = 0 then ! 403: BadArgErr 1, "ReadInfFile", szFile$ ! 404: end if ! 405: IF FOpenInf(szFile$, 1, 1) = 0 THEN ! 406: StfApiErr saeFail, "ReadInfFile", szFile$ ! 407: '$else ''!DEBUG ! 408: IF FOpenInf(szFile$, 1, 0) = 0 THEN ! 409: '$endif ''!DEBUG ! 410: ERROR STFERR ! 411: END IF ! 412: END SUB ! 413: ! 414: ! 415: '************************************************************************* ! 416: FUNCTION UIStartDlg(szDll$, Dlg%, szDlgProc$, HelpDlg%, szHelpProc$) STATIC AS STRING ! 417: '$ifdef DEBUG ! 418: if szDll$ = "" then ! 419: n% = 1 ! 420: elseif szDlgProc$ = "" then ! 421: n% = 3 ! 422: else ! 423: n% = 0 ! 424: end if ! 425: if n% > 0 then ! 426: BadArgErr n%, "UIStartDlg", szDll$+", "+STR$(Dlg%)+", "+szDlgProc$+", "+STR$(HelpDlg%)+", "+szHelpProc$ ! 427: end if ! 428: '$endif ''DEBUG ! 429: ! 430: IF FDoDialog(HwndFrame(), szDll$, Dlg%, szDlgProc$, HelpDlg%, szHelpProc$) = 0 THEN ! 431: '$ifdef DEBUG ! 432: StfApiErr saeFail, "UIStartDlg", szDll$+", "+STR$(Dlg%)+", "+szDlgProc$+", "+STR$(HelpDlg%)+", "+szHelpProc$ ! 433: '$endif ''DEBUG ! 434: ERROR STFERR ! 435: ELSE ! 436: UIStartDlg = GetSymbolValue("DLGEVENT") ! 437: END IF ! 438: END FUNCTION ! 439: ! 440: ! 441: '************************************************************************* ! 442: SUB UIPop (n%) STATIC ! 443: IF FKillNDialogs(n%) = 0 THEN ! 444: '$ifdef DEBUG ! 445: StfApiErr saeFail, "UIPop", STR$(n%) ! 446: '$endif ''DEBUG ! 447: ERROR STFERR ! 448: END IF ! 449: END SUB ! 450: ! 451: ! 452: '************************************************************************* ! 453: SUB UIPopAll STATIC ! 454: IF FKillNDialogs(65535) = 0 THEN ! 455: '$ifdef DEBUG ! 456: StfApiErr saeFail, "UIPopAll", "" ! 457: '$endif ''DEBUG ! 458: ERROR STFERR ! 459: END IF ! 460: END SUB ! 461: ! 462: ! 463: '************************************************************************* ! 464: FUNCTION GetSymbolValue(szSymbol$) STATIC AS STRING ! 465: '$ifdef DEBUG ! 466: if szSymbol$ = "" then ! 467: BadArgErr 1, "GetSymbolValue", szSymbol$ ! 468: end if ! 469: '$endif ''DEBUG ! 470: szValue$ = string$(cbSymValMax,32) ! 471: Length% = CbGetSymbolValue(szSymbol$, szValue$, cbSymValMax) ! 472: GetSymbolValue = szValue$ ! 473: IF Length% >= cbSymValMax THEN ! 474: res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK) ! 475: ERROR STFERR ! 476: END IF ! 477: IF szSymbol$ = "" THEN ! 478: ERROR STFERR ! 479: END IF ! 480: szValue$ = "" ! 481: END FUNCTION ! 482: ! 483: ! 484: '************************************************************************* ! 485: FUNCTION GetListLength(szSymbol$) STATIC AS INTEGER ! 486: '$ifdef DEBUG ! 487: if szSymbol$ = "" then ! 488: BadArgErr 1, "GetListLength", szSymbol$ ! 489: end if ! 490: '$endif ''DEBUG ! 491: GetListLength = UsGetListLength(szSymbol$) ! 492: IF szSymbol$ = "" THEN ! 493: ERROR STFERR ! 494: END IF ! 495: END FUNCTION ! 496: ! 497: ! 498: '************************************************************************* ! 499: FUNCTION GetListItem(szListSymbol$, nItem%) STATIC AS STRING ! 500: '$ifdef DEBUG ! 501: if szListSymbol$ = "" then ! 502: BadArgErr 1, "GetListItem", szListSymbol$+", "+STR$(nItem%) ! 503: end if ! 504: ! 505: if nItem% <= 0 or nItem% > GetListLength(szListSymbol$) then ! 506: BadArgErr 2, "GetListItem", szListSymbol$+", "+STR$(nItem%) ! 507: end if ! 508: '$endif ''DEBUG ! 509: ! 510: szListItem$ = string$(cbSymValMax,32) ! 511: Length% = CbGetListItem(szListSymbol$, nItem%, szListItem$, cbSymValMax) ! 512: GetListItem = szListItem$ ! 513: IF Length% >= cbSymValMax THEN ! 514: res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK) ! 515: ERROR STFERR ! 516: END IF ! 517: IF szListSymbol$ = "" THEN ! 518: ERROR STFERR ! 519: END IF ! 520: if nItem% <= 0 or nItem% > GetListLength(szListSymbol$) then ! 521: ERROR STFERR ! 522: end if ! 523: szListItem$ = "" ! 524: END FUNCTION ! 525: ! 526: ! 527: '************************************************************************* ! 528: SUB AddListItem(szSymbol$, szItem$) STATIC ! 529: '$ifdef DEBUG ! 530: if szSymbol$ = "" then ! 531: BadArgErr 1, "AddListItem", szSymbol$+", "+szItem$ ! 532: end if ! 533: '$endif ''DEBUG ! 534: IF FAddListItem(szSymbol$, szItem$) = 0 THEN ! 535: '$ifdef DEBUG ! 536: StfApiErr saeFail, "AddListItem", szSymbol$+", "+szItem$ ! 537: '$endif ''DEBUG ! 538: ERROR STFERR ! 539: END IF ! 540: END SUB ! 541: ! 542: ! 543: '************************************************************************* ! 544: SUB ReplaceListItem(szSymbol$, n%, szItem$) STATIC ! 545: '$ifdef DEBUG ! 546: if szSymbol$ = "" then ! 547: nArg% = 1 ! 548: elseif (n% <= 0) OR (n% > GetListLength(szSymbol$)) then ! 549: nArg% = 2 ! 550: else ! 551: nArg% = 0 ! 552: end if ! 553: if nArg% > 0 then ! 554: BadArgErr nArg%, "ReplaceListItem", szSymbol$+", "+STR$(n%)+", "+szItem$ ! 555: end if ! 556: '$endif ''DEBUG ! 557: ! 558: IF FReplaceListItem(szSymbol$, n%, szItem$) = 0 THEN ! 559: '$ifdef DEBUG ! 560: StfApiErr saeFail, "ReplaceListItem", szSymbol$+", "+STR$(n%)+", "+szItem$ ! 561: '$endif ''DEBUG ! 562: ERROR STFERR ! 563: END IF ! 564: END SUB ! 565: ! 566: ! 567: '************************************************************************** ! 568: SUB MakeListFromSectionKeys(szSymbol$, szSect$) STATIC ! 569: '$ifdef DEBUG ! 570: if szSymbol$ = "" then ! 571: n% = 1 ! 572: elseif FValidInfSect(szSect$) = 0 then ! 573: n% = 2 ! 574: else ! 575: n% = 0 ! 576: end if ! 577: if n% > 0 then ! 578: BadArgErr n%, "MakeListFromSectionKeys", szSymbol$+", "+szSect$ ! 579: end if ! 580: '$endif ''DEBUG ! 581: ! 582: IF FSetSymbolToListOfInfKeys(szSymbol$, szSect$, 1) = 0 THEN ! 583: '$ifdef DEBUG ! 584: StfApiErr saeFail, "MakeListFromSectionKeys", szSymbol$+", "+szSect$ ! 585: '$endif ''DEBUG ! 586: ERROR STFERR ! 587: END IF ! 588: END SUB ! 589: ! 590: ! 591: '************************************************************************* ! 592: SUB SetSymbolValue(szSymbol$, szValue$) STATIC ! 593: '$ifdef DEBUG ! 594: if szSymbol$ = "" then ! 595: BadArgErr 1, "SetSymbolValue", szSymbol$+", "+szValue$ ! 596: end if ! 597: '$endif ''DEBUG ! 598: IF FSetSymbolValue(szSymbol$, szValue$) = 0 THEN ! 599: '$ifdef DEBUG ! 600: StfApiErr saeFail, "SetSymbolValue", szSymbol$+", "+szValue$ ! 601: '$endif ''DEBUG ! 602: ERROR STFERR ! 603: END IF ! 604: END SUB ! 605: ! 606: ! 607: '************************************************************************* ! 608: SUB RemoveSymbol(szSym$) STATIC ! 609: '$ifdef DEBUG ! 610: if szSym$ = "" then ! 611: BadArgErr 1, "RemoveSymbol", szSym$ ! 612: end if ! 613: '$endif ''DEBUG ! 614: IF FRemoveSymbol(szSym$) = 0 THEN ! 615: '$ifdef DEBUG ! 616: StfApiErr saeFail, "RemoveSymbol", szSym$ ! 617: '$endif ''DEBUG ! 618: ERROR STFERR ! 619: END IF ! 620: END SUB ! 621: ! 622: ! 623: '************************************************************************* ! 624: FUNCTION ShowWaitCursor STATIC AS INTEGER ! 625: ShowWaitCursor = HShowWaitCursor ! 626: END FUNCTION ! 627: ! 628: ! 629: '************************************************************************* ! 630: SUB RestoreCursor (hPrev%) STATIC ! 631: i% = FRestoreCursor(hPrev%) ! 632: IF i% = 0 THEN ! 633: '$ifdef DEBUG ! 634: StfApiErr saeFail, "RestoreCursor", "" ! 635: '$endif ''DEBUG ! 636: ERROR STFERR ! 637: END IF ! 638: END SUB ! 639: ! 640: ! 641: '************************************************************************* ! 642: FUNCTION SetBeepingMode (mode%) STATIC AS INTEGER ! 643: SetBeepingMode = FSetBeepingMode(mode%) ! 644: END FUNCTION ! 645: ! 646: ! 647: '************************************************************************* ! 648: FUNCTION SetSilentMode (mode%) STATIC AS INTEGER ! 649: SetSilentMode = FSetSilent(mode%) ! 650: END FUNCTION ! 651: ! 652: ! 653: '************************************************************************* ! 654: FUNCTION GetSectionKeyDate (szSect$, szKey$) STATIC AS STRING ! 655: '$ifdef DEBUG ! 656: if FValidInfSect(szSect$) = 0 then ! 657: n% = 1 ! 658: elseif szKey$ = "" then ! 659: n% = 2 ! 660: else ! 661: n% = 0 ! 662: end if ! 663: if n% > 0 then ! 664: BadArgErr n%, "GetSectionKeyDate", szSect$+", "+szKey$ ! 665: end if ! 666: '$endif ''DEBUG ! 667: ! 668: szBuf$ = string$(128, 32) ! 669: Length% = CbGetInfSectionKeyField(szSect$, szKey$, 5, szBuf$, 128) ! 670: IF Length% >= 128 THEN ! 671: res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK) ! 672: ERROR STFERR ! 673: END IF ! 674: ! 675: IF Length% = -1 THEN ! 676: '$ifdef DEBUG ! 677: StfApiErr saeFail, "GetSectionKeyDate", szSect$+", "+szKey$ ! 678: '$endif ''DEBUG ! 679: ERROR STFERR ! 680: END IF ! 681: ! 682: GetSectionKeyDate = szBuf$ ! 683: szBuf$ = "" ! 684: END FUNCTION ! 685: ! 686: ! 687: '************************************************************************* ! 688: FUNCTION GetSectionKeyFilename (szSect$, szKey$) STATIC AS STRING ! 689: '$ifdef DEBUG ! 690: if FValidInfSect(szSect$) = 0 then ! 691: n% = 1 ! 692: elseif szKey$ = "" then ! 693: n% = 2 ! 694: else ! 695: n% = 0 ! 696: end if ! 697: if n% > 0 then ! 698: BadArgErr n%, "GetSectionKeyFilename", szSect$+", "+szKey$ ! 699: end if ! 700: '$endif ''DEBUG ! 701: ! 702: szBuf$ = string$(128, 32) ! 703: Length% = CbGetInfSectionKeyField(szSect$, szKey$, 1, szBuf$, 128) ! 704: IF Length% >= 128 THEN ! 705: res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK) ! 706: ERROR STFERR ! 707: END IF ! 708: ! 709: IF Length% = -1 THEN ! 710: '$ifdef DEBUG ! 711: StfApiErr saeFail, "GetSectionKeyFilename", szSect$+", "+szKey$ ! 712: '$endif ''DEBUG ! 713: ERROR STFERR ! 714: END IF ! 715: ! 716: GetSectionKeyFilename = szBuf$ ! 717: szBuf$ = "" ! 718: END FUNCTION ! 719: ! 720: ! 721: '************************************************************************* ! 722: FUNCTION GetSectionKeySize (szSect$, szKey$) STATIC AS LONG ! 723: '$ifdef DEBUG ! 724: if FValidInfSect(szSect$) = 0 then ! 725: n% = 1 ! 726: elseif szKey$ = "" then ! 727: n% = 2 ! 728: else ! 729: n% = 0 ! 730: end if ! 731: if n% > 0 then ! 732: BadArgErr n%, "GetSectionKeySize", szSect$+", "+szKey$ ! 733: end if ! 734: '$endif ''DEBUG ! 735: ! 736: szBuf$ = string$(128, 32) ! 737: Length% = CbGetInfSectionKeyField(szSect$, szKey$, 15, szBuf$, 128) ! 738: IF Length% >= 128 THEN ! 739: res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK) ! 740: ERROR STFERR ! 741: END IF ! 742: ! 743: IF Length% = -1 THEN ! 744: '$ifdef DEBUG ! 745: StfApiErr saeFail, "GetSectionKeySize", szSect$+", "+szKey$ ! 746: '$endif ''DEBUG ! 747: ERROR STFERR ! 748: END IF ! 749: ! 750: GetSectionKeySize = VAL(szBuf$) ! 751: szBuf$ = "" ! 752: END FUNCTION ! 753: ! 754: ! 755: '************************************************************************* ! 756: FUNCTION GetSectionKeyVersion (szSect$, szKey$) STATIC AS STRING ! 757: '$ifdef DEBUG ! 758: if FValidInfSect(szSect$) = 0 then ! 759: n% = 1 ! 760: elseif szKey$ = "" then ! 761: n% = 2 ! 762: else ! 763: n% = 0 ! 764: end if ! 765: if n% > 0 then ! 766: BadArgErr n%, "GetSectionKeyVersion", szSect$+", "+szKey$ ! 767: end if ! 768: '$endif ''DEBUG ! 769: ! 770: szBuf$ = string$(128, 32) ! 771: Length% = CbGetInfSectionKeyField(szSect$, szKey$, 19, szBuf$, 128) ! 772: IF Length% >= 128 THEN ! 773: res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK) ! 774: ERROR STFERR ! 775: END IF ! 776: ! 777: IF Length% = -1 THEN ! 778: '$ifdef DEBUG ! 779: StfApiErr saeFail, "GetSectionKeyVersion", szSect$+", "+szKey$ ! 780: '$endif ''DEBUG ! 781: ERROR STFERR ! 782: END IF ! 783: ! 784: GetSectionKeyVersion = szBuf$ ! 785: szBuf$ = "" ! 786: END FUNCTION ! 787: ! 788: ! 789: '************************************************************************* ! 790: SUB MakeListFromSectionDate (szSym$, szSect$) STATIC ! 791: '$ifdef DEBUG ! 792: if szSym$ = "" then ! 793: n% = 1 ! 794: elseif FValidInfSect(szSect$) = 0 then ! 795: n% = 2 ! 796: else ! 797: n% = 0 ! 798: end if ! 799: if n% > 0 then ! 800: BadArgErr n%, "MakeListFromSectionDate", szSym$+", "+szSect$ ! 801: end if ! 802: '$endif ''DEBUG ! 803: ! 804: IF FMakeListInfSectionField(szSym$, szSect$, 5) = 0 THEN ! 805: '$ifdef DEBUG ! 806: StfApiErr saeFail, "MakeListFromSectionDate", szSym$+", "+szSect$ ! 807: '$endif ''DEBUG ! 808: ERROR STFERR ! 809: END IF ! 810: END SUB ! 811: ! 812: ! 813: '************************************************************************* ! 814: SUB MakeListFromSectionFilename (szSym$, szSect$) STATIC ! 815: '$ifdef DEBUG ! 816: if szSym$ = "" then ! 817: n% = 1 ! 818: elseif FValidInfSect(szSect$) = 0 then ! 819: n% = 2 ! 820: else ! 821: n% = 0 ! 822: end if ! 823: if n% > 0 then ! 824: BadArgErr n%, "MakeListFromSectionFilename", szSym$+", "+szSect$ ! 825: end if ! 826: '$endif ''DEBUG ! 827: ! 828: IF FMakeListInfSectionField(szSym$, szSect$, 1) = 0 THEN ! 829: '$ifdef DEBUG ! 830: StfApiErr saeFail, "MakeListFromSectionFilename", szSym$+", "+szSect$ ! 831: '$endif ''DEBUG ! 832: ERROR STFERR ! 833: END IF ! 834: END SUB ! 835: ! 836: ! 837: '************************************************************************* ! 838: SUB MakeListFromSectionSize (szSym$, szSect$) STATIC ! 839: '$ifdef DEBUG ! 840: if szSym$ = "" then ! 841: n% = 1 ! 842: elseif FValidInfSect(szSect$) = 0 then ! 843: n% = 2 ! 844: else ! 845: n% = 0 ! 846: end if ! 847: if n% > 0 then ! 848: BadArgErr n%, "MakeListFromSectionSize", szSym$+", "+szSect$ ! 849: end if ! 850: '$endif ''DEBUG ! 851: ! 852: IF FMakeListInfSectionField(szSym$, szSect$, 15) = 0 THEN ! 853: '$ifdef DEBUG ! 854: StfApiErr saeFail, "MakeListFromSectionSize", szSym$+", "+szSect$ ! 855: '$endif ''DEBUG ! 856: ERROR STFERR ! 857: END IF ! 858: END SUB ! 859: ! 860: ! 861: '************************************************************************* ! 862: SUB MakeListFromSectionVersion (szSym$, szSect$) STATIC ! 863: '$ifdef DEBUG ! 864: if szSym$ = "" then ! 865: n% = 1 ! 866: elseif FValidInfSect(szSect$) = 0 then ! 867: n% = 2 ! 868: else ! 869: n% = 0 ! 870: end if ! 871: if n% > 0 then ! 872: BadArgErr n%, "MakeListFromSectionVersion", szSym$+", "+szSect$ ! 873: end if ! 874: '$endif ''DEBUG ! 875: ! 876: IF FMakeListInfSectionField(szSym$, szSect$, 19) = 0 THEN ! 877: '$ifdef DEBUG ! 878: StfApiErr saeFail, "MakeListFromSectionVersion", szSym$+", "+szSect$ ! 879: '$endif ''DEBUG ! 880: ERROR STFERR ! 881: END IF ! 882: END SUB ! 883: ! 884: ! 885: '************************************************************************* ! 886: SUB InitInstall STATIC ! 887: IF hSetup > 0 THEN ! 888: '$ifdef DEBUG ! 889: StfApiErr saeInit, "InitInstall", "" ! 890: '$endif ''DEBUG ! 891: ELSEIF FInitializeInstall(HinstFrame(), HwndFrame()) = 0 THEN ! 892: '$ifdef DEBUG ! 893: StfApiErr saeFail, "InitInstall", "" ! 894: '$endif ''DEBUG ! 895: END ! 896: END IF ! 897: END SUB ! 898: ! 899: ! 900: '************************************************************************* ! 901: SUB CreateDir (szDir$, cmo%) STATIC ! 902: '$ifdef DEBUG ! 903: if FValidFATDir(szDir$) = 0 then ! 904: BadArgErr 1, "CreateDir", szDir$+", "+STR$(cmo%) ! 905: end if ! 906: '$endif ''DEBUG ! 907: IF FCreateDir(szDir$, cmo%) = 0 THEN ! 908: '$ifdef DEBUG ! 909: StfApiErr saeFail, "CreateDir", szDir$+", "+STR$(cmo%) ! 910: '$endif ''DEBUG ! 911: ERROR STFERR ! 912: END IF ! 913: END SUB ! 914: ! 915: ! 916: '************************************************************************* ! 917: SUB RemoveDir (szDir$, cmo%) STATIC ! 918: '$ifdef DEBUG ! 919: if FValidFATDir(szDir$) = 0 then ! 920: BadArgErr 1, "RemoveDir", szDir$+", "+STR$(cmo%) ! 921: end if ! 922: '$endif ''DEBUG ! 923: IF FRemoveDir(szDir$, cmo%) = 0 THEN ! 924: '$ifdef DEBUG ! 925: StfApiErr saeFail, "RemoveDir", szDir$+", "+STR$(cmo%) ! 926: '$endif ''DEBUG ! 927: ERROR STFERR ! 928: END IF ! 929: END SUB ! 930: ! 931: ! 932: ! 933: '************************************************************************* ! 934: SUB RemoveIniSection (szFile$, szSect$, cmo%) STATIC ! 935: '$ifdef DEBUG ! 936: if FValidIniFile(szFile$) = 0 then ! 937: n% = 1 ! 938: elseif FValidInfSect(szSect$) = 0 then ! 939: n% = 2 ! 940: else ! 941: n% = 0 ! 942: end if ! 943: if n% > 0 then ! 944: BadArgErr n%, "RemoveIniSection", szFile$+", "+szSect$+", "+STR$(cmo%) ! 945: end if ! 946: '$endif ''DEBUG ! 947: ! 948: IF FRemoveIniSection(szFile$, szSect$, cmo%) = 0 THEN ! 949: '$ifdef DEBUG ! 950: StfApiErr saeFail, "RemoveIniSection", szFile$+", "+szSect$+", "+STR$(cmo%) ! 951: '$endif ''DEBUG ! 952: ERROR STFERR ! 953: END IF ! 954: END SUB ! 955: ! 956: ! 957: '************************************************************************* ! 958: SUB CreateIniKeyValue (szFile$, szSect$, szKey$, szValue$, cmo%) STATIC ! 959: '$ifdef DEBUG ! 960: if FValidIniFile(szFile$) = 0 then ! 961: n% = 1 ! 962: elseif FValidInfSect(szSect$) = 0 then ! 963: n% = 2 ! 964: else ! 965: n% = 0 ! 966: end if ! 967: if n% > 0 then ! 968: BadArgErr n%, "CreateIniKeyValue", szFile$+", "+szSect$+", "+szKey$+", "+szValue$+", "+STR$(cmo%) ! 969: end if ! 970: '$endif ''DEBUG ! 971: ! 972: IF FCreateIniKeyValue(szFile$, szSect$, szKey$, szValue$, cmo%) = 0 THEN ! 973: '$ifdef DEBUG ! 974: StfApiErr saeFail, "CreateIniKeyValue", szFile$+", "+szSect$+", "+szKey$+", "+szValue$+", "+STR$(cmo%) ! 975: '$endif ''DEBUG ! 976: ERROR STFERR ! 977: END IF ! 978: END SUB ! 979: ! 980: ! 981: '************************************************************************* ! 982: SUB RemoveIniKey (szFile$, szSect$, szKey$, cmo%) STATIC ! 983: '$ifdef DEBUG ! 984: if FValidIniFile(szFile$) = 0 then ! 985: n% = 1 ! 986: elseif FValidInfSect(szSect$) = 0 then ! 987: n% = 2 ! 988: elseif szKey$ = "" then ! 989: n% = 3 ! 990: else ! 991: n% = 0 ! 992: end if ! 993: if n% > 0 then ! 994: BadArgErr n%, "RemoveIniKey", szFile$+", "+szSect$+", "+szKey$+", "+STR$(cmo%) ! 995: end if ! 996: '$endif ''DEBUG ! 997: ! 998: IF FRemoveIniKey(szFile$, szSect$, szKey$, cmo%) = 0 THEN ! 999: '$ifdef DEBUG ! 1000: StfApiErr saeFail, "RemoveIniKey", szFile$+", "+szSect$+", "+szKey$+", "+STR$(cmo%) ! 1001: '$endif ''DEBUG ! 1002: ERROR STFERR ! 1003: END IF ! 1004: END SUB ! 1005: ! 1006: ! 1007: '************************************************************************* ! 1008: SUB CreateSysIniKeyValue (szFile$, szSect$, szKey$, szValue$, cmo%) STATIC ! 1009: '$ifdef DEBUG ! 1010: if FValidFATPath(szFile$) = 0 then ! 1011: n% = 1 ! 1012: elseif FValidInfSect(szSect$) = 0 then ! 1013: n% = 2 ! 1014: elseif szKey$ = "" then ! 1015: n% = 3 ! 1016: else ! 1017: n% = 0 ! 1018: end if ! 1019: if n% > 0 then ! 1020: BadArgErr n%, "CreateSysIniKeyValue", szFile$+", "+szSect$+", "+szKey$+", "+szValue$+", "+STR$(cmo%) ! 1021: end if ! 1022: '$endif ''DEBUG ! 1023: ! 1024: IF FCreateSysIniKeyValue(szFile$, szSect$, szKey$, szValue$, cmo%) = 0 THEN ! 1025: '$ifdef DEBUG ! 1026: StfApiErr saeFail, "CreateSysIniKeyValue", szFile$+", "+szSect$+", "+szKey$+", "+szValue$+", "+STR$(cmo%) ! 1027: '$endif ''DEBUG ! 1028: ERROR STFERR ! 1029: END IF ! 1030: END SUB ! 1031: ! 1032: ! 1033: '************************************************************************* ! 1034: SUB CreateProgmanGroup (szGroup$, szPath$, cmo%) STATIC ! 1035: '$ifdef DEBUG ! 1036: if szGroup$ = "" or len(szGroup$) > 24 then ! 1037: BadArgErr 1, "CreateProgmanGroup", szGroup$+", "+STR$(Cmd%)+", "+STR$(cmo%) ! 1038: end if ! 1039: '$endif ''DEBUG ! 1040: IF FCreateProgManGroup(szGroup$, szPath$, cmo%) = 0 THEN ! 1041: '$ifdef DEBUG ! 1042: StfApiErr saeFail, "CreateProgmanGroup", szGroup$+", "+szPath$+", "+STR$(cmo%) ! 1043: '$endif ''DEBUG ! 1044: ERROR STFERR ! 1045: END IF ! 1046: END SUB ! 1047: ! 1048: ! 1049: '************************************************************************* ! 1050: SUB ShowProgmanGroup (szGroup$, Cmd%, cmo%) STATIC ! 1051: '$ifdef DEBUG ! 1052: if szGroup$ = "" or len(szGroup$) > 24 then ! 1053: BadArgErr 1, "ShowProgmanGroup", szGroup$+", "+STR$(Cmd%)+", "+STR$(cmo%) ! 1054: end if ! 1055: '$endif ''DEBUG ! 1056: IF FShowProgManGroup(szGroup$, STR$(Cmd%), cmo%) = 0 THEN ! 1057: '$ifdef DEBUG ! 1058: StfApiErr saeFail, "ShowProgmanGroup", szGroup$+", "+STR$(Cmd%)+", "+STR$(cmo%) ! 1059: '$endif ''DEBUG ! 1060: ERROR STFERR ! 1061: END IF ! 1062: END SUB ! 1063: ! 1064: ! 1065: '************************************************************************* ! 1066: SUB StampResource (szSect$, szKey$, szDst$, wResType%, wResId%, szData$, cbData%) STATIC ! 1067: '$ifdef DEBUG ! 1068: if FValidInfSect(szSect$) = 0 then ! 1069: n% = 1 ! 1070: elseif szKey$ = "" then ! 1071: n% = 2 ! 1072: elseif FValidFATDir(szDst$) = 0 then ! 1073: n% = 3 ! 1074: else ! 1075: n% = 0 ! 1076: end if ! 1077: if n% > 0 then ! 1078: BadArgErr n%, "StampResource", szSect$+", "+szKey$+", "+szDst$+", "+STR$(wResType%)+", "+STR$(wResId%)+", "+szData$+", "+STR$(cbData%) ! 1079: end if ! 1080: '$endif ''DEBUG ! 1081: ! 1082: IF FStampResource (szSect$, szKey$, szDst$, wResType%, wResId%, szData$, cbData%) = 0 THEN ! 1083: '$ifdef DEBUG ! 1084: StfApiErr saeFail, "StampResource", szSect$+", "+szKey$+", "+szDst$+", "+STR$(wResType%)+", "+STR$(wResId%)+", "+szData$+", "+STR$(cbData%) ! 1085: '$endif ''DEBUG ! 1086: ERROR STFERR ! 1087: END IF ! 1088: END SUB ! 1089: ! 1090: ! 1091: '************************************************************************* ! 1092: SUB DumpCopyList (szFile$) STATIC ! 1093: '$ifdef DEBUG ! 1094: if szFile$ = "" then ! 1095: BadArgErr 1, "DumpCopyList", szFile$ ! 1096: end if ! 1097: '$endif ''DEBUG ! 1098: IF FDumpCopyListToFile (szFile$) = 0 THEN ! 1099: '$ifdef DEBUG ! 1100: StfApiErr saeFail, "DumpCopyList", szFile$ ! 1101: '$endif ''DEBUG ! 1102: ERROR STFERR ! 1103: END IF ! 1104: END SUB ! 1105: ! 1106: ! 1107: '************************************************************************* ! 1108: SUB ClearCopyList STATIC ! 1109: ResetCopyList ! 1110: END SUB ! 1111: ! 1112: ! 1113: '************************************************************************* ! 1114: FUNCTION GetCopyListCost (szExtraList$, szCostList$, szNeedList$) STATIC AS LONG ! 1115: lNeed& = LcbGetCopyListCost (szExtraList$, szCostList$, szNeedList$) ! 1116: IF lNeed& < 0 THEN ! 1117: '$ifdef DEBUG ! 1118: StfApiErr saeFail, "GetCopyListCost", szExtraList$+", "+szCostList$+", "+szNeedList$ ! 1119: '$endif ''DEBUG ! 1120: ERROR STFERR ! 1121: END IF ! 1122: GetCopyListCost = lNeed& ! 1123: END FUNCTION ! 1124: ! 1125: ! 1126: '************************************************************************* ! 1127: SUB CreateProgmanItem (szGroup$, szItem$, szCmd$, szOther$, cmo%) STATIC ! 1128: szItemNew$ = szItem$ ! 1129: IF szOther$ <> "" THEN ! 1130: szItemNew$ = szItem$ + "," + szOther$ ! 1131: END IF ! 1132: '$ifdef DEBUG ! 1133: if szGroup$ = "" or len(szGroup$) > 24 then ! 1134: BadArgErr 1, "CreateProgmanItem", szGroup$+", "+STR$(Cmd%)+", "+STR$(cmo%) ! 1135: end if ! 1136: '$endif ''DEBUG ! 1137: ! 1138: IF FCreateProgManItem(szGroup$, szItemNew$, szCmd$, cmo%) = 0 THEN ! 1139: '$ifdef DEBUG ! 1140: StfApiErr saeFail, "CreateProgmanItem", szGroup$+", "+szItem$+", "+szCmd$+", "+szOther$+", "+STR$(cmo%) ! 1141: '$endif ''DEBUG ! 1142: ERROR STFERR ! 1143: END IF ! 1144: szItemNew$ = "" ! 1145: END SUB ! 1146: ! 1147: ! 1148: '************************************************************************* ! 1149: SUB AddDos5Help (szProgName$, szProgHelp$, cmo%) STATIC ! 1150: '$ifdef DEBUG ! 1151: if szProgName$ = "" OR MID$(szProgName$, 1, 1) = "@" OR LEN(szProgName$) > 8 then ! 1152: n% = 1 ! 1153: elseif INSTR(szProgName$, " ") <> 0 OR INSTR(szProgName$, CHR$(9)) <> 0 then ! 1154: n% = 1 ! 1155: elseif szProgHelp$ = "" then ! 1156: n% = 2 ! 1157: else ! 1158: n% = 0 ! 1159: end if ! 1160: if n% > 0 then ! 1161: BadArgErr n%, "AddDos5Help", szProgName$+", "+szProgHelp$+", "+STR$(cmo%) ! 1162: end if ! 1163: '$endif ''DEBUG ! 1164: IF FAddDos5Help (szProgName$, szProgHelp$, cmo%) = 0 THEN ! 1165: '$ifdef DEBUG ! 1166: StfApiErr saeFail, "AddDos5Help", szProgName$+", "+szProgHelp$+", "+STR$(cmo%) ! 1167: '$endif ''DEBUG ! 1168: ERROR STFERR ! 1169: END IF ! 1170: END SUB ! 1171: ! 1172: ! 1173: '************************************************************************* ! 1174: SUB CopyFilesInCopyList STATIC ! 1175: grc% = GrcCopyFilesInCopyList (HinstFrame()) ! 1176: ! 1177: IF grc% = grcUserQuit THEN ! 1178: ERROR STFQUIT ! 1179: ELSEIF grc% > 0 THEN ! 1180: '$ifdef DEBUG ! 1181: StfApiErr saeFail, "CopyFilesInCopyList", "" ! 1182: '$endif ''DEBUG ! 1183: ERROR STFERR ! 1184: END IF ! 1185: END SUB ! 1186: ! 1187: ! 1188: '************************************************************************* ! 1189: SUB CopyFile (szFullPathSrc$, szFullPathDst$, cmo%, fAppend%) STATIC ! 1190: '$ifdef DEBUG ! 1191: if FValidFATPath(szFullPathSrc$) = 0 then ! 1192: n% = 1 ! 1193: elseif FValidFATPath(szFullPathDst$) = 0 then ! 1194: n% = 2 ! 1195: else ! 1196: n% = 0 ! 1197: end if ! 1198: if n% > 0 then ! 1199: BadArgErr n%, "CopyFile", szFullPathSrc$+", "+szFullPathDst$+", "+STR$(cmo%)+", "+STR$(fAppend%) ! 1200: end if ! 1201: '$endif ''DEBUG ! 1202: ! 1203: IF FCopyOneFile(szFullPathSrc$, szFullPathDst$, (cmo OR cmoCopy), fAppend%) = 0 THEN ! 1204: '$ifdef DEBUG ! 1205: StfApiErr saeFail, "CopyFile", szFullPathSrc$+", "+szFullPathDst$+", "+STR$(cmo%)+", "+STR$(fAppend%) ! 1206: '$endif ''DEBUG ! 1207: ERROR STFERR ! 1208: END IF ! 1209: END SUB ! 1210: ! 1211: ! 1212: ! 1213: '************************************************************************* ! 1214: SUB RemoveFile (szFullPathSrc$, cmo%) STATIC ! 1215: '$ifdef DEBUG ! 1216: if FValidFATPath(szFullPathSrc$) = 0 then ! 1217: BadArgErr 1, "RemoveFile", szFullPathSrc$+", "+STR$(cmo%) ! 1218: end if ! 1219: '$endif ''DEBUG ! 1220: IF YnrcRemoveFile(szFullPathSrc$, cmo%) = ynrcNo THEN ! 1221: '$ifdef DEBUG ! 1222: StfApiErr saeFail, "RemoveFile", szFullPathSrc$+", "+STR$(cmo%) ! 1223: '$endif ''DEBUG ! 1224: ERROR STFERR ! 1225: END IF ! 1226: END SUB ! 1227: ! 1228: ! 1229: '************************************************************************* ! 1230: SUB BackupFile (szFullPath$, szBackup$) STATIC ! 1231: '$ifdef DEBUG ! 1232: if FValidFATPath(szFullPath$) = 0 then ! 1233: n% = 1 ! 1234: elseif szBackup$ = "" then ! 1235: n% = 2 ! 1236: else ! 1237: n% = 0 ! 1238: end if ! 1239: if n% > 0 then ! 1240: BadArgErr n%, "BackupFile", szFullPath$+", "+szBackup$ ! 1241: end if ! 1242: '$endif ''DEBUG ! 1243: ! 1244: IF YnrcBackupFile(szFullPath$, szBackup$, cmoNone) = ynrcNo THEN ! 1245: '$ifdef DEBUG ! 1246: StfApiErr saeFail, "BackupFile", szFullPath$+", "+szBackup$ ! 1247: '$endif ''DEBUG ! 1248: ERROR STFERR ! 1249: END IF ! 1250: END SUB ! 1251: ! 1252: ! 1253: '************************************************************************* ! 1254: SUB RenameFile (szFullPath$, szBackup$) STATIC ! 1255: '$ifdef DEBUG ! 1256: if FValidFATPath(szFullPath$) = 0 then ! 1257: n% = 1 ! 1258: elseif szBackup$ = "" then ! 1259: n% = 2 ! 1260: else ! 1261: n% = 0 ! 1262: end if ! 1263: if n% > 0 then ! 1264: BadArgErr n%, "RenameFile", szFullPath$+", "+szBackup$ ! 1265: end if ! 1266: '$endif ''DEBUG ! 1267: ! 1268: IF YnrcBackupFile(szFullPath$, szBackup$, cmoNone) = ynrcNo THEN ! 1269: '$ifdef DEBUG ! 1270: StfApiErr saeFail, "RenameFile", szFullPath$+", "+szBackup$ ! 1271: '$endif ''DEBUG ! 1272: ERROR STFERR ! 1273: END IF ! 1274: END SUB ! 1275: ! 1276: ! 1277: '************************************************************************* ! 1278: SUB AddSectionFilesToCopyList (szSect$, szSrc$, szDest$) STATIC ! 1279: '$ifdef DEBUG ! 1280: if FValidInfSect(szSect$) = 0 then ! 1281: n% = 1 ! 1282: elseif FValidFATDir(szSrc$) = 0 then ! 1283: n% = 2 ! 1284: elseif FValidFATDir(szDest$) = 0 then ! 1285: n% = 3 ! 1286: else ! 1287: n% = 0 ! 1288: end if ! 1289: if n% > 0 then ! 1290: BadArgErr n%, "AddSectionFilesToCopyList", szSect$+", "+szSrc$+", "+szDest$ ! 1291: end if ! 1292: '$endif ''DEBUG ! 1293: ! 1294: IF FAddSectionFilesToCopyList (szSect$, szSrc$, szDest$) = 0 THEN ! 1295: '$ifdef DEBUG ! 1296: StfApiErr saeFail, "AddSectionFilesToCopyList", szSect$+", "+szSrc$+", "+szDest$ ! 1297: '$endif ''DEBUG ! 1298: ERROR STFERR ! 1299: END IF ! 1300: END SUB ! 1301: ! 1302: ! 1303: '************************************************************************* ! 1304: SUB AddSectionKeyFileToCopyList (szSect$, szKey$, szSrc$, szDest$) STATIC ! 1305: '$ifdef DEBUG ! 1306: if FValidInfSect(szSect$) = 0 then ! 1307: n% = 1 ! 1308: elseif szKey$ = "" then ! 1309: n% = 2 ! 1310: elseif FValidFATDir(szSrc$) = 0 then ! 1311: n% = 3 ! 1312: elseif FValidFATDir(szDest$) = 0 then ! 1313: n% = 4 ! 1314: else ! 1315: n% = 0 ! 1316: end if ! 1317: if n% > 0 then ! 1318: BadArgErr n%, "AddSectionKeyFileToCopyList", szSect$+", "+szKey$+", "+szSrc$+", "+szDest$ ! 1319: end if ! 1320: '$endif ''DEBUG ! 1321: ! 1322: IF FAddSectionKeyFileToCopyList (szSect$, szKey$, szSrc$, szDest$) = 0 THEN ! 1323: '$ifdef DEBUG ! 1324: StfApiErr saeFail, "AddSectionKeyFileToCopyList", szSect$+", "+szKey$+", "+szSrc$+", "+szDest$ ! 1325: '$endif ''DEBUG ! 1326: ERROR STFERR ! 1327: END IF ! 1328: END SUB ! 1329: ! 1330: ! 1331: '************************************************************************* ! 1332: SUB AddSpecialFileToCopyList (szSect$, szKey$, szSrc$, szDest$) STATIC ! 1333: '$ifdef DEBUG ! 1334: if FValidInfSect(szSect$) = 0 then ! 1335: n% = 1 ! 1336: elseif szKey$ = "" then ! 1337: n% = 2 ! 1338: elseif FValidFATDir(szSrc$) = 0 then ! 1339: n% = 3 ! 1340: elseif FValidFATPath(szDest$) = 0 then ! 1341: n% = 4 ! 1342: else ! 1343: n% = 0 ! 1344: end if ! 1345: if n% > 0 then ! 1346: BadArgErr n%, "AddSpecialFileToCopyList", szSect$+", "+szKey$+", "+szSrc$+", "+szDest$ ! 1347: end if ! 1348: '$endif ''DEBUG ! 1349: ! 1350: IF FAddSpecialFileToCopyList (szSect$, szKey$, szSrc$, szDest$) = 0 THEN ! 1351: '$ifdef DEBUG ! 1352: StfApiErr saeFail, "AddSpecialFileToCopyList", szSect$+", "+szKey$+", "+szSrc$+", "+szDest$ ! 1353: '$endif ''DEBUG ! 1354: ERROR STFERR ! 1355: END IF ! 1356: END SUB ! 1357: ! 1358: ! 1359: '************************************************************************* ! 1360: SUB AddToBillboardList (szDll$, idDlg%, szProc$, lTicks&) STATIC ! 1361: '$ifdef DEBUG ! 1362: if szDll$ = "" then ! 1363: n% = 1 ! 1364: elseif idDlg% = 0 then ! 1365: n% = 2 ! 1366: elseif szProc$ = "" then ! 1367: n% = 3 ! 1368: elseif lTicks& <= 0 then ! 1369: n% = 4 ! 1370: else ! 1371: n% = 0 ! 1372: end if ! 1373: if n% > 0 then ! 1374: BadArgErr n%, "AddToBillboardList", szDll$+", "+STR$(idDlg%)+", "+szProc$+", "+STR$(lTicks&) ! 1375: end if ! 1376: '$endif ''DEBUG ! 1377: ! 1378: IF FAddToBillboardList(szDll$, idDlg%, szProc$, lTicks&) = 0 THEN ! 1379: '$ifdef DEBUG ! 1380: StfApiErr saeFail, "AddToBillboardList", szDll$+", "+STR$(idDlg%)+", "+szProc$+", "+STR$(lTicks&) ! 1381: '$endif ''DEBUG ! 1382: ERROR STFERR ! 1383: END IF ! 1384: END SUB ! 1385: ! 1386: ! 1387: '************************************************************************* ! 1388: SUB AddBlankToBillboardList (lTicks&) STATIC ! 1389: '$ifdef DEBUG ! 1390: if lTicks& <= 0 then ! 1391: BadArgErr 1, "AddBlankToBillboardList", STR$(lTicks&) ! 1392: end if ! 1393: '$endif ''DEBUG ! 1394: IF FAddToBillboardList(NULL, 0, NULL, lTicks&) = 0 THEN ! 1395: '$ifdef DEBUG ! 1396: StfApiErr saeFail, "AddBlankToBillboardList", STR$(lTicks&) ! 1397: '$endif ''DEBUG ! 1398: ERROR STFERR ! 1399: END IF ! 1400: END SUB ! 1401: ! 1402: ! 1403: '************************************************************************* ! 1404: SUB ClearBillboardList STATIC ! 1405: IF FClearBillboardList = 0 THEN ! 1406: '$ifdef DEBUG ! 1407: StfApiErr saeFail, "ClearBillboardList", "" ! 1408: '$endif ''DEBUG ! 1409: ERROR STFERR ! 1410: END IF ! 1411: END SUB ! 1412: ! 1413: ! 1414: '************************************************************************* ! 1415: SUB OpenLogFile (szFile$, fAppend%) STATIC ! 1416: '$ifdef DEBUG ! 1417: if FValidFATPath(szFile$) = 0 then ! 1418: BadArgErr 1, "OpenLogFile", szFile$+", "+STR$(fAppend%) ! 1419: end if ! 1420: '$endif ''DEBUG ! 1421: IF FOpenLogFile(szFile$, fAppend%) = 0 THEN ! 1422: '$ifdef DEBUG ! 1423: StfApiErr saeFail, "OpenLogFile", szFile$+", "+STR$(fAppend%) ! 1424: '$endif ''DEBUG ! 1425: ERROR STFERR ! 1426: END IF ! 1427: END SUB ! 1428: ! 1429: ! 1430: '************************************************************************* ! 1431: SUB CloseLogFile STATIC ! 1432: IF FCloseLogFile() = 0 THEN ! 1433: '$ifdef DEBUG ! 1434: StfApiErr saeFail, "CloseLogFile", "" ! 1435: '$endif ''DEBUG ! 1436: ERROR STFERR ! 1437: END IF ! 1438: END SUB ! 1439: ! 1440: ! 1441: '************************************************************************* ! 1442: SUB WriteToLogFile (szStr$) STATIC ! 1443: IF FWriteToLogFile(szStr$, 1) = 0 THEN ! 1444: '$ifdef DEBUG ! 1445: StfApiErr saeFail, "WriteToLogFile", szStr$ ! 1446: '$endif ''DEBUG ! 1447: ERROR STFERR ! 1448: END IF ! 1449: END SUB ! 1450: ! 1451: ! 1452: ''' -1 in either parameter will mean 'center in frame client area' ! 1453: '************************************************************************* ! 1454: SUB SetCopyGaugePosition (x%, y%) STATIC ! 1455: ProSetPos x%, y% ! 1456: END SUB ! 1457: ! 1458: ! 1459: '************************************************************************* ! 1460: FUNCTION FindFileUsingFileOpen (szFile$) STATIC AS STRING ! 1461: szBuf$ = STRING$(512, 32) ! 1462: ! 1463: wRet% = WFindFileUsingFileOpen(szFile$, szBuf$, len(szBuf$)) ! 1464: IF wRet% = 0 THEN ! 1465: FindFileUsingFileOpen = szBuf$ ! 1466: ELSEIF wRet% = 1 THEN ! 1467: FindFileUsingFileOpen = "" ! 1468: ELSE ! 1469: '$ifdef DEBUG ! 1470: StfApiErr saeFail, "FindFileUsingFileOpen", szFile$ ! 1471: '$endif ''DEBUG ! 1472: ERROR STFERR ! 1473: END IF ! 1474: ! 1475: szBuf$ = "" ! 1476: END FUNCTION ! 1477: ! 1478: ! 1479: '************************************************************************* ! 1480: FUNCTION IsDirWritable (szDir$) STATIC AS INTEGER ! 1481: IsDirWritable = FIsDirWritable(szDir$) ! 1482: END FUNCTION ! 1483: ! 1484: ! 1485: '************************************************************************* ! 1486: FUNCTION IsFileWritable (szFile$) STATIC AS INTEGER ! 1487: '$ifdef DEBUG ! 1488: if FValidFATDir(szFile$) = 0 then ! 1489: BadArgErr 1, "IsFileWritable", szFile$ ! 1490: end if ! 1491: '$endif ''DEBUG ! 1492: IsFileWritable = FIsFileWritable(szFile$) ! 1493: END FUNCTION ! 1494: ! 1495: ! 1496: '************************************************************************* ! 1497: FUNCTION GetNthFieldFromIniString (szLine$, iField%) STATIC AS STRING ! 1498: IF iField% < 1 THEN ! 1499: '$ifdef DEBUG ! 1500: StfApiErr saeFail, "GetNthFieldFromIniString", szLine$+", "+STR$(iField%) ! 1501: '$endif ''DEBUG ! 1502: ERROR STFERR ! 1503: END IF ! 1504: szStart$ = szLine$ ! 1505: IF iField% <> 1 THEN ! 1506: FOR i% = 2 TO iField% STEP 1 ! 1507: iNew% = INSTR(szStart$, ",") ! 1508: IF iNew% = 0 THEN ! 1509: GetNthFieldFromIniString = "" ! 1510: GOTO _GNFFIS_END ! 1511: END IF ! 1512: szStart$ = MID$(szStart$, (iNew% + 1)) ! 1513: NEXT ! 1514: END IF ! 1515: ! 1516: iNew% = INSTR(szStart$, ",") ! 1517: IF iNew% <> 0 THEN ! 1518: szStart$ = MID$(szStart$, 1, (iNew% - 1)) ! 1519: END IF ! 1520: ! 1521: GetNthFieldFromIniString = LTRIM$(RTRIM$(szStart$)) ! 1522: ! 1523: _GNFFIS_END: ! 1524: ! 1525: END FUNCTION ! 1526: ! 1527: ! 1528: '************************************************************************* ! 1529: FUNCTION GetWindowsMajorVersion STATIC AS INTEGER ! 1530: GetWindowsMajorVersion = GetVersion() MOD 256 ! 1531: END FUNCTION ! 1532: ! 1533: ! 1534: '************************************************************************* ! 1535: FUNCTION GetWindowsMinorVersion STATIC AS INTEGER ! 1536: GetWindowsMinorVersion = GetVersion() / 256 ! 1537: END FUNCTION ! 1538: ! 1539: ! 1540: '************************************************************************* ! 1541: FUNCTION GetWindowsMode STATIC AS INTEGER ! 1542: GetWindowsMode = 0 ! 1543: longTmp& = GetWinFlags() ! 1544: IF longTmp& AND WF_STANDARD THEN ! 1545: GetWindowsMode = 1 ! 1546: ELSEIF longTmp& AND WF_ENHANCED THEN ! 1547: GetWindowsMode = 2 ! 1548: END IF ! 1549: END FUNCTION ! 1550: ! 1551: ! 1552: '************************************************************************* ! 1553: FUNCTION GetWindowsDir STATIC AS STRING ! 1554: szBuf$ = string$(256, 32) ! 1555: cbBuf% = GetWindowsDirectory(szBuf$, 256) ! 1556: ! 1557: IF cbBuf% = 0 THEN ! 1558: GetWindowsDir = "" ! 1559: '$ifdef DEBUG ! 1560: StfApiErr saeFail, "GetWindowsDir", "" ! 1561: '$endif ''DEBUG ! 1562: ERROR STFERR ! 1563: ELSE ! 1564: IF cbBuf% > 255 THEN ! 1565: res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK) ! 1566: ERROR STFERR ! 1567: END IF ! 1568: szBuf$ = RTRIM$(szBuf$) ! 1569: IF MID$(szBuf$, 1, 1) = "\" THEN ! 1570: 'szBuf$ = MID$(CURDIR$, 1, 2) + szBuf$ ! 1571: szBuf$ = MID$(GetWindowsSysDir, 1, 2) + szBuf$ ! 1572: ELSEIF MID$(szBuf$, 2, 1) <> ":" THEN ! 1573: szBuf$ = MID$(GetWindowsSysDir, 1, 3) + szBuf$ ! 1574: END IF ! 1575: IF MID$(szBuf$, LEN(szBuf$), 1) <> "\" THEN ! 1576: szBuf$ = szBuf$ + "\" ! 1577: END IF ! 1578: GetWindowsDir = szBuf$ ! 1579: END IF ! 1580: ! 1581: szBuf$ = "" ! 1582: END FUNCTION ! 1583: ! 1584: ! 1585: '************************************************************************* ! 1586: FUNCTION GetWindowsSysDir STATIC AS STRING ! 1587: szBuf$ = string$(256, 32) ! 1588: cbBuf% = GetSystemDirectory(szBuf$, 256) ! 1589: ! 1590: IF cbBuf% = 0 THEN ! 1591: '$ifdef DEBUG ! 1592: StfApiErr saeFail, "GetWindowsSysDir", "" ! 1593: '$endif ''DEBUG ! 1594: ERROR STFERR ! 1595: ELSE ! 1596: IF cbBuf% > 255 THEN ! 1597: res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK) ! 1598: ERROR STFERR ! 1599: END IF ! 1600: szBuf$ = RTRIM$(szBuf$) ! 1601: IF MID$(szBuf$, 1, 1) = "\" THEN ! 1602: szBuf$ = MID$(CURDIR$, 1, 2) + szBuf$ ! 1603: ELSEIF MID$(szBuf$, 2, 1) <> ":" THEN ! 1604: szBuf$ = MID$(CURDIR$, 1, 3) + szBuf$ ! 1605: END IF ! 1606: IF MID$(szBuf$, LEN(szBuf$), 1) <> "\" THEN ! 1607: szBuf$ = szBuf$ + "\" ! 1608: END IF ! 1609: GetWindowsSysDir = szBuf$ ! 1610: END IF ! 1611: ! 1612: szBuf$ = "" ! 1613: END FUNCTION ! 1614: ! 1615: ! 1616: '************************************************************************* ! 1617: FUNCTION IsWindowsShared STATIC AS INTEGER ! 1618: szWin$ = UCASE$(GetWindowsDir()) ! 1619: szSys$ = UCASE$(GetWindowsSysDir()) ! 1620: ! 1621: IF len(szWin$) = 0 THEN ! 1622: '$ifdef DEBUG ! 1623: StfApiErr saeFail, "IsWindowsShared", "" ! 1624: '$endif ''DEBUG ! 1625: ERROR STFERR ! 1626: END IF ! 1627: ! 1628: IF len(szSys$) <= len(szWin$) THEN ! 1629: IsWindowsShared = 1 ! 1630: ELSE ! 1631: szSys$ = MID$(szSys$, 1, len(szWin$)) ! 1632: IF szWin$ = szSys$ THEN ! 1633: IsWindowsShared = 0 ! 1634: ELSE ! 1635: IsWindowsShared = 1 ! 1636: END IF ! 1637: END IF ! 1638: END FUNCTION ! 1639: ! 1640: ! 1641: '************************************************************************* ! 1642: FUNCTION GetScreenWidth STATIC AS INTEGER ! 1643: GetScreenWidth = GetSystemMetrics(SM_CXSCREEN) ! 1644: END FUNCTION ! 1645: ! 1646: ! 1647: '************************************************************************* ! 1648: FUNCTION GetScreenHeight STATIC AS INTEGER ! 1649: GetScreenHeight = GetSystemMetrics(SM_CYSCREEN) ! 1650: END FUNCTION ! 1651: ! 1652: ! 1653: '************************************************************************* ! 1654: SUB SetRestartDir (szDir$) STATIC ! 1655: '$ifdef DEBUG ! 1656: if FValidFATDir(szDir$) = 0 then ! 1657: BadArgErr 1, "SetRestartDir", szDir$ ! 1658: end if ! 1659: '$endif ''DEBUG ! 1660: IF FSetRestartDir(szDir$) = 0 THEN ! 1661: '$ifdef DEBUG ! 1662: StfApiErr saeFail, "SetRestartDir", szDir$ ! 1663: '$endif ''DEBUG ! 1664: ERROR STFERR ! 1665: END IF ! 1666: END SUB ! 1667: ! 1668: ! 1669: '************************************************************************* ! 1670: FUNCTION RestartListEmpty STATIC AS INTEGER ! 1671: IF FRestartListEmpty() = 0 THEN ! 1672: RestartListEmpty = 0 ! 1673: ELSE ! 1674: RestartListEmpty = 1 ! 1675: END IF ! 1676: END FUNCTION ! 1677: ! 1678: ! 1679: '************************************************************************* ! 1680: FUNCTION ExitExecRestart STATIC AS INTEGER ! 1681: ExitExecRestart = FExitExecRestart ! 1682: END FUNCTION ! 1683: ! 1684: ! 1685: '************************************************************************* ! 1686: SUB PrependToPath (szSrc$, szDst$, szDir$, cmo%) STATIC ! 1687: ! 1688: '$ifdef DEBUG ! 1689: if (FValidFATPath(szSrc$) = 0) AND (szSrc$ <> "") then ! 1690: n% = 1 ! 1691: elseif FValidFATPath(szDst$) = 0 then ! 1692: n% = 2 ! 1693: elseif FValidFATDir(szDir$) = 0 then ! 1694: n% = 3 ! 1695: else ! 1696: n% = 0 ! 1697: end if ! 1698: if n% > 0 then ! 1699: BadArgErr n%, "PrependToPath", szSrc$+", "+szDst$+", "+szDir$+", "+STR$(cmo%) ! 1700: end if ! 1701: '$endif ''DEBUG ! 1702: ! 1703: IF FPrependToPath (szSrc$, szDst$, szDir$, cmo%) = 0 THEN ! 1704: '$ifdef DEBUG ! 1705: StfApiErr saeFail, "PrependToPath", szSrc$+", "+szDst$+", "+szDir$+", "+STR$(cmo%) ! 1706: '$endif ''DEBUG ! 1707: ERROR STFERR ! 1708: END IF ! 1709: END SUB ! 1710: ! 1711: ! 1712: ! 1713: '************************************************************************** ! 1714: '*************************** Error Handlers ***************************** ! 1715: '************************************************************************** ! 1716: ! 1717: ! 1718: '$ifdef DEBUG ! 1719: '************************************************************************** ! 1720: SUB StfApiErr (nMsg%, szApi$, szArgs$) STATIC ''DEBUG only ! 1721: select case nMsg% ! 1722: case saeFail ! 1723: lpText$ = "Failed" ! 1724: case saeInit ! 1725: lpText$ = "Already Initialized" ! 1726: case saeNYI ! 1727: lpText$ = "NYI" ! 1728: case else ! 1729: lpText$ = "Bad Arg "+LTRIM$(STR$(nMsg% - saeArg)) ! 1730: end select ! 1731: ! 1732: lpText$ = lpText$ + ": "+ szApi$ ! 1733: if szArgs$ <> "" then ! 1734: lpText$ = lpText + " (" + szArgs$ + ")" ! 1735: end if ! 1736: lpCaption$ = "MS-Setup Toolkit API Error" ! 1737: res% = DoMsgBox(lpText$, lpCaption$, MB_TASKMODAL+MB_ICONHAND+MB_OK) ! 1738: print lpText$ ! 1739: lpText$ = "" ! 1740: lpCaption$ = "" ! 1741: END SUB ! 1742: ! 1743: '************************************************************************** ! 1744: SUB BadArgErr (nArg%, szApi$, szArgs$) STATIC ''DEBUG only ! 1745: StfApiErr nArg%+saeArg, szApi$, szArgs$ ! 1746: ERROR STFERR ! 1747: END SUB ! 1748: ! 1749: ! 1750: '** REVIEW: Move this function into common lib (we'll need it there too) ! 1751: '************************************************************************** ! 1752: FUNCTION FValidInfSect (szSect$) STATIC AS INTEGER ! 1753: if (szSect$ = "") OR (INSTR(1,szSect$,"]") <> 0) then ! 1754: FValidInfSect = 0 ! 1755: else ! 1756: FValidInfSect = 1 ! 1757: end if ! 1758: END FUNCTION ! 1759: ! 1760: ! 1761: '** REVIEW: Move this function into common lib (we'll need it there too) ! 1762: '************************************************************************** ! 1763: FUNCTION FValidIniFile (szFile$) STATIC AS INTEGER ! 1764: if (FValidFATPath(szFile$) = 0) AND (UCASE$(szFile$) <> "WIN.INI") then ! 1765: FValidIniFile = 0 ! 1766: else ! 1767: FValidIniFile = 1 ! 1768: end if ! 1769: END FUNCTION ! 1770: ! 1771: '************************************************************************** ! 1772: FUNCTION FValidDrive (szDrive$) STATIC AS INTEGER ! 1773: ! 1774: if szDrive$ = "" then ! 1775: FValidDrive = 0 ! 1776: elseif INSTR(1,szDrive$,"\\") = 1 then ' UNC path ! 1777: FValidDrive = 1 ! 1778: elseif ASC(UCASE$(szDrive$)) - ASC("A") < 0 then ! 1779: FValidDrive = 0 ! 1780: elseif ASC(UCASE$(szDrive$)) - ASC("A") > 25 then ! 1781: FValidDrive = 0 ! 1782: elseif LEN(szDrive$) = 1 then ! 1783: FValidDrive = 1 ! 1784: elseif INSTR(2,szDrive$,":\") = 2 then ! 1785: FValidDrive = 1 ! 1786: elseif INSTR(1,szDrive$,":") = 2 then ! 1787: FValidDrive = 1 ! 1788: else ! 1789: FValidDrive = 0 ! 1790: end if ! 1791: END FUNCTION ! 1792: ! 1793: '$endif ''DEBUG ! 1794: ! 1795: ! 1796: TRAP CleanupTrap From "MSSHLSTF.DLL" ! 1797: ! 1798: End Trap ! 1799: ! 1800: hSetup = InitSetup(COMMAND$) ! 1801: ! 1802: ON ERROR GOTO QUIT ! 1803:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.