GetUserObjectInformationW function (winuser.h)

Retrieves information about the specified window station or desktop object.

Syntax

BOOL GetUserObjectInformationW(
  [in]            HANDLE  hObj,
  [in]            int     nIndex,
  [out, optional] PVOID   pvInfo,
  [in]            DWORD   nLength,
  [out, optional] LPDWORD lpnLengthNeeded
);

Parameters

[in] hObj

A handle to the window station or desktop object. This handle is returned by the CreateWindowStation, OpenWindowStation, CreateDesktop, or OpenDesktop function.

[in] nIndex

The information to be retrieved. The parameter can be one of the following values.

Value Meaning
UOI_FLAGS
1
The handle flags. The pvInfo parameter must point to a USEROBJECTFLAGS structure.
UOI_HEAPSIZE
5
The size of the desktop heap, in KB, as a ULONG value. The hObj parameter must be a handle to a desktop object, otherwise, the function fails.

Windows Server 2003 and Windows XP/2000:  This value is not supported.

UOI_IO
6
TRUE if the hObj parameter is a handle to the desktop object that is receiving input from the user. FALSE otherwise.

Windows Server 2003 and Windows XP/2000:  This value is not supported.

UOI_NAME
2
The name of the object, as a string.
UOI_TYPE
3
The type name of the object, as a string.
UOI_USER_SID
4
The SID structure that identifies the user that is currently associated with the specified object. If no user is associated with the object, the value returned in the buffer pointed to by lpnLengthNeeded is zero. Note that SID is a variable length structure. You will usually make a call to GetUserObjectInformation to determine the length of the SID before retrieving its value.

[out, optional] pvInfo

A pointer to a buffer to receive the object information.

[in] nLength

The size of the buffer pointed to by the pvInfo parameter, in bytes.

[out, optional] lpnLengthNeeded

A pointer to a variable receiving the number of bytes required to store the requested information. If this variable's value is greater than the value of the nLength parameter when the function returns, the function returns FALSE, and none of the information is copied to the pvInfo buffer. If the value of the variable pointed to by lpnLengthNeeded is less than or equal to the value of nLength, the entire information block is copied.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Note

The winuser.h header defines GetUserObjectInformation as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll
API set ext-ms-win-ntuser-windowstation-ansi-l1-1-0 (introduced in Windows 10, version 10.0.10240)

See also

CreateDesktop

CreateWindowStation

GetUserObjectSecurity

OpenDesktop

OpenWindowStation

SID

SetUserObjectInformation

SetUserObjectSecurity

USEROBJECTFLAGS

Window Station and Desktop Functions