/// <summary>Returns the length, in bytes, of a valid security identifier (SID).</summary> /// <param name="pSid">A pointer to the SID structure whose length is returned. The structure is assumed to be valid.</param> /// <returns> /// If the SID structure is valid, the return value is the length, in bytes, of the SID structure. If the SID structure is not valid, /// the return value is 0. /// </returns> public static int Length(this PSID pSid) => AdvApi32.IsValidSid(pSid) ? AdvApi32.GetLengthSid(pSid) : 0;
/// <summary> /// Validates a security identifier (SID) by verifying that the revision number is within a known range, and that the number of /// subauthorities is less than the maximum. /// </summary> /// <param name="pSid">A pointer to the SID structure to validate. This parameter cannot be NULL.</param> /// <returns> /// If the SID structure is valid, the return value is <see langword="true"/>. If the SID structure is not valid, the return value is <see langword="false"/>. /// </returns> public static bool IsValidSid(this PSID pSid) => AdvApi32.IsValidSid(pSid);