There are a lot of setups out there which just copy some files and then run the application. I often wonder why they really need Administrator rights at all. So IMO, if you want to create a setup for your product you should really consider the following question:
Does your setup really need Administrator rights?
I often wonder why some setups need administrative rights at all. Many setups just fail to run if someone isn’t running with highest privileges. But why can’t they just copy their files to a directory of my choice. I have a friend who doesn’t like to install an application. He is always lucky if he finds a zip download instead – otherwise he doesn’t use it.
If I choose to place product files in the protected “Program Files”-folder, well then a setup could elevate itself because it detects an inaccessible folder. There are setups out there which elevate themselves right before copying the files – with some effort this is possible for none MSI setups, too (run a second elevated process for copying, e.g.). However it is always possible to tell the user that the target folder isn’t accessible.
Secondly, is it really necessary to create registry keys in the local machine tree? Well, if you want to hide your secret registration information that is a good reason. A second good reason will be if you want to write system wide and valid data which should not be messed around with — like installation information for uninstalling. However you should also consider to store this kind of data in the current user tree if the user isn’t an Administrator! In this way the user can remove the product and you support people who are not members of Administrators group like office staff, students and of course relatives who have an Administrator in their family. Furthermore, if you go one more step you could move the registration stuff into your application. In this way your application can restore its data and even be saved on a USB data drive.
Fairly everything can be done in your application:
and
I told you that there are setups which elevate, copy their files and then run the application. Did you know that this application is run with the same administrative privileges as the setup? If the setup isn’t written to lower the rights, the application is started with Administrator rights! Did you notice?
Some applications are trying to access the local machine registry key at the first start – to do their init stuff. Since I do not run these applications from the setup, they often fail to start. I think only few people know about the “run by setup for the first time”-issue.
So if you can avoid writing to secured places like windows folder/registry/”Program Files” you could transfer some initial routines to your application. It would mean less “you have to reinstall the product”-errors when your app tries to start and, of course, less “I reinstalled your app for the 20th time and it doesn’t work”-customers.
Don’t hesitate to use “elevate yourself ” feature (ShellExecute + runas + ParamStr(0) or COM elevation) if you need administrator rights. But use it only if you need it.
Nowadays, imo, it is all about installation. Don’t misunderstand me! Setups can be nice and comfortable. Installation of JWA and JWSCL is still made by hand and I’m in the middle of creating a setup FOR YOU! But today, setup applications grew to big monsters which take a lot of time to start (”Initializing…”), to run (”Registering {139D6D44-6008-F26F-AA2B-214A31915CCD}…”) and sometimes to understand (”Error xxx. DLL not registered”). Many years ago (good old DOS days *g*), a setup just copied files, created directory structures and setup the sound card for the first time (often the setup could be used to change that later). In times of Windows, setup applications became sometimes more than the applications which they install. Well, I must say: “Times became more complicated”.
I would like to see more and more apps which are independent of the machines they run on. You don’t have to abandon your setup routines though! Think about a setup that allows a customer to run your app directly from the setup itself – without installation! That it is possible shows us Embarcadero with “Instant-On” (Olaf’s Thoughts). Delphi on a USB data store – I’m looking forward to it!
7 Responses
Xepol
19|Mar|2009 1Your entire discussion may well be moot. Since Vista, you need administrative rights to write any files into Program files folder if UAC is enabled. ( http://technet.microsoft.com/en-us/library/cc709628.aspx )
So, basically, YES, you need administrative rights to install an application (at least if you do it correctly).
Which makes sense to me. If it had been that way in past, many of the malware apps my children downloaded to their machines may well have been avoided since they did not have administrative rights. Installing software is a form of administration, only the administrator should be able to do it, thus you should need administrative rights to accomplish it.
If anything, I would extend the system to require someone with administrative rights to sign off on ANY new executable content on a system before it was allowed to run. Of course, this would confuse and frustate novices, so it won’t happen.
Christian Wimmer
19|Mar|2009 2I can install applications on my system without administrative rights and with activated UAC because I don’t use the “Program Files” folder. I install applications on a separate partition. So this isn’t moot in Vista.
The installation process doesn’t need administrative rights by itself – it is just made this way because it changes protected resources (like registry). But many applications don’t use these resources anyway, so why are they changed at all?
Craig Stuntz
20|Mar|2009 3If your application appears (to Vista) to be an installer, then it *will* request elevation, no matter what it actually does. Try and write an application called setup.exe and see what happens. Or write a do-nothing installer with any popular install product. Microsoft thinks that you *should* put your application in Program Files, and therefore your installer should need elevation. If you wanted to write an installer which didn’t need elevation, then you would need to fool Windows into thinking that it was not, in fact, an installer.
Christian Wimmer
20|Mar|2009 4Nope, I don’t think so.
Try to install this product : http://www.teamviewer.com (Free for private use)
It has an installer that can either start the application or install it (whereever your want). It does not request elevated privileges at the beginning. The name of the file is “TeamViewer_Setup.exe”
So it can be done in Vista without elevation in the beginning.
It’s all about the embedded manifest!
Craig Stuntz
20|Mar|2009 5Sure, you can override what Vista does by default. But don’t completely miss the point: This is a choice that Vista makes, not a choice that the developer made.
Christian Wimmer
21|Mar|2009 6The choice is always made by the programmers. Before Vista, programmers decided that their setup routines needs administrative rights always! Many people didn’t care because they were Administrators by default. However in Vista, many setup would have failed if MS haven’t implemented that files with setup or install in the name are elevated by default (with no manifest).
So the next step of the programmers would be to leave the choice to the users whether they want to install the product in a commonly used place (like Program Files) and thus need elevation or in another place of their choice (but whithout elevation).
Dmitry Karzhavin
19|Oct|2009 7With regards to my installers, it was due to Inno Setup’s preferences. One needs to take some care to create non-admin installer. It’s not on by default. Still, Inno Setup doesn’t work flawlessly in non-admin mode. I’d like it to copy files into Application Data (instead of Program Files) and create icons in the private Start Menu folder (instead of Common). Inno Setup doesn’t allow such tricks to be easily expressed. I’ve done my best to make my installer non-admin demanding, but it’s indeed easier to download .zip instead of .exe from my website.
Youк claims should be addresed to setup compiler creators IMHO. I have nothing against non-admin installations. It just was off by default.
Leave a reply
Search
Paypal donation (EUR)
Categories
Archives
Tags
Recent Posts
Recent Comments
Blogroll
JEDI Sites
Pages
A design creation of Design Disease
Copyright © 2007 - JEDI Windows API - is proudly powered by WordPress
InSense 1.0 Theme by Design Disease brought to you by HostGator Web Hosting.