Archive: NSIS Develop, Deploy 32 bit applications to 64 bit Windows?


NSIS Develop, Deploy 32 bit applications to 64 bit Windows?
I think I am close. For 32 bit I can install, run and uninstall.
For 64 bit (Win7 x64) I can install, run but uninstall only the application, not the data.
x64 requires two 'install directories', one for the app and one for any data created by the app (including its .ini file) In addition to the $INSTDIR variable, I defined another: $DATADIR
What am I missing?
Here are parts of the script that almost works:
var /GLOBAL DATADIR
:
:
Function dir_pge_txt_dest
${If} ${AtLeastWinVista}
!define $MUI_DIRECTORYPAGE_TEXT_DESTINATION "Setup will install ${MUI_PRODUCT} ${MUI_VERSION} in the Following folder. To install in a difFerent folder, click Browse and select another Folder. Click Install to start the installation. It is imperative to install into the C:\Users\Public\... folder structure! "
${EndIf}
FunctionEnd

Function .onVerifyInstDir
${If} ${RunningX64}
${Else}
StrCpy $DATADIR $INSTDIR
${EndIf}
FunctionEnd
:
:
:
!define MUI_WELCOMEPAGE
!define MUI_LICENSEPAGE
!define MUI_DIRECTORYPAGE

!define MUI_ABORTWARNING
!define MUI_UNINSTALLER
!define MUI_UNCONFIRMPAGE
!define MUI_FINISHPAGE

Function .onInit
${If} ${AtLeastWinVista}
${If} ${RunningX64}
StrCpy $INSTDIR "$PROGRAMFILES32\Clark_Anderson\${MUI_FILE}"
StrCpy $DATADIR "C:\Users\Public\Clark_Anderson\${MUI_FILE}"
${Else}
StrCpy $INSTDIR "C:\Users\Public\Clark_Anderson\${MUI_FILE}"
StrCpy $DATADIR "C:\Users\Public\Clark_Anderson\${MUI_FILE}"
${EndIf}
${Else}
StrCpy $INSTDIR "$PROGRAMFILES\Clark_Anderson\${MUI_FILE}"
StrCpy $DATADIR "$PROGRAMFILES\Clark_Anderson\${MUI_FILE}"
${EndIf}
FunctionEnd
:
:
:
Section "Sample Data Files (Optional: Recommended for starting)"
SectionIn 2
SetOutPath "$DATADIR\DataBases"
:
:
SectionEnd

Section "Uninstall"
:
:
:
:
;Delete Files
Delete "$INSTDIR\*.*"
Delete "$DATADIR\Reports\Templates\*.*"
Delete "$DATADIR\Reports\*.*"
Delete "$DATADIR\DataBases\*.*"
Delete "$DATADIR\ExpImport\*.*"
Delete "$DATADIR\*.*"

;Remove the installation directory
RMDir /r "$INSTDIR"
RMDir /r "$DATADIR\Reports\Templates\*.*"
RMDir /r "$DATADIR\Reports\*.*"
RMDir /r "$DATADIR\DataBases\*.*"
RMDir /r "$DATADIR\ExpImport\*.*"
RMDir /r "$DATADIR"

;Delete Start Menu Shortcuts
Delete "$DESKTOP\${MUI_PRODUCT}.lnk"
Delete "$SMPROGRAMS\${MUI_PRODUCT}\*.*"
RmDir "$SMPROGRAMS\${MUI_PRODUCT}"

;Delete Uninstaller And Unistall Registry Entries
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\${MUI_PRODUCT}"
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}"

SectionEnd
:
:


I tried changing ShowUninstDetails "nevershow" to "show" or show

The details went by so fast I could not hope to read them.


${If} ${AtLeastWinVista}
!define $MUI_DIRECTORYPAGE_TEXT_DESTINATION "Set..."
${EndIf}
Will not work, !define will always be set.

You should not treat x64 like this, why do you think it needs its own data dir. If there is a need for a data dir then all versions of NT need it.

If you are installing a 64bit application and/or driver then you need to check, if not you should try to treat it the same as 32bit Windows...

Thank you for responding.
My applications are all 32 bit.
The quoted segment is a residual form earlier in my learning curve. I guess it does nothing? I do not see the full text anywhere.
I probably should remove the entire Function dir_pge_txt_dest .

I do not have any other instances of trying to enclose a !define phrase within logic.

My primary difficulty is that the uninstall if RunningX64 does not delete the $DATADIR files and folders.


My choice of title for this thread hid my real question, so I have moved my question to a new thread: http://forums.winamp.com/showthread.php?t=368666