GetUserNameEx (Compact 2013)

3/26/2014

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 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 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

See Also

Reference

User Management Functions
SetUserData
SetCurrentUser

Other Resources

EXTENDED_NAME_FORMAT