Skip to content

Latest commit

 

History

History
136 lines (101 loc) · 5.06 KB

nf-wtsapi32-wtssetuserconfiga.md

File metadata and controls

136 lines (101 loc) · 5.06 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:wtsapi32.WTSSetUserConfigA
WTSSetUserConfigA function (wtsapi32.h)
Modifies configuration information for the specified user on the specified domain controller or Remote Desktop Session Host (RD Session Host) server. (ANSI)
WTSSetUserConfigA
wtsapi32/WTSSetUserConfigA
termserv\wtssetuserconfig.htm
TermServ
44d027c6-6ebb-4750-a0fa-17fdf31e45cd
12/05/2018
WTSSetUserConfig, WTSSetUserConfig function [Remote Desktop Services], WTSSetUserConfigA, WTSSetUserConfigW, _win32_wtssetuserconfig, termserv.wtssetuserconfig, wtsapi32/WTSSetUserConfig, wtsapi32/WTSSetUserConfigA, wtsapi32/WTSSetUserConfigW
wtsapi32.h
Windows
Windows Vista
Windows Server 2008
WTSSetUserConfigW (Unicode) and WTSSetUserConfigA (ANSI)
Wtsapi32.lib
Wtsapi32.dll
Windows
19H1
WTSSetUserConfigA
wtsapi32/WTSSetUserConfigA
c++
APIRef
kbSyntax
DllExport
Wtsapi32.dll
WTSSetUserConfig
WTSSetUserConfigA
WTSSetUserConfigW

WTSSetUserConfigA function

-description

Modifies configuration information for the specified user on the specified domain controller or Remote Desktop Session Host (RD Session Host) server.

-parameters

-param pServerName [in]

Pointer to a null-terminated string containing the name of a domain controller or RD Session Host server. Specify WTS_CURRENT_SERVER_NAME to indicate the RD Session Host server on which your application is running.

-param pUserName [in]

Pointer to a null-terminated string containing the name of the user whose configuration is being set.

-param WTSConfigClass [in]

Specifies the type of information to set for the user. 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 specified in ppBuffer for each of the information types.

-param pBuffer [in]

Pointer to the data used to modify the specified user's configuration.

-param DataLength [in]

Size, in TCHARs, of the pBuffer buffer.

-returns

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.

If the value of the WTSConfigClass parameter corresponds to an integer value in the WTS_CONFIG_CLASS enumeration, define the value to be set as a DWORD. Then cast the value to an LPWSTR in the call to WTSSetUserConfig, as in the following example:

WTSSetUserConfig( strServer.GetBuffer(0), 
                  m_strName.GetBuffer(0), 
                  WTSUserConfigfAllowLogonTerminalServer, 
                  (LPWSTR) &dwEnable, 
                  sizeof(DWORD));

Note

The wtsapi32.h header defines WTSSetUserConfig as an alias which 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 not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

-see-also

WTSQueryUserConfig

WTS_CONFIG_CLASS