Archive: Custom Page is skipped on XP; enable Cancel button


Custom Page is skipped on XP; enable Cancel button
I created a custom page using the InstallOptions template; it appears fine in Win2000 on the development box, but when I run the installer in XP, this page is skipped. Has this happened to anyone else?

Also, how can I enable the CANCEL button, which is disabled during the install-files portion of the installation?

Thank you,

-Jared


Re: Custom Page is skipped on XP; enable Cancel button

Originally posted by jared
Also, how can I enable the CANCEL button, which is disabled during the install-files portion of the installation?
using the search feature you will find multiple posts related to this. i bet there's also something about it in the faq.

not in the faq
Thanks for your quick response. I had in fact already searched, but found nothing. Thanks to your hint, I dug deeper and finally found the fact that the Cancel button is disabled until at least NSIS 2.1.

However, this is not in the faq, and if the problem persists much longer, it _should_ be in the faq, which I had also already read, seeking an answer.

Meanwhile, back at the ranch: Does anyone know why the custom page works fine in Win2K but not XP?


To help you with this problem I need more information, including script files and INI files.


Script and INI
Here is the script; the ini file follows:

; preamble
Name "WinLAMP"
OutFile "WinLAMP03.exe"
Icon "Apache2\install\dct.ico"


; install directory options
InstallDir "C:\"
DirText "Select the drive on which to install Apache2. \
For quick navigation to the Apache2\htdocs directory, \
we recommend a root directory, as below."
AllowRootDirInstall true
ShowInstDetails show
SetCompress auto


; define the installation types
InstType "Typical" ; Section 1
InstType "Full" ; Section 2
InstType "Minimal" ; Section 3


; list the various component sections
ComponentText "Note: MySQL, php, and phpMyAdmin directories are installed within the Apache2 tree."


; show pages in this order
Page components
Page directory
Page custom ApacheConfig ValidateConfig ": Apache2 configuration"
Page instfiles


;display the Install Options dialog
Function ApacheConfig
Push $R0
InstallOptions::dialog Apache2\install\apacheconfig.ini
Pop $R0
FunctionEnd


; retrieve apache configuration data
Function ValidateConfig
; retrieve data from the two fields
ReadINIStr $0 "Apache2\install\apacheconfig.ini" "Field 4" "State"
ReadINIStr $1 "Apache2\install\apacheconfig.ini" "Field 5" "State"
; crude attempt at validation: make sure there is at least some data
StrCmp $0 "" +1 +3
MessageBox MB_ICONEXCLAMATION|MB_OK "Please enter a Server Name"
Abort
StrCmp $1 "" +1 +3
MessageBox MB_ICONEXCLAMATION|MB_OK "Please enter an Admin Email Address"
Abort
FunctionEnd


; main section
Section "Apache + MySQL + PHP"

SectionIn 1 2 3 RO ; this section is always included
SetShellVarContext all ; modifies 'all users' area of start menu

; backup and clean up from preceding installation
Call BackupHtdocs
Call BackupData
Call CleanupFromApache1

; install the main Apache2 directory
SetOutPath "$INSTDIR"
File /r "Apache2" ; install the main Apache directory

; install some shortcuts
SetOutPath "$SMPROGRAMS" ; install the Apache shortcuts directory into start menu
File /nonfatal /r "Apache2\install\WinLAMP"
CreateShortCut "$SMPROGRAMS\WinLAMP\Apache Start.lnk" \
"$INSTDIR\Apache2\bin\Apache.exe" \
'-w -n "Apache2" -d "$INSTDIR\Apache2" -k start' \
"$INSTDIR\Apache2\install\apache.ico"
CreateShortCut "$SMPROGRAMS\WinLAMP\Apache Stop.lnk" \
"$INSTDIR\Apache2\bin\Apache.exe" \
'-w -n "Apache2" -d "$INSTDIR\Apache2" -k stop' \
"$INSTDIR\Apache2\install\apache.ico"
CreateShortCut "$SMPROGRAMS\WinLAMP\Apache Restart.lnk" \
"$INSTDIR\Apache2\bin\Apache.exe" \
'-w -n "Apache2" -d "$INSTDIR\Apache2" -k restart' \
"$INSTDIR\Apache2\install\apache.ico"
CreateShortCut "$SMPROGRAMS\WinLAMP\MySQL Start.lnk" \
"$SYSDIR\net" \
"start mysql" \
"$INSTDIR\Apache2\install\mysql.ico"
CreateShortCut "$SMPROGRAMS\WinLAMP\MySQL Stop.lnk" \
"$SYSDIR\net" \
"stop mysql" \
"$INSTDIR\Apache2\install\mysql.ico"
CreateShortCut "$SMPROGRAMS\WinLAMP\Edit httpd.conf file.lnk" \
"Notepad" \
"$INSTDIR\Apache2\conf\httpd.conf"
CreateShortCut "$SMPROGRAMS\WinLAMP\Edit php.ini file.lnk" \
"Notepad" \
"$WINDIR\php.ini"
CreateShortCut "$SMPROGRAMS\WinLAMP\Edit my.ini file.lnk" \
"Notepad" \
"$WINDIR\my.ini"
CreateShortCut "$SMPROGRAMS\WinLAMP\Uninstall WinLAMP.lnk" \
"$INSTDIR\Apache2\uninstall_WinLAMP.exe" \
"$INSTDIR\Apache2\install\dct.ico"

; run the updateconfs perlscript to add this machine's servername to httpd.conf, etc.
; updateconfs also updates and copies my.ini and php.ini, etc. into their appropriate dir
SetOutPath '$INSTDIR\Apache2\install'
ExecWait '$INSTDIR\Apache2\install\perl \
"$INSTDIR\Apache2\install\updateconfs.pl" \
"$INSTDIR\Apache2" "$0" "$1" "$WINDIR"'

; make sure there are no other Apache, MySQL currently installed -- uninstall em
ExecWait "$SYSDIR\net stop mysql" ; shutdown mysql service
ExecWait '$INSTDIR\Apache2\mysql\bin\mysqld-nt.exe --remove' ; remove mysql service
ExecWait '$INSTDIR\Apache2\bin\Apache.exe -k uninstall' ; remove apache service

; install Apache and MySQL as services
ExecWait '$INSTDIR\Apache2\mysql\bin\mysqld-nt --install'
ExecWait '$INSTDIR\Apache2\bin\Apache.exe -k install -n "Apache2" -d "$INSTDIR\Apache2"'

; start the two services
ExecWait '$INSTDIR\Apache2\bin\Apache.exe -w -n "Apache2" -d "$INSTDIR\Apache2" -k start'
ExecWait "$SYSDIR\net start mysql"

; registry settings, useful for add/remove programs
WriteRegStr HKEY_LOCAL_MACHINE \
"SOFTWARE\DCT\WinLAMP" \
"Install_Dir" \
"$INSTDIR\Apache2"
WriteRegStr HKEY_LOCAL_MACHINE \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\WinLAMP" \
"DisplayName" \
"WinLAMP (remove only)"
WriteRegStr HKEY_LOCAL_MACHINE \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\WinLAMP" \
"UninstallString" \
"$INSTDIR\Apache2\uninstall_WinLAMP.exe"

; create the uninstaller
WriteUninstaller "$INSTDIR\Apache2\uninstall_WinLAMP.exe"

SectionEnd


Section "phpMyAdmin 2.5.6 (recommended)"
SectionIn 1 2 ; this section is often included
SetOutPath "$INSTDIR\Apache2"
File /r phpMyAdmin
SectionEnd


Section "esKUel 1.0.5"
SectionIn 2 ; this section is only in 'full' install
SetOutPath "$INSTDIR\Apache2"
File /r esKUel
SectionEnd


Section "Add MySQL-Front 2.5 Installer to desktop"
SectionIn 2 ; this section is only in 'full' install
SetOutPath "$DESKTOP"
File MySQL-Front\MySQL-Front_2.5_Setup.exe
SectionEnd


Section "Add SQLyog 3.71 Installer to desktop"
SectionIn 2 ; this section is only in 'full' install
SetOutPath "$DESKTOP"
File SQLyog\SQLyog371.exe
SectionEnd


Section "Add DBTools 2.3 Installer to desktop"
SectionIn 2 ; this section is only in 'full' install
SetOutPath "$DESKTOP"
File DBTools\prosetup230EN.exe
SectionEnd


Section "Add ActivePerl 5.8 Installer to desktop"
SectionIn 2 ; this section is only in 'full' install
SetOutPath "$DESKTOP"
File Perl58\ActivePerl-5.8.3.809-MSWin32-x86.msi
SectionEnd


Section "Apache help manual"
SectionIn 2 ; this section is only in 'full' install
SetOutPath "$INSTDIR\Apache2\manuals"
File /r manuals\apache
SectionEnd


Section "MySQL help manual"
SectionIn 2 ; this section is only in 'full' install
SetOutPath "$INSTDIR\Apache2\manuals"
File /r manuals\mysql
SectionEnd


Section "PHP help manual"
SectionIn 2 ; this section is only in 'full' install
SetOutPath "$INSTDIR\Apache2\manuals"
File /r manuals\php
SectionEnd


; popup a browser when the installation is complete
Function .onInstSuccess
; give us an introductory page; hopefully it will all work!
Exec '$PROGRAMFILES\Internet Explorer\Iexplore.exe http://localhost/'
FunctionEnd


; remove remnants of a previous Apache 1.x installation
Function CleanupFromApache1

SetShellVarContext all

; stop and remove any running versions of Apache and MySQL
ExecWait "$SYSDIR\net stop mysql" ; shutdown mysql service
ExecWait "$SYSDIR\net stop apache" ; shutdown apache service
Exec '$INSTDIR\Apache\mysql\bin\mysqld-nt.exe --remove' ; remove mysql service
Exec '$INSTDIR\Apache\Apache.exe -k uninstall' ; remove apache service

; remove Apache dir
IfFileExists "$INSTDIR\Apache\*.*" +1 WinLamp
MessageBox MB_YESNO "You are upgrading to Apache 2. \
I found an Apache 1.x version. \
$\n$\nIf you made backups of your data, it is safe to delete now. \
$\n$\nDo you want to remove it?" IDNO WinLamp
SetOutPath "$INSTDIR\Apache"
ExecWait 'del /s /q *.*' ; delete all files in the directory
RMDir /r "$INSTDIR\Apache" ; remove the empty directories

; remove Start Menu items
WinLamp:
Delete "$SMPROGRAMS\WinLAMP\Apache Start.lnk" ; remove shortcuts
Delete "$SMPROGRAMS\WinLAMP\Apache Stop.lnk"
Delete "$SMPROGRAMS\WinLAMP\Apache Restart.lnk"
Delete "$SMPROGRAMS\WinLAMP\Edit httpd.conf file.lnk"
Delete "$SMPROGRAMS\WinLAMP\Uninstall WinLAMP.lnk"
Delete "$SMPROGRAMS\WinLAMP\MySQL Start.lnk"
Delete "$SMPROGRAMS\WinLAMP\MySQL Stop.lnk"
Delete "$SMPROGRAMS\WinLAMP\Edit php.ini file.lnk"
Delete "$SMPROGRAMS\WinLAMP\Edit my.ini file.lnk"
RMDir "$SMPROGRAMS\WinLAMP"

; remove ini and dll files
Delete "$WINDIR\php.ini"
Delete "$WINDIR\my.ini"
Delete "$WINDIR\php4ts.dll"

; pull out any registry key
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\DCT\WinLAMP"
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinLAMP"

FunctionEnd


; backup Apache htdocs directories; ask first
Function BackupHtdocs

; backup Apache htdocs
IfFileExists "$INSTDIR\Apache\htdocs" +1 +3
MessageBox MB_OKCANCEL "Your Apache\htdocs directory has files in it. I recommend a backup before continuing. \
$\n$\nClick OK to make a backup now." IDOK +1 IDCANCEL +2
CopyFiles /SILENT "$INSTDIR\Apache\htdocs" "$DESKTOP\WinLAMP Apache htdocs Backup"
; backup Apache2 htdocs
IfFileExists "$INSTDIR\Apache2\htdocs" +1 +3
MessageBox MB_OKCANCEL "Your Apache2\htdocs directory has files in it. I recommend a backup before continuing. \
$\n$\nClick OK to make a backup now." IDOK +1 IDCANCEL +2
CopyFiles /SILENT "$INSTDIR\Apache2\htdocs" "$DESKTOP\WinLAMP Apache2 htdocs Backup"

FunctionEnd


; backup MySQL data directories; ask first
Function BackupData

; backup mysql data
IfFileExists "$INSTDIR\Apache\mysql\data" +1 +3
MessageBox MB_OKCANCEL "Your Apache\mysql\data directory has files in it. I recommend a backup before continuing. \
$\n$\nClick OK to make a backup now." IDOK +1 IDCANCEL +2
CopyFiles /SILENT "$INSTDIR\Apache\mysql\data" "$DESKTOP\WinLAMP MySQL data Backup"
; backup mysql2 data
IfFileExists "$INSTDIR\Apache2\mysql\data" +1 +3
MessageBox MB_OKCANCEL "Your Apache2\mysql\data directory has files in it. I recommend a backup before continuing. \
$\n$\nClick OK to make a backup now." IDOK +1 IDCANCEL +2
CopyFiles /SILENT "$INSTDIR\Apache\mysql\data" "$DESKTOP\WinLAMP MySQL data Backup(2)"

FunctionEnd


; uninstaller version; note the path difference here, though: whether NSIS bug or feature, not sure
Function un.BackupHtdocs

IfFileExists "$INSTDIR\htdocs\*.*" +1 +3
MessageBox MB_OKCANCEL "Your Apache2\htdocs directory has files in it. I recommend a backup before continuing. \
$\n$\nClick OK to make a backup now." IDOK +1 IDCANCEL +2
CopyFiles /SILENT "$INSTDIR\htdocs" "$DESKTOP\WinLAMP Apache htdocs Backup"

FunctionEnd


; uninstaller version of backupdata func
Function un.BackupData

IfFileExists "$INSTDIR\mysql\data\*.*" +1 +3
MessageBox MB_OKCANCEL "Your Apache2\mysql\data directory has files in it. I recommend a backup before continuing. \
$\n$\nClick OK to make a backup now." IDOK +1 IDCANCEL +2
CopyFiles /SILENT "$INSTDIR\mysql\data" "$DESKTOP\WinLAMP MySQL data Backup"

FunctionEnd


; set the text which appears on the uninstall page
UninstallText "Uninstalls WinLAMP from your system.$\rThe entire directory below WILL BE REMOVED!"


; uninstall
Section "Uninstall"

SetShellVarContext all

; check and see if we're about to delete somethin precious
Call un.BackupHtdocs
Call un.BackupData

; shutdown anything still running
ExecWait "$SYSDIR\net stop mysql" ; shutdown mysql service
ExecWait '$INSTDIR\bin\Apache.exe -k shutdown' ; stop apache service
ExecWait '$INSTDIR\mysql\bin\mysqld-nt.exe --remove' ; remove mysql service
ExecWait '$INSTDIR\bin\Apache.exe -k uninstall' ; remove apache service

; remove the start menu items
Delete "$SMPROGRAMS\WinLAMP\Apache Start.lnk" ; remove shortcuts
Delete "$SMPROGRAMS\WinLAMP\Apache Stop.lnk"
Delete "$SMPROGRAMS\WinLAMP\Apache Restart.lnk"
Delete "$SMPROGRAMS\WinLAMP\Edit httpd.conf file.lnk"
Delete "$SMPROGRAMS\WinLAMP\Uninstall WinLAMP.lnk"
Delete "$SMPROGRAMS\WinLAMP\MySQL Start.lnk"
Delete "$SMPROGRAMS\WinLAMP\MySQL Stop.lnk"
Delete "$SMPROGRAMS\WinLAMP\Edit php.ini file.lnk"
Delete "$SMPROGRAMS\WinLAMP\Edit my.ini file.lnk"
RMDir "$SMPROGRAMS\WinLAMP"

; remove the ini files in the windows directory
Delete "$WINDIR\php.ini"
Delete "$WINDIR\my.ini"

; goodbye registry entries
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\DCT\WinLAMP"
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinLAMP"

; and finally, goodbye to the Apache2 directory
SetOutPath "$INSTDIR"
ExecWait 'del /s /q *.*' ; delete all files in the directory
RMDir /r "$INSTDIR" ; remove the empty directories

SectionEnd

;eof

=============ini:================

; Ini file generated by the HM NIS Edit IO designer.
[Settings]
NumFields=7
Title=Apache Configuration

[Field 1]
Type=Groupbox
Text=Apache Configuration
Left=22
Right=242
Top=14
Bottom=115

[Field 2]
Type=Label
Text=Server Name:
Left=37
Right=89
Top=40
Bottom=48

[Field 3]
Type=Label
Text=Admin email address:
Left=37
Right=103
Top=75
Bottom=83

[Field 4]
Type=Text
State="localhost"
Left=110
Right=234
Top=38
Bottom=51

[Field 5]
Type=Text
State="admin@somewhere.com"
Left=110
Right=234
Top=73
Bottom=86

[Field 6]
Type=Label
Text=(either a valid DNS name for your host, or an IP address)
Left=110
Right=233
Top=52
Bottom=70

[Field 7]
Type=Label
Text=(appears on some server-generated pages)
Left=110
Right=233
Top=88
Bottom=105


Is that INI file stored as a normal ANSI file?


ANSI
Yes. I am using the HM NIS editor to create and save the script. I assume that it is saving in a normal ANSI format.


Please create a minimal example that compiles on every system and reproduces the problem.


It will take some time
That will take me some time; I will post here again in a few days when I can. Thank you for your patience.