When I build a map installer with NSIS everything seems to install properly but the installer is not writing the registry entries. I have to manually run the xxx.reg file to get the map to load in map source This happens even when the installer is run as administrator. I am using the map_install.nis file from this site and the OS is windows 7. Does anyone have a fix for this or any ideas?
Prolly a different problem in XP
Just tried it in XP the NC map installer from this site works and I can load my maps into mapsource with mapsettoolkit but when I use the install.exe i made I get problem occurred with installation error and mapsource crashes. tried to manually run the xx.reg file and got the same errors and have to uninstall my maps for mapsource to work again. BTW I have tried several versions of mapsource and they all behave the same way.
Anyway I am sure its something simple i am overlooking in the xx.nis script or maybe I should try a different program than NSIS.
Thanks
Freecat
Might be easier for us to detect an issue in your NSIS file if you attached it.
Thanks for the fast replies. Here is a copy of the .nis file file for the custom type test. The other test file is the same except for lines 15,109,119 are commented out.
;--------------------------------
; install.nsi
;--------------------------------
!include "MUI2.nsh"
; Configuration parameters
!define MAP_DESC_NAME "test Topo Map"
!define MAP_SHORT_NAME "test"
!define MAP_URL "http://www.freecat.com/"
!define MAP_EMAIL "[email protected]"
!define MAP_COPYRIGHT "Copyright (C) 2010 freecat.com"
!define MAP_VERSION "1.0"
!define MAP_REL_DATE "22 Feb 2010"
!define MAP_ID 301E ; Family ID = 4644 (dec) = 1224 (hex) = 2412 (hex flipped) --> http://www.geocities.com/binary_converter/
!define MAP_TYPE 23837773 ; only if using custom types
!define DIRECTORY "C:\Users\Freecat\Desktop\maptest3\"
!define EXE_FILE "${DIRECTORY}test_topo_install.exe"
; !define INSTALL_ICON "C:\gps_maps\arizona_topo\complete\favicon.ico"
; !define INSTALL_IMAGE "C:\gps_maps\left_header.bmp"
; !define INSTALL_LICENSE "C:\gps_maps\license.txt"
; !define INSTALL_README "$INSTDIR\readme.txt"
; !define INSTALL_MSG "${MAP_DESC_NAME} - Maps for Garmin GPS Units$\r$\n${MAP_URL}$\r$\nVersion ${MAP_VERSION} - ${MAP_REL_DATE}$\r$\n$\r$\n$\r$\nPlease email ${MAP_EMAIL} with any questions or comments or if you paid for this map.$\r$\n$\r$\n$\r$\n${MAP_COPYRIGHT}$\r$\nThis software is provided 'as-is', without any express or implied warranty. In no event will the author(s) be held liable for any damages arising from the use of this software."
!define INSTALL_MSG "This wizard will guide you through the installation of ${MAP_DESC_NAME} version ${MAP_VERSION} (${MAP_REL_DATE}) for Garmin GPS Units.$\r$\n$\r$\n${MAP_URL}$\r$\n$\r$\nPlease email ${MAP_EMAIL} with any questions or comments or if you paid for this map.$\r$\n$\r$\nIt is recommended that you close all other applications before starting Setup. This will make it possible to update relevant system files without having to reboot your computer.$\r$\n$\r$\nClick Next to continue."
; Setup installer
Name "${MAP_DESC_NAME}"
OutFile ${EXE_FILE}
InstallDir "$PROGRAMFILES\${MAP_SHORT_NAME}"
BrandingText " "
;--------------------------------
;Interface Settings
;--------------------------------
!define MUI_ABORTWARNING
; !define MUI_ICON ${INSTALL_ICON}
; !define MUI_UNICON ${INSTALL_ICON}
;--------------------------------
;Pages
;--------------------------------
; Generic welcome screen (optional)
; !define MUI_WELCOMEFINISHPAGE_BITMAP ${INSTALL_IMAGE}
; !insertmacro MUI_PAGE_WELCOME
; Custom welcome screen (optional)
!define MUI_WELCOMEPAGE_TITLE "Welcome to the ${MAP_DESC_NAME} Setup Wizard"
!define MUI_WELCOMEPAGE_TEXT "${INSTALL_MSG}"
!insertmacro MUI_PAGE_WELCOME
; !define MUI_LICENSEPAGE_CHECKBOX
; !insertmacro MUI_PAGE_LICENSE "${INSTALL_LICENSE}"
; Installation directory dialog
!insertmacro MUI_PAGE_DIRECTORY
; Installation
!insertmacro MUI_PAGE_INSTFILES
; Readme (optional)
; !define MUI_FINISHPAGE_SHOWREADME "${INSTALL_README}"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
;--------------------------------
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
; The stuff to install
;--------------------------------
Section "Install"
;remove the old version first
ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" \
"UninstallString"
StrCmp $R0 "" done
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"${MAP_DESC_NAME} is already installed. $\n$\nClick `OK` to remove the \
previous version and upgrade or `Cancel` to cancel this upgrade." \
IDOK uninst
Abort
;Run the uninstaller
uninst:
ClearErrors
ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
IfErrors no_remove_uninstaller
;You can either use Delete /REBOOTOK in the uninstaller or add some code
;here to remove the uninstaller. Use a registry key to check
;whether the user has chosen to uninstall. If you are using an uninstaller
;components page, make sure all sections are uninstalled.
no_remove_uninstaller:
done:
; Set output path to the installation directory.
SetOutPath $INSTDIR
; Source files for creating installation
File /a "${DIRECTORY}${MAP_SHORT_NAME}.tdb"
File /a "${DIRECTORY}${MAP_SHORT_NAME}.img"
File /a "C:\Users\Freecat\Desktop\maptest3\${MAP_TYPE}.typ" ; only if using custom type
; File /a ".\readme.txt"
File /a "${DIRECTORY}*.img"
; Write the installation path into the registry
WriteRegStr HKLM "SOFTWARE\${MAP_SHORT_NAME}" "Install_Dir" "$INSTDIR"
WriteRegStr HKLM "SOFTWARE\${MAP_SHORT_NAME}" "Version" "${MAP_VERSION}"
; Write the MapSource configuration into the registry
WriteRegBin HKLM "SOFTWARE\Garmin\MapSource\Families\${MAP_SHORT_NAME}" "ID" ${MAP_ID}
WriteRegStr HKLM "SOFTWARE\Garmin\MapSource\Families\${MAP_SHORT_NAME}" "TYP" "$INSTDIR\${MAP_TYPE}.typ" ; only if using custom type
WriteRegStr HKLM "SOFTWARE\Garmin\MapSource\Families\${MAP_SHORT_NAME}\1" "LOC" "$INSTDIR\"
WriteRegStr HKLM "SOFTWARE\Garmin\MapSource\Families\${MAP_SHORT_NAME}\1" "BMAP" "$INSTDIR\${MAP_SHORT_NAME}.img"
WriteRegStr HKLM "SOFTWARE\Garmin\MapSource\Families\${MAP_SHORT_NAME}\1" "TDB" "$INSTDIR\${MAP_SHORT_NAME}.tdb"
; Write the uninstall keys for Windows
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "DisplayName" "${MAP_DESC_NAME}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "NoModify" 1
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "NoRepair" 1
WriteUninstaller "uninstall.exe"
SectionEnd
;--------------------------------
; Uninstaller
;--------------------------------
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}"
DeleteRegKey HKLM "SOFTWARE\${MAP_SHORT_NAME}"
DeleteRegKey HKLM "SOFTWARE\Garmin\MapSource\Families\${MAP_SHORT_NAME}"
; Remove files and uninstaller
Delete $INSTDIR\*.*
Delete $INSTDIR\uninstall.exe
; Remove directories used
RMDir "$INSTDIR"
SectionEnd
I've run OZ's plain vanilla NSIS installer script on both XP and Win7, without problems on install or uninstall, but I haven't used custom TYP files.
Maps automatically go to the Program Files X86 folder in Win7 64bit.
I just rebuilt my installer package with Clickteam's Install Creator and got the same behavior as NSIS. Then I set the installer to run the .reg file as visible at the end of the install process. Now at the last installer window a box pops up asking for permission to add to the registry, click ok and the .reg entries installed ok and mapsource loads the maps perfectly ;D. This worked with both standard and custom types but it's not as clean as having the installer write them. I am going to keep messing with NSIS and see if I can get it to work correctly.
on win7 right click on your install and tell it to run as administrator; see if that works then we can narrow it down.
I've built the installs on xp and 7 (and even vista) and installed on all of those.
Thanks for all the help everyone. Oz I have run the installer as administrator and get the same behavior. I am going to create a small test mapset and go though everything again to see if i messed up somewhere. Will post what happens in a little while.
Freecat
;D Ok problem solved the registry locations are wrong in the map_install.nis file
OLD FILE:
; Write the installation path into the registry
WriteRegStr HKLM "SOFTWARE\${MAP_SHORT_NAME}" "Install_Dir" "$INSTDIR"
WriteRegStr HKLM "SOFTWARE\${MAP_SHORT_NAME}" "Version" "${MAP_VERSION}"
; Write the MapSource configuration into the registry
WriteRegBin HKLM "SOFTWARE\Garmin\MapSource\Families\${MAP_SHORT_NAME}" "ID" ${MAP_ID}
WriteRegStr HKLM "SOFTWARE\Garmin\MapSource\Families\${MAP_SHORT_NAME}" "TYP" "$INSTDIR\${MAP_TYPE}.typ" ; only if using custom type
WriteRegStr HKLM "SOFTWARE\Garmin\MapSource\Families\${MAP_SHORT_NAME}\1" "LOC" "$INSTDIR\"
WriteRegStr HKLM "SOFTWARE\Garmin\MapSource\Families\${MAP_SHORT_NAME}\1" "BMAP" "$INSTDIR\${MAP_SHORT_NAME}.img"
WriteRegStr HKLM "SOFTWARE\Garmin\MapSource\Families\${MAP_SHORT_NAME}\1" "TDB" "$INSTDIR\${MAP_SHORT_NAME}.tdb"
; Write the uninstall keys for Windows
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "DisplayName" "${MAP_DESC_NAME}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "NoModify" 1
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "NoRepair" 1
WriteUninstaller "uninstall.exe"
SectionEnd
NEW FILE
; Write the installation path into the registry
WriteRegStr HKLM "SOFTWARE\${MAP_SHORT_NAME}" "Install_Dir" "$INSTDIR"
WriteRegStr HKLM "SOFTWARE\${MAP_SHORT_NAME}" "Version" "${MAP_VERSION}"
; Write the MapSource configuration into the registry
WriteRegBin HKLM "SOFTWARE\Wow6432Node\Garmin\MapSource\Families\${MAP_SHORT_NAME}" "ID" ${MAP_ID}
; WriteRegStr HKLM "SOFTWARE\Garmin\MapSource\Families\${MAP_SHORT_NAME}" "TYP" "$INSTDIR\${MAP_TYPE}.typ" ; only if using custom type
WriteRegStr HKLM "SOFTWARE\Wow6432Node\Garmin\MapSource\Families\${MAP_SHORT_NAME}\1" "LOC" "$INSTDIR\"
WriteRegStr HKLM "SOFTWARE\Wow6432Node\Garmin\MapSource\Families\${MAP_SHORT_NAME}\1" "BMAP" "$INSTDIR\${MAP_SHORT_NAME}.img"
WriteRegStr HKLM "SOFTWARE\Wow6432Node\Garmin\MapSource\Families\${MAP_SHORT_NAME}\1" "TDB" "$INSTDIR\${MAP_SHORT_NAME}.tdb"
; Write the uninstall keys for Windows
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "DisplayName" "${MAP_DESC_NAME}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "NoModify" 1
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "NoRepair" 1
WriteUninstaller "uninstall.exe"
SectionEnd
Notice the only change is Wow6432Node folder entry. The test was done with a known working image of 1 24000 quad and the installer was run normally without admin rights in Win7 64B. The uninstaller works ok and removes all the associated registry entires. Next I am going to test this on my map and will update this thread when I get done but I expect it to work.
Freecat
NSIS Installer worked just fine with my map both with and without custom types. I think the script can be modified the to check the registry and use the correct set of reg entries for the OS that it is being installed into. The NSIS registry plug-in looks like it is able to do this. I could give it a try but I am sure Oz can do it better.
Next I have to sort out my previously mentioned issues on XP WEEEEEEEEEE fun :-\
Below is a copy of the original .nsi script with only the registry changes made if anyone needs a copy:
;--------------------------------
; install.nsi*********************** FOR WINDOWS 7 64 BIT***************************************
;--------------------------------
!include "MUI2.nsh"
; Configuration parameters
!define MAP_DESC_NAME "Mississippi Topo Map"
!define MAP_SHORT_NAME "Mississippi Topo"
!define MAP_URL "http://www.gpsfiledepot.com/"
!define MAP_EMAIL "[email protected]"
!define MAP_COPYRIGHT "Copyright (C) 2008 GPSFileDepot.com"
!define MAP_VERSION "1.0"
!define MAP_REL_DATE "21 Jul 2008"
!define MAP_ID C10C ; Family ID = 4644 (dec) = 1224 (hex) = 2412 (hex flipped) --> http://www.geocities.com/binary_converter/
; !define MAP_TYPE 11224 ; only if using custom types
!define DIRECTORY "C:\gps_maps\mississippi_topo\release_version_1.00\"
!define EXE_FILE "${DIRECTORY}mstopo_install.exe"
; !define INSTALL_ICON "C:\gps_maps\arizona_topo\complete\favicon.ico"
; !define INSTALL_IMAGE "C:\gps_maps\left_header.bmp"
; !define INSTALL_LICENSE "C:\gps_maps\license.txt"
; !define INSTALL_README "$INSTDIR\readme.txt"
; !define INSTALL_MSG "${MAP_DESC_NAME} - Maps for Garmin GPS Units$\r$\n${MAP_URL}$\r$\nVersion ${MAP_VERSION} - ${MAP_REL_DATE}$\r$\n$\r$\n$\r$\nPlease email ${MAP_EMAIL} with any questions or comments or if you paid for this map.$\r$\n$\r$\n$\r$\n${MAP_COPYRIGHT}$\r$\nThis software is provided 'as-is', without any express or implied warranty. In no event will the author(s) be held liable for any damages arising from the use of this software."
!define INSTALL_MSG "This wizard will guide you through the installation of ${MAP_DESC_NAME} version ${MAP_VERSION} (${MAP_REL_DATE}) for Garmin GPS Units.$\r$\n$\r$\n${MAP_URL}$\r$\n$\r$\nPlease email ${MAP_EMAIL} with any questions or comments or if you paid for this map.$\r$\n$\r$\nIt is recommended that you close all other applications before starting Setup. This will make it possible to update relevant system files without having to reboot your computer.$\r$\n$\r$\nClick Next to continue."
; Setup installer
Name "${MAP_DESC_NAME}"
OutFile ${EXE_FILE}
InstallDir "$PROGRAMFILES\${MAP_SHORT_NAME}"
BrandingText " "
;--------------------------------
;Interface Settings
;--------------------------------
!define MUI_ABORTWARNING
; !define MUI_ICON ${INSTALL_ICON}
; !define MUI_UNICON ${INSTALL_ICON}
;--------------------------------
;Pages
;--------------------------------
; Generic welcome screen (optional)
; !define MUI_WELCOMEFINISHPAGE_BITMAP ${INSTALL_IMAGE}
; !insertmacro MUI_PAGE_WELCOME
; Custom welcome screen (optional)
!define MUI_WELCOMEPAGE_TITLE "Welcome to the ${MAP_DESC_NAME} Setup Wizard"
!define MUI_WELCOMEPAGE_TEXT "${INSTALL_MSG}"
!insertmacro MUI_PAGE_WELCOME
; !define MUI_LICENSEPAGE_CHECKBOX
; !insertmacro MUI_PAGE_LICENSE "${INSTALL_LICENSE}"
; Installation directory dialog
!insertmacro MUI_PAGE_DIRECTORY
; Installation
!insertmacro MUI_PAGE_INSTFILES
; Readme (optional)
; !define MUI_FINISHPAGE_SHOWREADME "${INSTALL_README}"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
;--------------------------------
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
; The stuff to install
;--------------------------------
Section "Install"
;remove the old version first
ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" \
"UninstallString"
StrCmp $R0 "" done
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"${MAP_DESC_NAME} is already installed. $\n$\nClick `OK` to remove the \
previous version and upgrade or `Cancel` to cancel this upgrade." \
IDOK uninst
Abort
;Run the uninstaller
uninst:
ClearErrors
ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
IfErrors no_remove_uninstaller
;You can either use Delete /REBOOTOK in the uninstaller or add some code
;here to remove the uninstaller. Use a registry key to check
;whether the user has chosen to uninstall. If you are using an uninstaller
;components page, make sure all sections are uninstalled.
no_remove_uninstaller:
done:
; Set output path to the installation directory.
SetOutPath $INSTDIR
; Source files for creating installation
File /a "${DIRECTORY}${MAP_SHORT_NAME}.tdb"
File /a "${DIRECTORY}${MAP_SHORT_NAME}.img"
; File /a "..\garmin\types\${MAP_TYPE}.typ" ; only if using custom type
; File /a ".\readme.txt"
File /a "${DIRECTORY}*.img"
; Write the installation path into the registry
WriteRegStr HKLM "SOFTWARE\${MAP_SHORT_NAME}" "Install_Dir" "$INSTDIR"
WriteRegStr HKLM "SOFTWARE\${MAP_SHORT_NAME}" "Version" "${MAP_VERSION}"
; Write the MapSource configuration into the registry
WriteRegBin HKLM "SOFTWARE\Wow6432Node\Garmin\MapSource\Families\${MAP_SHORT_NAME}" "ID" ${MAP_ID}
; WriteRegStr HKLM "SOFTWARE\Wow6432Node\Garmin\MapSource\Families\${MAP_SHORT_NAME}" "TYP" "$INSTDIR\${MAP_TYPE}.typ" ; only if using custom type
WriteRegStr HKLM "SOFTWARE\Wow6432Node\Garmin\MapSource\Families\${MAP_SHORT_NAME}\1" "LOC" "$INSTDIR\"
WriteRegStr HKLM "SOFTWARE\Wow6432Node\Garmin\MapSource\Families\${MAP_SHORT_NAME}\1" "BMAP" "$INSTDIR\${MAP_SHORT_NAME}.img"
WriteRegStr HKLM "SOFTWARE\Wow6432Node\Garmin\MapSource\Families\${MAP_SHORT_NAME}\1" "TDB" "$INSTDIR\${MAP_SHORT_NAME}.tdb"
; Write the uninstall keys for Windows
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "DisplayName" "${MAP_DESC_NAME}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "NoModify" 1
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "NoRepair" 1
WriteUninstaller "uninstall.exe"
SectionEnd
;--------------------------------
; Uninstaller
;--------------------------------
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}"
DeleteRegKey HKLM "SOFTWARE\${MAP_SHORT_NAME}"
DeleteRegKey HKLM "SOFTWARE\Garmin\MapSource\Families\${MAP_SHORT_NAME}"
; Remove files and uninstaller
Delete $INSTDIR\*.*
Delete $INSTDIR\uninstall.exe
; Remove directories used
RMDir "$INSTDIR"
SectionEnd
I got everything working fine in xp with the original .nsi file. It must have been a issue with my mapsource install. Once I un.../reinstalled and updated mapsource my map installed without a issue, both with and without custom types.
Oz thanks for your help and for making the .nsi script. If not for this site :) and folks like you this type of project would be much more difficult to complete.
=^_^= Freecat=^_^=
Hmm, the issue will be that in 32bit windows that doesn't exist so I think if someone uses a 32 bit windows they won't be able to install it...
Hi Oz
Your correct the script I posted will only work in 64 bit windows. Since NSIS scripts can read/write to the registry and also can check conditions (if statements), I think I can have the script check the bit type then load the 32 bit or the 64 bit reg entries based on the result of the condition check. NSIS has a registry plug-in that should make this easy.
http://nsis.sourceforge.net/Registry_plug-in (http://nsis.sourceforge.net/Registry_plug-in)
I am going to start making the changes to the script as soon as I figure out how to get the OS bit type from the registry. I think I can just check for the Wow6432Node folder and if if the check returns true install the 64 bit reg entries and if not install the 32 bit reg entries.
Freecat
All right I have the modified map_install.nsi script written, commented and tested. 8)
What I did was (also see script comments)
1- Put registry entries into separate functions for each Bit type
2-Run a check for a folder that is only on 64 bit systems
3-Execute the correct function based on the result of #2
NOTE FOR CUSTOM TYPES: Un-comment and adjust lines- 17, 109 ,159(for 64 bit), 186(for32bit)
It works fine in Windows XP 32Bit and on Windows 7 64Bit. If anyone can test this script on Vista 32/64 and XP 64Bit and post back to this thread that would be awesome. Also I can zip this file up and host it on my website or can I or a Mod put it into the download section here???
Anyhow here's the new script
;--------------------------------
;Multi-bit NSIS installer script**original script by Oz** modified 3-1-2010 by =^_^= Freecat =^_^= *****
;NOTE FOR CUSTOM TYPES: Un-comment and adjust lines- 17, 109, 159(for 64 bit), 186(for32bit)
; install.nsi
;--------------------------------
!include "MUI2.nsh"
!include "Sections.nsh"
; Configuration parameters
!define MAP_DESC_NAME "Mississippi Topo Map"
!define MAP_SHORT_NAME "Mississippi_Topo" ;<<<Name must match>>>.TDB file name ?????
!define MAP_URL "http://www.gpsfiledepot.com/"
!define MAP_EMAIL "[email protected]"
!define MAP_COPYRIGHT "Copyright (C) 2008 GPSFileDepot.com"
!define MAP_VERSION "1.0"
!define MAP_REL_DATE "21 Jul 2008"
!define MAP_ID C10C ; Family ID = 4644 (dec) = 1224 (hex) = 2412 (hex flipped) --> http://www.geocities.com/binary_converter/
; !define MAP_TYPE 11224 ; only if using custom types
!define DIRECTORY "C:\gps_maps\mississippi_topo\release_version_1.00\"
!define EXE_FILE "${DIRECTORY}mstopo_install.exe"
; !define INSTALL_ICON "C:\gps_maps\arizona_topo\complete\favicon.ico"
; !define INSTALL_IMAGE "C:\gps_maps\left_header.bmp"
; !define INSTALL_LICENSE "C:\gps_maps\license.txt"
; !define INSTALL_README "$INSTDIR\readme.txt"
; !define INSTALL_MSG "${MAP_DESC_NAME} - Maps for Garmin GPS Units$\r$\n${MAP_URL}$\r$\nVersion ${MAP_VERSION} - ${MAP_REL_DATE}$\r$\n$\r$\n$\r$\nPlease email ${MAP_EMAIL} with any questions or comments or if you paid for this map.$\r$\n$\r$\n$\r$\n${MAP_COPYRIGHT}$\r$\nThis software is provided 'as-is', without any express or implied warranty. In no event will the author(s) be held liable for any damages arising from the use of this software."
!define INSTALL_MSG "This wizard will guide you through the installation of ${MAP_DESC_NAME} version ${MAP_VERSION} (${MAP_REL_DATE}) for Garmin GPS Units.$\r$\n$\r$\n${MAP_URL}$\r$\n$\r$\nPlease email ${MAP_EMAIL} with any questions or comments or if you paid for this map.$\r$\n$\r$\nIt is recommended that you close all other applications before starting Setup. This will make it possible to update relevant system files without having to reboot your computer.$\r$\n$\r$\nClick Next to continue."
; Setup installer
Name "${MAP_DESC_NAME}"
OutFile ${EXE_FILE}
InstallDir "$PROGRAMFILES\${MAP_SHORT_NAME}"
BrandingText " "
;--------------------------------
;Interface Settings
;--------------------------------
!define MUI_ABORTWARNING
; !define MUI_ICON ${INSTALL_ICON}
; !define MUI_UNICON ${INSTALL_ICON}
;--------------------------------
;Pages
;--------------------------------
; Generic welcome screen (optional)
; !define MUI_WELCOMEFINISHPAGE_BITMAP ${INSTALL_IMAGE}
; !insertmacro MUI_PAGE_WELCOME
; Custom welcome screen (optional)
!define MUI_WELCOMEPAGE_TITLE "Welcome to the ${MAP_DESC_NAME} Setup Wizard"
!define MUI_WELCOMEPAGE_TEXT "${INSTALL_MSG}"
!insertmacro MUI_PAGE_WELCOME
; !define MUI_LICENSEPAGE_CHECKBOX
; !insertmacro MUI_PAGE_LICENSE "${INSTALL_LICENSE}"
; Installation directory dialog
!insertmacro MUI_PAGE_DIRECTORY
; Installation
!insertmacro MUI_PAGE_INSTFILES
; Readme (optional)
; !define MUI_FINISHPAGE_SHOWREADME "${INSTALL_README}"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
;--------------------------------
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
; The stuff to install
;--------------------------------
Section "Install"
;remove the old version first
ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" \
"UninstallString"
StrCmp $R0 "" done
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"${MAP_DESC_NAME} is already installed. $\n$\nClick `OK` to remove the \
previous version and upgrade or `Cancel` to cancel this upgrade." \
IDOK uninst
Abort
;Run the uninstaller
uninst:
ClearErrors
ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
IfErrors no_remove_uninstaller
;You can either use Delete /REBOOTOK in the uninstaller or add some code
;here to remove the uninstaller. Use a registry key to check
;whether the user has chosen to uninstall. If you are using an uninstaller
;components page, make sure all sections are uninstalled.
no_remove_uninstaller:
done:
; Set output path to the installation directory.
SetOutPath $INSTDIR
; Source files for creating installation
File /a "${DIRECTORY}${MAP_SHORT_NAME}.tdb"
File /a "${DIRECTORY}${MAP_SHORT_NAME}.img"
; File /a "..\garmin\types\${MAP_TYPE}.typ" ; only if using custom type
; File /a ".\readme.txt"
File /a "${DIRECTORY}*.img"
;*****************************************************************************************************************
;This part determines if the OS is 32 or 64 bit and executes the needed function
;*****************************************************************************************************************
StrCpy $0 0
ClearErrors ; reset error flags
IfFileExists C:\Windows\SysWOW64\*.* +1 +3 ;check for folder that only occurs on 64 bit systems
Call .win7 ; if folder is there call the 64 bit function
Goto fin ; move to Label fin:
Call .winxp ; if folder is not there call the 32 bit function
fin: ;ends section after 64 bit reg entries are written
;*****************************************************************************************************************
SectionEnd
;--------------------------------
; Uninstaller
;--------------------------------
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}"
DeleteRegKey HKLM "SOFTWARE\${MAP_SHORT_NAME}"
DeleteRegKey HKLM "SOFTWARE\Garmin\MapSource\Families\${MAP_SHORT_NAME}"
; Remove files and uninstaller
Delete $INSTDIR\*.*
Delete $INSTDIR\uninstall.exe
; Remove directories used
RMDir "$INSTDIR"
SectionEnd
;*************************FUNCTIONS********************************************
;******************************************************************************
;****************This function writes the 64 Bit registry entries**************
;******************************************************************************
Function .win7
; Write the installation path into the registry
WriteRegStr HKLM "SOFTWARE\${MAP_SHORT_NAME}" "Install_Dir" "$INSTDIR"
WriteRegStr HKLM "SOFTWARE\${MAP_SHORT_NAME}" "Version" "${MAP_VERSION}"
; Write the MapSource configuration into the registry
WriteRegBin HKLM "SOFTWARE\Wow6432Node\Garmin\MapSource\Families\${MAP_SHORT_NAME}" "ID" ${MAP_ID}
; WriteRegStr HKLM "SOFTWARE\Wow6432Node\Garmin\MapSource\Families\${MAP_SHORT_NAME}" "TYP" "$INSTDIR\${MAP_TYPE}.typ" ; only if using custom type
WriteRegStr HKLM "SOFTWARE\Wow6432Node\Garmin\MapSource\Families\${MAP_SHORT_NAME}\1" "LOC" "$INSTDIR\"
WriteRegStr HKLM "SOFTWARE\Wow6432Node\Garmin\MapSource\Families\${MAP_SHORT_NAME}\1" "BMAP" "$INSTDIR\${MAP_SHORT_NAME}.img"
WriteRegStr HKLM "SOFTWARE\Wow6432Node\Garmin\MapSource\Families\${MAP_SHORT_NAME}\1" "TDB" "$INSTDIR\${MAP_SHORT_NAME}.tdb"
; Write the uninstall keys for Windows
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "DisplayName" "${MAP_DESC_NAME}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "NoModify" 1
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "NoRepair" 1
WriteUninstaller "uninstall.exe"
FunctionEnd
;******************************************************************************
;****************This function writes the 32 Bit registry entries**************
;******************************************************************************
Function .winxp
; Write the installation path into the registry
WriteRegStr HKLM "SOFTWARE\${MAP_SHORT_NAME}" "Install_Dir" "$INSTDIR"
WriteRegStr HKLM "SOFTWARE\${MAP_SHORT_NAME}" "Version" "${MAP_VERSION}"
; Write the MapSource configuration into the registry
WriteRegBin HKLM "SOFTWARE\Garmin\MapSource\Families\${MAP_SHORT_NAME}" "ID" ${MAP_ID}
; WriteRegStr HKLM "SOFTWARE\Garmin\MapSource\Families\${MAP_SHORT_NAME}" "TYP" "$INSTDIR\${MAP_TYPE}.typ" ; only if using custom type
WriteRegStr HKLM "SOFTWARE\Garmin\MapSource\Families\${MAP_SHORT_NAME}\1" "LOC" "$INSTDIR\"
WriteRegStr HKLM "SOFTWARE\Garmin\MapSource\Families\${MAP_SHORT_NAME}\1" "BMAP" "$INSTDIR\${MAP_SHORT_NAME}.img"
WriteRegStr HKLM "SOFTWARE\Garmin\MapSource\Families\${MAP_SHORT_NAME}\1" "TDB" "$INSTDIR\${MAP_SHORT_NAME}.tdb"
; Write the uninstall keys for Windows
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "DisplayName" "${MAP_DESC_NAME}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "NoModify" 1
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "NoRepair" 1
WriteUninstaller "uninstall.exe"
Functionend
;**********************************************
http://www.gpsfiledepot.com/tools/map_install.zip
That is what is linked to from the tutorial so I've put yours in place of it.
I'll get to test it tomorrow hopefully on my new map. I just wonder why it worked on my w7-64 with no issues...
Hi Oz
I think the reason that the installer worked for you is that NSIS has a way to check the bit type of the OS and then make changes to the registry part of the installer based on this. From what I have read this is a very buggy feature and rarely works right. Several developers have made plug-ins to check the OS and bit type and return a string to get around this bug but I think the way I did it will be fine to.
Let me know how your test go and if I need to make any changes to the script.
Thanks
freecat
Alright; after accidentally deleting all my new .img files I've remade them and tried out the installer.
With a brand new install of nsis it doesn't include Registry.nsh
Second problem: the uninstall won't be clean because it only looks for the 32bit entries and removes them.
Edit; my script didn't actually work; I have to look into what changes I made and why they weren't working.
Edit 2: I think the new script i wrote fixing the above works BUT... the preview files didn't compile correctly so I can't test it.
Hi Oz
Registry.nsh Should have been deleted from the includes. This was a 3rd party registry plug-in that I was messing with. It is not necessary for the script to work. I will edit the code I posted sorry.
The script changes I made does remove the registry entries from 32 or 64 bit systems. I checked again on both 32bit xp and 64bit win7 and they are removed. I have tested it several times and am sure they are gone on both. Did the entries not get removed from your system when you tested the script?
While the uninstaller seems to auto detect the bit type and removes the registry entries on both my systems. If this does not work for everyone it would be very easy to have the script write one uninstaller for 64bit and one for 32bit if things are not uninstalling correctly. BTW what operating systems are you testing the script on Oz?
Freecat
I am testing on win7 32 bit, win 7 64 bit, and win xp 32 bit.
I couldn't test the install/uninstall beacuse it has always auto-sensed so I didn't need to use the modified script. I was just looking at the code and figured if you had to specify during the install you'll have to specify during the uninstall.
Turns out the rewrite I did actually worked; something is wrong with the map that was compiled. I tested it on old files and it worked. I'll post it here when I get home from work for opinions.
alright; this appears to work so I've loaded it over the old nsi file.
http://www.gpsfiledepot.com/tools/map_install.zip
Here's the code; opinions:
;--------------------------------
;Multi-bit NSIS installer script for Garmin GPS Maps
;NOTE FOR CUSTOM TYPES: Un-comment and adjust lines- 17, 118, 129
;NOTE FOR MDX FILES: Un-comment lines 117, 128
;--------------------------------
!include "MUI2.nsh"
; Configuration parameters
!define MAP_DESC_NAME "Arizona Topo Map"
!define MAP_SHORT_NAME "Arizona Topo" ; <<<Name must match>>>.TDB file name
!define MAP_URL "http://www.gpsfiledepot.com/maps/view/1/"
!define MAP_EMAIL "[email protected]"
!define MAP_COPYRIGHT "Copyright (C) 2010 GPSFileDepot.com"
!define MAP_VERSION "2.0"
!define MAP_REL_DATE "5 Mar 2010"
!define MAP_ID BD0C ; Family ID = 4644 (dec) = 1224 (hex) = 2412 (hex flipped) --> http://www.gpsfiledepot.com/tutorials/how-to-create-garmin-topo-maps---part-9---compiling-data/
; !define MAP_TYPE 11224 ; only if using custom types
!define DIRECTORY "C:\gps_maps\ArizonaTopo\img\" ;make sure it includes the ending slash
!define EXE_FILE "${DIRECTORY}az2topo_install.exe"
; !define INSTALL_ICON "C:\gps_maps\gpsfiledepot_icon.ico"
; !define INSTALL_IMAGE "C:\gps_maps\left_header.bmp"
!define INSTALL_LICENSE "${DIRECTORY}license.txt"
; !define INSTALL_README "$INSTDIR\readme.txt"
!define INSTALL_MSG "This wizard will guide you through the installation of ${MAP_DESC_NAME} version ${MAP_VERSION} (${MAP_REL_DATE}) for Garmin GPS Units.$\r$\n$\r$\n${MAP_URL}$\r$\n$\r$\nPlease email ${MAP_EMAIL} with any questions or comments or if you paid for this map.$\r$\n$\r$\nIt is recommended that you close all other applications before starting Setup. This will make it possible to update relevant system files without having to reboot your computer.$\r$\n$\r$\nClick Next to continue."
; Setup installer
Name "${MAP_DESC_NAME}"
OutFile "${EXE_FILE}"
InstallDir "$PROGRAMFILES\${MAP_SHORT_NAME}"
BrandingText " "
;--------------------------------
;Interface Settings
;--------------------------------
!define MUI_ABORTWARNING
!define MUI_ICON ${INSTALL_ICON}
!define MUI_UNICON ${INSTALL_ICON}
Var OS_EXTRA
;--------------------------------
;Pages
;--------------------------------
; Generic welcome screen (optional)
!define MUI_WELCOMEFINISHPAGE_BITMAP ${INSTALL_IMAGE}
; !insertmacro MUI_PAGE_WELCOME
; Custom welcome screen (optional)
!define MUI_WELCOMEPAGE_TITLE "Welcome to the ${MAP_DESC_NAME} Setup Wizard"
!define MUI_WELCOMEPAGE_TEXT "${INSTALL_MSG}"
!insertmacro MUI_PAGE_WELCOME
!define MUI_LICENSEPAGE_CHECKBOX
!insertmacro MUI_PAGE_LICENSE "${INSTALL_LICENSE}"
; Installation directory dialog
!insertmacro MUI_PAGE_DIRECTORY
; Installation
!insertmacro MUI_PAGE_INSTFILES
; Readme (optional)
; !define MUI_FINISHPAGE_SHOWREADME "${INSTALL_README}"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
;--------------------------------
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
; The stuff to install
;--------------------------------
Section "Install"
; Check for 64bit or 32bit - currently force 32 bit since mapsource is 32bit
IfFileExists $WINDIR\SysWOW64\*.* +1 +3
StrCpy $OS_EXTRA "Wow6432Node\"
Goto fin ; move to Label fin:
StrCpy $OS_EXTRA ""
fin:
;remove the old version first
ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" \
"UninstallString"
StrCmp $R0 "" done
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"${MAP_DESC_NAME} is already installed. $\n$\nClick `OK` to remove the \
previous version and upgrade or `Cancel` to cancel this upgrade." \
IDOK uninst
Abort
;Run the uninstaller
uninst:
ClearErrors
ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
IfErrors no_remove_uninstaller
;You can either use Delete /REBOOTOK in the uninstaller or add some code
;here to remove the uninstaller. Use a registry key to check
;whether the user has chosen to uninstall. If you are using an uninstaller
;components page, make sure all sections are uninstalled.
no_remove_uninstaller:
done:
; Set output path to the installation directory.
SetOutPath $INSTDIR
; Source files for creating installation
File /a "${DIRECTORY}${MAP_SHORT_NAME}.tdb"
File /a "${DIRECTORY}${MAP_SHORT_NAME}.img"
; File /a "${DIRECTORY}${MAP_SHORT_NAME}.mdx" ;only if you have a .mdx file
; File /a "${DIRECTORY}${MAP_TYPE}.typ" ; only if using custom type
; File /a ".\readme.txt"
File /a "${DIRECTORY}*.img"
; Write the installation path into the registry
WriteRegStr HKLM "SOFTWARE\${MAP_SHORT_NAME}" "Install_Dir" "$INSTDIR"
WriteRegStr HKLM "SOFTWARE\${MAP_SHORT_NAME}" "Version" "${MAP_VERSION}"
; Write the MapSource configuration into the registry
WriteRegBin HKLM "SOFTWARE\$OS_EXTRAGarmin\MapSource\Families\${MAP_SHORT_NAME}" "ID" ${MAP_ID}
; WriteRegStr HKLM "SOFTWARE\$OS_EXTRAGarmin\MapSource\Families\${MAP_SHORT_NAME}" "IDX" "$INSTDIR\${MAP_SHORT_NAME}.mdx"
; WriteRegStr HKLM "SOFTWARE\$OS_EXTRAGarmin\MapSource\Families\${MAP_SHORT_NAME}" "TYP" "$INSTDIR\${MAP_TYPE}.typ" ; only if using custom type
WriteRegStr HKLM "SOFTWARE\$OS_EXTRAGarmin\MapSource\Families\${MAP_SHORT_NAME}\1" "LOC" "$INSTDIR\"
WriteRegStr HKLM "SOFTWARE\$OS_EXTRAGarmin\MapSource\Families\${MAP_SHORT_NAME}\1" "BMAP" "$INSTDIR\${MAP_SHORT_NAME}.img"
WriteRegStr HKLM "SOFTWARE\$OS_EXTRAGarmin\MapSource\Families\${MAP_SHORT_NAME}\1" "TDB" "$INSTDIR\${MAP_SHORT_NAME}.tdb"
; Write the uninstall keys for Windows
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "DisplayName" "${MAP_DESC_NAME}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "NoModify" 1
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}" "NoRepair" 1
WriteUninstaller "uninstall.exe"
SectionEnd
;--------------------------------
; Uninstaller
;--------------------------------
Section "Uninstall"
; Check for 64bit or 32bit - currently force 32 bit since mapsource is 32bit
IfFileExists $WINDIR\SysWOW64\*.* +1 +3
StrCpy $OS_EXTRA "Wow6432Node\"
Goto fin ; move to Label fin:
StrCpy $OS_EXTRA ""
fin:
; Remove registry keys
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MAP_SHORT_NAME}"
DeleteRegKey HKLM "SOFTWARE\${MAP_SHORT_NAME}"
DeleteRegKey HKLM "SOFTWARE\$OS_EXTRAGarmin\MapSource\Families\${MAP_SHORT_NAME}"
; Remove files and uninstaller
Delete $INSTDIR\*.*
Delete $INSTDIR\uninstall.exe
; Remove directories used
RMDir "$INSTDIR"
SectionEnd
It improves on the 64 bit manual handling as well as now handles the .mdx files so they get included.
Hi Oz
Just thought I would let ya know I finally had time to tested the new script In Win7 64bit and windows XP 32 bit and it worked fine on both. :)
freecat
OZ, on Mar. 11-12 I posted in the map making support forum, under install problem, some ideas I had that may clarify the entries. You might want to looksee and see if you think any of it would clarify things for "dummies"
LINK (http://forums.gpsfiledepot.com/index.php/topic,1056.0.html)
Yea, I'm on vacation right now so I'll look when I return in about 4 days.
Some of the entries you suggested removing are needed for the more advanced maps but I will probably add a lot of the comments.