NetWkstaSetInfo

The NetWkstaSetInfo function configures a workstation. This information remains in effect after the system has been reinitialized.

Security Requirements

Only members of the Administrators local group can successfully execute NetWkstaSetInfo on a remote server.

NET_API_STATUS NetWkstaSetInfo(
  LPWSTR servername, 
  DWORD level,       
  LPBYTE buffer,     
  LPDWORD parm_err   
);
 

Parameters

servername
Pointer to a Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local computer.
level
Specifies one of the following values to set the level of information provided.
Value Meaning
100 The buffer parameter points to a WKSTA_INFO_100 structure.
101 The buffer parameter points to a WKSTA_INFO_101 structure.
102 The buffer parameter points to a WKSTA_INFO_102 structure.
302 The buffer parameter points to a WKSTA_INFO_302 structure.
402 The buffer parameter points to a WKSTA_INFO_402 structure.
1101 The buffer parameter points to a WKSTA_USER_INFO_1101 structure.

In addition, the structures WKSTA_USER_INFO_502, WKSTA_USER_INFO_1010-1013, WKSTA_USER_INFO_1018, WKSTA_USER_INFO_1023, WKSTA_USER_INFO_1027, WKSTA_USER_INFO_1028, WKSTA_USER_INFO_1032, WKSTA_USER_INFO_1033, WKSTA_USER_INFO_1035, and WKSTA_USER_INFO_1041-1062 should not be set by the user.

buffer
Pointer to the buffer in which the data set with the level parameter is stored.
parm_num
Determines whether the buffer parameter contains a complete WKSTA_INFO_X (where Xis the level) structure or a single structure component. If parm_num is set to PARMNUM_ALL, buffer must point to a WKSTA_INFO_X structure. Otherwise, only one element is changed, and parm_num must point to the single element to change.

Not all elements can be changed. Only those elements that have a specific PARMNUM constant value defined can be set. The following possible values are defined.
Value Component to Set
PARMNUM_ALL All elements
WKSTA_CHARWAIT_PARMNUM wki0_charwait
WKSTA_CHARTIME_PARMNUM wki0_chartime
WKSTA_CHARCOUNT_PARMNUM wki0_charcount
WKSTA_ERRLOGSZ_PARMNUM wki0_errlogsz
WKSTA_PRINTBUFTIME_PARMNUM wki0_printbuftime
WKSTA_WRKHEURISTICS_PARMNUM wki0_wrkheuristics
WKSTA_OTHDOMAINS_PARMNUM wki1_oth_domains

parm_err
Optional pointer to a DWORD that contains the index of the first parameter that causes ERROR_INVALID_PARAMETER. If NULL, the parameter is not returned on error.

Return Values

If the function is successful, it returns NERR_SUCCESS.

If the function fails, the return value is one of the following error codes.

Value Meaning
ERROR_ACCESS_DENIED The user does not have access to the requested information.
ERROR_INVALID_PARAMETER One of the function parameters is invalid.

Remarks

You must be a member of the Administrators local group to successfully execute NetWkstaSetInfo on a remote server or on a computer that has local security enabled. NetWkstaSetInfo does not change values in the LANMAN.INI file. Values set by previous calls to NetWkstaSetInfo can be overwritten when workstation parameters are reset. When the Workstation service is stopped and restarted, parameters are reset to the default values specified in the LANMAN.INI file unless overwritten by command-line parameters.

Domain names in the wki1_oth_domains member of the WKSTA_USER_INFO_1101 structure are separated by spaces. An empty list is valid. A null pointer means to leave the member unmodified. The wki1_oth_domains member cannot be set with MS-DOS. When setting this element, NetWkstaSetInfo rejects the request if the name list was invalid or if a name could not be added to one or more of the network adapters managed by Net.

QuickInfo

  Windows NT: Requires version 3.1 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in lmwksta.h.
  Import Library: Use netapi32.lib.

See Also

Networking (Net) Overview, Net Functions, NetWkstaGetInfo