⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uninst.tcl

📁 这是vxworks 的图形界面开发软件windML2.0和另一个CP2可以构成完整的界面开发。
💻 TCL
📖 第 1 页 / 共 3 页
字号:
                       if {[catch {sysRegistryValueDelete \
                                  $rootKey $subKey $value} err]} {
                           print "cannot delete registry value, $value: $err"
                           if {$uninst(useInputScript)} {
                              autoUninstLog "cannot delete registry value, $value: $err"
                           }
                       } else {
                           print "deleted registry value: $value"
                           if {$uninst(useInputScript)} {
                              autoUninstLog "deleted registry value: $value"
                           }
                       }
                   }
               }
    
               service {
                   if {![isUnix]} {
                       set serviceName [lindex $line 1]
    
                       if {[catch {setupServiceStop $serviceName} err]} {
                           print "cannot stop service, $serviceName: $err"
                           if {$uninst(useInputScript)} {
                              autoUninstLog "cannot stop service, $serviceName: $err"
                           }
                       } else {
                           print "stopped service: $serviceName"
                           if {$uninst(useInputScript)} {
                              autoUninstLog "stopped service: $serviceName"
                           }
                       }
                       if {[catch {setupServiceRemove $serviceName} err]} {
                           print "cannot delete service: $serviceName: $err"
                           if {$uninst(useInputScript)} {
                              autoUninstLog "cannot delete service: $serviceName: $err"
                           }
                       } else {
                           print "deleted service: $serviceName"
                           if {$uninst(useInputScript)} {
                              autoUninstLog "deleted service: $serviceName"
                           }
                       }
                   } 
               }
    
               default {}
           }
        }
    }

    if {![isUnix]} {
        # now is time to remove all folders if any

        foreach folder $folderList {

            set folderName [lindex $folder 1]
            set common [lindex $folder 2]

            setupFolderDelete $folderName $common
        }
    }
}

##############################################################################
#
# uninstUITclDialogInit - initialization procedure for the uninstall dialog.
#
# This procedure sets the dialog's check boxes based on the contents of the
# uninst(mode) array variable.  This procedure is a no-op if automation is
# turned on.
#
# SYNOPSIS
# 
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc uninstUITclDialogInit {} {
    global uninst
    global argv
    global env

    applicationTitleSet "Tornado Uninstall"

    if {$uninst(useInputScript)} {
        return
    }

    if {$uninst(mode) == "none"} {
       messageBox -stop "Cannot find the uninstall information."
       windowClose uninstDlg

    } elseif {$uninst(mode) == "all"} {
       controlCheckSet uninstDlg.uninstAll 1
       controlEnable uninstDlg.uninstPart 0
       onUninstallAll
    } else {
       controlCheckSet uninstDlg.uninstAll 1
       onUninstallAll
    }
}

##############################################################################
#
# dosTempDirGet - returns a unique temporary directory name.
# 
#
# This procedure determine a temporary directory name based on the process
# id.
#
# SYNOPSIS
# 
#
# PARAMETERS: N/A
#
# RETURNS: a unique string name for a temporary directory path.
#
# ERRORS: N/A
#

proc dosTempDirGet {} {
    global env

    # Determine the "temp" directory

    set uninstTemp "_TMP[pid]"

    foreach elem [array names env] {
       if {[string compare [string tolower $elem] "tmp"] == 0} {
           set env(TMP) $env($elem)
       }
       if {[string compare [string tolower $elem] "temp"] == 0} {
           set env(TEMP) $env($elem)
       }
       if {[string compare [string tolower $elem] "tmpdir"] == 0} {
           set env(TMPDIR) $env($elem)
       }
    }

    if {[info exists env(TEMP)] && [file isdir $env(TEMP)]} {
        set TMP $env(TEMP)\\$uninstTemp

    } elseif {[info exists env(TMP)] && [file isdir $env(TMP)]} {
        set TMP $env(TMP)\\$uninstTemp

    } elseif {[info exists env(TMPDIR)] && [file isdir $env(TMPDIR)]} {
        set TMP $env(TMPDIR)\\$uninstTemp
    } else {
        set TMP "C:\\$uninstTemp"
    }

    return $TMP
}

##############################################################################
#
# seedUninstall -  make a list of required files to delete.
#       
#
# This procedure, invoked for Windows based machines, makes a list of required
# files that are used by the Uninstaller.  It also creates a batch file
# that is invoked to create a temporary directory where the uninstall program
# is actually executed so that the directory where uninstall resides itself 
# can be deleted as well.
#
# SYNOPSIS
# seedUninstall
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc seedUninstall {} {
    global env argv0 uninst

    set env(TMP) [unixToDos [dosTempDirGet]]

    set uninstDir [unixToDos "$uninst(WIND_BASE)\\.wind\\uninst"]
    set binDir [unixToDos "$uninst(WIND_BASE)\\SETUP\\X86\\WIN32"]

    set requiredFiles(msvcp50.dll) $binDir
    set requiredFiles(mfc42.dll) $binDir
    set requiredFiles(uitclcontrols.dll) $binDir
    set requiredFiles(msvcrt.dll) $binDir
    set requiredFiles(pctree32.dll) $binDir
    set requiredFiles(tcl.dll) $binDir
    set requiredFiles(uitcl.dll) $binDir
    set requiredFiles(setuptcl.dll) $binDir
    set requiredFiles(uitclsh.exe) $binDir
    set requiredFiles(uninst.tcl) $uninstDir
    set requiredFiles(uninst.bmp) $uninstDir
    set requiredFiles(wrsCW.dll) $binDir
    set requiredFiles(t2UninstallCleanup.exe) $binDir

    # create the batch file that will copy required files and invoke uitclsh.exe

    catch {file mkdir $env(TMP)}

    foreach file [array names requiredFiles] {
         file copy -force $requiredFiles($file)\\$file $env(TMP)
    }

    set version [setupWinVerGet]

    set flag ""

    if {[info exists env(SETUP_DEBUG)]} {
        set flag "-C"
    }

    if [catch {processCreate \
        "$env(TMP)\\uitclsh.exe $flag  [dosToUnix $env(TMP)\\uninst.tcl] \
         $uninst(WIND_BASE) [dosToUnix $env(TMP)]" $env(TMP)} error] {
        puts $error
    }
}

##############################################################################
#
# print - prints a message to the active console.
#
# SYNOPSIS
# print <nsg>
#
# PARAMETERS: msg - message to be printed.
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc print {msg} {
    global env

    if {[info exists env(SETUP_DEBUG)]} {
        puts "$msg"
    }
}

##############################################################################
#
# uninstMeterUpdate - updates the meter display
#
# This procedure uses the percent passed to update the meter.
#
# SYNOPSIS
# uninstMeterUpdate <percent tag1 tag2>
#
# PARAMETERS:
#     percent - number indicating percentage complete
#     tag 1 - any informational string to display or null
#     tag 2 - a second string to display or null
#
# RETURNS: N/A
#
# ERRORS: N/A
#
#
proc uninstMeterUpdate {percent tag1 tag2} {
    global ctrlVals
    global uninst
    global env

   set shortFileName [fileNameAbbreviate $tag2 30]

   controlValuesSet uninstDlg.progress $percent
   controlValuesSet uninstDlg.progressTag "$tag1 $shortFileName"
   uiEventProcess
}

##############################################################################
#
# message - prints a message 
#
# This procedure prints a message either in the form of a message box.
#
# SYNOPSIS
# message <msg>
#
# PARAMETERS: msg - any string
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc message {msg} {
    global uninst
    global env

    messageBox -ok -information $msg
}

##############################################################################
#
#
#
# This procedure 
#
# SYNOPSIS
# 
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc dialog {type title msg bitmap default} {
    global env

    switch $type {
        re_ig_cancel {
            switch [messageBox -abortretryignore -questionicon $msg] {
                abort  { return 2 }
                retry  { return 0 }
                ignore { return 1 }
            }
        }
    }
}

##############################################################################
#
# lastInstSessionInfoGet - retrieves infomation on the last install session
#
# This procedure retrieves and stores into uninst(info) strings which indicate
# what was installed during the last install session.
#
# SYNOPSIS
# lastInstSessionInfoGet
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc lastInstSessionInfoGet {} {
    global uninst env

    set zipFile \
        [lindex [lsort -decreasing \
                       [glob -nocomplain $uninst(home)/data.???]] 0]

    set saveDir [pwd]
    cd $env(TMP)

    catch {setupUnzip -o -qq $zipFile "installInfo"}

    if {[file exists "installInfo"]} {
        set f [open "installInfo" "r"]
        set uninst(info) [read $f]
        close $f
    } else {
        set uninst(info) "No previous install infomation to extract."
    }
}

##############################################################################
#
# uninstInfoGet - unzips the installInfo from the zip files
#
# This procedure unzips previous installation information from the data.???
# file into the appropriate unist() array values.
#
# SYNOPSIS
# uninstInfoGet
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc uninstInfoGet {} {
    global uninst
    global env

    set uninst(currItem) 1
    set uninst(totalItem) 1
    set uninst(resList) ""
    set uninst(fileList) ""
    set uninst(bakList) ""

    beginWaitCursor

    set uninstZipFileList \
        [lsort -decreasing [glob -nocomplain $uninst(home)/data.???]]

    if {"$uninst(mode)" == "part"} {
        set uninst(zipFile) [lindex $uninstZipFileList 0]
        uninstInfoGetHelper $uninst(zipFile)

    } elseif {"$uninst(mode)" == "all"} {
        foreach zipFile $uninstZipFileList {
            uninstInfoGetHelper $zipFile
        }
    }

    endWaitCursor

    print "uninst(resList) = $uninst(resList)"
    print "uninst(totalItem) = $uninst(totalItem)"
    if {$uninst(useInputScript)} {
        autoUninstLog "uninst(resList) = $uninst(resList)"
        autoUninstLog "uninst(totalItem) = $uninst(totalItem)"
    }
}
    
##############################################################################
#
# uninstInfoGetHelper - helper proc for uninstInfoGet
#
# This procedure is invoked by uninstInfoGet which then does all the work
# of initializing the uninst(fileList), uninst(bakList), and uninst(resList).
#
# SYNOPSIS
# uninstInfoGetHelper <zipFile>
#
# PARAMETERS: zipFile - the zipfile to search through for the information.
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc uninstInfoGetHelper {zipFile} {
    global uninst
    global env

    set saveDir [pwd]
    cd $env(TMP)

    catch {setupUnzip -o -qq $zipFile "install*"}

    # Load the installed file list

    if {[file exists "installFile"]} {
        set f [open "installFile" "r"]

        while {[gets $f line] != "-1"} {
            if {"$line" != ""} {
                lappend uninst(fileList) [split $line "\t"]
            }
        }
        close $f
    }

    # Load the backup file list

    if {[file exists "installBackup"]} {
        set f [open "installBackup" "r"]

        while {[gets $f line] != "-1"} {
            if {"$line" != ""} {
                lappend uninst(bakList) [split $line "\t"]
            }
        }
        close $f
    }

    # Load the resource file list

    if {[file exists "installResource"]} {
        set f [open "installResource" "r"]

        while {[gets $f line] != "-1"} {
            if {"$line" != ""} {
                lappend uninst(resList) [split $line "\t"]
            }
        }
        close $f
    }

    incr uninst(totalItem) [llength $uninst(fileList)]
    incr uninst(totalItem) [llength $uninst(resList)]
 
    if {"$uninst(mode)" == "part"} {
        incr uninst(totalItem) [llength $uninst(bakList)]
    }
  
    cd $saveDir
}

##############################################################################
#
# uninstBackup - restores the file in the backup list
#
# This procedure restores the files from the $uninst(zipFile) zipfile.
#

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -