网站首页  词典首页

请输入您要查询的函数:

 

术语 netusermodalsget
释义 NetUserModalsGet
语法:
C++
NET_API_STATUS NetUserModalsGet(
__in LPCWSTR servername,
__in DWORD level,
__out LPBYTE *bufptr
);
NetUserModalsGet功能
该NetUserModalsGet函数检索的所有用户和安全数据库,它是安全帐户管理器(SAM)数据库或全局组的全球信息,在域控制器的情况下,Active Directory中。
参数
服务器名 [in]
指针常量字符串指定的DNS或NetBIOS的远程服务器上的功能是执行的名称。如果该参数为NULL,则使用本地计算机。有关详细信息,请参阅下面的备注部分。
Level [in]
指定的数据信息的Level。此参数可以是下列值之一。
ValueMeaning
0Return全球密码参数。在bufptr参数指向USER_MODALS_INFO_0结构。
1Return登录服务器和域控制器的信息。在bufptr参数指向USER_MODALS_INFO_1结构。
2Return域名和标识。在bufptr参数指向USER_MODALS_INFO_2结构。有关详细信息,请参阅下面的备注部分。
3Return锁定信息。在bufptr参数指向USER_MODALS_INFO_3结构。
阿空会话登录,可调用NetUserModalsGet匿名的信息级别0和3。
bufptr [out]
指针的缓冲区,接收数据。这一数据格式取决于Level的参数值。此缓冲区分配制度,必须使用NetApiBufferFree释放功能。有关更多信息,请参阅网络管理功能,缓冲器和网络管理功能缓冲区长度。
返回值
如果函数成功,返回值是NERR_Success。
如果函数失败,返回值可以是下面的错误代码之一。
返回codeDescription
ERROR_ACCESS_DENIEDThe用户没有获得所需的信息。
NERR_InvalidComputerThe计算机名无效。
备注
如果您是Active Directory的程序,您可以调用某些Active Directory服务接口(ADSI)的方法来达到同样的功能,您可以通过调用用户的网络管理模式的功能。有关更多信息,请参阅IADsDomain。
如果您调用域控制器上运行Active Directory的这一功能,允许访问或拒绝的访问控制列表的安全对象(ACL)的基础。默认的ACL允许所有经过身份验证的用户和“前成员Windows2000兼容访问”组查看信息。如果您调用一个成员服务器或工作站,所有的身份验证的用户可以查看此功能的信息。有关匿名访问的信息,并限制在这些平台上匿名访问,看到了网络管理功能的安全要求。欲了解更多有关的ACL,ACE的,和访问令牌信息,请访问控制模型。
域的对象的安全描述符用于执行此函数访问检查。
要检索域的安全标识符(SID),该计算机所属NetUserModalsGet函数调用中指定的服务器名参数USER_MODALS_INFO_2结构和NULL。如果计算机不是域的成员,该函数返回一个NULL指针。
实例
下面的代码示例演示了如何为所有用户检索和向NetUserModalsGet函数调用的全局组的全球信息。该范例调用NetUserModalsGet,指定信息化Level0(USER_MODALS_INFO_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 *pBuf = NULL;
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];
//
// Call the NetUserModalsGet function; specify level 0.
//
nStatus = NetUserModalsGet((LPCWSTR) pszServerName,
dwLevel,
(LPBYTE *)&pBuf);
//
// If the call succeeds, print the global information.
//
if (nStatus == NERR_Success)
{
if (pBuf != NULL)
{
printf("\\tMinimum password length: %d\\n", pBuf->usrmod0_min_passwd_len);
printf("\\tMaximum password age (d): %d\\n", pBuf->usrmod0_max_passwd_age/86400);
printf("\\tMinimum password age (d): %d\\n", pBuf->usrmod0_min_passwd_age/86400);
printf("\\tForced log off time (s): %d\\n", pBuf->usrmod0_force_logoff);
printf("\\tPassword history length: %d\\n", pBuf->usrmod0_password_hist_len);
}
}
// Otherwise, print the system error.
//
else
fprintf(stderr, "A system error has occurred: %d\\n", nStatus);
//
// Free the allocated memory.
//
if (pBuf != NULL)
NetApiBufferFree(pBuf);
return 0;
}
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderLmaccess.h(包括Lm.h)
LibraryNetapi32.lib
DLLNetapi32.dll
参见
网络管理概述
网络管理功能
用户情态动词功能
NetUserModalsSet
USER_MODALS_INFO_0
USER_MODALS_INFO_1
USER_MODALS_INFO_2
USER_MODALS_INFO_3
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月13日
==英文原文==NetUserModalsGet Function
The NetUserModalsGet function retrieves 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 NetUserModalsGet(
__in LPCWSTR servername,
__in DWORD level,
__out LPBYTE *bufptr
);
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. For more information, see the following Remarks section.
level [in]
Specifies the information level of the data. This parameter can be one of the following values.
ValueMeaning
0Return global password parameters. The bufptr parameter points to a USER_MODALS_INFO_0 structure.
1Return logon server and domain controller information. The bufptr parameter points to a USER_MODALS_INFO_1 structure.
2Return domain name and identifier. The bufptr parameter points to a USER_MODALS_INFO_2 structure. For more information, see the following Remarks section.
3Return lockout information. The bufptr parameter points to a USER_MODALS_INFO_3 structure.

A null session logon can call NetUserModalsGet anonymously at information levels 0 and 3.
bufptr [out]
Pointer to the buffer that receives the data. The format of this data depends on the value of the level parameter. This buffer is allocated by the system and must be freed using the NetApiBufferFree function. For more information, see Network Management Function Buffers and Network Management Function Buffer Lengths .
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.
NERR_InvalidComputerThe computer name is invalid.

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 all authenticated users and members of the " Pre-Windows2000 compatible access " group to view the information. If you call this function on a member server or workstation, all authenticated users can view the information. For information about anonymous access and restricting anonymous access on these platforms, 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.
To retrieve the security identifier (SID) of the domain to which the computer belongs, call the NetUserModalsGet function specifying a USER_MODALS_INFO_2 structure and NULL in the servername parameter. If the computer isn't a member of a domain, the function returns a NULL pointer.
Examples
The following code sample demonstrates how to retrieve global information for all users and global groups with a call to the NetUserModalsGet function. The sample calls NetUserModalsGet, specifying information level 0 ( USER_MODALS_INFO_0 ). If the call succeeds, the sample prints global password information. Finally, the code sample frees the memory allocated for the information buffer.
#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 *pBuf = NULL;
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];
//
// Call the NetUserModalsGet function; specify level 0.
//
nStatus = NetUserModalsGet((LPCWSTR) pszServerName,
dwLevel,
(LPBYTE *)&pBuf);
//
// If the call succeeds, print the global information.
//
if (nStatus == NERR_Success)
{
if (pBuf != NULL)
{
printf("\\tMinimum password length: %d\\n", pBuf->usrmod0_min_passwd_len);
printf("\\tMaximum password age (d): %d\\n", pBuf->usrmod0_max_passwd_age/86400);
printf("\\tMinimum password age (d): %d\\n", pBuf->usrmod0_min_passwd_age/86400);
printf("\\tForced log off time (s): %d\\n", pBuf->usrmod0_force_logoff);
printf("\\tPassword history length: %d\\n", pBuf->usrmod0_password_hist_len);
}
}
// Otherwise, print the system error.
//
else
fprintf(stderr, "A system error has occurred: %d\\n", nStatus);
//
// Free the allocated memory.
//
if (pBuf != NULL)
NetApiBufferFree(pBuf);
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
NetUserModalsSet
USER_MODALS_INFO_0
USER_MODALS_INFO_1
USER_MODALS_INFO_2
USER_MODALS_INFO_3
Send comments about this topic to Microsoft
Build date: 8/13/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa370656(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:32:28