Click here to Skip to main content
15,867,330 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi All,

i developed an application in win32 with VS2005 on WIN-XP platform. this application is working as expected in WIN-XP but not working in VISTA. vista is not allowing my application to create some files in program file(x86). if i disable the UAC then its working fine. i got some information from internet and i added a manifest file also, but still its not working.

please suggest me how can i fix this issue in my application.
i don't want end user to disable UAC for using my application.

any help is very much appreciated.

Thank You.
Posted
Updated 5-Apr-11 0:21am
v2

You should use the Application Data directory instead. You can do whatever you want there.
 
Share this answer
 
Comments
Guyverthree 5-Apr-11 7:11am    
I have a similar problem on Vista, Olivier correctly states that you need to use the application Data. It might well be a hidden directory called app data under the user which is signed in however.
Olivier Levrey 5-Apr-11 7:48am    
Thanks for the vote.
Jayant Narayan Dash 5-Apr-11 10:06am    
Thanks Olivier,

but vista also not allowing to add a registry entry if UAC is enabled.

is it possible to fix this issue by digitally sign my app.
Olivier Levrey 5-Apr-11 10:16am    
I have no knowledge about digitally signatures, sorry.

Concerning registry access, the best option is not to touch it at all. I mean, you can of course add entries while installing your application, but while it is running you should access it only in read-only mode. It is better to store all settings in a file rather thant registry.
Kim Togo 5-Apr-11 10:15am    
Just remember to use a function that returns where application data folder is. Do not hard code the location of Application Data folder.
In general, there is read-only in "Program Files" folder for no admin programs. Try read this link New UAC Technologies for Windows Vista[^]

Best way is to use ProgramData for data which often change. You can have a manifest file that tells Windows Vista it requires administrator rights.
 
Share this answer
 
Comments
Jayant Narayan Dash 5-Apr-11 10:02am    
hello Kim,
thanks for your solution.
just i curious to know how other applications installing and creating files at "program files" folder and adding some registry entries(is vista will allow an app to add a registry entry if UAC is enabled).
can it be fixed by adding a digital signature to my application???

please update me if u have some other solution.
Kim Togo 5-Apr-11 10:12am    
Installations program (MSI or EXE) has a manifest witch tells Windows Vista/7 that to run this program "Admin rights is required". Then Windows Vista/7 will prompt the use to allow this program to run in elevated permission. When in elevated rights, the program has access to read and write to "program folder" and registry. In the link, it says that 32 bit applications can run in Virtualization, that improve application compatibility. The program think it is writing to "Program folder", put behind the scene it write folder is in another folder.
Jayant Narayan Dash 5-Apr-11 10:37am    
thanks Kim,

i ll write my data to app data folder may be this is the only solution.
if you get any soln to my approach then please let me know.
Kim Togo 6-Apr-11 2:27am    
In your installation program, you can always change NTFS security settings under "Program Files" for that folder you wish to write files to. And give local user group "Users" or "Authenticated Users" read and write access.
Jayant Narayan Dash 9-Apr-11 0:16am    
hi kim
so what i can do if i want to add a registry entry in my application.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900