Archive: user account of the person who installed


user account of the person who installed
I've been fiddling with the uninstaller name.

Short of naming an Admin uninstaller 'uninsta.exe' and a User uninstaller something else, and querying if the file exists, is there a way NSIS could be made to read who installed, a User or an Admin?

Does anyone know how to do that? A variable, similar to $INSTDIR, which gets passed to the uninstaller, that would return the account type of whoever installed the software? Or some other method?

Thanks.


nsis doesn't need that, there are multiple ways to do that already. write the user-name into an ini file or the registry or whatever.


Ok. Or rename the uninstaller. Thank you.


Originally posted by bnicer
Does anyone know how to do that? A variable, similar to $INSTDIR, which gets passed to the uninstaller[...]
No variables are EVER passed to the uninstaller. Not even $INSTDIR. As you can find in the manual: "in uninstaller code, $INSTDIR contains the directory where the uninstaller lies."

The help file just says $INSTDIR may be a different location in the uninstaller.

Hate to quibble, but that's all it says. You can take from that, that the variable is not passed to the uninstaller, which of course it isn't.

Why can't variables be passed to the uninstaller?

I think Yathosho said it, nsis doesn't need that. I agree -- why argue?


The help file just says $INSTDIR may be a different location in the uninstaller. Hate to quibble, but that's all it says.
If you look at the manual again, you will see that you are wrong about this. From http://nsis.sourceforge.net/Docs/Chapter4.html#4.2.2

"Note that in uninstaller code, $INSTDIR contains the directory where the uninstaller lies. It does not necessarily contain the same value it contained in the installer. For example, if you write the uninstaller to $WINDIR and the user doesn't move it, $INSTDIR will be $WINDIR in the uninstaller. If you write the uninstaller to another location, you should keep the installer's $INSTDIR in the registry or an alternative storing facility and read it in the uninstaller."

You actually can move it and $INSTDIR will change; I didn't know that. Now I do. I was wrong.

On reflection, I also think, it might not be the safest if you could pass variables to the uninstaller. Like, if you pass the installer account type as standard user and you make a mistake, the account type is really admin. The safest place for that info is the registry, which can't err. I was wrong.