Compartilhar via


GetUserNameEx

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function obtains the name of the user or other security principal associated with the calling thread. You can specify the format of the returned name.

Syntax

BOOLEAN GetUserNameEx(
  EXTENDED_NAME_FORMAT NameFormat,
  LPTSTR lpNameBuffer,
  PULONG nSize
);

Parameters

  • NameFormat
    [in] Value **indicating the desired name format.

    This value cannot be NameUnknown.

  • lpNameBuffer
    [out] Pointer to a buffer that receives the name in the specified format.
  • nSize
    [in, out] On input, specifies the size, in TCHARs, of the lpNameBuffer buffer.

    On output, receives the size of the returned string, including the terminating null character.

Return Value

A nonzero value indicates success. Zero indicates failure. To get extended error information, call GetLastError.

Remarks

If the lpNameBuffer buffer is too small to hold the name, the function fails, and nSize receives the required buffer size.

Requirements

Header winbase.h
Library coredll.lib
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

User Management Functions
SetUserData
SetCurrentUser

Other Resources