共用方式為


2.5.2.1.2 AddPrivilegesToToken

The AddPrivilegesToToken function returns a token with privileges based on the local PrivilegeMapping array using the SID in the token passed to the function, as shown in the following pseudocode.

 AddPrivilegesToToken( Token )
     -- On entry
     --    Token is an authorization context containing all sids that represent the security principal
  
     FOR EACH SID s in Token DO
         FOR EACH MAPPING mapping in PrivilegeMapping DO
             IF mapping.SID equals s 
                 Token.Privileges is a union of Token.Privileges and mapping.Privileges
             END IF
         END FOR
     END FOR
 END-SUBROUTINE