A problem with IO File

A

Andrea

- Sorry for previous erroneous post -

Another Vista trouble. This is the most incredible I've seen until now.
There are some folders that are certainly in a specific location, and in
that folders there are files.

I cannot reach them neither through Computer explorer nor command view using
standard ms-dos command. So you are probably thinking that folders and files
doesn't exist. But what you think if I say that using .net and IO command I
can get that files and open them?

The folder on a standard XP aren't hidden and files are the same. They are
just plain text files. I've enabled show all hidden files, and also system
hidden files (also if they aren't system files). But nothing to do.

Meanwhile I got the reply by myself and a new question too. Just below the
address bar
there is a new button that says Compatibility files. Well. Clicking there I
was redirected to
my profile folder in a subdirectory called with the same name as the program
files where
the folder should be and where the directory was placed - I think - during
the setup process.

The strange things are two.
First, why they are moved below my profile folder. There was also another
directory that
setup created and it is correctly located below the program files.

Second, how is possible that accessing with the IO calls in .net I just try
to access to current path \ subfolder
I can get the files also if they are in different location?

This certanly involve the new way with which Vista manage permissions,
files, etc, but I disapprove this
path exchange without permission.


Thanks
Andrea
 
J

Jimmy Brush

Hello,

The problem you are experiencing is a result of "Virtualization."

In Windows Vista, programs that do not ask for permission ("Windows needs
your permission to continue") CAN NOT do administrative tasks.

Writing inside of the Program Files folder is an administrative task.

For compatability purposes, Windows Vista misleads applications that try to
write to commonly misued system locations (such as program files) into
thinking that they are writing to the folder; instead, Windows writes those
files under the user's profile directory.

If Windows did not do this, programs that make these common mistakes would
fail with "access denied," and you probably would not be able to use them at
all.

This is why you would be able to "see" these files in your .NET
application - your application is running in compatability mode, and so the
system lets it "see" compatability files.

Applications that are written for Windows Vista (they contain a vista
manifest), such as Windows Explorer, or are running with administrator
powers, do not see compatability files. If you run your .NET application
with administrative powers (right-click it and click Run As Administrator),
then you will notice that you can no longer see the compatability files.

The solution:

* Applications MUST NOT write to the program files folder. Program files is
only for storing static application files (such as .exe's), and programs
must have administrative powers (by asking the user for consent) in order to
write to this area. You will need to upgrade any application that does this
to the Vista-compatabile version.

* Do not save your files inside the program files folder. Save them inside
your user profile folder.

* Any program that has a valid need to write to program files folder (such
as an auto updater, for example) will have to be given administrative
powers. If the program does not ask for permission when it starts,
right-click the program and click Run As Administrator.


--
- JB
Microsoft MVP - Windows Shell/User

Windows Vista Support Faq
http://www.jimmah.com/vista/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top