What's the deal with creating files in Vista?

BlitzMax Forums/BlitzMax Programming/What's the deal with creating files in Vista?

JoshK(Posted 2008) [#1]
I have heard an application is not supposed to be able to write a file outside it's own directory or subdirectory. If this is the case, how are you supposed to write an installer? If there is a workaround for this to allow writing outside the app directory, what is the point of having the security measure in the first place?


Winni(Posted 2008) [#2]
Installers run with administrator privileges, applications shouldn't. It's one of those things that Windows always did wrong in the past, and they finally changed it in Vista.


JoshK(Posted 2008) [#3]
How do you make an installer run with administrator privaleges?


plash(Posted 2008) [#4]
right click->runas
no?

EDIT: Its all on the user side, just do the file writes in the installer, its the user's problem if they don't run it as an administrator.


Matthew Smith(Posted 2008) [#5]
Josh,

Not sure about the Installer, but your aren't supposed to write to even an application's folder in 'Program Files' - it should go into the 'c:\users\<username>\' folder.

I believe Grey Alien did some research about it a few months ago now for his framework - some of it will be on the forum - sorry don't have time to advise.


ziggy(Posted 2008) [#6]
@Leadwerks: A lot of them include a msi file (most of them create the msi in the temp folder after all the set up options have been collected) and then run the MSI in the background at the end, while you see a wonderfull progress bar.


TMK(Posted 2008) [#7]
If you use NSIS to create your installer, you can put this line which should make the setup ask for admin rights:

RequestExecutionLevel admin

I also think that Vista figures out that files named "setup.exe" etc. will require admin rights, so it will ask for the rights if you try to open one of those automatically. Actually this link describes the process:

http://www.theregister.co.uk/2007/04/23/vista_program_naming_oddness/