网站首页  词典首页

请输入您要查询的函数:

 

术语 netwkstasetinfo
释义 NetWkstaSetInfo
语法:
C++
NET_API_STATUS NetWkstaSetInfo(
__in LPWSTR servername,
__in DWORD level,
__in LPBYTE buffer,
__out LPDWORD parm_err
);
NetWkstaSetInfo功能
该NetWkstaSetInfo功能配置与信息工作站,至今仍然有效后,系统已重新初始化。
参数
服务器名 [in]
一个字符串,它指定的DNS或NetBIOS的远程服务器上的功能是执行名称的指针。如果该参数为NULL,则使用本地计算机。
Level [in]
数据的信息化Level。此参数可以是下列值之一。
ValueMeaning
100Windows新台币:指定一个工作站环境信息,包括平台的特定信息,该域名和本地计算机,以及有关的作业系统。缓冲区参数指向WKSTA_INFO_100结构。这个结构的wk100_computername和wk100_langroup字段不能被通过调用这个函数。要设置这些值,请SetComputerName / SetComputerNameEx或NetJoinDomain分别。
101Windows新台币:一级,除了100的信息,指定路径兰曼目录。缓冲区参数指向WKSTA_INFO_101结构。这个结构的wk101_computername和wk101_langroup字段不能被通过调用这个函数。要设置这些值,请SetComputerName / SetComputerNameEx或NetJoinDomain分别。
102Windows新台币:一级,除了101的信息,指定谁是用户数量到本地登录到计算机。缓冲区参数指向WKSTA_INFO_102结构。这个结构的wk102_computername和wk102_langroup字段不能被通过调用这个函数。要设置这些值,请SetComputerName / SetComputerNameEx或NetJoinDomain分别。
502Windows新台币:缓冲区参数指向WKSTA_INFO_502结构,它包含有关该工作站环境的信息。
不设置Level1010-1013,1018,1023,1027,1028,1032,1033,1035,或1041年至1062年。
缓冲区 [in]
一个指定的缓冲区中的数据指针。这一数据格式取决于Level的参数值。有关更多信息,请参阅网络管理功能的缓冲器。
parm_err [out]
一个值,接收了该工作站的信息结构,导致了ERROR_INVALID_PARAMETER错误的第一个成员的索引指针。如果该参数为NULL,则指数不返回的错误。有关详细信息,请参见备注部分。
返回值
如果函数成功,返回值是NERR_Success。
如果函数失败,返回值可以是下面的错误代码之一。
返回codeDescription
ERROR_ACCESS_DENIEDThe用户没有获得所需的信息。
函数的参数ERROR_INVALID_PARAMETEROne是无效的。有关详细信息,请参阅下面的备注部分。
备注
Administrators组的成员才可以成功地执行远程服务器上的NetWkstaSetInfo功能。
该NetWkstaSetInfo函数调用本地系统或远程系统的工作站服务。只有对WKSTA_INFO_502结构的成员数量有限,其实是可以改变使用NetWkstaSetInfo功能。没有错误返回的一成员设置由该工作站服务的忽视。该工作站服务主要配置使用的注册表设置。
该NetWkstaUserSetInfo函数可以用来代替NetWkstaSetInfo函数来设置本地系统上的配置信息。该NetWkstaUserSetInfo函数调用本地安全机构(LSA)。
如果NetWkstaSetInfo函数返回ERROR_INVALID_PARAMETER,您可以使用parm_err参数表明该工作站的信息结构的第一个成员是无效的。 (工作站的信息结构开始WKSTA_INFO_以及它的形式是指定的Level参数。)下表列出了可以返回的parm_err参数和相应的结构成员,在错误的价值观。 (前缀wki * _表明,成员国可以开始与多个前缀,例如,wki100_或wki402_。)
ValueMember
WKSTA_PLATFORM_ID_PARMNUMwki * _platform_id
WKSTA_COMPUTERNAME_PARMNUMwki * _computername
WKSTA_LANGROUP_PARMNUMwki * _langroup
WKSTA_VER_MAJOR_PARMNUMwki * _ver_major
WKSTA_VER_MINOR_PARMNUMwki * _ver_minor
WKSTA_LOGGED_ON_USERS_PARMNUMwki * _logged_on_users
WKSTA_LANROOT_PARMNUMwki * _lanroot
WKSTA_LOGON_DOMAIN_PARMNUMwki * _logon_domain
WKSTA_LOGON_SERVER_PARMNUMwki * _logon_server
WKSTA_CHARWAIT_PARMNUMwki * _char_wait
WKSTA_CHARTIME_PARMNUMwki * _collection_time
WKSTA_CHARCOUNT_PARMNUMwki * _maximum_collection_count
WKSTA_KEEPCONN_PARMNUMwki * _keep_conn
WKSTA_KEEPSEARCH_PARMNUMwki * _keep_search
WKSTA_MAXCMDS_PARMNUMwki * _max_cmds
WKSTA_NUMWORKBUF_PARMNUMwki * _num_work_buf
WKSTA_MAXWRKCACHE_PARMNUMwki * _max_wrk_cache
WKSTA_SESSTIMEOUT_PARMNUMwki * _sess_timeout
WKSTA_SIZERROR_PARMNUMwki * _siz_error
WKSTA_NUMALERTS_PARMNUMwki * _num_alerts
WKSTA_NUMSERVICES_PARMNUMwki * _num_services
WKSTA_ERRLOGSZ_PARMNUMwki * _errlog_sz
WKSTA_PRINTBUFTIME_PARMNUMwki * _print_buf_time
WKSTA_NUMCHARBUF_PARMNUwki * _num_char_buf
WKSTA_SIZCHARBUF_PARMNUMwki * _siz_char_buf
WKSTA_WRKHEURISTICS_PARMNUMwki * _wrk_heuristics
WKSTA_MAILSLOTS_PARMNUMwki * _mailslots
WKSTA_MAXTHREADS_PARMNUMwki * _max_threads
WKSTA_SIZWORKBUF_PARMNUMwki * _siz_work_buf
WKSTA_NUMDGRAMBUF_PARMNUMwki * _num_dgram_buf
工作站服务参数设置存储在注册表中,在文件中使用不LanMan.ini通过局域网管理prveiously。该NetWkstaSetInfo函数不会改变LanMan.ini文件中的值。当工作站服务停止并重新启动计算机,工作站参数重置为默认值中指定的注册表(除非它们覆盖命令行参数)。由以往的呼吁,以NetWkstaSetInfo设置值时,可以覆盖工作站参数复位。
实例
下面的代码示例演示如何设置会话超时,可以通过一个调用NetServerSetInfo功能工作站的关联值。 (会话超时时间是多少秒的服务器,然后断开的活动会话等待。)代码指定信息化Level502(WKSTA_INFO_502)。
#ifndef UNICODE
#define UNICODE
#endif
#pragma comment(lib, "netapi32.lib")
#include
#include
#include
int wmain(int argc, wchar_t *argv[])
{
LPWKSTA_INFO_502 pBuf = NULL;
WKSTA_INFO_502 wi;
DWORD dwLevel = 502;
NET_API_STATUS nStatus;
LPWSTR pszServerName = NULL;
if ((argc < 2) || (argc > 3))
{
fwprintf(stderr, L"Usage: %s [\\\\\\\\ServerName] SessionTimeOut\\n", argv[0]);
exit(1);
}
if (argc == 3)
pszServerName = argv[1];
//
// Retrieve the current settings.
//
nStatus = NetWkstaGetInfo(pszServerName,
dwLevel,
(LPBYTE *)&pBuf);
if (nStatus != NERR_Success)
{
fprintf(stderr, "A system error has occurred (NetWkstaGetInfo): %d\\n", nStatus);
return -1;
}
if (pBuf != NULL)
{
//
// Copy the existing settings to the new structure,
// and free the buffer.
//
CopyMemory(&wi, pBuf, sizeof(wi));
NetApiBufferFree(pBuf);
}
else
{
fprintf(stderr, "Memory invalid!\\n");
return -1;
}
//
// Set a new session time-out value by
// calling the NetWkstaSetInfo function.
//
wi.wki502_sess_timeout = _wtoi(argv[argc-1]);
nStatus = NetWkstaSetInfo(pszServerName,
dwLevel,
(LPBYTE)&wi,
NULL);
//
// Display the result of the call.
//
if (nStatus == NERR_Success)
fwprintf(stderr, L"Workstation information reset: session time-out = %d\\n", _wtoi(argv[argc-1]));
else
fprintf(stderr, "A system error has occurred (NetWkstaSetInfo): %d\\n", nStatus);
return 0;
}
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderLmwksta.h(包括Lm.h)
LibraryNetapi32.lib
DLLNetapi32.dll
参见
网络管理概述
网络管理功能
工作站和工作站用户功能
NetWkstaGetInfo
NetWkstaUserGetInfo
NetWkstaUserSetInfo
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月13日
==英文原文==NetWkstaSetInfo Function
The NetWkstaSetInfo function configures a workstation with information that remains in effect after the system has been reinitialized.
Syntax
C++
NET_API_STATUS NetWkstaSetInfo(
__in LPWSTR servername,
__in DWORD level,
__in LPBYTE buffer,
__out LPDWORD parm_err
);
Parameters
servername [in]
A pointer to a string that specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this parameter is NULL, the local computer is used.
level [in]
The information level of the data. This parameter can be one of the following values.
ValueMeaning
100Windows NT: Specifies information about a workstation environment, including platform-specific information, the names of the domain and the local computer, and information concerning the operating system. The buffer parameter points to a WKSTA_INFO_100 structure. The wk100_computername and wk100_langroup fields of this structure cannot be set by calling this function. To set these values, call SetComputerName / SetComputerNameEx or NetJoinDomain , respectively.
101Windows NT: In addition to level 100 information, specifies the path to the LANMAN directory. The buffer parameter points to a WKSTA_INFO_101 structure. The wk101_computername and wk101_langroup fields of this structure cannot be set by calling this function. To set these values, call SetComputerName/SetComputerNameEx or NetJoinDomain, respectively.
102Windows NT: In addition to level 101 information, specifies the number of users who are logged on to the local computer. The buffer parameter points to a WKSTA_INFO_102 structure. The wk102_computername and wk102_langroup fields of this structure cannot be set by calling this function. To set these values, call SetComputerName/SetComputerNameEx or NetJoinDomain, respectively.
502Windows NT: The buffer parameter points to a WKSTA_INFO_502 structure that contains information about the workstation environment.

Do not set levels 1010-1013, 1018, 1023, 1027, 1028, 1032, 1033, 1035, or 1041-1062.
buffer [in]
A pointer to the buffer that specifies the data. The format of this data depends on the value of the level parameter. For more information, see Network Management Function Buffers .
parm_err [out]
A pointer to a value that receives the index of the first member of the workstation information structure that causes the ERROR_INVALID_PARAMETER error. If this parameter is NULL, the index is not returned on error. For more information, see the Remarks section.
Return Value
If the function succeeds, the return value is NERR_Success.
If the function fails, the return value can be one of the following error codes.
Return codeDescription
ERROR_ACCESS_DENIEDThe user does not have access to the requested information.
ERROR_INVALID_PARAMETEROne of the function parameters is invalid. For more information, see the following Remarks section.

Remarks
Only members of the Administrators group can successfully execute the NetWkstaSetInfo function on a remote server.
The NetWkstaSetInfo function calls the workstation service on the local system or a remote system. Only a limited number of members of the WKSTA_INFO_502 structure can actually be changed using the NetWkstaSetInfo function. No errors are returned if a member is set that is ignored by the workstation service. The workstation service is primarily configured using settings in the registry.
The NetWkstaUserSetInfo function can be used instead of the NetWkstaSetInfo function to set configuration information on the local system. The NetWkstaUserSetInfo function calls the Local Security Authority (LSA).
If the NetWkstaSetInfo function returns ERROR_INVALID_PARAMETER, you can use the parm_err parameter to indicate the first member of the workstation information structure that is invalid. (A workstation information structure begins with WKSTA_INFO_ and its format is specified by the level parameter.) The following table lists the values that can be returned in the parm_err parameter and the corresponding structure member that is in error. (The prefix wki*_ indicates that the member can begin with multiple prefixes, for example, wki100_ or wki402_.)
ValueMember
WKSTA_PLATFORM_ID_PARMNUMwki*_platform_id
WKSTA_COMPUTERNAME_PARMNUMwki*_computername
WKSTA_LANGROUP_PARMNUMwki*_langroup
WKSTA_VER_MAJOR_PARMNUMwki*_ver_major
WKSTA_VER_MINOR_PARMNUMwki*_ver_minor
WKSTA_LOGGED_ON_USERS_PARMNUMwki*_logged_on_users
WKSTA_LANROOT_PARMNUMwki*_lanroot
WKSTA_LOGON_DOMAIN_PARMNUMwki*_logon_domain
WKSTA_LOGON_SERVER_PARMNUMwki*_logon_server
WKSTA_CHARWAIT_PARMNUMwki*_char_wait
WKSTA_CHARTIME_PARMNUMwki*_collection_time
WKSTA_CHARCOUNT_PARMNUMwki*_maximum_collection_count
WKSTA_KEEPCONN_PARMNUMwki*_keep_conn
WKSTA_KEEPSEARCH_PARMNUMwki*_keep_search
WKSTA_MAXCMDS_PARMNUMwki*_max_cmds
WKSTA_NUMWORKBUF_PARMNUMwki*_num_work_buf
WKSTA_MAXWRKCACHE_PARMNUMwki*_max_wrk_cache
WKSTA_SESSTIMEOUT_PARMNUMwki*_sess_timeout
WKSTA_SIZERROR_PARMNUMwki*_siz_error
WKSTA_NUMALERTS_PARMNUMwki*_num_alerts
WKSTA_NUMSERVICES_PARMNUMwki*_num_services
WKSTA_ERRLOGSZ_PARMNUMwki*_errlog_sz
WKSTA_PRINTBUFTIME_PARMNUMwki*_print_buf_time
WKSTA_NUMCHARBUF_PARMNUwki*_num_char_buf
WKSTA_SIZCHARBUF_PARMNUMwki*_siz_char_buf
WKSTA_WRKHEURISTICS_PARMNUMwki*_wrk_heuristics
WKSTA_MAILSLOTS_PARMNUMwki*_mailslots
WKSTA_MAXTHREADS_PARMNUMwki*_max_threads
WKSTA_SIZWORKBUF_PARMNUMwki*_siz_work_buf
WKSTA_NUMDGRAMBUF_PARMNUMwki*_num_dgram_buf

The workstation service parameter settings are stored in the registry, not in the LanMan.ini file used prveiously by LAN Manager. The NetWkstaSetInfo function does not change the values in the LanMan.ini file. When the workstation service is stopped and restarted, workstation parameters are reset to the default values specified in the registry (unless they are overwritten by command-line parameters). Values set by previous calls to NetWkstaSetInfo can be overwritten when workstation parameters are reset.
Examples
The following code sample demonstrates how to set the session time-out value associated with a workstation using a call to the NetServerSetInfo function. (The session time-out is the number of seconds the server waits before disconnecting an inactive session.) The code specifies information level 502 (WKSTA_INFO_502).
#ifndef UNICODE
#define UNICODE
#endif
#pragma comment(lib, "netapi32.lib")
#include
#include
#include
int wmain(int argc, wchar_t *argv[])
{
LPWKSTA_INFO_502 pBuf = NULL;
WKSTA_INFO_502 wi;
DWORD dwLevel = 502;
NET_API_STATUS nStatus;
LPWSTR pszServerName = NULL;
if ((argc < 2) || (argc > 3))
{
fwprintf(stderr, L"Usage: %s [\\\\\\\\ServerName] SessionTimeOut\\n", argv[0]);
exit(1);
}
if (argc == 3)
pszServerName = argv[1];
//
// Retrieve the current settings.
//
nStatus = NetWkstaGetInfo(pszServerName,
dwLevel,
(LPBYTE *)&pBuf);
if (nStatus != NERR_Success)
{
fprintf(stderr, "A system error has occurred (NetWkstaGetInfo): %d\\n", nStatus);
return -1;
}
if (pBuf != NULL)
{
//
// Copy the existing settings to the new structure,
// and free the buffer.
//
CopyMemory(&wi, pBuf, sizeof(wi));
NetApiBufferFree(pBuf);
}
else
{
fprintf(stderr, "Memory invalid!\\n");
return -1;
}
//
// Set a new session time-out value by
// calling the NetWkstaSetInfo function.
//
wi.wki502_sess_timeout = _wtoi(argv[argc-1]);
nStatus = NetWkstaSetInfo(pszServerName,
dwLevel,
(LPBYTE)&wi,
NULL);
//
// Display the result of the call.
//
if (nStatus == NERR_Success)
fwprintf(stderr, L"Workstation information reset: session time-out = %d\\n", _wtoi(argv[argc-1]));
else
fprintf(stderr, "A system error has occurred (NetWkstaSetInfo): %d\\n", nStatus);
return 0;
}
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderLmwksta.h (include Lm.h)
LibraryNetapi32.lib
DLLNetapi32.dll
See Also
Network Management Overview
Network Management Functions
Workstation and Workstation User Functions
NetWkstaGetInfo
NetWkstaUserGetInfo
NetWkstaUserSetInfo
Send comments about this topic to Microsoft
Build date: 8/13/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa370664(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 11:31:52