/// <summary> /// The <c>GetDomainSid</c> function receives a security identifier (SID) and returns a SID representing the domain of that SID. /// </summary> /// <param name="pSid">A pointer to the SID to examine.</param> /// <returns>An allocated safe pointer to a SID representing the domain.</returns> public static AdvApi32.SafePSID GetDomainSid(this PSID pSid) { Win32Error.ThrowLastErrorIfFalse(AdvApi32.GetWindowsAccountDomainSid(pSid, out var pDomSid)); return(pDomSid); }