I'm using the following piece of code to build my setup with NSIS. I built it on Windows XP and it works fine with Windows XP and 2000. But on Windows 7 and Vista, NSIS isn't able to write files to "C:\Program files\software name". But if I use a target directory wich doesn't include spaces, for example "C:\softwarename", it works.
Do you have any idea, why or what I shall do for get it working?
Raphael; Needs:
; http://nsis.sourceforge.net/ZipDLL_plug-in
!define MUI_ICON cookiepascal.ico
!define MUI_UNICON ${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico
!define MUI_HEADERIMAGE_BITMAP ${NSISDIR}\Contrib\Graphics\Header\orange.bmp
!define MUI_HEADERIMAGE_UNBITMAP ${NSISDIR}\Contrib\Graphics\Header\orange-uninstall.bmp
!define MUI_WELCOMEFINISHPAGE_BITMAP left.bmp
!define MUI_UNWELCOMEFINISHPAGE_BITMAP left-un.bmp
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
!include "MUI2.nsh"
!include "ZipDLL.nsh"
Name "Cookie Pascal"
OutFile "setup_win32.exe"
InstallDir "$PROGRAMFILES\CookiePascal"
RequestExecutionLevel user
!define MUI_ABORTWARNING
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
!insertmacro MUI_LANGUAGE "German"
!define MUI_WELCOMEPAGE_TITLE "Installation"
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
section
setOutPath $INSTDIR
File "CookiePascal.exe"
File "cookiepascal.ico"
File "default-windows-config.conf"
File "bins.zip" ; contains:
; - Folder units/ with all FPC-units directly (e.g. subdir "rtl")
; - as.exe, cp.exe, cpp.exe, diff.exe, fp.exe, fp32.ico, fpc.cfg, fpc.exe, fpcmake.exe, fpcmkcfg.exe, fpcsubst.exe, fpdoc.exe, fpmc.exe,
; fppkg.exe, fprcp.exe, gcc.exe, gdate.exe, gdb.exe, gecho.exe, ginstall.exe, gmkdir.exe, grep.exe, ld.exe, make.exe, mv.exe, patch.exe,
; ppc386.exe, rm.exe, unzip.exe, upx.exe, zip.exe
!insertmacro ZIPDLL_EXTRACT "$INSTDIR\bins.zip" "$INSTDIR" "<ALL>"
Rename "$INSTDIR\default-windows-config.conf" "$INSTDIR\cookiepascal.conf"
writeUninstaller "$INSTDIR\uninstaller.exe"
delete "$INSTDIR\bins.zip"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CookiePascal" \
"DisplayName" "Cookie Pascal" ;angezeigter Name
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CookiePascal" \
"UninstallString" "$INSTDIR\uninstaller.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CookiePascal" \
"InstallLocation" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CookiePascal" \
"Publisher" "geek's factory"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CookiePascal" \
"DisplayVersion" "1.0.0.0"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CookiePascal" \
"NoModify" 0 ; Keine nachträgliche Modifizierung möglich
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CookiePascal" \
"NoRepair" 1 ; Keine Reparatur möglich
WriteRegStr HKLM "Software\geeksfactory\CookiePascal" \
"Path" $INSTDIR ; Keine Reparatur möglich
sectionEnd
section "Desktop-Icons"
createShortCut "$DESKTOP\Cookie Pascal.lnk" "$INSTDIR\CookiePascal.exe"
sectionEnd
section "Startmenue-Eintrag"
createShortCut "$SMPROGRAMS\Cookie Pascal.lnk" "$INSTDIR\CookiePascal.exe"
sectionEnd
section "Schnellstartverknuepfung"
createShortCut "$QUICKLAUNCH\Cookie Pascal.lnk" "$INSTDIR\CookiePascal.exe"
sectionEnd
section "Uninstall"
delete "$INSTDIR\uninstaller.exe"
delete "$INSTDIR\CookiePascal.exe"
delete "$SMPROGRAMS\Cookie Pascal.lnk"
delete "$QUICKLAUNCH\Cookie Pascal.lnk"
delete "$DESKTOP\Cookie Pascal.lnk"
delete "$INSTDIR\cookiepascal.conf"
delete "$INSTDIR\cookiepascal.ico"
delete "$INSTDIR\as.exe"
delete "$INSTDIR\cp.exe"
delete "$INSTDIR\cpp.exe"
delete "$INSTDIR\diff.exe"
delete "$INSTDIR\fp.exe"
delete "$INSTDIR\fp32.ico"
delete "$INSTDIR\fpc.cfg"
delete "$INSTDIR\fpc.exe"
delete "$INSTDIR\fpcmake.exe"
delete "$INSTDIR\fpcmkcfg.exe"
delete "$INSTDIR\fpcsubst.exe"
delete "$INSTDIR\fpdoc.exe"
delete "$INSTDIR\fpmc.exe"
delete "$INSTDIR\fppkg.exe"
delete "$INSTDIR\fprcp.exe"
delete "$INSTDIR\gcc.exe"
delete "$INSTDIR\gdate.exe"
delete "$INSTDIR\gdb.exe"
delete "$INSTDIR\gecho.exe"
delete "$INSTDIR\ginstall.exe"
delete "$INSTDIR\gmkdir.exe"
delete "$INSTDIR\grep.exe"
delete "$INSTDIR\ld.exe"
delete "$INSTDIR\make.exe"
delete "$INSTDIR\mv.exe"
delete "$INSTDIR\patch.exe"
delete "$INSTDIR\ppc386.exe"
delete "$INSTDIR\rm.exe"
delete "$INSTDIR\unzip.exe"
delete "$INSTDIR\upx.exe"
delete "$INSTDIR\zip.exe"
DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall\CookiePascal
RMDir $INSTDIR
sectionEnd