Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Retrieves configuration information for the specified user on the specified ___domain controller or Remote Desktop Session Host (RD Session Host) server.
Syntax
BOOL WTSQueryUserConfigA(
[in] LPSTR pServerName,
[in] LPSTR pUserName,
[in] WTS_CONFIG_CLASS WTSConfigClass,
[out] LPSTR *ppBuffer,
[out] DWORD *pBytesReturned
);
Parameters
[in] pServerName
Pointer to a null-terminated string containing the name of a ___domain controller or an RD Session Host server. Specify WTS_CURRENT_SERVER_NAME to indicate the RD Session Host server on which your application is running.
[in] pUserName
Pointer to a null-terminated string containing the user name to query. To retrieve the default user settings for the RD Session Host server, set this parameter to NULL.
Windows Server 2008 and Windows Vista: Setting this parameter to NULL returns an error.
[in] WTSConfigClass
Specifies the type of information to retrieve. This parameter can be one of the values from the WTS_CONFIG_CLASS enumeration type. The documentation for WTS_CONFIG_CLASS describes the format of the data returned in ppBuffer for each of the information types.
[out] ppBuffer
Pointer to a variable that receives a pointer to the requested information. The format and contents of the data depend on the information class specified in the WTSConfigClass parameter. To free the returned buffer, call the WTSFreeMemory function.
[out] pBytesReturned
Pointer to a variable that receives the size, in bytes, of the data returned in ppBuffer.
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.
Remarks
The WTSQueryUserConfig and WTSSetUserConfig functions are passed a server name instead of a handle because user account information often resides on a ___domain controller. To set user configuration information, use the primary ___domain controller. You can call the NetGetDCName function to get the name of the primary ___domain controller. To query user configuration information, you can use the NetGetAnyDCName function to get the name of a primary or backup ___domain controller.
Any ___domain controller can set or query user configuration information. Use the DsGetDcName function to retrieve the name of a ___domain controller.
Note
The wtsapi32.h header defines WTSQueryUserConfig 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 Vista |
Minimum supported server | Windows Server 2008 |
Target Platform | Windows |
Header | wtsapi32.h |
Library | Wtsapi32.lib |
DLL | Wtsapi32.dll |