Solutions I've already tried that have not worked are:
1) Add ini key to $WINDIR\system.ini
[boot]
SCRNSAVE.EXE $SYSDIR\savername.scr
2) Call user32.dll::SystemParametersInfo(17, 1, 0, 2)
The above works in XP but not in 2000
rundll32.exe desk.cpl,InstallScreenSaver <path to screensaver>
This kind of works in 2000 but it pops up a configuration dialog and then when I go back into the dialog the settings are gone.
Looking for a solution or set of solutions that works on all platforms, does not pop up a configuration screen, retains the settings when you open the configuration dialog and doesn't require third-party software.
What worked was combining the INI method and the registry method found here: How do I change the screensaver programatically?. Here is the NSIS code:
!include WinVer.nsh
; Install the executable
${If} ${AtMostWinXP}
SetOutPath "$SYSDIR"
File screen.scr
${EndIf}
SetOutPath "$INSTDIR"
File screen.scr
; Set screensaver and make it active
${If} ${AtMostWinXP}
WriteINIStr "$WINDIR\system.ini" "boot" "SCRNSAVE.EXE" "$SYSDIR\screen.scr"
${Else}
WriteRegStr HKCU "Control Panel\desktop" "SCRNSAVE.EXE" "$INSTDIR\screen.scr"
WriteRegStr HKCU "Control Panel\desktop" "ScreenSaveActive" "1"
${EndIf}
; Notify system of the change
System::Call 'user32.dll::SystemParametersInfo(17, 1, 0, 2)'
Notice that I install the screensaver both in \windows\system32 and in the package install directory. For some reason installing in system32 did not work in Windows 2000.