NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: codeferever on March 06, 2011, 03:49:07 AM

Title: A problem while unistall nasm
Post by: codeferever on March 06, 2011, 03:49:07 AM
Hello,everybody
As I had just installed office 2010 in my XP, and at the same time unistalled the nasm.
But the nasm-unistall-tool had deleted the files in office directory, why ?  ???
Title: Re: A problem while unistall nasm
Post by: Frank Kotler on March 09, 2011, 10:17:38 PM
Hi Codeferever,

Don't uninstall Nasm! Why would anyone want to uninstall Nasm? :)

Seriously, I have no idea why that happened. You didn't install the Office(r) files under the nasm directory, did you? Could be a bug in the uninstaller, but it seems improbable that it would search out and uninstall Office(r) files. If it's a bug, it's pretty serious, uninstalling stuff it's not supposed to! I'm not in a position to test it (my religion prohibits MS software). If it should happen again, see if you can spot a pattern to what it's doing - just Office(r)? Anything you install after Nasm? Just the first thing installed after Nasm? Or what? I suspect - I hope - that it's a one-time glitch... possibly "pilot error". I suppose if it turns out to be a bug, the easiest thing would be to remove the uninstaller from the package(?). You shouldn't need an "uninstaller" to delete a couple of files!

Sorry you had a problem with it.

Best,
Frank

Title: Re: A problem while unistall nasm
Post by: David Stone on March 26, 2011, 06:39:44 AM
I also had a problem like this. thanks admin for solving it.
Title: Re: A problem while unistall nasm
Post by: the_mart on July 05, 2011, 08:21:32 AM
What was the solution to this? Was it a bug in the uninstaller? I don’t know if it’s the same issue, but I’ve found that the NASM uninstaller sometimes tries to delete all of the files in my root C directory, including the boot manager! Fortunately it doesn’t succeed in deleting the boot manager, but it did delete the boot sector backup (not really an issue, but worrying nonetheless).

Attached is a screenshot where I have tested this on a Windows Vista x86 machine. The “mart.txt” file is just an empty text file I put there, to check whether it is deleting all files indiscriminately.
Title: Re: A problem while unistall nasm
Post by: Cyrill Gorcunov on July 05, 2011, 09:39:47 AM
What was the solution to this? Was it a bug in the uninstaller? I don’t know if it’s the same issue, but I’ve found that the NASM uninstaller sometimes tries to delete all of the files in my root C directory, including the boot manager! Fortunately it doesn’t succeed in deleting the boot manager, but it did delete the boot sector backup (not really an issue, but worrying nonetheless).

Attached is a screenshot where I have tested this on a Windows Vista x86 machine. The “mart.txt” file is just an empty text file I put there, to check whether it is deleting all files indiscriminately.

Crap, i'll take a look.
Title: Re: A problem while unistall nasm
Post by: Cyrill Gorcunov on July 05, 2011, 09:50:16 AM
It seems the following snippets from installer script are failed

Code: [Select]
    ;
    ; Start Menu folder
    ReadRegStr $0 HKCU Software\${PRODUCT_SHORT_NAME} "lnk"
    Delete /rebootok "$0\*"
    RMDir "$0"
    DeleteRegKey /ifempty HKCU "Software\${PRODUCT_SHORT_NAME}"

Could you please check what you have in Current User\Software\nasm hive of Registry?
(I'm not sure if I wrote the hive path correct -- don't have access to win machine for a while).
Title: Re: A problem while unistall nasm
Post by: the_mart on July 05, 2011, 10:57:17 AM
I currently have this in the registry key:

Code: [Select]
[HKEY_CURRENT_USER\Software\nasm]
@="C:\\Program Files\\nasm"
"lnk"="C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Netwide Assembler 2.09.09"
"nasm"="Netwide Assembler 2.09.09"

I’ve just tested on my Vista x86 VM, and I think I see what has happened. The uninstaller doesn’t require privilege escalation, so if you run it without escalation it deletes the NASM registry key, but is unable to remove any of the files. If you then run the uninstaller as an admin, it looks like the absence of the registry key is causing files from the root of the drive to be deleted.

So, steps to reproduce:


I have verified this by running the installer as an admin, deleting the NASM registry key with regedit, and then running the uninstaller as an admin.
Title: Re: A problem while unistall nasm
Post by: Cyrill Gorcunov on July 05, 2011, 05:20:29 PM
Quote
I currently have this in the registry key:

Code: [Select]
[HKEY_CURRENT_USER\Software\nasm]
@="C:\\Program Files\\nasm"
"lnk"="C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Netwide Assembler 2.09.09"
"nasm"="Netwide Assembler 2.09.09"

I’ve just tested on my Vista x86 VM, and I think I see what has happened. The uninstaller doesn’t require privilege escalation, so if you run it without escalation it deletes the NASM registry key, but is unable to remove any of the files. If you then run the uninstaller as an admin, it looks like the absence of the registry key is causing files from the root of the drive to be deleted.

Hmm, indeed, it seems to be related to the priviliedges obtained at uninstallation procedure. But if you've installed nasm as a regular user uninstaller still can't delete files?

Quote
So, steps to reproduce:

  • Run uninstaller in Vista or Windows 7 by double clicking it.
  • Run uninstaller again by right clicking and choosing “Run as administrator”.

I have verified this by running the installer as an admin, deleting the NASM registry key with regedit, and then running the uninstaller as an admin.
Title: Re: A problem while unistall nasm
Post by: the_mart on July 05, 2011, 05:30:38 PM
But if you've installed nasm as a regular user uninstaller still can't delete files?

I ran the installer with admin privileges, otherwise it doesn’t even give the option to install for all users.
Title: Re: A problem while unistall nasm
Post by: Cyrill Gorcunov on July 05, 2011, 05:40:21 PM
crap, I'll try to grab windows machine to test all things out. Previously (at time the script was developed) there was no such problem, but it was winxp machine and i'm far from being win expert, so any help quite appreciated.
Title: Re: A problem while unistall nasm
Post by: Cyrill Gorcunov on July 05, 2011, 07:29:55 PM
Could you please try the installer from here, in case if registry keys are empty it should stop uninstalling.

http://ge.tt/9nrjxh5/v
Title: Re: A problem while unistall nasm
Post by: Cyrill Gorcunov on July 05, 2011, 07:32:59 PM
Still I have no idea why files being installed as regular user can't be removed by the  same user after :/
Title: Re: A problem while unistall nasm
Post by: the_mart on July 05, 2011, 08:06:33 PM
Could you please try the installer from here, in case if registry keys are empty it should stop uninstalling.

http://ge.tt/9nrjxh5/v

I tried this, and it did indeed abort the uninstall. The NASM files were removed, but the menu entries were left. It’s much better than before though.

The files can be removed by the same user afterwards, but you have to use privilege escalation. Without that, it happily removes the HKCU registry keys but fails on removing the files.
Title: Re: A problem while unistall nasm
Post by: Cyrill Gorcunov on July 05, 2011, 08:34:45 PM
Sigh, i don't understand windows, completely. Lets summarize what we have now.

1) A regular user can install the nasm but at uninstall the start menu entries left untouched, right?
In result the second attempt to remove files with admin rights leads to problems because registry
entries already cleaned up.

2) An admin user can operate with nasm uninstaller without problems, correct? Ie if admin installed it
he can uninstall it safely, right?
Title: Re: A problem while unistall nasm
Post by: Cyrill Gorcunov on July 06, 2011, 09:03:08 PM
So the_mart is there a way you to help resolve this issue by testing various scenarios I mentioned before?
I really with this problem was reported to bug tracker directly pretty ago :(
Title: Re: A problem while unistall nasm
Post by: the_mart on July 06, 2011, 09:47:45 PM
1) A regular user can install the nasm but at uninstall the start menu entries left untouched, right?
In result the second attempt to remove files with admin rights leads to problems because registry
entries already cleaned up.

It’s not really a case of regular user versus admin user, as the install and uninstall is being done by a user account which has admin privileges. As this is Windows Vista / Windows 7, just double clicking the uninstaller runs it without privilege escalation, so it removes only the registry entry (because HKCU is writable without privilege escalation) and does not delete the NASM files or menu entry (because those folders are not writable without privilege escalation). If you choose the “run as administrator” option then the uninstaller can remove the registry entry, the NASM files, and the menu entry.

2) An admin user can operate with nasm uninstaller without problems, correct? Ie if admin installed it
he can uninstall it safely, right?

If they remember to choose the “run as administrator” option when uninstalling, they will be ok. If they forget to do this when uninstalling, they run into the above problem.

If you run the installer without privilege escalation, it installs in the user’s profile directory and there is no issue uninstalling it.

Is there something I can help with? I’ve only created Windows Installers before, but I can take a look at the installer if the learning curve is not too steep.
Title: Re: A problem while unistall nasm
Post by: the_mart on July 06, 2011, 09:50:16 PM
Btw, can the registry key go under HKLM rather than HKCU when doing an “install for all users”? It would certainly avoid the problem of the uninstaller removing the registry entry whilst leaving everything else in place.
Title: Re: A problem while unistall nasm
Post by: Rob Neff on July 06, 2011, 11:03:03 PM
I ran into the issues mentioned when writing commercial apps for Vista a few years ago.  HKLM is a protected resource and would require the installer to have elevated administrative privileges.  One area I believe that the installer may need enhancement is to include a program manifest and possibly code signing which would eliminate the right-click Run-As Admin issue...
Title: Re: A problem while unistall nasm
Post by: Cyrill Gorcunov on July 07, 2011, 06:16:36 AM
So, Rob, could you please take a look into nasm.nsi to fix all this out? I don't have windows machine permanent access for testing :(
Title: Re: A problem while unistall nasm
Post by: Cyrill Gorcunov on July 07, 2011, 06:21:02 AM
1) A regular user can install the nasm but at uninstall the start menu entries left untouched, right?
In result the second attempt to remove files with admin rights leads to problems because registry
entries already cleaned up.

It’s not really a case of regular user versus admin user, as the install and uninstall is being done by a user account which has admin privileges. As this is Windows Vista / Windows 7, just double clicking the uninstaller runs it without privilege escalation, so it removes only the registry entry (because HKCU is writable without privilege escalation) and does not delete the NASM files or menu entry (because those folders are not writable without privilege escalation). If you choose the “run as administrator” option then the uninstaller can remove the registry entry, the NASM files, and the menu entry.

The former idea wast to allow installation for a regular user as well, without priviledge escalation. Ie kinda "install for me only" and as far as i remember such scenario should work on windows.

2) An admin user can operate with nasm uninstaller without problems, correct? Ie if admin installed it
he can uninstall it safely, right?

If they remember to choose the “run as administrator” option when uninstalling, they will be ok. If they forget to do this when uninstalling, they run into the above problem.

If you run the installer without privilege escalation, it installs in the user’s profile directory and there is no issue uninstalling it.

Is there something I can help with? I’ve only created Windows Installers before, but I can take a look at the installer if the learning curve is not too steep.

If you can look into nasm.nsi script (which is the nsis installer script) this would be just great!
Title: Re: A problem while unistall nasm
Post by: the_mart on July 07, 2011, 07:11:34 AM
The former idea wast to allow installation for a regular user as well, without priviledge escalation. Ie kinda "install for me only" and as far as i remember such scenario should work on windows.

Indeed. With Windows installer you double click the installer, and then it gives you the choice of installing for all users, or just the current user (if the installer has this option enabled of course). If you choose the “all users” option, it gives the privilege escalation prompt. I wonder if the installer can do it that way.

If you can look into nasm.nsi script (which is the nsis installer script) this would be just great!

Sure, I’ll see what I can do.
Title: Re: A problem while unistall nasm
Post by: Cyrill Gorcunov on July 15, 2011, 08:25:26 PM
Anyway, I'm going to release a fix in nasm-2.09.10, uninstallation procedure will ask a user to confirm files deletion, it's better than silent deletion of files and etc I think.