none
Need a help to provide full permission for all the accounts in the system RRS feed

  • Question

  • Hi,

    Iam creating a Directory in "%appdata%"  ,I want to provide full permission to the newly created folder in appdata folder.

    Below is the code ,in which iam adding "Everyone" to the newly created folder.This works fine in XP.But not in Vista

     System.Security.AccessControl.DirectorySecurity sec = System.IO.Directory.GetAccessControl(directory);
                FileSystemAccessRule accRule = new FileSystemAccessRule("Everyone",
                     FileSystemRights.FullControl, ((int)InheritanceFlags.ContainerInherit+InheritanceFlags.ObjectInherit), PropagationFlags.InheritOnly, AccessControlType.Allow);
                sec.AddAccessRule(accRule);


    I could not able to see everyone in security tab of folder properties in vista.

    is there anything i have to set for windows vistaaa

    Mahender
    Wednesday, January 13, 2010 1:52 PM

Answers

  • If this is failing then a common reason is that you are not running elevated, from an elevated command prompt or with an elevation manifest.


    Phil Wilson
    • Marked as answer by eryang Tuesday, January 19, 2010 8:55 AM
    Thursday, January 14, 2010 11:47 PM

All replies

  • If this is failing then a common reason is that you are not running elevated, from an elevated command prompt or with an elevation manifest.


    Phil Wilson
    • Marked as answer by eryang Tuesday, January 19, 2010 8:55 AM
    Thursday, January 14, 2010 11:47 PM
  • Can we add elevated manifest to custom actions phil.please let me know.

    I dont think we can add manifest for custom action dll.

    With Regards,
    Mahender

    Mahender
    Wednesday, January 20, 2010 3:47 PM
  • You didn't say it was a custom action in the original post, so I didn't mention it.  Perhaps you are running a Visual Studio 2005-generated MSI file. Those custom actions do not run elevated when you launch the MSI file.

    Another issue is that it's not clear where your "directory" parameter is from. Nobody can tell from that code if you're actually referring to the correct location. 

    This looks to me like another case where the application is storing files in a location that limited users cannot access, and so they're asking the install to change the security, instead of changing the app to put the files sdomeplace where they are accessible.


    Phil Wilson
    Wednesday, January 20, 2010 8:14 PM
  • Hi Phil,

    As a part of installation,I will create a folder under %appdata% ,let say it has 'XYZ'  and move some of the application files into %appdata%/XYZ folder.Im trying to set permission on the newly created 'XYZ" folder.
    Im using vs2008 has environment of development project.

    Please help me how to set manifest with elevated previliges for custom actions

    With Regards,
    Mahens


    Mahender
    Wednesday, January 27, 2010 2:02 PM
  • You don't need a manifest for custom actions, only for executables. If you have a custom action running in a VS 2008 setup project, then it will run with the SYSTEM account, and that should have the rights to change security settings on directories on the system.  So it should be elevated already.  But I still don't know how you're getting the directory exactly, so it's not possible to say if your code is correct.

    The problem is likely to be your %appdata%. I don't believe that's correct. That's a user-specific roaming profile directory, and I don't know what it might be when you're running with the SYSTEM account.  I think you probably need some system wide app data folder, not a user-specific one.
    Phil Wilson
    Wednesday, January 27, 2010 8:00 PM
  • Hi Phil,

    Your right. %appdata% belongs to user specific roaming folder.So u mean to say i have to create folder under %commonappdata% folder ?. can we set custom actions to run under admin account rather than SYSTEM account?


    With Regards,
    Mahender

    Mahender
    Sunday, January 31, 2010 3:52 PM
  • Phil,

    Quick question ur explaining about MSI installer not service installer right?

    Mahender
    Monday, February 1, 2010 1:39 PM