网站首页  词典首页

请输入您要查询的函数:

 

术语 netserversetinfo
释义 NetServerSetInfo
语法:
C++
NET_API_STATUS NetServerSetInfo(
__in LPWSTR servername,
__in DWORD level,
__in LPBYTE buf,
__out LPDWORD ParmError
);
NetServerSetInfo功能
该NetServerSetInfo函数设置服务器的运行参数,它可以将他们单独或集体。该信息存储的方式,允许其继续有效后,系统已重新初始化。
参数
服务器名 [in]
一个字符串指针,指定的远程服务器上的功能是执行的名称。如果该参数为NULL,则使用本地计算机。
Level [in]
指定的数据信息的Level。此参数可以是下列值之一。
ValueMeaning
101Specifies服务器名称,类型和相关软件。在buf参数指向一个SERVER_INFO_101结构。
102Specifies服务器的名称,类型,相关软件和其他属性。在buf参数指向一个SERVER_INFO_102结构。
402Specifies的详细信息服务器。在buf参数指向一个SERVER_INFO_402结构。
403Specifies的详细信息服务器。在buf参数指向一个SERVER_INFO_403结构。
此外,各级1001-1006,1009至11年,1016至1018年,1021,1022,1028,1029,1037,和1043是有效的基础上局域网管理系统的限制。
缓冲带 [in]
指针指向一个缓冲区,接收服务器的信息。这一数据格式取决于Level的参数值。有关更多信息,请参阅网络管理功能的缓冲器。
ParmError [out]
指针的值,它接收的信息结构的服务器,导致错误的ERROR_INVALID_PARAMETER第一个成员的索引。如果该参数为NULL,则指数不返回的错误。有关详细信息,请参阅下面的备注部分。
返回值
如果函数成功,返回值是NERR_Success。
如果函数失败,返回值可以是下面的错误代码之一。
返回codeDescription
ERROR_ACCESS_DENIEDThe用户没有获得所需的信息。
ERROR_INVALID_LEVELThe价值Level参数指定无效。
ERROR_INVALID_PARAMETERThe指定的参数无效。有关详细信息,请参阅下面的备注部分。
ERROR_NOT_ENOUGH_MEMORYInsufficient内存可用。
备注
管理员或服务器操作员本地组的成员才可以成功地执行NetServerSetInfo功能。
如果您是Active Directory的程序,您可以调用某些Active Directory服务接口(ADSI)的方法来达到同样的功能,您可以通过调用实现网络管理服务器功能。有关更多信息,请参阅IADsComputer。
如果NetServerSetInfo函数返回ERROR_INVALID_PARAMETER,您可以使用ParmError参数表明服务器的信息结构的第一个成员是无效的。 (服务器的信息结构开始SERVER_INFO_以及它的形式是指定的Level参数。)下表列出了可以返回的ParmError参数和相应的结构成员,在错误的价值观。 (前缀希沃特* _表明,成员国可以开始与多个前缀,例如,sv101_或sv402_。)
ValueMember
SV_PLATFORM_ID_PARMNUMsv*_platform_id
SV_NAME_PARMNUMsv * _name
SV_VERSION_MAJOR_PARMNUMsv * _version_major
SV_VERSION_MINOR_PARMNUMsv * _version_minor
SV_TYPE_PARMNUMsv * _type
SV_COMMENT_PARMNUMsv * _comment
SV_USERS_PARMNUMsv * _users
SV_DISC_PARMNUMsv * _disc
SV_HIDDEN_PARMNUMsv * _hidden
SV_ANNOUNCE_PARMNUMsv * _announce
SV_ANNDELTA_PARMNUMsv * _anndelta
SV_USERPATH_PARMNUMsv * _userpath
SV_ULIST_MTIME_PARMNUMsv * _ulist_mtime
SV_GLIST_MTIME_PARMNUMsv * _glist_mtime
SV_ALIST_MTIME_PARMNUMsv * _alist_mtime
SV_ALERTS_PARMNUMsv * _alerts
SV_SECURITY_PARMNUMsv * _security
SV_NUMADMIN_PARMNUMsv * _numadmin
SV_LANMASK_PARMNUMsv * _lanmask
SV_GUESTACC_PARMNUMsv * _guestacc
SV_CHDEVQ_PARMNUMsv * _chdevq
SV_CHDEVJOBS_PARMNUMsv * _chdevjobs
SV_CONNECTIONS_PARMNUMsv * _connections
SV_SHARES_PARMNUMsv * _shares
SV_OPENFILES_PARMNUMsv * _openfiles
SV_SESSOPENS_PARMNUMsv * _sessopens
SV_SESSVCS_PARMNUMsv * _sessvcs
SV_SESSREQS_PARMNUMsv * _sessreqs
SV_OPENSEARCH_PARMNUMsv * _opensearch
SV_ACTIVELOCKS_PARMNUMsv * _activelocks
SV_NUMREQBUF_PARMNUMsv * _numreqbuf
SV_SIZREQBUF_PARMNUMsv * _sizreqbuf
SV_NUMBIGBUF_PARMNUMsv * _numbigbuf
SV_NUMFILETASKS_PARMNUMsv * _numfiletasks
SV_ALERTSCHED_PARMNUMsv * _alertsched
SV_ERRORALERT_PARMNUMsv * _erroralert
SV_LOGONALERT_PARMNUMsv * _logonalert
SV_ACCESSALERT_PARMNUMsv * _accessalert
SV_DISKALERT_PARMNUMsv * _diskalert
SV_NETIOALERT_PARMNUMsv * _netioalert
SV_MAXAUDITSZ_PARMNUMsv * _maxauditsz
SV_SRVHEURISTICS_PARMNUMsv * _srvheuristics
SV_TIMESOURCE_PARMNUMsv * _timesource
实例
下面的代码示例演示如何调用NetServerSetInfo功能。该范例调用NetServerSetInfo,指定Level参数,1005(要求)设置SERVER_INFO_1005结构sv1005_comment成员。
#ifndef UNICODE
#define UNICODE
#endif
#pragma comment(lib, "netapi32.lib")
#include
#include
#include
int wmain(int argc, wchar_t *argv[])
{
DWORD dwLevel = 1005;
SERVER_INFO_1005 si;
NET_API_STATUS nStatus;
if (argc != 3)
{
fwprintf(stderr, L"Usage: %s \\\\\\\\ServerName Comment\\n", argv[0]);
exit(1);
}
//
// Fill in SERVER_INFO_1005 structure member.
//
si.sv1005_comment = (LPTSTR) argv[2];
//
// Call the NetServerSetInfo function,
// specifying level 1005.
//
nStatus = NetServerSetInfo(argv[1],
dwLevel,
(LPBYTE)&si,
NULL);
//
// Display the result of the call.
//
if (nStatus == NERR_Success)
fwprintf(stderr, L"Comment reset\\n", argv[2]);
else
fprintf(stderr, "A system error has occurred: %d\\n", nStatus);
return 0;
}
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderLmserver.h(包括Lm.h)
LibraryNetapi32.lib
DLLNetapi32.dll
参见
网络管理概述
网络管理功能
服务器功能
NetServerGetInfo
SERVER_INFO_101
SERVER_INFO_102
SERVER_INFO_402
SERVER_INFO_403
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月13日
==英文原文==NetServerSetInfo Function
The NetServerSetInfo function sets a server's operating parameters; it can set them individually or collectively. The information is stored in a way that allows it to remain in effect after the system has been reinitialized.
Syntax
C++
NET_API_STATUS NetServerSetInfo(
__in LPWSTR servername,
__in DWORD level,
__in LPBYTE buf,
__out LPDWORD ParmError
);
Parameters
servername [in]
Pointer to a string that specifies the name of the remote server on which the function is to execute. If this parameter is NULL, the local computer is used.
level [in]
Specifies the information level of the data. This parameter can be one of the following values.
ValueMeaning
101Specifies the server name, type, and associated software. The buf parameter points to a SERVER_INFO_101 structure.
102Specifies the server name, type, associated software, and other attributes. The buf parameter points to a SERVER_INFO_102 structure.
402Specifies detailed information about the server. The buf parameter points to a SERVER_INFO_402 structure.
403Specifies detailed information about the server. The buf parameter points to a SERVER_INFO_403 structure.

In addition, levels 1001-1006, 1009-1011, 1016-1018, 1021, 1022, 1028, 1029, 1037, and 1043 are valid based on the restrictions for LAN Manager systems.
buf [in]
Pointer to a buffer that receives the server information. The format of this data depends on the value of the level parameter. For more information, see Network Management Function Buffers .
ParmError [out]
Pointer to a value that receives the index of the first member of the server 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 following 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_LEVELThe value specified for the level parameter is invalid.
ERROR_INVALID_PARAMETERThe specified parameter is invalid. For more information, see the following Remarks section.
ERROR_NOT_ENOUGH_MEMORYInsufficient memory is available.

Remarks
Only members of the Administrators or Server Operators local group can successfully execute the NetServerSetInfo function.
If you are programming for Active Directory, you may be able to call certain Active Directory Service Interface (ADSI) methods to achieve the same functionality you can achieve by calling the network management server functions. For more information, see IADsComputer .
If the NetServerSetInfo function returns ERROR_INVALID_PARAMETER, you can use the ParmError parameter to indicate the first member of the server information structure that is invalid. (A server information structure begins with SERVER_INFO_ and its format is specified by the level parameter.) The following table lists the values that can be returned in the ParmError parameter and the corresponding structure member that is in error. (The prefix sv*_ indicates that the member can begin with multiple prefixes, for example, sv101_ or sv402_.)
ValueMember
SV_PLATFORM_ID_PARMNUMsv*_platform_id
SV_NAME_PARMNUMsv*_name
SV_VERSION_MAJOR_PARMNUMsv*_version_major
SV_VERSION_MINOR_PARMNUMsv*_version_minor
SV_TYPE_PARMNUMsv*_type
SV_COMMENT_PARMNUMsv*_comment
SV_USERS_PARMNUMsv*_users
SV_DISC_PARMNUMsv*_disc
SV_HIDDEN_PARMNUMsv*_hidden
SV_ANNOUNCE_PARMNUMsv*_announce
SV_ANNDELTA_PARMNUMsv*_anndelta
SV_USERPATH_PARMNUMsv*_userpath
SV_ULIST_MTIME_PARMNUMsv*_ulist_mtime
SV_GLIST_MTIME_PARMNUMsv*_glist_mtime
SV_ALIST_MTIME_PARMNUMsv*_alist_mtime
SV_ALERTS_PARMNUMsv*_alerts
SV_SECURITY_PARMNUMsv*_security
SV_NUMADMIN_PARMNUMsv*_numadmin
SV_LANMASK_PARMNUMsv*_lanmask
SV_GUESTACC_PARMNUMsv*_guestacc
SV_CHDEVQ_PARMNUMsv*_chdevq
SV_CHDEVJOBS_PARMNUMsv*_chdevjobs
SV_CONNECTIONS_PARMNUMsv*_connections
SV_SHARES_PARMNUMsv*_shares
SV_OPENFILES_PARMNUMsv*_openfiles
SV_SESSOPENS_PARMNUMsv*_sessopens
SV_SESSVCS_PARMNUMsv*_sessvcs
SV_SESSREQS_PARMNUMsv*_sessreqs
SV_OPENSEARCH_PARMNUMsv*_opensearch
SV_ACTIVELOCKS_PARMNUMsv*_activelocks
SV_NUMREQBUF_PARMNUMsv*_numreqbuf
SV_SIZREQBUF_PARMNUMsv*_sizreqbuf
SV_NUMBIGBUF_PARMNUMsv*_numbigbuf
SV_NUMFILETASKS_PARMNUMsv*_numfiletasks
SV_ALERTSCHED_PARMNUMsv*_alertsched
SV_ERRORALERT_PARMNUMsv*_erroralert
SV_LOGONALERT_PARMNUMsv*_logonalert
SV_ACCESSALERT_PARMNUMsv*_accessalert
SV_DISKALERT_PARMNUMsv*_diskalert
SV_NETIOALERT_PARMNUMsv*_netioalert
SV_MAXAUDITSZ_PARMNUMsv*_maxauditsz
SV_SRVHEURISTICS_PARMNUMsv*_srvheuristics
SV_TIMESOURCE_PARMNUMsv*_timesource

Examples
The following code sample demonstrates how to call the NetServerSetInfo function. The sample calls NetServerSetInfo, specifying the level parameter as 1005 (required) to set the sv1005_comment member of the SERVER_INFO_1005 structure.
#ifndef UNICODE
#define UNICODE
#endif
#pragma comment(lib, "netapi32.lib")
#include
#include
#include
int wmain(int argc, wchar_t *argv[])
{
DWORD dwLevel = 1005;
SERVER_INFO_1005 si;
NET_API_STATUS nStatus;
if (argc != 3)
{
fwprintf(stderr, L"Usage: %s \\\\\\\\ServerName Comment\\n", argv[0]);
exit(1);
}
//
// Fill in SERVER_INFO_1005 structure member.
//
si.sv1005_comment = (LPTSTR) argv[2];
//
// Call the NetServerSetInfo function,
// specifying level 1005.
//
nStatus = NetServerSetInfo(argv[1],
dwLevel,
(LPBYTE)&si,
NULL);
//
// Display the result of the call.
//
if (nStatus == NERR_Success)
fwprintf(stderr, L"Comment reset\\n", argv[2]);
else
fprintf(stderr, "A system error has occurred: %d\\n", nStatus);
return 0;
}
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderLmserver.h (include Lm.h)
LibraryNetapi32.lib
DLLNetapi32.dll
See Also
Network Management Overview
Network Management Functions
Server Functions
NetServerGetInfo
SERVER_INFO_101
SERVER_INFO_102
SERVER_INFO_402
SERVER_INFO_403
Send comments about this topic to Microsoft
Build date: 8/13/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa370626(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 13:20:28