Why am I getting an access denied error for the Documents and Settings folder?

前端 未结 3 1441
你的背包
你的背包 2020-12-10 21:06

I\'m writing a program that gets all directories and sub-directories. I\'m using the following code:

DriveInfo[] drives = DriveInfo.GetDrives();
foreach (Dri         


        
3条回答
  •  孤城傲影
    2020-12-10 21:47

    This directory is what is known as a junction point, which should be pointing to c:\users.

    From the MSDN documentation:

    These junction points can be identified as follows:

    They have the FILE_ATTRIBUTE_REPARSE_POINT, FILE_ATTRIBUTE_HIDDEN, and FILE_ATTRIBUTE_SYSTEM file attributes set.

    They also have their access control lists (ACLs) set to deny read access to everyone.

    Applications that call out a specific path can traverse these junction points if they have the required permissions. However, attempts to enumerate the contents of the junction points will result in failures.

提交回复
热议问题