代码之家  ›  专栏  ›  技术社区  ›  Tobias Hertkorn

commonace构造函数(system.security.accesscontrol)中accessmask参数的意义

  •  0
  • Tobias Hertkorn  · 技术社区  · 16 年前

    accessmask参数的含义是什么 System.Security.AccessControl.CommonAce's Constructor . 不幸的是,描述“ace的访问掩码”并不是很有用。

    1 回复  |  直到 16 年前
        1
  •  2
  •   Hans Passant    16 年前

    从SDK文档:

    一个32位值,其位对应于对象的访问权限。位可以设置为开或关,但设置的含义取决于ace类型。例如,如果与读取权限对应的位已打开,并且ace类型为deny,则ace将拒绝读取对象的权限。如果相同的位设置为“允许”,但ace类型为“允许”,则ace授予读取对象权限的权利。

    从winnt.h sdk头文件:

    //       3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
    //       1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
    //      +---------------+---------------+-------------------------------+
    //      |G|G|G|G|Res'd|A| StandardRights|         SpecificRights        |
    //      |R|W|E|A|     |S|               |                               |
    //      +-+-------------+---------------+-------------------------------+
    //
    //      typedef struct _ACCESS_MASK {
    //          WORD   SpecificRights;
    //          BYTE  StandardRights;
    //          BYTE  AccessSystemAcl : 1;
    //          BYTE  Reserved : 3;
    //          BYTE  GenericAll : 1;
    //          BYTE  GenericExecute : 1;
    //          BYTE  GenericWrite : 1;
    //          BYTE  GenericRead : 1;
    //      } ACCESS_MASK;
    //      typedef ACCESS_MASK *PACCESS_MASK;
    //
    //  but to make life simple for programmer's we'll allow them to specify
    //  a desired access mask by simply OR'ing together mulitple single rights
    //  and treat an access mask as a DWORD.  For example
    //
    //      DesiredAccess = DELETE | READ_CONTROL