GetUserNameEx

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

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

Parameters

  • NameFormat
    [in] Value from the EXTENDED_NAME_FORMAT enumeration type 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 Values

If the function succeeds, the return value is a nonzero value.

If the function fails, the return value is zero. 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

OS Versions: Windows CE .NET 4.0 and later.
Header: Winbase.h.
Link Library: Coredll.lib.

See Also

SetUserData | SetCurrentUser | EXTENDED_NAME_FORMAT

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.