views:

50

answers:

1

This is a driving me nuts. I have searched all over StackOverflow and read all about UAC. But I'm still running into a problem.

Using VS 2008, I have a simple program that does nothing but this:

File.Delete("c:\windows\fonts\whatever.ttf")

The EXE has a proper manifest with requireAdministrator=True. When compiled, the app icon receives the shield icon. And when I launch the application, logged in as either an Admin or Standad user, I receive the "Do you want the following program to make changes..." confirmation dialog. Additionally, I use a code signing cert on the EXE.

When running the app, I get the following behaviors:

When I run the application when logged in as an Administrator, the file is deleted.

However, when logged in as a Standard user, I get a UAC prompt and enter in an Admin password, but I get a "file access is denied" error when the delete executes.

Can someone explain this to me? I thought that the requiresAdministrator=True in the manifest elevates the process. But I still can't delete a system file.

Thanks.

+1  A: 

It does elevate the process, but if the file has access controls dictating that only members of the Administrator's group can modify or delete it and the "Standard" user is not a member of the Administrator's group, then he still cannot modify the file.

Zach
Thanks for the input. Even if I give my Standard User explicit "full control" rights to the file to be deleted, I still get an exception. Any other ideas?
BerwynVB