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

📄 register.tcl

📁 windml3.0.3
💻 TCL
📖 第 1 页 / 共 4 页
字号:
                                findZipFileDlg
                                set env(CD_ROOT) [file dirname [cdromZipDirGet]]
                                checkBSPcd
                                set skipInstalloverCheck 1

                                # avoid calling objectConstruct by returning 0 here
                                # user will return to the registration page

                                return 0
                            }
                        }
                        default {
                            exitWithMessage [strTableGet REGISTRATION_WARN_5 $error]
                        }
                    }
                } else { # TEXT MODE

                    switch -exact -- $error {
                        BAD_CD_KEY {
                            puts "Error: [strTableGet REGISTRATION_WARN_2]\n"
                            set ret [prompt "Enter your key:"]
                            switch -regexp -- $ret {
                                "^-$"   { backCallback; return 0 }
                                "[eE][xX][iI][tT]"  { return 0 }
                                default { 
                                    return [pageProcess(registration)] 
                                }
                            }
                        }
                        BAD_CD_REVISION {
                            puts [strTableGet REGISTRATION_WARN_4_TEXT]
                            set ret [prompt]
                            switch -regexp -- $ret {
                                "^-$"   { backCallback; return 0 }
                                "^$"    { }
                                "[eE][xX][iI][tT]"  { return 0 }
                                default { 
                                    return [pageProcess(registration)] 
                                }
                            }
                        }
                        
                        # do not write to the registry if hidden box is checked

                        BAD_CD_VENDOR_ID {                           
                            puts "Error: [strTableGet REGISTRATION_WARN_3]"
                            return 0
                        }
                        NO_ZIP_FILE {

                            # if NO LM error, display NO_ZIP error message
 
                            if {$setupVals(lmError) == "" && [instTypeGet] != "licenseSetup"} {
                                set setupVals(noZipDir) 1

                                printPageTitle [strTableGet REGISTRATION_NO_ZIP_FILE_TITLE]
                                set ret ""
                                while { $ret == "" } {
                                    puts [strTableGet REGISTRATION_NO_ZIP_FILE_TEXT]
                                    set ret [prompt]
                                }
                                switch -regexp -- $ret {
                                    "^-$" { pageCreate(registration); return 0 }
                                    "[eE][xX][iI][tT]" { return 0 }
                                    default { 
                                        cdromZipDirSet [file join [string trim $ret] WIND]
                                        return [pageProcess(registration)]
                                    }
                                }
                            }
                        }
                        default {
                            puts [strTableGet REGISTRATION_WARN_5 $error]
                            return 0
                        }
                    }                                                
                }
            }
          }
        } else {
            if { [isGUImode] } {
                messageBox [strTableGet REGISTRATION_WARN_7]
                return 0
            }
        }
    } else {

        if { [isGUImode] } {

            # test automation

            if { $ctrlVals(useInputScript) } {
                autoSetupLog "[strTableGet REGISTRATION_WARN_6]"
                autoSetupLog "Application Exit\n"
                set setupVals(cancel) 1
                applicationExit
                return 0
            } else {
                messageBox [strTableGet REGISTRATION_WARN_6]
                return 0
            }
        } else { # TEXT MODE
            puts "Error: [strTableGet REGISTRATION_WARN_6]\n"
            set ret [prompt "Enter your key:"]

            switch -regexp -- $ret {
                "^-$"   { backCallback; return 0}
                "^$"    { }
                "[eE][xX][iI][tT]"  { return 0 }
                default { instKeySet $ret }
            }
            return [pageProcess(registration)]
        }
    }

    objectConstruct

    set prod [string toupper [getProdInfo name]]
    set infVals(addRegistration) 1
    searchAndProcessSection AddRegistry [cdFileNameGet [file join RESOURCE \
                                         INF $prod.INF]]
    queueExecute
    set infVals(addRegistration) 0
    set infVals(addRegKeyData) 0

    if { [isGUImode] } {

        endWaitCursor

        # if nokey is required, destroy the control that was created earlier
        if {[string compare "none" [instKeyGet]] == 0} {
            catch { controlDestroy $ctrlVals(mainWindow).noKeyText }
        }
    }

    # For BSP CD installation:
    # skip Installation Options page - no need
    # add full-installation page list
    # skip project info page because this is for BSP

    if { [isBSPcd] } {
        pageRemove installChoice
        instTypeSet "core"
        if {[isUnix]} {     
            pageListAdd "unixFullInstPages"
        } else {
            pageListAdd "winFullInstPages"
        }
        pageRemove projectInfo
    }

    dbgputs "current pagelist: $ctrlVals(pageList)"

    return $retVal
}

#############################################################################
#
# modKeyDataRegistryValue - modifies installation key information in the 
#                           Windows registry
#
# This procedure will set installation key information in the Windows
# registry
#
#
# SYNOPSIS
# .tS
# modKeyDataRegistryValue
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc modKeyDataRegistryValue {} {
    global setupVals
    global infVals

    if {[instKeyGet] != "none"} {
        set HKCU HKEY_CURRENT_USER
        set infVals(addRegKeyData) 1
        set key [instKeyGet]

        if {![catch {sysRegistryValueRead $HKCU \
            "Software\\$setupVals(WRS)" "keyData"} setupVals(keyString)]} {

            set foundCD 0
            for {set idx 0} \
                {$idx < [llength $setupVals(keyString)]} \
                {incr idx} {
                set combo [lindex $setupVals(keyString) $idx]

                if {[lsearch $combo $setupVals(CDnumber)] != -1} {
                    set foundCD 1
                            set tgtKeyIdx [lsearch $combo $key]
                    if {$tgtKeyIdx != -1} {
                        # installation key has been found

                        set setupVals(keyString) \
                        [lreplace $setupVals(keyString) $idx $idx \
                                  [lreplace $combo $tgtKeyIdx $tgtKeyIdx]]
                        dbgputs "CD found, new key: \
                            setupVals(keyString) = $setupVals(keyString)"
                    }
                }
            }
        } else {
            set setupVals(keyString) $setupVals(CDnumber)
        }
    }
}



#############################################################################
#
# setKeyDataRegistryValue - set installation key information in the Windows
#                           registry
#
# This procedure will set installation key information in the Windows
# registry
#
#
# SYNOPSIS
# .tS
# setKeyDataRegistryValue
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc setKeyDataRegistryValue {} {
    global ctrlVals
    global setupVals
    global infVals

    if {[instKeyGet] != "none"} {
        set infVals(addRegKeyData) 1
        set key [instKeyGet]

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

            set foundCD 0
            for {set idx 0} \
                {$idx < [llength $setupVals(keyString)]} \
                {incr idx} {
                set combo [lindex $setupVals(keyString) $idx]

                if {[lsearch $combo $setupVals(CDnumber)] != -1} {
                    set foundCD 1
                    if {[lsearch $combo $key] == -1} {
                        # installation key is not found
                        set setupVals(keyString) \
                        [lreplace $setupVals(keyString) $idx $idx \
                                  [linsert $combo 1 $key]]

                        dbgputs "CD found, new key: \
                            setupVals(keyString) = $setupVals(keyString)"
                    }
                }
            }

            if !{$foundCD} {
                set setupVals(keyString) \
                    "\{$setupVals(CDnumber) $key\} $setupVals(keyString)"

                dbgputs "new CD, new key: \
                        setupVals(keyString) = $setupVals(keyString)"
            }

        } else {
            set setupVals(keyString) "\{$setupVals(CDnumber) $key\}"

            dbgputs "new keyData registry: \
                    setupVals(keyString) = $setupVals(keyString)"
        }
    }

}

#############################################################################
#
# onFindZipFileBrowse - set the value in edit box when a directory is selected
#                       from the browse window
#
# This procedure will set the value in edit box when a directory is selected
# from the browse window
#
# This procedure
#
# SYNOPSIS
# .tS
# onFindZipFileBrowse <ctrlName>
# .tE
#
# PARAMETERS:
# .IP ctrlName
# control name which will have the new value
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc onFindZipFileBrowse {ctrlName} {
    global ctrlVals

    set retDir [dirBrowseDialogCreate \
                    -title "WIND Directory" \
                    -initialDir [cdromZipDirGet] ]
    if {"$retDir" != ""} {
        controlValuesSet findZipFileDlgHnd.$ctrlName $retDir
    }
}

#############################################################################
#
# registrationValuesReadFromRegistry - fetch user registration values from
#                                      the Windows registry
#
# This procedure will fetch user registration values from the Windows
# registry
#
# SYNOPSIS
# .tS
# registrationValuesReadFromRegistry
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc registrationValuesReadFromRegistry {} {
    global setupVals


    # Load user name from the previous installation if any

⌨️ 快捷键说明

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