[][src]Function windows_acl::helper::name_to_sid

pub fn name_to_sid(name: &str, system: Option<&str>) -> Result<Vec<BYTE>, DWORD>

Resolves a system username (either in the format of "user" or "DOMAIN\user") into a raw SID. The raw SID is represented by a Vec<u8> object.

Arguments

  • name - The user name to be resolved into a raw SID.
  • system - An optional string denoting the scope of the user name (such as a machine or domain name). If not required, use None.

Errors

On error, a Windows error code is returned with the Err type.

Note: If the error code is 0, GetLastError() returned ERROR_INSUFFICIENT_BUFFER after invoking LookupAccountNameW or the sid_size is 0.