Installer fails with system.dll error- win XP
Hi,

I am using the example here:
http://nsis.sourceforge.net/Adding_D...directory_page
as my basis, and have adapted it to use the modern interface rather than classis. I am using Windows XP SP2 on my development machine, with NSIS 2.44. My code is as follows:

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

!include "MUI2.nsh"

;--------------------------------
; Other required files

!include WinMessages.nsh
!include FileFunc.nsh
!insertmacro GetDrives
!insertmacro DriveSpace

;--------------------------------
; App-specific definitions

!define SIZE "1700" ;add here total uncompressed data size in Mb of your application
!define APPNAME "Portable GIS 1.2"
Name '${APPNAME}'
OutFile 'portablegis_setup_v1_2.exe'
AllowRootDirInstall true

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

!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "C:\JO\PROGS-CODE\USBGIS_SETUP\oadigi_logo_150.bmp" ; optional
!define MUI_ABORTWARNING

;--------------------------------
; Pages (generic ones prefixed with insertmacro)

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "C:\JO\PROGS-CODE\USBGIS_SETUP\license.txt"
Page Custom CustomCreate CustomLeave
!insertmacro MUI_PAGE_INSTFILES
# These indented statements modify settings for MUI_PAGE_FINISH
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_CHECKED
!define MUI_FINISHPAGE_RUN_TEXT "Start the Control Panel"
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
!define MUI_FINISHPAGE_SHOWREADME_CHECKED
!define MUI_FINISHPAGE_SHOWREADME $INSTDIR\portablegis_readme.txt
!insertmacro MUI_PAGE_FINISH

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

!insertmacro MUI_LANGUAGE "English"

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

Section "primary" SecPrimary
setOutPath $INSTDIR
file /r usbgis
file Autorun.inf
file PortableGIS_Menu.exe
file portablegis_readme.txt
SectionEnd

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

;Language strings
LangString DESC_SecPrimary ${LANG_ENGLISH} "Primary section."

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

;--------------------------------
;Custom Functions to replace standard directory chooser with a drive-letter chooser instead

Function CustomCreate
WriteIniStr '$PLUGINSDIR\custom.ini' 'Settings' 'NumFields' '6'

WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 1' 'Type' 'Label'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 1' 'Left' '5'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 1' 'Top' '5'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 1' 'Right' '-6'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 1' 'Bottom' '17'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 1' 'Text' \
'Select Installation drive:'

StrCpy $R2 0
StrCpy $R0 ''
${GetDrives} "FDD+HDD" GetDrivesCallBack

WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 2' 'Type' 'DropList'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 2' 'Left' '30'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 2' 'Top' '26'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 2' 'Right' '-31'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 2' 'Bottom' '100'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 2' 'Flags' 'Notify'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 2' 'State' '$R1'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 2' 'ListItems' '$R0'

WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 3' 'Type' 'Label'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 3' 'Left' '5'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 3' 'Top' '109'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 3' 'Right' '59'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 3' 'Bottom' '119'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 3' 'Text' \
'Space required:'

WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 4' 'Type' 'Label'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 4' 'Left' '60'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 4' 'Top' '109'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 4' 'Right' '-5'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 4' 'Bottom' '119'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 4' 'Text' \
'${SIZE} Mb'

WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 5' 'Type' 'Label'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 5' 'Left' '5'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 5' 'Top' '120'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 5' 'Right' '59'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 5' 'Bottom' '130'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 5' 'Text' \
'Space available:'

WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 6' 'Type' 'Label'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 6' 'Left' '60'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 6' 'Top' '120'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 6' 'Right' '-5'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 6' 'Bottom' '130'
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 6' 'Text' \
'$R3 Mb'

push $0
InstallOptions::Dialog '$PLUGINSDIR\custom.ini'
pop $0
pop $0
FunctionEnd

Function CustomLeave
ReadIniStr $0 '$PLUGINSDIR\custom.ini' 'Settings' 'State'
StrCmp $0 '2' 0 next
ReadIniStr $0 '$PLUGINSDIR\custom.ini' 'Field 2' 'State'
StrCpy $0 $0 3
${DriveSpace} "$0" "/D=F /S=M" $R3
WriteIniStr '$PLUGINSDIR\custom.ini' 'Field 6' 'Text' \
'$R3 Mb'
ReadIniStr $0 '$PLUGINSDIR\custom.ini' 'Field 6' 'HWND'
SendMessage $0 ${WM_SETTEXT} 0 'STR:$R3 Mb'
Abort

next:
ReadIniStr $0 '$PLUGINSDIR\custom.ini' 'Field 2' 'State'
StrCpy '$INSTDIR' '$0'
FunctionEnd

Function GetDrivesCallBack
${DriveSpace} "$9" "/D=F /S=M" $R4
IntCmp $R4 '${SIZE}' end end def
def:
StrCmp $R2 '0' 0 next
StrCpy $R3 '$R4'
StrCpy $R1 '$9'
IntOp $R2 $R2 + 1
next:
StrCpy $R0 '$R0$9|'
end:
Push $0
FunctionEnd

Function .onInit
InitPluginsDir
GetTempFileName $0
Rename $0 '$PLUGINSDIR\custom.ini'
FunctionEnd

Function LaunchLink
ExecShell "" "$INSTDIR\PortableGIS_menu.exe"
FunctionEnd

On my development machine this compiles and tests just fine, but on a different machine, running Windows XP SP3 the installer crashes at the point where the user would choose the drive, with a generic "blah.exe has encountered a problem and needs to close" error. When I look in the system event logs I get the following error:

Faulting application blah.exe, version 0.0.0.0 faulting module system.dll, version 0.0.0.0, fault address 0x000186d

However, if I run the exe in Windows 2000 compatibility mode then the installer runs just fine.

I'm very new to nsis, and I have seen lots of stuff about system.dll, and I can see that this is being called in Filefunc.nsh, but other than that I'm not very sure what I need to do here. I am assuming that my development machine is using one version of system.dll, and the test machine another, is this correct? If so, could someone show me how, in my code, I ensure that the same dll is used both times? Or is this a different problem?

Many thanks for your help

Archaeogeek