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