How does System.Security.Principal.NTAccount.Translate() resolve specified user to an SID

.net

Solution

The SID resolution is done when `Translate` method is called,

http://msdn.microsoft.com/en-us/library/system.security.principal.ntaccount.translate.aspx.

If you use `NTAccount(string)` to initialize the instance, and provide an isolated name (name without domain), then the resolution is determined by the SID lookup code (if you know how to decompile) which calls to LsaLookupName2,

http://msdn.microsoft.com/en-us/library/windows/desktop/ms721798(v=vs.85).aspx

To translate isolated names

1.If the name is a well-known name, such as Local or Interactive, the function returns the corresponding well-known security identifier (SID).

2.If the name is the name of the built-in domain, the function returns the SID of that domain.

3.If the name is the name of the account domain, the function returns the SID of that domain.

4.If the name is the name of the primary domain, the function returns the SID of that domain.

5.If the name is one of the names of the trusted domain, the function returns the SID of that domain.

6.If the name is a user, group, or local group account in the built-in domain, the function returns the SID of that account.

7.If the name is a user, group, or local group account in the account domain on the local system, the function returns the SID of that account.

8.If the name is a user, group, or a local group in the primary domain, the function returns the SID of that account.

9.After looking in the primary domain, the function looks in each of the primary domain's trusted domains.

10.Otherwise, the name is not translated.

Problem

I am wondering, if there is a local user account with the specified account name would it get resolved before or after any domain account with the same name?

Original source