Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 21st October 2004, 15:12   #1
GFORCE100
Member
 
Join Date: Oct 2004
Posts: 68
Writing to the registry fails

I am using/testing the script below, so far I cant get it to write data to the uninstall section of the Windows registry. It should show me XXX I believe but nothing gets added to that section of the registry.

My account has admin rights.....

Script->>>>>>

;Setup program

;--------------------------------
;Include Modern UI

!include "MUI.nsh"

;--------------------------------
;General

;Name and file
Name "XXX YYY"
OutFile "Setup.exe"

;Default installation folder
InstallDir "$EXEDIR"

;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\XXX\YYY\Uninstall" ""

BrandingText /TRIMLEFT "XXXYYY Setup"

XPStyle on


;--------------------------------
;Interface Configuration

!define MUI_ICON setup.ico
!define MUI_UNICON setup.ico

!define MUI_ABORTWARNING

!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP header.bmp
!define MUI_WELCOMEFINISHPAGE_BITMAP welcome.bmp

XPStyle on


;--------------------------------
;Pages

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE license.txt
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

;--------------------------------
;Languages

!insertmacro MUI_LANGUAGE "English"

;--------------------------------
;Installer Sections

Section "Standard installation" StandardInstall

SetOutPath "$INSTDIR"

;ADD YOUR OWN FILES HERE...

;Store installation folder
WriteRegStr HKCU "Software\XXX\YYY" "" $INSTDIR

;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"

WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\" "XXX" "YYY"



SectionEnd

;--------------------------------
;Descriptions

;Language strings
LangString DESC_StandardInstall ${LANG_ENGLISH} "Standard installation."

;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${StandardInstall} $(DESC_StandardInstall)
!insertmacro MUI_FUNCTION_DESCRIPTION_END

;--------------------------------
;Uninstaller Section

Section "Uninstall"

;ADD YOUR OWN FILES HERE...

Delete "$INSTDIR\Uninstall.exe"

RMDir "$INSTDIR"

DeleteRegKey /ifempty HKCU "Software\XXX"

DeleteRegKey /ifempty HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XXX"

SectionEnd

;--------------------------------
;Init Section

Function .onInit
SetOutPath $TEMP
File /oname=spltmp.bmp "splash.bmp"

; optional
; File /oname=spltmp.wav "splash.wav"

splash::show 1000 $TEMP\spltmp

Pop $0 ; $0 has '1' if the user closed the splash screen early,
; '0' if everything closed normal, and '-1' if some error occured.

Delete $TEMP\spltmp.bmp
; Delete $TEMP\spltmp.wav
FunctionEnd
GFORCE100 is offline   Reply With Quote
Old 21st October 2004, 15:39   #2
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,898
here:
code:

InstallDirRegKey HKCU "Software\XXX\YYY\Uninstall" ""


Where is allocated the returning var???

That's why:
code:

InstallDirRegKey $0 HKCU "Software\XXX\YYY\Uninstall" ""


If I remember.


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux w/ xfce4.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Debian unstable w/ xfce4.
Joel is offline   Reply With Quote
Old 21st October 2004, 16:18   #3
GFORCE100
Member
 
Join Date: Oct 2004
Posts: 68
Quote:
Originally posted by Lobo Lunar
here:
code:

InstallDirRegKey HKCU "Software\XXX\YYY\Uninstall" ""


Where is allocated the returning var???

That's why:
code:

InstallDirRegKey $0 HKCU "Software\XXX\YYY\Uninstall" ""


If I remember.
Hmm I'll check it.

I found the method on the NSIS archive and it didn't mention using a var, oh well. Thanks.
GFORCE100 is offline   Reply With Quote
Old 21st October 2004, 16:22   #4
GFORCE100
Member
 
Join Date: Oct 2004
Posts: 68
Quote:
Originally posted by Lobo Lunar
here:
code:

InstallDirRegKey HKCU "Software\XXX\YYY\Uninstall" ""


Where is allocated the returning var???

That's why:
code:

InstallDirRegKey $0 HKCU "Software\XXX\YYY\Uninstall" ""


If I remember.
Just noticed you were refering to something else which works.

The problem is this line below, it doesn't yield a new data entry within the registry:

WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\" "XXX" "YYY"
GFORCE100 is offline   Reply With Quote
Old 21st October 2004, 19:24   #5
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,898
Of course is only for example propuse

You do the real stuff


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux w/ xfce4.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Debian unstable w/ xfce4.
Joel is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump