网站首页  词典首页

请输入您要查询的函数:

 

术语 netusermodalsset
释义 NetUserModalsSet
语法:
C++
NET_API_STATUS NetUserModalsSet(
__in LPCWSTR servername,
__in DWORD level,
__in LPBYTE buf,
__out LPDWORD parm_err
);
NetUserModalsSet功能
该NetUserModalsSet功能,对所有用户和安全数据库,它是安全帐户管理器(SAM)数据库或全局组的全球信息,在域控制器的情况下,Active Directory中。
参数
服务器名 [in]
指针常量字符串指定的DNS或NetBIOS的远程服务器上的功能是执行的名称。如果该参数为NULL,则使用本地计算机。
Level [in]
指定的数据信息的Level。此参数可以是下列值之一。
ValueMeaning
0Specifies全球密码参数。在buf参数指向一个USER_MODALS_INFO_0结构。
1Specifies登录服务器和域控制器的信息。在buf参数指向一个USER_MODALS_INFO_1结构。
2Specifies域名和标识。在buf参数指向一个USER_MODALS_INFO_2结构。
3Specifies锁定信息。在buf参数指向一个USER_MODALS_INFO_3结构。
1001Specifies最低限度的密码长度。在buf参数指向一个USER_MODALS_INFO_1001结构。
1002Specifies最高允许使用期限。在buf参数指向一个USER_MODALS_INFO_1002结构。
1003Specifies所允许的最低年龄的密码。在buf参数指向一个USER_MODALS_INFO_1003结构。
1004Specifies被迫注销的信息。在buf参数指向一个USER_MODALS_INFO_1004结构。
1005Specifies密码的历史之长。在buf参数指向一个USER_MODALS_INFO_1005结构。
1006Specifies的作用登录服务器。在buf参数指向一个USER_MODALS_INFO_1006结构。
1007Specifies域控制器的信息。在buf参数指向一个USER_MODALS_INFO_1007结构。
缓冲带 [in]
缓冲区指针指定的数据。这一数据格式取决于Level的参数值。有关更多信息,请参阅网络管理功能的缓冲器。
parm_err [out]
指针的值,它接收的信息结构的第一个成员的索引导致ERROR_INVALID_PARAMETER。如果该参数为NULL,则指数不返回的错误。有关详细信息,请参阅下面的备注部分。
返回值
如果函数成功,返回值是NERR_Success。
如果函数失败,返回值可以是下面的错误代码之一。
返回codeDescription
ERROR_ACCESS_DENIEDThe用户没有获得所需的信息。
ERROR_INVALID_PARAMETERThe指定的参数无效。有关详细信息,请参阅下面的备注部分。
NERR_InvalidComputerThe计算机名无效。
NERR_UserNotFoundThe用户名找不到。
备注
如果您是Active Directory的程序,您可以调用某些Active Directory服务接口(ADSI)的方法来达到同样的功能,您可以通过调用用户的网络管理模式的功能。有关更多信息,请参阅IADsDomain。
如果您调用域控制器上运行Active Directory的这一功能,允许访问或拒绝的访问控制列表的安全对象(ACL)的基础。默认的ACL只允许域管理员和Account Operators调用此函数。在成员服务器或工作站,只有Administrators和Power Users可以调用这个函数。有关更多信息,请参阅的网络管理功能的安全要求。欲了解更多有关的ACL,ACE的,和访问令牌信息,请访问控制模型。
域的对象的安全描述符用于执行此函数访问检查。通常情况下,来电者必须具有写访问的这个整个对象函数调用成功。
如果NetUserModalsSet函数返回ERROR_INVALID_PARAMETER,您可以使用parm_err参数显示的信息结构的第一个成员,是无效的。 (信息结构开始USER_MODALS_INFO_以及它的形式是指定的Level参数。)下表列出了可以返回的parm_err参数和相应的结构成员,在错误的价值观。 (前缀usrmod * _表明,成员国可以开始与多个前缀,例如,usrmod2_或usrmod1002_。)
ValueMember
MODALS_MIN_PASSWD_LEN_PARMNUMusrmod * _min_passwd_len
MODALS_MAX_PASSWD_AGE_PARMNUMusrmod * _max_passwd_age
MODALS_MIN_PASSWD_AGE_PARMNUMusrmod * _min_passwd_age
MODALS_FORCE_LOGOFF_PARMNUMusrmod * _force_logoff
MODALS_PASSWD_HIST_LEN_PARMNUMusrmod * _password_hist_len
MODALS_ROLE_PARMNUMusrmod * _role
MODALS_PRIMARY_PARMNUMusrmod * _primary
MODALS_DOMAIN_NAME_PARMNUMusrmod * _domain_name
MODALS_DOMAIN_ID_PARMNUMusrmod * _domain_id
MODALS_LOCKOUT_DURATION_PARMNUMusrmod * _lockout_duration
MODALS_LOCKOUT_OBSERVATION_WINDOW_PARMNUMusrmod * _lockout_observation_window
MODALS_LOCKOUT_THRESHOLD_PARMNUMusrmod * _lockout_threshold
实例
下面的代码示例演示如何设置为所有用户和向NetUserModalsSet函数调用的全局组的全球信息。样本填充在USER_MODALS_INFO_0结构的成员,并呼吁NetUserModalsSet,明确信息化Level0。
#ifndef UNICODE
#define UNICODE
#endif
#pragma comment(lib, "netapi32.lib")
#include
#include
#include
int wmain(int argc, wchar_t *argv[])
{
DWORD dwLevel = 0;
USER_MODALS_INFO_0 ui;
NET_API_STATUS nStatus;
LPTSTR pszServerName = NULL;
if (argc > 2)
{
fwprintf(stderr, L"Usage: %s [\\\\\\\\ServerName]\\n", argv[0]);
exit(1);
}
// The server is not the default local computer.
//
if (argc == 2)
pszServerName = (LPTSTR) argv[1];
//
// Fill in the USER_MODALS_INFO_0 structure.
//
ui.usrmod0_min_passwd_len = 0;
ui.usrmod0_max_passwd_age = (86400 * 30);
ui.usrmod0_min_passwd_age = 0;
ui.usrmod0_force_logoff = TIMEQ_FOREVER; // never force logoff
ui.usrmod0_password_hist_len = 0;
//
// Call the NetUserModalsSet function; specify level 0.
//
nStatus = NetUserModalsSet((LPCWSTR) pszServerName,
dwLevel,
(LPBYTE)&ui,
NULL);
//
// If the call succeeds, inform the user.
//
if (nStatus == NERR_Success)
fwprintf(stderr, L"Modals information set successfully on %s\\n", argv[1]);
//
// Otherwise, print the system error.
//
else
fprintf(stderr, "A system error has occurred: %d\\n", nStatus);
return 0;
}
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderLmaccess.h(包括Lm.h)
LibraryNetapi32.lib
DLLNetapi32.dll
参见
网络管理概述
网络管理功能
用户情态动词功能
NetUserModalsGet
USER_MODALS_INFO_0
USER_MODALS_INFO_1
USER_MODALS_INFO_2
USER_MODALS_INFO_3
USER_MODALS_INFO_1001
USER_MODALS_INFO_1002
USER_MODALS_INFO_1003
USER_MODALS_INFO_1004
USER_MODALS_INFO_1005
USER_MODALS_INFO_1006
USER_MODALS_INFO_1007
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月13日
==英文原文==NetUserModalsSet Function
The NetUserModalsSet function sets global information for all users and global groups in the security database, which is the security accounts manager (SAM) database or, in the case of domain controllers, the Active Directory.
Syntax
C++
NET_API_STATUS NetUserModalsSet(
__in LPCWSTR servername,
__in DWORD level,
__in LPBYTE buf,
__out LPDWORD parm_err
);
Parameters
servername [in]
Pointer to a constant 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]
Specifies the information level of the data. This parameter can be one of the following values.
ValueMeaning
0Specifies global password parameters. The buf parameter points to a USER_MODALS_INFO_0 structure.
1Specifies logon server and domain controller information. The buf parameter points to a USER_MODALS_INFO_1 structure.
2Specifies the domain name and identifier. The buf parameter points to a USER_MODALS_INFO_2 structure.
3Specifies lockout information. The buf parameter points to a USER_MODALS_INFO_3 structure.
1001Specifies the minimum allowable password length. The buf parameter points to a USER_MODALS_INFO_1001 structure.
1002Specifies the maximum allowable password age. The buf parameter points to a USER_MODALS_INFO_1002 structure.
1003Specifies the minimum allowable password age. The buf parameter points to a USER_MODALS_INFO_1003 structure.
1004Specifies forced logoff information. The buf parameter points to a USER_MODALS_INFO_1004 structure.
1005Specifies the length of the password history. The buf parameter points to a USER_MODALS_INFO_1005 structure.
1006Specifies the role of the logon server. The buf parameter points to a USER_MODALS_INFO_1006 structure.
1007Specifies domain controller information. The buf parameter points to a USER_MODALS_INFO_1007 structure.

buf [in]
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]
Pointer to a value that receives the index of the first member of the information structure that causes ERROR_INVALID_PARAMETER. 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_PARAMETERThe specified parameter is invalid. For more information, see the following Remarks section.
NERR_InvalidComputerThe computer name is invalid.
NERR_UserNotFoundThe user name could not be found.

Remarks
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 user modal functions. For more information, see IADsDomain .
If you call this function on a domain controller that is running Active Directory, access is allowed or denied based on the access control list (ACL) for the securable object . The default ACL permits only Domain Admins and Account Operators to call this function. On a member server or workstation, only Administrators and Power Users can call this function. For more information, see Security Requirements for the Network Management Functions . For more information on ACLs, ACEs, and access tokens, see Access Control Model .
The security descriptor of the Domain object is used to perform the access check for this function. Typically, callers must have write access to the entire object for calls to this function to succeed.
If the NetUserModalsSet function returns ERROR_INVALID_PARAMETER, you can use the parm_err parameter to indicate the first member of the information structure that is invalid. (The information structure begins with USER_MODALS_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 usrmod*_ indicates that the member can begin with multiple prefixes, for example, usrmod2_ or usrmod1002_.)
ValueMember
MODALS_MIN_PASSWD_LEN_PARMNUMusrmod*_min_passwd_len
MODALS_MAX_PASSWD_AGE_PARMNUMusrmod*_max_passwd_age
MODALS_MIN_PASSWD_AGE_PARMNUMusrmod*_min_passwd_age
MODALS_FORCE_LOGOFF_PARMNUMusrmod*_force_logoff
MODALS_PASSWD_HIST_LEN_PARMNUMusrmod*_password_hist_len
MODALS_ROLE_PARMNUMusrmod*_role
MODALS_PRIMARY_PARMNUMusrmod*_primary
MODALS_DOMAIN_NAME_PARMNUMusrmod*_domain_name
MODALS_DOMAIN_ID_PARMNUMusrmod*_domain_id
MODALS_LOCKOUT_DURATION_PARMNUMusrmod*_lockout_duration
MODALS_LOCKOUT_OBSERVATION_WINDOW_PARMNUMusrmod*_lockout_observation_window
MODALS_LOCKOUT_THRESHOLD_PARMNUMusrmod*_lockout_threshold

Examples
The following code sample demonstrates how to set the global information for all users and global groups with a call to the NetUserModalsSet function. The sample fills in the members of the USER_MODALS_INFO_0 structure and calls NetUserModalsSet, specifying information level 0.
#ifndef UNICODE
#define UNICODE
#endif
#pragma comment(lib, "netapi32.lib")
#include
#include
#include
int wmain(int argc, wchar_t *argv[])
{
DWORD dwLevel = 0;
USER_MODALS_INFO_0 ui;
NET_API_STATUS nStatus;
LPTSTR pszServerName = NULL;
if (argc > 2)
{
fwprintf(stderr, L"Usage: %s [\\\\\\\\ServerName]\\n", argv[0]);
exit(1);
}
// The server is not the default local computer.
//
if (argc == 2)
pszServerName = (LPTSTR) argv[1];
//
// Fill in the USER_MODALS_INFO_0 structure.
//
ui.usrmod0_min_passwd_len = 0;
ui.usrmod0_max_passwd_age = (86400 * 30);
ui.usrmod0_min_passwd_age = 0;
ui.usrmod0_force_logoff = TIMEQ_FOREVER; // never force logoff
ui.usrmod0_password_hist_len = 0;
//
// Call the NetUserModalsSet function; specify level 0.
//
nStatus = NetUserModalsSet((LPCWSTR) pszServerName,
dwLevel,
(LPBYTE)&ui,
NULL);
//
// If the call succeeds, inform the user.
//
if (nStatus == NERR_Success)
fwprintf(stderr, L"Modals information set successfully on %s\\n", argv[1]);
//
// Otherwise, print the system error.
//
else
fprintf(stderr, "A system error has occurred: %d\\n", nStatus);
return 0;
}
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderLmaccess.h (include Lm.h)
LibraryNetapi32.lib
DLLNetapi32.dll
See Also
Network Management Overview
Network Management Functions
User Modals Functions
NetUserModalsGet
USER_MODALS_INFO_0
USER_MODALS_INFO_1
USER_MODALS_INFO_2
USER_MODALS_INFO_3
USER_MODALS_INFO_1001
USER_MODALS_INFO_1002
USER_MODALS_INFO_1003
USER_MODALS_INFO_1004
USER_MODALS_INFO_1005
USER_MODALS_INFO_1006
USER_MODALS_INFO_1007
Send comments about this topic to Microsoft
Build date: 8/13/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa370657(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:54