📄 utilw32.tcl
字号:
# UTILW32.TCL - Utility functions for win32 installation
#
# Copyright 1996-2003 Wind River Systems, Inc.
#
# modification history
# --------------------
# 04o,29apr03,bjl modified help callback to always open top of help file.
# 04n,27jan03,wmd Modify to use licInfoGetAll2 for ALI.
# 04m,16jan03,wmd Fix SPR #85761, better error message than Unknown database
# error.
# 04l,03oct02,bjl fixed uninstall icon link to use core product name rather
# than cdromDesc (spr 77983).
# 04k,31jul02,wmd Modify LM error return strings for clarity.
# 04j,23may02,bwd SPR 77766: remove setup.log.abort after LM configuration
# finish
# 04i,23may02,bwd SPR 77766: allow optional tornado products CD to read dest
# dir value from registries
# 04h,17may02,j_w Fixed parsing of tgsg.hm
# 04g,01may02,j_w Add yesnocancel option in messageBox; Fixed SPR 76685:
# translate error code into meaningful message
# 04f,30apr02,wmd Fix spr 76136 - remove fade from slideshow.
# 04e,05mar02,bwd Modified SETUP to be non-tornado centric
# 04d,22jan02,bwd Skip adding Uninstall icon for BSP CD
# 04c,03jan02,bwd Added proceed-cancel dialog
# 04b,26oct01,bwd Removed old windows 95/98 system check.
# SPR 70033: modified dialog file_exists_older_warn
# 04a,12jun01,j_w Modified for Tornado 2.2
# 03y,02may01,j_w No need to resend licFileConfig request due to
# duplicate hostId (Vol. Serial).
# 03x,13mar01,j_w update version 3.0 to 3.1
# 03w,17jan01,bwd SPR 63555: added \\ at the end of CD_ROOT to prevent
# invalid path name
# 03v,22nov00,bwd SPR 62562: modified quitCallback to display different
# cancel message for LM Installation path
# 03u,07nov00,wmd Fix dialog re_ig_cancel as part of spr #35911..
# 03t,07nov00,wmd Fix XPR #35574, SETUP failed to work with FVWM on Linux.
# 03s,02nov00,j_w Name change - Tornado AE
# 03r,25oct00,j_w Fixed typo
# 03q,19oct00,wmd Correct error messages.
# 03p,19oct00,j_w Added new ALI error types -- 11, 48, 51, 53
# 03o,10oct00,bwd SPR 34462: also use ethernet card serial number for hostID
# when encountering error code *4045 in sendToALD
# 03n,04oct00,bwd SPR 34732: messageBox arg passing
# 03m,29sep00,bwd Add check if LMHelpPath exists before using it
# 03l,20sep00,bwd Modified HELP on Windows to use default internet browser.
# Modified helpCallback to recognize duplicate pages and
# to choose the right help IDs set
# 03k,20sep00,j_w Fixed linkCreateLog and setupLinkCreateLog
# 03k,20sep00,bwd Added codes to read in a file with all the anchors for HELP
# pages to display correct HELP page for each SETUP page.
# 03j,15sep00,bwd SPR 34462: use ethernet card serial number for hostID when
# encountering error code *4041 in sendToALD
# 03i,11Sep00,j_w Updated ALD error code and error messages. Removed "?" icon
# in dlgFrmCreate and other dialogs. Added messageBox()
# procedure
# 03i,24aug00,bwd SPR 32263: add string trim to remove possible extra semi
# colons at the end of the paths for internet browsers
# 03h,28jun00,bwd Changed host checking to use windHostTypeGet instead of
# env(WIND_HOST_TYPE)
# 03g,22jun00,bwd SPR 32061: changed the size of the message in meterCreate
# procedure to vary, depending on the length of the message.
# Removed fade for bitmap if linux.
# 03f,21jun00,bjl Added regIntValueWriteLog functions.
# 03e,06jun00,bwd Added new page lists to lmPages in procedure quiteCallback
# 03d,30may00,bwd Modified reconstructPageList to handle special case when
# the page lead get removed (in case of reloading a license
# file via email/phone request).
# 03c,23may00,j_w Added default error handling (SPR 31160)
# 03b,19may00,wmd SPR 31003 - use lmVals(httpToken) to hold tranaction token.
# 03a,10may00,j_w Replaced "WRS" to "Wind River"(SPR 31004). Added error
# handling for error code -25 and -26 (SPR 31153)
# 02z,05may00,bwd Fixed SPR 31061. Declared ctrlVals variable in
# linkCreateLog procedure
# 02y,26apr00,bwd Fixed Windows HELP in helpCallback to retrieve PATH for
# Netscape and Iexplorer from system registries
# 02x,19apr00,bwd Fixed netscape lauching for windows in helpCallback
# 02w,19apr00,bwd Change SETUP HELP to assume that user has either internet
# explorer (Windows) or/and netscape. Workaround for Beta -
# use only 1 default help page.
# 02v,19apr00,bwd Change SETUP HELP (helpCallback) to use HTML pages for both
# windows and UNIX
# 02u,18apr00,bwd Added calls to display error messages for CGI_ERROR_32,
# ALD_ERROR_51, ALD_ERROR_52.
# 02t,13apr00,j_w fixed typo
# 02s,13apr00,j_w fix VersionNumber
# 02r,10apr00,j_w Updated parameter list for sendToALD
# 02q,06apr00,bwd Removed contact info to use URL instead.
# 02p,15mar00,bwd Added additional message in quitCallback to prompt user
# that LM configuration/installation is not yet complete if
# user quits during LM pages. Increased the height of
# resume_exit dialog box to fit new message.
# 02o,10feb00,j_w Fix spacing
# 02n,04feb00,wmd Add error messages for db error -23, transaction cannot be
# automated.
# 02n,04feb00,j_w Fix parameter list for commit request
# 02m,03feb00,j_w Remove commit command in the parameter list of commit
# request call
# 02l,02feb00,bwd Fixed queueExecute to reset setupVals(commandQueue) after
# each execution
# 02k,01feb00,j_w Removed error dlg box for error code -31 -- return 1
# instead
# 02j,01feb00,bwd Fixed error handling for test automation
# 02i,25jan00,bwd Added codes for error handling and displaying contact
# information in TEXT mode
# 02h,24jan00,bwd Deleted redundant codes
# 02g,21jan00,j_w Update licInfoGetAllRequest in sendToALD procedure and
# remove redundant code
# 02f,19jan00,wmd Modify ok_with_title dialog box to check for \n.
# 02e,11jan00,j_w Updated CGI_ERROR_30 error message
# 02d,07jan00,j_w Tested network connection to Wind River Server and
# updated CGI_ERROR_30 error message
# 02c,04jan00,bwd Corrected contact information for License Administrator
# 02b,23dec99,bwd Modified the error dialog to display with a scrollbar to
# accommodate long message/information
# 02a,17dec99,clc remove debug code from testing
# 01z,16dec99,clc add uninstStop to textmode nextCallback
# 01y,10dec99,j_w Add error checking in sendToALD if CGI is down
# 01x,09dec99,j_w Update serverErrorDlg
# 01w,08dec99,j_w Added error checking in helpCallback
# 01v,08dec99,j_w Replace hh viewer from modal to modeless
# 01u,07dec99,wmd Add license admin email/phone number to help customers.
# 01t,07dec99,j_w catch error for hh
# 01s,04dec99,wmd Add error pages for sendToALD.
# 01r,01dec99,j_w Add helpCallback procedure
# 01r,30nov99,clc add text mode for sendToALD procedure
# 01q,30nov99,wmd Add endWaitCursor to the default case.
# 01p,30nov99,j_w Add a Help button
# 01o,23nov99,clc add text mode to meterUpdate
# 01n,23nov99,j_w Add error handling for Server Error inside sendToALD proc.
# 01m,15nov99,wmd Fix debug messages.
# 01l,10nov99,wmd Add error handling switch to sendToALD proc.
# 01k,05nov99,wmd Add a new dialog proc ok_with_title.
# 01j,04nov99,j_w added more case statements in sendToALD
# 01i,03nov99,j_w Added sendToALD
# 01h,30oct99,wmd Add a pageExists procedure.
# 01g,27oct99,bwd Moved autoSetupLog to INSTW32.TCL
# 01f,22oct99,j_w Added comments and remove debug messages
# 01e,18oct99,j_w Update error messages in linkCreateLog
# 01d,15oct99,bjl removed DCOM update for Win95 from windowsSystemCheck.
# 01c,14oct99,j_w Add paramenters to uninstallInitWin32
# 01b,06oct99,j_w added calcPage procedure
# 01a,09Sep99,j_w written
#
# DESCRIPTION
# This module is the Tcl code for the Setup program. It contains procedures for
# the wizard pages.
#
global errorReturnVal
#############################################################################
#
# removeBackground - determine whether environment variable
# SETUP_REMOVEBACKGROUND is set
#
# This procedure will determine whether environment variable
# SETUP_REMOVEBACKGROUND is set
#
# SYNOPSIS
# .tS
# removeBackground
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: 0 if enviroment variable SETUP_REMOVEBACKGROUND is not set
# 1 if enviroment variable SETUP_REMOVEBACKGROUND is set
#
# ERRORS: N/A
#
proc removeBackground {} {
global env
if {[info exists env(SETUP_REMOVEBACKGROUND)]} {
if {$env(SETUP_REMOVEBACKGROUND)==1} {
return 1
}
}
return 0
}
#############################################################################
#
# setupFolderCreate - create folder for the product (ex: Tornado)
#
# This procedure will create folder for the product
#
# SYNOPSIS
# .tS
# setupFolderCreate <folder> <mode>
# .tE
#
# PARAMETERS:
# .IP folder
# folder name to be created
# .IP mode
# 0 -- install the product in the user program group
# 1 -- install the product in the common program group
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc setupFolderCreate {folder mode} {
set path [programPathGet $mode]
if [catch {file mkdir "$path\\$folder"} err] {
dbgputs "cannot create folder, $folder, $mode: $err"
}
}
#############################################################################
#
# folderCreateLog - create the product's folders and log the actions
#
# This procedure will create the product's folders and log the actions
# for uninstall to use later
#
# SYNOPSIS
# .tS
# folderCreateLog <folder> <mode> [log]
# .tE
#
# PARAMETERS:
# .IP folder
# folder name to be created
# .IP mode
# 0 -- install the product in the user program group
# 1 -- install the product in the common program group
# .IP log
# true -- log the actions (default)
# false -- do not log the actions
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc folderCreateLog {folder mode {log true}} {
global ctrlVals
setupFolderCreate $folder $mode
if {[lsearch $ctrlVals(folders) $folder] == "-1" && $log == "true"} {
lappend ctrlVals(folders) $folder
uninstLog resource "folder\t$folder\t$mode"
}
}
#############################################################################
#
# setupLinkDelete - create the product program links
#
# This procedure will create the product program links
#
# SYNOPSIS
# .tS
# setupLinkDelete <folder> <linkName> <mode>
# .tE
#
# PARAMETERS:
# .IP folder
# folder name containing the program links
# .IP linkName
# string name of program links
# .IP mode
# 0 -- install the product in the user program group
# 1 -- install the product in the common program group
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc setupLinkDelete {folder linkName mode} {
set programPath [programPathGet $mode]
if { "$folder" == "" } {
puts "Error: folder name is null"
return
}
if {"$linkName" == "" } {
puts "Error: link name is null"
return
}
if [catch {file delete "$programPath\\$folder\\$linkName.lnk"} err] {
dbgputs "cannot delete icon, $linkName: $err"
} else {
dbgputs "deleted icon: $linkName"
}
}
#############################################################################
#
# linkCreateLog - create the product program links and log the actions
#
# This procedure will create the product program links and log the actions for
# uninstall use later
#
# SYNOPSIS
# .tS
# linkCreateLog <folder> <item> <exe> [args] [dir] [mode] [fMin] [iconIndex]
# [iconPath]
# .tE
#
# PARAMETERS:
# .IP folder
# folder name containing the program links
# .IP item
# icon name; eg "Tornado Registry", "VxWorks COM1"
# .IP exe
# path to the executable file; eg "host\x86-win32\bin\wtxregd.exe"
# .IP args
# arguments passed to the executable; eg "-V"
# .IP dir
# directory that the executable resides
# .IP mode
# 0 -- install the product in the user program group
# 1 -- install the product in the common program group
# .IP fMin
# run in minimized state
# .IP iconIndex
# icon index
# .IP iconPath
# path to the icon file; eg host\resource\bitmaps\WindView\evtRecv.ico
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc linkCreateLog {folder item exe args dir mode {fMin 0} {iconIndex 0}\
{iconPath ""}} {
global ctrlVals
set added 0
set new 0
if {![catch {setupLinkDelete $folder $item $mode} error]} {
set new 1
}
if {$iconPath == "" && ![catch {setupLinkCreate $folder \
$item \
$exe \
$args \
$dir \
$mode \
$fMin} error]} {
set added 1
} elseif {![catch {setupLinkCreate $folder \
$item \
$exe \
$args \
$dir \
$mode \
$fMin \
$iconIndex \
$iconPath} error]} {
set added 1
} else {
dbgputs "error when creating item $item in $folder: $error"
set hasError 1
}
if {$new && $added} {
dbgputs "Added to uninstLog: icon\t$folder\t$item\t$mode"
uninstLog resource "icon\t$folder\t$item\t$mode"
}
if [info exists hasError] {
set msg "Cannot create icons(s): $error\nPlease run \"SETUP\" \
and select Program Group installation option to install \
icons at a later time."
if { $ctrlVals(useInputScript) } {
autoSetupLog "$msg"
autoSetupLog "Application Exit\n"
set setupVals(cancel) 1
applicationExit
return 0
} else {
messageBox "$msg"
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -