网站首页  词典首页

请输入您要查询的函数:

 

术语 netwkstagetinfo
释义 NetWkstaGetInfo
语法:
C++
NET_API_STATUS NetWkstaGetInfo(
__in LPWSTR servername,
__in DWORD level,
__out LPBYTE *bufptr
);
NetWkstaGetInfo功能
该NetWkstaGetInfo函数返回信息的工作站配置。
参数
服务器名 [in]
指针指向一个字符串,它指定的DNS或NetBIOS的远程服务器上的功能是执行的名称。如果该参数为NULL,则使用本地计算机。
Level [in]
指定的数据信息的Level。此参数可以是下列值之一。
ValueMeaning
100Return信息工作站环境,包括平台的特定信息,该域名和本地计算机,以及有关的作业系统。在bufptr参数指向WKSTA_INFO_100结构。
101In除了Level100信息,返回路径兰曼目录。在bufptr参数指向WKSTA_INFO_101结构。
102In除了Level101信息,返回的用户数量是谁到本地登录到计算机。在bufptr参数指向WKSTA_INFO_102结构。
bufptr [out]
指针的缓冲区,接收数据。这一数据格式取决于Level的参数值。此缓冲区分配制度,必须使用NetApiBufferFree释放功能。有关更多信息,请参阅网络管理功能,缓冲器和网络管理功能缓冲区长度。
返回值
如果函数成功,返回值是NERR_Success。
如果函数失败,返回值可以是下面的错误代码之一。
返回codeDescription
ERROR_ACCESS_DENIEDThe用户没有获得所需的信息。
ERROR_INVALID_LEVELTheLevel参数无效。
备注
Server 2003和Windows XP中:如果您调用域控制器上运行Active Directory的这一功能,允许访问或拒绝关于在安全对象的ACL的视窗。要启用匿名访问,用户必须是匿名的“前成员Windows 2000兼容访问”组。这是因为匿名令牌不包括Everyone组默认的SID。如果您调用一个成员服务器或工作站,所有的身份验证的用户可以查看此功能的信息。匿名访问也是允许的,如果everyoneincludesanonymous的策略设置允许匿名访问。匿名访问总是允许的Level100。如果您打电话给101级这个功能,身份验证的用户可以查看的信息。系统管理员议员,服务器,系统和打印操作员组可以查看当地的Level,102和502信息。如需有关限制匿名访问的信息,请参阅的网络管理功能的安全要求。欲了解更多有关的ACL,ACE的,和访问令牌信息,请访问控制模型。
Windows 2000中:如果您调用域控制器上运行Active Directory的这一功能,允许访问或拒绝的访问控制列表的安全对象(ACL)的基础。默认的ACL允许所有经过身份验证的用户和“前成员Windows2000兼容访问”组查看信息。默认情况下,“预Windows2000兼容访问”组包括每个人作为成员。这使得匿名访问的信息如果系统允许匿名访问。如果您调用一个成员服务器或工作站,所有的身份验证的用户可以查看此功能的信息。匿名访问也是允许的,如果RestrictAnonymous的策略设置允许匿名访问。
要编译的应用程序使用此函数,定义为0x0400或更高_WIN32_WINNT宏。有关详细信息,请参阅使用Windows头。
实例
下面的代码示例演示了如何检索有关的使用调用NetWkstaGetInfo功能的工作站的配置元素的信息。该范例调用NetWkstaGetInfo,指定信息化Level102(WKSTA_INFO_102)。如果调用成功,样本打印有关工作站的信息。最后,代码示例释放的信息缓冲区分配的内存。
#ifndef UNICODE
#define UNICODE
#endif
#pragma comment(lib, "netapi32.lib")
#include
#include
#include
int wmain(int argc, wchar_t *argv[])
{
DWORD dwLevel = 102;
LPWKSTA_INFO_102 pBuf = NULL;
NET_API_STATUS nStatus;
LPWSTR pszServerName = NULL;
//
// Check command line arguments.
//
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 = argv[1];
//
// Call the NetWkstaGetInfo function, specifying level 102.
//
nStatus = NetWkstaGetInfo(pszServerName,
dwLevel,
(LPBYTE *)&pBuf);
//
// If the call is successful,
// print the workstation data.
//
if (nStatus == NERR_Success)
{
printf("\\n\\tPlatform: %d\\n", pBuf->wki102_platform_id);
wprintf(L"\\tName: %s\\n", pBuf->wki102_computername);
printf("\\tVersion: %d.%d\\n", pBuf->wki102_ver_major,
pBuf->wki102_ver_minor);
wprintf(L"\\tDomain: %s\\n", pBuf->wki102_langroup);
wprintf(L"\\tLan Root: %s\\n", pBuf->wki102_lanroot);
wprintf(L"\\t# Logged On Users: %d\\n", pBuf->wki102_logged_on_users);
}
//
// Otherwise, indicate 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服务器
HeaderLmwksta.h(包括Lm.h)
LibraryNetapi32.lib
DLLNetapi32.dll
参见
网络管理概述
网络管理功能
工作站和工作站用户功能
NetWkstaSetInfo
WKSTA_INFO_100
WKSTA_INFO_101
WKSTA_INFO_102
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月13日
==英文原文==NetWkstaGetInfo Function
The NetWkstaGetInfo function returns information about the configuration of a workstation.
Syntax
C++
NET_API_STATUS NetWkstaGetInfo(
__in LPWSTR servername,
__in DWORD level,
__out LPBYTE *bufptr
);
Parameters
servername [in]
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]
Specifies the information level of the data. This parameter can be one of the following values.
ValueMeaning
100Return information about the workstation environment, including platform-specific information, the name of the domain and the local computer, and information concerning the operating system. The bufptr parameter points to a WKSTA_INFO_100 structure.
101In addition to level 100 information, return the path to the LANMAN directory. The bufptr parameter points to a WKSTA_INFO_101 structure.
102In addition to level 101 information, return the number of users who are logged on to the local computer. The bufptr parameter points to a WKSTA_INFO_102 structure.

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.
ERROR_INVALID_LEVELThe level parameter is invalid.

Remarks
Windows Server 2003 and Windows XP: If you call this function on a domain controller that is running Active Directory, access is allowed or denied based on the ACL for the securable object. To enable anonymous access, the user Anonymous must be a member of the "Pre-Windows 2000 compatible access" group. This is because anonymous tokens do not include the Everyone group SID by default. If you call this function on a member server or workstation, all authenticated users can view the information. Anonymous access is also permitted if the EveryoneIncludesAnonymous policy setting allows anonymous access. Anonymous access is always permitted for level 100. If you call this function at level 101, authenticated users can view the information. Members of the Administrators, and the Server, System and Print Operator local groups can view information at levels 102 and 502. For more information about restricting anonymous access, see Security Requirements for the Network Management Functions . For more information on ACLs, ACEs, and access tokens, see Access Control Model .
Windows 2000: 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. By default, the "Pre-Windows2000 compatible access" group includes Everyone as a member. This enables anonymous access to the information if the system allows anonymous access. If you call this function on a member server or workstation, all authenticated users can view the information. Anonymous access is also permitted if the RestrictAnonymous policy setting allows anonymous access.
To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0400 or later. For more information,see Using the Windows Headers .
Examples
The following code sample demonstrates how to retrieve information about the configuration elements for a workstation using a call to the NetWkstaGetInfo function. The sample calls NetWkstaGetInfo, specifying information level 102 ( WKSTA_INFO_102 ). If the call succeeds, the sample prints information about the workstation. 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 = 102;
LPWKSTA_INFO_102 pBuf = NULL;
NET_API_STATUS nStatus;
LPWSTR pszServerName = NULL;
//
// Check command line arguments.
//
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 = argv[1];
//
// Call the NetWkstaGetInfo function, specifying level 102.
//
nStatus = NetWkstaGetInfo(pszServerName,
dwLevel,
(LPBYTE *)&pBuf);
//
// If the call is successful,
// print the workstation data.
//
if (nStatus == NERR_Success)
{
printf("\\n\\tPlatform: %d\\n", pBuf->wki102_platform_id);
wprintf(L"\\tName: %s\\n", pBuf->wki102_computername);
printf("\\tVersion: %d.%d\\n", pBuf->wki102_ver_major,
pBuf->wki102_ver_minor);
wprintf(L"\\tDomain: %s\\n", pBuf->wki102_langroup);
wprintf(L"\\tLan Root: %s\\n", pBuf->wki102_lanroot);
wprintf(L"\\t# Logged On Users: %d\\n", pBuf->wki102_logged_on_users);
}
//
// Otherwise, indicate 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
HeaderLmwksta.h (include Lm.h)
LibraryNetapi32.lib
DLLNetapi32.dll
See Also
Network Management Overview
Network Management Functions
Workstation and Workstation User Functions
NetWkstaSetInfo
WKSTA_INFO_100
WKSTA_INFO_101
WKSTA_INFO_102
Send comments about this topic to Microsoft
Build date: 8/13/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa370663(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:48