Sign in to follow this  
Vortez

Why is windows 7 deleting my files?

Recommended Posts

Vortez    2714

So, i have this program that save it's settings using a .bin file, it work normally under xp, but in windows 7, since i disabled uac it keep deleting it after each reboot, what's wrong??? And im running on an admin acount... do i have to give the file special permision or something?

Is it because the file is in program files (x86) folder?

 

I really hate windows 7 over-security problem, it's just constantly get in the way of what you are trying to do... I guess ill have to use the registry, at least it wont delete my key (i hope...).

Share this post


Link to post
Share on other sites
ericthobbs    283

So, i have this program that save it's settings using a .bin file, it work normally under xp, but in windows 7, since i disabled uac it keep deleting it after each reboot, what's wrong??? And im running on an admin acount... do i have to give the file special permision or something?

Is it because the file is in program files (x86) folder?

 

 

It might be due to UAC Folder Virtualization.

 

see http://msdn.microsoft.com/en-us/gg465124

 

I really hate windows 7 over-security problem, it's just constantly get in the way of what you are trying to do... I guess ill have to use the registry, at least it wont delete my key (i hope...).

 

 

Its not overly secure and for most scenarios you want settings and other volatile data to be per user anyway so you shouldn't be writing to a global directory, like program files, anyway.

Edited by Eric Hobbs

Share this post


Link to post
Share on other sites
Aardvajk    13207

Note also: the registry is also virtualized so if you try to write to HKEY_LOCAL_MACHINE without elevated permissions, it will be redirected to a virtual area under HKEY_CURRENT_USER.

 

As above, UAC is just fine and the virtualization was essential for backwards compatibility. The "problem" occurs when you aren't respecting the modern rules which are there for good reasons.

Share this post


Link to post
Share on other sites
Vortez    2714

Thx for the replys, i'll take a look at the ms stuffs when i have the time.

 

EDIT: The file was not deleted, but the settings didn't load for some reason, guess ill have to reproduce the bug in vmware.

 

Also, i can't add "Enable UAC" in vs because my programs interface is build using Delphi 6 (but most of the code is loaded from c++ dlls).

 

So, what's the best way to save programs settings nowaday?

Edited by Vortez

Share this post


Link to post
Share on other sites
ericthobbs    283

You do like MJP suggested and get the path to the Application Data directory via the appropriate API calls. Google searching "Delphi <FOLDERID>" where <FOLDERID> is the name of the constant that MJP pointed out might lead you down the correct path.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this