ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

BOOLEAN WINAPI GetUserNameExW ( EXTENDED_NAME_FORMAT  NameFormat,
LPWSTR  lpNameBuffer,
PULONG  nSize 
)

Definition at line 230 of file secext.c.

Referenced by GetUserNameExA().

{
    BOOLEAN status;
    WCHAR samname[UNLEN + 1 + MAX_COMPUTERNAME_LENGTH + 1];
    LPWSTR out;
    DWORD len;
    DPRINT("(%d %p %p)\n", NameFormat, lpNameBuffer, nSize);

    switch (NameFormat)
    {
    case NameSamCompatible:
        {
            /* This assumes the current user is always a local account */
            len = MAX_COMPUTERNAME_LENGTH + 1;
            if (GetComputerNameW(samname, &len))
            {
                out = samname + lstrlenW(samname);
                *out++ = '\\';
                len = UNLEN + 1;
                if (GetUserNameW(out, &len))
                {
                    status = (lstrlenW(samname) < *nSize);
                    if (status)
                    {
                        lstrcpyW(lpNameBuffer, samname);
                        *nSize = lstrlenW(samname);
                    }
                    else
                    {
                        SetLastError(ERROR_MORE_DATA);
                        *nSize = lstrlenW(samname) + 1;
                    }
                }
                else
                    status = FALSE;
            }
            else
                status = FALSE;
        }
        break;
    case NameUnknown:
    case NameFullyQualifiedDN:
    case NameDisplay:
    case NameUniqueId:
    case NameCanonical:
    case NameUserPrincipal:
    case NameCanonicalEx:
    case NameServicePrincipal:
    case NameDnsDomain:
        SetLastError(ERROR_NONE_MAPPED);
        status = FALSE;
        break;
    default:
        SetLastError(ERROR_INVALID_PARAMETER);
        status = FALSE;
    }

    return status;
}

Generated on Fri May 25 2012 05:15:52 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.