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

📄 registry.tcl

📁 windml3.0.3
💻 TCL
📖 第 1 页 / 共 2 页
字号:
# onTorRegOptSel <opt>
# .tE
#
# PARAMETERS:
# .IP opt
# option selected
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc onTorRegOptSel {opt} {
    global ctrlVals

    set ctrlVals(torRegAction) $opt

}

#############################################################################
#
# regOptionRegValueRead - load tornado registry option from the previous
#                         installation if any
#
# This procedure will load tornado registry option from the previous
# installation if any
#
# SYNOPSIS
# .tS
# regOptionRegValueRead
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: last saved tornado registry selection
#
# ERRORS: N/A
#

proc regOptionRegValueRead {} {
    global setupVals
    global ctrlVals

    # Load tornado registry option from the previous installation if any

    if ![info exists setupVals(torRegOption)] {
        set setupVals(torRegOption) ""

        if {![catch {sysRegistryValueRead HKEY_CURRENT_USER \
                "Software\\$setupVals(WRS)" \
                registryOption} retVal]} {

            set setupVals(torRegOption) $retVal

        } elseif {![catch {sysRegistryValueRead HKEY_LOCAL_MACHINE \
                "SOFTWARE\\$setupVals(WRS)" \
                registryOption} retVal]} {

            set setupVals(torRegOption) $retVal
        }
    }

    return $setupVals(torRegOption)
}

#############################################################################
#
# torRegistryServiceAdd - Install Tornado Registry as an NT service
#
# This procedure will install Tornado Registry as an NT service and start it
# if successful. This procedure is used for post-install Tornado Registry 
# configuration. (Setup /R)
#
# SYNOPSIS
# .tS
# torRegistryServiceAdd serviceName
# .tE
#
# PARAMETERS: Service Name
#
# RETURNS: 1 if success, 0 if failed
#
# ERRORS: N/A
#
proc torRegistryServiceAdd {serviceName} {
        global setupVals env

        if {[destDirGet] == "" } {
            if {$env(WIND_BASE) != ""} {
                destDirSet $env(WIND_BASE)
            } else {
                messageBox -stop "Environment variable WIND_BASE is not set or \
                                 found in the windows registry."
            }
        }

        # The following code is copied from INF.TCL

        set servicePath "host\\x86-win32\\bin"
        set serviceExe  "wtxregds.exe"
        set dependency ""
        set rootKey  HKEY_LOCAL_MACHINE
        set key "SYSTEM\\CurrentControlSet\\Services\\$serviceName"
        set valueName ImagePath
        set value [fullPathName $servicePath $serviceExe]

        if {![catch {setupServiceInstall $serviceName \
                        [fullPathName $servicePath $serviceExe] $dependency} err]} {
            dbgputs "service installed: $serviceName"
                
        } else {

            # NT service registry data
                
            # check if "Tornado Registry" exists in the service registry
            # if exists, that means the service has already been installed
            # and we only have to overwrite the wtxregds.exe path and restart
            # the service
                        
            if {[regValueExists $rootKey $key $valueName]} {
                if {![catch {sysRegistryValueWrite \
                             $rootKey $key $valueName $value} error2]} {
                    dbgputs "New registry value written. Service Installed."
                } else {
                    dbgputs "Failed to install $serviceName: $error2"
                }
            } else {
                dbgputs "Unable to install $serviceName"
            }
        }
                
                
        if {[catch {setupServiceStart $serviceName} err]} {
                dbgputs "Failed to start service $serviceName: $err"
                messageBox "Error: Failed to install $serviceName as a service."
                return 0
        } else {
                dbgputs "service started: $serviceName"
                messageBox "$serviceName has been installed as a service."
                return 1
        }
        

}
        
#############################################################################
#
# torRegistryServiceRemove - Remove the Tornado Registry Service
#
# This procedure will remove Tornado Registry as an NT service. This 
# procedure is used for post-install Tornado Registry configuration. 
# (Setup /R)
#
# SYNOPSIS
# .tS
# torRegistryServiceRemove
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: 1 if success, 0 if failed
#
# ERRORS: N/A
#
proc torRegistryServiceRemove {serviceName} {

        if {[catch {setupServiceStop $serviceName} err]} {
                dbgputs "cannot stop service, $serviceName: $err"
        } else {
                dbgputs "stopped service: $serviceName"
        }

        if {[catch {setupServiceRemove $serviceName} err]} {
                dbgputs "cannot delete service: $serviceName: $err"
                return 0
        } else {
                dbgputs "deleted service: $serviceName"
                return 1
        }
}

#############################################################################
#
# torRegistryStartupIconAdd - Install Tornado Registry in the startup group
#
# This procedure will install Tornado Registry in the startup group
# This procedure is used for post-install Tornado Registry 
# configuration. (Setup /R)
#
# SYNOPSIS
# .tS
# torRegistryStartupIconAdd
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: 1 if success, 0 if failed
#
# ERRORS: N/A
#
proc torRegistryStartupIconAdd {} {
        global ctrlVals env

        #destDirSet $env(WIND_BASE)
        
        if {[destDirGet] == "" } {
            if {$env(WIND_BASE) != ""} {
                destDirSet $env(WIND_BASE)
            } else {
                messageBox -stop "Environment variable WIND_BASE is not set or \
                                 found in the windows registry."
                return 0
            }
        }

        set folder "Startup"
        set item   "Tornado Registry"
        set exe    "[destDirGet]\\host\\x86-win32\\bin\\wtxregd.exe"
        set args   "-V"
        set dir    "[destDirGet]\\host\\x86-win32\\bin"
        set mode   "$ctrlVals(admin)"
        set fMin   0

        ### The following code is copied from linkCreateLog{} in UTILW32.TCL

        # create the group
        if {[catch {setupLinkDelete $folder $item $mode} error]} {
                messageBox -stop "Unable to delete $folder. \
                                Failed to add $item icon in the $folder group."
                return 0
        } else {

                if {[catch {setupLinkCreate $folder \
                                $item \
                                $exe \
                                $args \
                                $dir \
                                $mode \
                                $fMin} error]} {
                        
                        messageBox -stop "Error: Failed to install $item icon \
                                        in the $folder group."
                } else {
                        dbgputs "added icon: $item"
                        messageBox "Tornado registry has been installed in the \
                                        Startup Group"
                        return 1
                }
        }
}

#############################################################################
#
# torRegistryStartupIconRemove - Remove Tornado Registry icon  in the 
#                                startup group
#
# This procedure will remove Tornado Registry icon in the startup group
# This procedure is used for post-install Tornado Registry 
# configuration. (Setup /R)
#
# SYNOPSIS
# .tS
# torRegistryStartupIconRemove
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: 1 if success, 0 if failed
#
# ERRORS: N/A
#
proc torRegistryStartupIconRemove {} {
        global ctrlVals env

        set folder "Startup"
        set item   "Tornado Registry"
        set mode   $ctrlVals(admin)

        if {[catch {setupLinkDelete $folder $item $mode} error]} {
                dbgputs "Error: Unable to delete the $item folder."
                return 0
        } else {
                dbgputs "deleted $item in $folder group"
                return 1
        }
} 



######################################################################
# Dialog Text Messages
######################################################################

set strTable(TORREGISTRY_TITLE) "Tornado Registry"

set strTable(TORREGISTRY_DESC) \
    "The Tornado target server registry is a daemon that keeps track\
     of all available targets by name. Only one registry is required on\
     your network, and it can run on any networked host."

set strTable(TORREGISTRY_OPTION_SELECT) \
    "The following configuration options will allow you to define how\
     you will use the Tornado registry:"

set strTable(TORREGISTRY_OPTION_SERVICE) \
    "Run the Tornado registry as a Windows service (typical)"

set strTable(TORREGISTRY_OPTION_SERVICE_DESC) \
        "Select this option to have the Tornado registry started automatically \
        on this machine at boot time."

set strTable(TORREGISTRY_OPTION_STARTUP) \
    "Run the Tornado registry as part of the Startup Group"

set strTable(TORREGISTRY_OPTION_STARTUP_DESC) \
        "Select this option to have the Tornado registry started automatically \
        on this machine when the current user logs on."

set strTable(TORREGISTRY_OPTION_MANUAL) \
        "Start the Tornado registry manually"

set strTable(TORREGISTRY_OPTION_MANUAL_DESC) \
        "Select this option if you want to start the registry manually using \
        the Windows Start menu before running Tornado."
        
set strTable(TORREGISTRY_OPTION_REMOTE) \
        "Use a remote Tornado registry"
        
set strTable(TORREGISTRY_MSG1) \
    "NOTE: If you will be using Tornado outside of a networked development\
     environment (for example, with a notebook computer off-site), we\
     recommend that you select the Windows service or Windows Startup\
     Group option."

        

⌨️ 快捷键说明

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