Welcome, Guest. Please login or register.

Login with username, password and session length
Forums Search:  


Author Topic: Problem with NSIS and registry entries  (Read 39744 times)

-Oz-

  • Map Maker!
  • Administrator
  • Expert Advisor
  • *****
  • Posts: 1579
  • Karma: 27
    • View Profile
    • GPSFileDepot
Re: Problem with NSIS and registry entries
« Reply #15 on: March 04, 2010, 08:54:42 PM »
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.
Dan Blomberg
Administrator - GPSFileDepot
GPS Units: Garmin Dakota 20, Garmin GPSMap 60csx, Nuvi 255W, Nuvi 250W, ForeRunner 110, Fenix 2, Tactix Bravo, Foretrex 401
See/Download My Maps!

-Oz-

  • Map Maker!
  • Administrator
  • Expert Advisor
  • *****
  • Posts: 1579
  • Karma: 27
    • View Profile
    • GPSFileDepot
Re: Problem with NSIS and registry entries
« Reply #16 on: March 04, 2010, 10:50:27 PM »
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.
« Last Edit: March 04, 2010, 11:18:24 PM by -Oz- »
Dan Blomberg
Administrator - GPSFileDepot
GPS Units: Garmin Dakota 20, Garmin GPSMap 60csx, Nuvi 255W, Nuvi 250W, ForeRunner 110, Fenix 2, Tactix Bravo, Foretrex 401
See/Download My Maps!

freecat

  • Jr. Member
  • **
  • Posts: 24
  • Karma: 0
    • View Profile
Re: Problem with NSIS and registry entries
« Reply #17 on: March 05, 2010, 04:48:00 AM »
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
« Last Edit: March 05, 2010, 04:59:11 AM by freecat »

-Oz-

  • Map Maker!
  • Administrator
  • Expert Advisor
  • *****
  • Posts: 1579
  • Karma: 27
    • View Profile
    • GPSFileDepot
Re: Problem with NSIS and registry entries
« Reply #18 on: March 05, 2010, 10:01:13 AM »
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.
Dan Blomberg
Administrator - GPSFileDepot
GPS Units: Garmin Dakota 20, Garmin GPSMap 60csx, Nuvi 255W, Nuvi 250W, ForeRunner 110, Fenix 2, Tactix Bravo, Foretrex 401
See/Download My Maps!

-Oz-

  • Map Maker!
  • Administrator
  • Expert Advisor
  • *****
  • Posts: 1579
  • Karma: 27
    • View Profile
    • GPSFileDepot
Re: Problem with NSIS and registry entries
« Reply #19 on: March 07, 2010, 06:25:13 PM »
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:
Code: [Select]
;--------------------------------
;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.
Dan Blomberg
Administrator - GPSFileDepot
GPS Units: Garmin Dakota 20, Garmin GPSMap 60csx, Nuvi 255W, Nuvi 250W, ForeRunner 110, Fenix 2, Tactix Bravo, Foretrex 401
See/Download My Maps!

freecat

  • Jr. Member
  • **
  • Posts: 24
  • Karma: 0
    • View Profile
Re: Problem with NSIS and registry entries
« Reply #20 on: March 18, 2010, 03:53:28 AM »
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

Jimbob

  • Sr. Member
  • ****
  • Posts: 145
  • Karma: 0
    • View Profile
Re: Problem with NSIS and registry entries
« Reply #21 on: March 18, 2010, 12:33:41 PM »
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
« Last Edit: March 18, 2010, 02:44:39 PM by Coggins »

-Oz-

  • Map Maker!
  • Administrator
  • Expert Advisor
  • *****
  • Posts: 1579
  • Karma: 27
    • View Profile
    • GPSFileDepot
Re: Problem with NSIS and registry entries
« Reply #22 on: March 19, 2010, 07:11:41 AM »
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.
Dan Blomberg
Administrator - GPSFileDepot
GPS Units: Garmin Dakota 20, Garmin GPSMap 60csx, Nuvi 255W, Nuvi 250W, ForeRunner 110, Fenix 2, Tactix Bravo, Foretrex 401
See/Download My Maps!

 

anything