با سلام
من در برنامه ام بروی یک فایل سطح دسترسی را برای کاربران محدود کردم تا نتوانند محتوای فایل را تغییر دهند.
ولی زمانی که برنامه من در ویندوز 7 نصب میشه اگر User Account Control (UAC) فعال باشه ویندوز به برنامه خودم هم اجازه دسترسی به فایل را نمی دهد

کد برنامه من چیزی مثل کد زیر است:



namespace AwsPermission
{
public class AwsPermissionCls
{
static WindowsIdentity winIdentity = WindowsIdentity.GetCurrent();

/// <summary>
/// protect from file of change
/// </summary>
/// <param name="path_file">path of file for protect</param>
public static void Protect_File(string path_file)
{
try
{
string account = winIdentity.Name;

FileSecurity fs = new FileSecurity();
fs.AddAccessRule(new FileSystemAccessRule(account, FileSystemRights.FullControl, AccessControlType.Deny));
File.SetAccessControl(path_file, fs);


}
catch (IOException ex)
{
throw ex;
}
}


/// <summary>
/// Unprotect from file for make chang
/// </summary>
/// <param name="path_file">path of file for change</param>
public static void UnProtect_File(string path_file)
{
try
{
string account = winIdentity.Name;


FileSecurity fs = new FileSecurity();
fs.RemoveAccessRule(new FileSystemAccessRule(account, FileSystemRights.FullControl, AccessControlType.Allow));
if (File.Exists(path_file))
File.SetAccessControl(path_file, fs);
}
catch (IOException ex)
{
throw ex;
}


}//end


}
}



لطفا راهنمایی نمایید
با تشکر