📄 register.tcl
字号:
set infVals(addRegistration) 0 endWaitCursor # if nokey is required, destroy the control that was created earlier if {[string compare "none" [instKeyGet]] == 0} { controlDestroy $ctrlVals(mainWindow).noKeyText } 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\\Wind River Systems" "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)" } } } } }}############################################################################### 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 if {"[userNameGet]" == ""} { if {![catch {sysRegistryValueRead HKEY_CURRENT_USER \ "Software\\$setupVals(WRS)" "name"} name]} { userNameSet $name } elseif {![catch {sysRegistryValueRead HKEY_LOCAL_MACHINE \ "SOFTWARE\\$setupVals(WRS)" "name"} name]} { userNameSet $name } else { userNameSet "" } } # Load company name from the previous installation if any if {"[companyNameGet]" == ""} { if {![catch {sysRegistryValueRead HKEY_CURRENT_USER \ "Software\\$setupVals(WRS)" "company"} company]} { companyNameSet $company } elseif {![catch {sysRegistryValueRead HKEY_LOCAL_MACHINE \ "SOFTWARE\\$setupVals(WRS)" "company"} company]} { companyNameSet $company } else { companyNameSet "" } } # Load installation key from the previous installation if any if {![catch {sysRegistryValueRead HKEY_CURRENT_USER \ "Software\\$setupVals(WRS)" "keyData"} keyString]} { instKeyDataSet [getKeyData $keyString $setupVals(CDnumber) list] } elseif {![catch {sysRegistryValueRead HKEY_LOCAL_MACHINE \ "SOFTWARE\\$setupVals(WRS)" "keyData"} keyString]} { instKeyDataSet [getKeyData $keyString $setupVals(CDnumber) list] } else { instKeyDataSet "" }}############################################################################### getKeyData - search for the requested CD number in string of keys and# CD numbers and return either the installation key or the# combination of key and the CD number## This procedure will search for the requested CD number in string of keys and# CD numbers and return either the installation key or the combination of# key and the CD number## SYNOPSIS# .tS# getKeyData <keyString> <CDnumber> <data># .tE## PARAMETERS:# .IP keyString# the entire list of keys and CD number read from the registry# .IP CDnumber# the CD number (TDK-XXXXX-XX-XX) to look for in keyString# .IP data# data to be fetched - key -- installation key# - list -- combination of key and CD number## RETURNS: either the installation key or the combination of# key and the CD number## ERRORS: N/A#proc getKeyData {keyString CDnumber {data {key list}}} { for {set idx 0} {$idx < [llength $keyString]} {incr idx} { set combo [lindex $keyString $idx] set found [lsearch $combo $CDnumber] if {$found != -1} { switch -exact $data { key { return [lindex $combo 1]} list { return [lrange $combo 1 end]} default { dbgputs "getKeyData: bad argument: $data" return "" } } } } return ""}################################################################################ objectConstruct - creates objects to store all information about the unlocked# products.## This function must be called prior to the following functions: cdInfoGet/Set# SYNOPSIS# objectConstruct## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc objectConstruct {} { global productObj partObj featureObj cdObj global constructed global setupVals if {![info exists constructed([instKeyGet])]} { catch { unset constructed unset productObj unset partObj unset featureObj unset setupVals(tornadoIndex) unset setupVals(drvIndex) } set constructed([instKeyGet]) 1 set productDescList {} set setupVals(drvIndex) -1 foreach prodIndex [setupProductIndexListGet] { set productObj($prodIndex,instFlag) 0 set productObj($prodIndex,prevInstFlag) 0 set productObj($prodIndex,partIndexList) {} set partIndexList [setupPartIndexListGet $prodIndex] foreach partIndex $partIndexList { set infoList [setupPartInfoGet $partIndex] set productNum [lindex $infoList 0] set productName [lindex $infoList 1] set productDesc [lindex $infoList 2] set partName [lindex $infoList 3] set partDesc [lindex $infoList 4] set productIndex [lindex $infoList 5] set defInstFlag [lindex $infoList 6] set totalFile [lindex $infoList 7] set featureDesc [lindex $infoList 8] set featureId [lindex $infoList 9] set size [lindex $infoList 10] set coreProd [lindex $infoList 12] # record the prodIndex of the drivers product if {[string compare $productName "tornado-comp-drv"] == 0} { if {[lindex $setupVals(drvIndex) 0] == -1} { set setupVals(drvIndex) \ [lreplace $setupVals(drvIndex) 0 0] } set lineIx [string last ":" $productDesc] set lineLen [string length $productDesc] set arch [string range $productDesc \ [expr $lineIx+2] $lineLen] lappend setupVals(drvIndex) [list $prodIndex $arch] } if {[string compare $productName "tornado"] == 0} { set lineIx [string last "x" $productDesc] set lineLen [string length $productDesc] set arch [string range $productDesc \ [expr $lineIx+2] $lineLen] lappend setupVals(tornadoIndex) [list $prodIndex $arch] } if {[string compare $productName "tornado-vxsim"] == 0 } { set lineIx [string last ":" $productDesc] set lineLen [string length $productDesc] set arch [string range $productDesc \ [expr $lineIx+2] $lineLen] switch -exact -- $arch { hp9700 { set arch simhppa } x86-winNT { set arch simnt } solaris { set arch simsolaris } } lappend setupVals(tornadoIndex) [list $prodIndex $arch] } # construct CD object if {![info exists cdObj(number)]} { set cdObj(number) [lindex $infoList 11] } # construct product objects set productObj($prodIndex,number) $productNum set productObj($prodIndex,name) $productName set productObj($prodIndex,desc) $productDesc set productObj($prodIndex,featureId) $featureId set productObj($prodIndex,coreProd) $coreProd lappend productObj($prodIndex,partIndexList) $partIndex # construct part objects set partObj($partIndex,instFlag) $defInstFlag set partObj($partIndex,prevInstFlag) $defInstFlag set partObj($partIndex,desc) $partDesc set partObj($partIndex,size) $size set partObj($partIndex,totalFile) $totalFile set partObj($partIndex,parent) $prodIndex set partObj($partIndex,coreProd) $coreProd set featureObj($featureId) $featureDesc if {"$defInstFlag" == "1"} { set productObj($prodIndex,instFlag) 1 set productObj($prodIndex,prevInstFlag) 1 } } if {[llength $partIndexList] == 1} { set partObj([lindex $partIndexList 0],instFlag) 1 set partObj([lindex $partIndexList 0],prevInstFlag) 1 } lappend productDescList \ [list $productObj($prodIndex,desc) $prodIndex] } set cdObj(productIndexList) {} foreach pair [lsort $productDescList] { lappend cdObj(productIndexList) [lindex $pair 1] } } # make the list of tornado indices unique if {[info exists setupVals(tornadoIndex)]} { set setupVals(tornadoIndex) [lunique $setupVals(tornadoIndex)] } dbgputs "finish constructing the products array"}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -