Serious uninstall bug - Windows XP

A place for general chatter about games in progress, games completed, strategy advice, bug reports, or really anything at all that relates in some vague way to RSW.
Post Reply
Puzzler
Posts: 61
Joined: Sat Aug 16, 2008 1:25 pm

Serious uninstall bug - Windows XP

Post by Puzzler »

On Windows XP, when I uninstall the RSW Client, the uninstaller deletes EVERYTHING in my start menu that is installed for my personal user account (as opposed to the start menu items that are installed for all users). And I mean here that it deletes things that have nothing to do with RSW. I was able to verify that the deletion of my start menu shortcuts was definitely caused by the RSW uninstaller because I restored my system, and then ran the RSW uninstaller again, and watched it delete the files.

If it helps you to reproduce the problem, you should know that I installed the RSW client's folder to a subdirectory of Programs in the start menu (Games), rather than just installing it directly to the main Programs folder.

I hope you can fix this pretty quickly; I've just recommended RSW to a bunch of friends, and I'd feel terrible if they also get their shortcuts all blown away. Fortunately, it is possible to recover by using Windows' system restore.

In the meantime, Windows users should be advised to install new versions of RSW on top of the old versions, rather than uninstalling previous versions first.

Thanks!
drwr
Posts: 636
Joined: Sat Dec 10, 2005 10:56 am
Location: Glendale, CA
Contact:

Re: Serious uninstall bug - Windows XP

Post by drwr »

Gaack! I'll investigate immediately.

David
drwr
Posts: 636
Joined: Sat Dec 10, 2005 10:56 am
Location: Glendale, CA
Contact:

Re: Serious uninstall bug - Windows XP

Post by drwr »

OK, got it fixed. Who knew you could do so much damage with a mostly-boilerplate installer script?

Version 0.98.8.8 fixes this. It is sufficient to install this new version on top of your current version, and then thereafter any uninstall operations will be safe.

David
Puzzler
Posts: 61
Joined: Sat Aug 16, 2008 1:25 pm

Re: Serious uninstall bug - Windows XP

Post by Puzzler »

Thanks for fixing that so quickly.

As a technical guy, I'm kind of curious what installer system you use, and what caused the problem, just so I can know for future reference. If you can give a short summary, I'm interested.

Was it caused by my installing in a subfolder of Programs, or was it something else altogether?
drwr
Posts: 636
Joined: Sat Dec 10, 2005 10:56 am
Location: Glendale, CA
Contact:

Re: Serious uninstall bug - Windows XP

Post by drwr »

I am using NSIS to generate the installer.

The problem had nothing to do with the use of a submenu. In fact, it was caused by my own misunderstanding of NSIS's scripting language.

In my script, I had lines like this:

Code: Select all

  CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
  CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\RSW Client.lnk" "$INSTDIR\rsw_client.exe"
under the "install" rule, and this line:

Code: Select all

        RMDir /r "$SMPROGRAMS\$STARTMENU_FOLDER"
under the "uninstall" rule.

It turns out, though, that although variables like $SMPROGRAMS are still valid in the uninstall rule, the custom variable $STARTMENU_FOLDER, which was queried originally from the user, is not automatically valid in the uninstall rule unless you include the line:

Code: Select all

        !insertmacro MUI_STARTMENU_GETFOLDER "RSW" $STARTMENU_FOLDER
which is necessary to query the value of $STARTMENU_FOLDER from the registry.

I'd assembled my script by piecing together examples provided with the NSIS installation, but overlooked the need to re-query this variable on uninstall. Without the correction, $STARTMENU_FOLDER was empty, and the RMDir /r command ended up recursively emptying the contents of $SMPROGRAMS instead--the entire start menu programs folder.

To be extra cautious, I also replaced:

Code: Select all

        RMDir /r "$SMPROGRAMS\$STARTMENU_FOLDER"
with the more explicit:

Code: Select all

        Delete "$SMPROGRAMS\$STARTMENU_FOLDER\RSW Client.lnk"
        Delete "$SMPROGRAMS\$STARTMENU_FOLDER\RSW Home.url"
        Delete "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall RSW.lnk"
        RMDir "$SMPROGRAMS\$STARTMENU_FOLDER"
 
And removed the "/r", so that it will try to delete each individual file, and then remove the empty directory. If anything goes wrong along the way, now it will simply fail to remove the directory, rather than recursively deleting something it shouldn't.

David
Post Reply