Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

GetComputerObjectName function

Retrieves the local computer's name in a specified format.


BOOLEAN WINAPI GetComputerObjectName(
  _In_     EXTENDED_NAME_FORMAT NameFormat,
  _Out_    LPTSTR lpNameBuffer,
  _Inout_  PULONG lpnSize


NameFormat [in]

The format for the name. This parameter is a value from the EXTENDED_NAME_FORMAT enumeration type. It cannot be NameUnknown.

lpNameBuffer [out]

A pointer to a buffer that receives the name in the specified format.

If this parameter is NULL, either the function succeeds and the lpnSize parameter receives the required size, or the function fails with ERROR_INSUFFICIENT_BUFFER and lpnSize receives the required size. The behavior depends on the value of NameFormat and the version of the operating system.

lpnSize [in, out]

On input, specifies the size of the lpNameBuffer buffer, in TCHARs. On success, receives the size of the name copied to the buffer. If the lpNameBuffer buffer is too small to hold the name, the function fails and lpnSize receives the required buffer size.

Return value

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.


Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]


Secext.h (include Security.h)





Unicode and ANSI names

GetComputerObjectNameW (Unicode) and GetComputerObjectNameA (ANSI)

See also

System Information Functions



Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.