网站首页  词典首页

请输入您要查询的函数:

 

术语 netdfsenum
释义 NetDfsEnum
语法:
C++
NET_API_STATUS NetDfsEnum(
__in LPWSTR DfsName,
__in DWORD Level,
__in DWORD PrefMaxLen,
__out LPBYTE *Buffer,
__out LPDWORD EntriesRead,
__inout LPDWORD ResumeHandle
);
NetDfsEnum功能
列举了分布式文件系统(DFS)命名空间托管在服务器或命名空间的DFS链接的服务器托管。
参数
DfsName [in]
一个字符串指针,指定通用命名约定(UNC)的DFS根目录或链接的路径。
当您指定信息化Level200(DFS_INFO_200),这个参数是一个域名。当您指定信息化Level300(DFS_INFO_300),这个参数是一个服务器的名称。
对于所有其他级别,该字符串可以在以下四种形式之一:
服务器名\\ DfsName

服务器名\\ DfsName \\ link_path
其中ServerName是根目标服务器承载独立的DFS命名空间的名称; Dfsname是DFS名称空间的名称和link_path是DFS链接。
该字符串也可以是以下形式:
域名\\域名\\ DomDfsName

域名\\ DomDfsName \\ link_path
其中DomainName是域的承载基于域的DFS根名称; DomDfsName是DFS名称空间的名称和link_path是DFS链接。
您可以先用反斜杠字符串(\\ \\),但它们并不是必需的。此参数是必需的。
Level [in]
指定请求的信息化Level。此参数可以是下列值之一。
ValueMeaning
1Return的DFS根名义和根的一切联系。缓冲区参数指向一个DFS_INFO_1结构的数组。
2Return的名称,注释,地位和打击对象的DFS根目录和根目录下的所有环节。缓冲区参数指向一个DFS_INFO_2结构的数组。
3Return的名称,注释,地位,目标号码和每个DFS根目录和根目录下的所有链接目标信息。缓冲区参数指向一个DFS_INFO_3结构的数组。
4Return的名称,注释,状态的GUID,超时,数量指标,以及有关每个DFS根目录和根目录下的所有链接目标信息。缓冲区参数指向一个DFS_INFO_4结构的数组。
5Return的名称,状态,GUID,请超时,财产旗帜,数据大小和数量指标的DFS根目录和根目录下的所有链接。缓冲区参数指向一个DFS_INFO_5结构的数组。
注意此值是原生支持只有在DFS链接驻留在一个服务器上运行Windows Server 2003 SP1或更高版本。
Windows Server 2003和Windows XP SP2中:KB 898900是必需的。请注意,此行为已与Windows Server 2003 SP1的变化。
Windows 2000中:此值不支持。
6Return的名称,状态,GUID,请超时,财产旗帜,元数据的大小,为的DFS根目录或链接目标的信息,以及DFS目标的清单。是缓冲区参数指向一个DFS_INFO_6结构的数组。
注意此值是原生支持只有在DFS链接驻留在一个服务器上运行Windows Server 2003 SP1或更高版本。
Windows Server 2003和Windows XP SP2中:KB 898900是必需的。请注意,此行为已与Windows Server 2003 SP1的变化。
Windows 2000中:此值不支持。
8Return的名称,状态,GUID,请超时,财产旗帜,数据大小,数量指标和链接分析点的DFS根目录和根目录下的各个环节的安全描述符。缓冲区参数指向一个DFS_INFO_8结构的数组。
Windows Vista中的Windows Server 2003,和Windows XP/2000:此值,直到装有SP1和Windows Server 2008 Vista的支持。
9Return的名称,状态,GUID,请超时,财产旗帜,数据大小,DFS的目标信息,链接分析点安全描述符,和指标的DFS根或链接的列表。缓冲区参数指向一个DFS_INFO_9结构的数组。
Windows Vista中的Windows Server 2003,和Windows XP/2000:此值,直到装有SP1和Windows Server 2008 Vista的支持。
200Return名单的领域中基于域的DFS命名空间。 The Buffer parameter points to an array of DFS_INFO_200 structures.
300Return独立的和基于域的DFS命名空间由服务器托管。缓冲区参数指向一个DFS_INFO_300结构的数组。
Windows XP/2000操作系统:此值不支持。
PrefMaxLen [in]
指定应该由这个函数返回的信息结构缓冲区的字节数。如果这个参数是MAX_PREFERRED_LENGTH,功能分配用于数据所需的内存量。有关详细信息,请参阅下面的备注部分。此参数被忽略如果您指定200级或级别300。
Windows Server 2003中:今年参赛作品的数量,返回的PrefMaxLen / sizeof(DFS_INFO_n)无论每个条目的总规模。
缓冲区[out]
指向一个缓冲区,它接收所要求的资料结构。这些数据的格式取决于该级别的参数值。此缓冲区分配制度,必须使用NetApiBufferFree释放功能。
EntriesRead [out]
指针的值,它接收在响应中返回的项目的实际人数。
ResumeHandle [ in , out ]
指针的值,它包含一个句柄将继续枚举时,可以用更多的数据比以往可以在一次调用这个函数返回。手柄应在第一次调用零,离开后续调用不变。有关详细信息,请参阅下面的备注部分。
Windows Server 2003的:如果ResumeHandle为NULL,则没有恢复处理返回这个功能。
返回值
如果函数成功,返回值是NERR_Success。
如果没有更多的项目可供被枚举,返回值是ERROR_NO_MORE_ITEMS。
如果函数失败,返回值是一个系统错误代码。对于一个错误代码的列表,请参见系统错误代码。
备注
没有特殊组成员都需要使用NetDfsEnum功能。
在Windows 2000 Server客户端调用该函数将收到一个错误(ERROR_DEVICE_NOT_AVAILABLE)如果承载DFS名称空间中的DfsName参数指定的服务器是Windows Server 2003或更高版本的服务器承载多个DFS名称空间。
呼叫与ResumeHandle参数NetDfsEnum功能设置为零开始枚举。要继续枚举操作,请与ResumeHandle这一职能由前调用NetDfsEnum返回。如果该函数没有返回ERROR_NO_MORE_ITEMS,后续调用此API将返回剩余的联系。一旦ERROR_NO_MORE_ITEMS返回,所有可用的DFS链接已被检索。
该NetDfsEnum函数分配的缓冲区的信息结构所需的内存。如果您指定的PrefMaxLen参数的数额,它限制的内存函数返回。然而,实际的内存大小的NetDfsEnum函数分配可能大于您指定的金额。有关其他信息,请参阅网络管理功能缓冲区长度。
由于并发更新的可能性DFS名称空间,调用不应承担完整性或恢复时,返回一个枚举操作的结果的唯一性。
Windows Server 2003中:您可以使用性能调整的PrefMaxLen价值。例如,如果调用该函数来填充列表框,列表框可容纳只有10项,为PrefMaxLen合理的值可能是12 * sizeof(DFS_INFO_n)。但是请注意,这NetDfsEnum忽略了在信息Level200和300 PrefMaxLen参数。
实例
下面的代码示例演示如何在一个名为名单的DFS链接的DFS根目录,以期在NetDfsEnum函数调用。该范例调用NetDfsEnum,指定信息第3级(DFS_INFO_3)。通过作品示例代码循环和打印检索到的数据和由DFS链接引用的每个主机服务器的状态。最后,该示例释放的信息缓冲区分配的内存。
#define UNICODE
#include
#include
#include
#include
#pragma comment(lib, "Netapi32.lib")
void wmain(int argc, wchar_t *argv[ ])
{
 PDFS_INFO_3 pData, p;
 PDFS_STORAGE_INFO ps;
 DWORD er = 0, hResume = 0, res, i, j;
 if(argc < 2)
  wprintf(L"Syntax: %s \\\\\\\\DfsName\\n", argv[0]);
 else
 {
  //
  // Call the NetDfsEnum function, specifying level 3.
  //
  res = NetDfsEnum(argv[1], 3, MAX_PREFERRED_LENGTH, (LPBYTE *) &pData, &er, &hResume);
  // Call NetDfsEnum until all available entries are returned.
  // NetDfsEnum will return ERROR_NO_MORE_ITEMS when all entries
  // have been obtained.
  while (res == ERROR_SUCCESS)
  {
 p = pData;
 //
 // Loop through the entries; print the data.
 //
 for(i = 1; i <= er; i++)
 {
  printf("%-30S%u\\n", p->EntryPath, p->NumberOfStorages);
  ps = p->Storage;
  //
  // Loop through each target.
  //
  for(j = 1; j <= p->NumberOfStorages; j++)
  {
   //
   // Print the status (Offline/Online) and the name
   // of each target referenced by the DFS link.
   //
   printf(" %S ", (ps->State == DFS_STORAGE_STATE_OFFLINE) ? TEXT("Offline"):TEXT("Online "));
   printf("\\\\\\\\%S\\\\%S\\n", ps->ServerName, ps->ShareName);
   ps++;
  }
  p++;
 }
 // Free the allocated buffer.
 //
 NetApiBufferFree(pData);

 res = NetDfsEnum(argv[1], 3, MAX_PREFERRED_LENGTH, (LPBYTE *) &pData, &er, &hResume);
  }

  if (res == ERROR_NO_MORE_ITEMS)
  {
 // the last of the entries have been processed.
 res = ERROR_SUCCESS;
 printf("Enumeration done\\n");
  }
  else
  {
 // an error occurred.
 printf("Error: %u\\n", res);
  }
 }
 return;
}
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderLmDfs.h(包括LmDfs.h或Lm.h)
LibraryNetapi32.lib
DLLNetapi32.dll
参见
网络管理概述
网络管理功能
分布式文件系统(DFS)功能
DFS_INFO_1
DFS_INFO_2
DFS_INFO_3
DFS_INFO_4
DFS_INFO_5
DFS_INFO_6
DFS_INFO_200
DFS_INFO_300
NetDfsAdd
NetDfsRemove
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月30日
==英文原文==NetDfsEnum Function
Enumerates the Distributed File System (DFS) namespaces hosted on a server or DFS links of a namespace hosted by a server.
Syntax
C++
NET_API_STATUS NetDfsEnum(
__in LPWSTR DfsName,
__in DWORD Level,
__in DWORD PrefMaxLen,
__out LPBYTE *Buffer,
__out LPDWORD EntriesRead,
__inout LPDWORD ResumeHandle
);
Parameters
DfsName [in]
Pointer to a string that specifies the Universal Naming Convention (UNC) path of the DFS root or link.
When you specify information level 200 ( DFS_INFO_200 ), this parameter is the name of a domain. When you specify information level 300 ( DFS_INFO_300 ), this parameter is the name of a server.
For all other levels, the string can be in one of the following four forms:
ServerName\\DfsName
or
ServerName\\DfsName\\link_path
where ServerName is the name of the root target server that hosts the stand-alone DFS namespace; Dfsname is the name of the DFS namespace; and link_path is a DFS link.
The string can also be of the following forms:
DomainName\\DomainName\\DomDfsName
or
DomainName\\DomDfsName\\link_path
where DomainName is the name of the domain that hosts the domain-based DFS root; DomDfsName is the name of the DFS namespace; and link_path is a DFS link.
You can precede the string with backslashes (\\\\), but they are not required. This parameter is required.
Level [in]
Specifies the information level of the request. This parameter can be one of the following values.
ValueMeaning
1Return the name of the DFS root and all links under the root. The Buffer parameter points to an array of DFS_INFO_1 structures.
2Return the name, comment, status, and the number of targets for the DFS root and all links under the root. The Buffer parameter points to an array of DFS_INFO_2 structures.
3Return the name, comment, status, number of targets, and information about each target for the DFS root and all links under the root. The Buffer parameter points to an array of DFS_INFO_3 structures.
4Return the name, comment, status, GUID, time-out, number of targets, and information about each target for the DFS root and all links under the root. The Buffer parameter points to an array of DFS_INFO_4 structures.
5Return the name, status, GUID, time-out, property flags, metadata size, and number of targets for a DFS root and all links under the root. The Buffer parameter points to an array of DFS_INFO_5 structures.
Note This value is natively supported only if the DFS link resides on a server that is running Windows Server 2003 with SP1 or later.
Windows Server 2003 and Windows XP with SP2: KB 898900 is required. Note that this behavior has changed with Windows Server 2003 with SP1.
Windows 2000: This value is not supported.
6Return the name, status, GUID, time-out, property flags, metadata size, DFS target information for a root or link, and a list of DFS targets. The Buffer parameter points to an array of DFS_INFO_6 structures.
Note This value is natively supported only if the DFS link resides on a server that is running Windows Server 2003 with SP1 or later.
Windows Server 2003 and Windows XP with SP2: KB 898900 is required. Note that this behavior has changed with Windows Server 2003 with SP1.
Windows 2000: This value is not supported.
8Return the name, status, GUID, time-out, property flags, metadata size, number of targets, and link reparse point security descriptors for a DFS root and all links under the root. The Buffer parameter points to an array of DFS_INFO_8 structures.
Windows Vista, Windows Server 2003, and Windows XP/2000: This value is not supported until Windows Vista with SP1 and Windows Server 2008.
9Return the name, status, GUID, time-out, property flags, metadata size, DFS target information, link reparse point security descriptors, and a list of DFS targets for a root or link. The Buffer parameter points to an array of DFS_INFO_9 structures.
Windows Vista, Windows Server 2003, and Windows XP/2000: This value is not supported until Windows Vista with SP1 and Windows Server 2008.
200Return the list of domain-based DFS namespaces in the domain. The Buffer parameter points to an array of DFS_INFO_200 structures.
300Return the stand-alone and domain-based DFS namespaces hosted by a server. The Buffer parameter points to an array of DFS_INFO_300 structures.
Windows XP/2000: This value is not supported.

PrefMaxLen [in]
Specifies the number of bytes that should be returned by this function in the information structure buffer. If this parameter is MAX_PREFERRED_LENGTH, the function allocates the amount of memory required for the data. For more information, see the following Remarks section. This parameter is ignored if you specify level 200 or level 300.
Windows Server 2003: The number of entries to be returned is PrefMaxLen / sizeof(DFS_INFO_n) regardless of the total size of each entry.
Buffer [out]
Pointer to a buffer that receives the requested information structures. 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.
EntriesRead [out]
Pointer to a value that receives the actual number of entries returned in the response.
ResumeHandle [in, out]
Pointer to a value that contains a handle to be used for continuing an enumeration when more data is available than can be returned in a single call to this function. The handle should be zero on the first call and left unchanged for subsequent calls. For more information, see the following Remarks section.
Windows Server 2003: If ResumeHandle is NULL, then no resume handle is returned by this function.
Return Value
If the function succeeds, the return value is NERR_Success.
If no more entries are available to be enumerated, the return value is ERROR_NO_MORE_ITEMS.
If the function fails, the return value is a system error code. For a list of error codes, see System Error Codes .
Remarks
No special group membership is required for using the NetDfsEnum function.
A Windows 2000 Server client that calls this function will receive an error (ERROR_DEVICE_NOT_AVAILABLE) if the server that hosts the DFS namespace specified in the DfsName parameter is a Windows Server 2003 or later version server that hosts more than one DFS namespace.
Call the NetDfsEnum function with the ResumeHandle parameter set to zero to begin the enumeration. To continue the enumeration operation, call this function with the ResumeHandle returned by the previous call to NetDfsEnum. If this function does not return ERROR_NO_MORE_ITEMS, subsequent calls to this API will return the remaining links. Once ERROR_NO_MORE_ITEMS is returned, all available DFS links have been retrieved.
The NetDfsEnum function allocates the memory required for the information structure buffer. If you specify an amount in the PrefMaxLen parameter, it restricts the memory that the function returns. However, the actual size of the memory that the NetDfsEnum function allocates can be greater than the amount you specify. For additional information see Network Management Function Buffer Lengths .
Due to the possibility of concurrent updates to the DFS namespace, the caller should not assume completeness or uniqueness of the results returned when resuming an enumeration operation.
Windows Server 2003: You can use the PrefMaxLen value for performance tuning. For example, if you call the function to fill a list box, and the list box can hold only 10 entries, a reasonable value for PrefMaxLen might be 12 * sizeof(DFS_INFO_n). Note, however, that NetDfsEnum ignores the PrefMaxLen parameter at information levels 200 and 300.
Examples
The following code sample demonstrates how to list the DFS links in a named DFS root with a call to the NetDfsEnum function. The sample calls NetDfsEnum, specifying information level 3 ( DFS_INFO_3 ). The sample code loops through the entries and prints the retrieved data and the status of each host server referenced by the DFS link. Finally, the sample frees the memory allocated for the information buffer.
#define UNICODE
#include
#include
#include
#include
#pragma comment(lib, "Netapi32.lib")
void wmain(int argc, wchar_t *argv[ ])
{
 PDFS_INFO_3 pData, p;
 PDFS_STORAGE_INFO ps;
 DWORD er = 0, hResume = 0, res, i, j;
 if(argc < 2)
  wprintf(L"Syntax: %s \\\\\\\\DfsName\\n", argv[0]);
 else
 {
  //
  // Call the NetDfsEnum function, specifying level 3.
  //
  res = NetDfsEnum(argv[1], 3, MAX_PREFERRED_LENGTH, (LPBYTE *) &pData, &er, &hResume);
  // Call NetDfsEnum until all available entries are returned.
  // NetDfsEnum will return ERROR_NO_MORE_ITEMS when all entries
  // have been obtained.
  while (res == ERROR_SUCCESS)
  {
 p = pData;
 //
 // Loop through the entries; print the data.
 //
 for(i = 1; i <= er; i++)
 {
  printf("%-30S%u\\n", p->EntryPath, p->NumberOfStorages);
  ps = p->Storage;
  //
  // Loop through each target.
  //
  for(j = 1; j <= p->NumberOfStorages; j++)
  {
   //
   // Print the status (Offline/Online) and the name
   // of each target referenced by the DFS link.
   //
   printf(" %S ", (ps->State == DFS_STORAGE_STATE_OFFLINE) ? TEXT("Offline"):TEXT("Online "));
   printf("\\\\\\\\%S\\\\%S\\n", ps->ServerName, ps->ShareName);
   ps++;
  }
  p++;
 }
 // Free the allocated buffer.
 //
 NetApiBufferFree(pData);

 res = NetDfsEnum(argv[1], 3, MAX_PREFERRED_LENGTH, (LPBYTE *) &pData, &er, &hResume);
  }

  if (res == ERROR_NO_MORE_ITEMS)
  {
 // the last of the entries have been processed.
 res = ERROR_SUCCESS;
 printf("Enumeration done\\n");
  }
  else
  {
 // an error occurred.
 printf("Error: %u\\n", res);
  }
 }
 return;
}
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderLmDfs.h (include LmDfs.h or Lm.h)
LibraryNetapi32.lib
DLLNetapi32.dll
See Also
Network Management Overview
Network Management Functions
Distributed File System (DFS) Functions
DFS_INFO_1
DFS_INFO_2
DFS_INFO_3
DFS_INFO_4
DFS_INFO_5
DFS_INFO_6
DFS_INFO_200
DFS_INFO_300
NetDfsAdd
NetDfsRemove
Send comments about this topic to Microsoft
Build date: 7/30/2009
==原始网址==http://msdn.microsoft.com/en-us/library/bb524809(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:19:55