NetDfsEnum

The NetDfsEnum function enumerates all the junction points in the named Distributed File System (Dfs) tree structure. The function returns information about the junction points based on information specified by the Level parameter.

NET_API_STATUS NET_API_FUNCTION NetDfsEnum(
  LPWSTR DfsName,        // name of the Dfs for enumeration
  DWORD Level,           // level of information requested
  DWORD PrefMaxLen,      // advisory, but -1 means return all
                         // information
  LPBYTE *Buffer,        // function allocates and returns buffer
                         // with requested info
  LPDWORD EntriesRead,   // number of entries returned
  LPDWORD ResumeHandle   // must be 0 on first call, reused on 
                         // subsequent calls
);
 

Parameters

DfsName
[in] Pointer to a null-terminated Unicode character string that specifies the name of a Windows NT server that hosts the Dfs root volume.
Level
[in] Specifies the information level of the request. This parameter can be one of the following values.
Value Meaning
1 Return Dfs junction point names. The Buffer parameter will contain an array of DFS_INFO_1 structures.
2 Return Dfs junction point names with information. The Buffer parameter will contain an array of DFS_INFO_2 structures.
3 Return Dfs junction point names with information, and share information. The Buffer parameter will contain an array of DFS_INFO_3 structures.

PrefMaxLen
[in] Specifies the preferred maximum number of bytes that should be returned by this enumeration function call in the information structure buffer. If you specify the value – 1, the NetDfsEnum function determines the number of bytes to return based on the information available. For additional information, see the following Remarks section.
Buffer
[out] Pointer to the address of a buffer that contains the requested information structures.
EntriesRead
[out] Pointer to a DWORD value that contains the actual enumerated junction point count.
ResumeHandle
[in/out] Pointer to a DWORD value that contains a handle that is used to continue the enumeration. The handle should be zero on the first call and left unchanged for subsequent calls.

Return Values

If the function succeeds, the return value is NERR_Success.

If the function fails, the return value is a Win32 API error code. For a list of error codes, see Error Codes.

Remarks

Call the NetDfsEnum function with the ResumeHandle parameter set to zero to begin the enumeration. To retrieve information about additional junction points, call the function with the ResumeHandle returned by the previous call to NetDfsEnum.

The NetDfsEnum function allocates the memory required for the information structure buffer. If you specify an amount in the PrefMaxLen parameter, it restricts the number of bytes 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 Enumeration Buffer Lengths.

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).

QuickInfo

  Windows NT: Requires version 4.0 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in lmdfs.h.
  Import Library: Use netapi32.lib.

See Also

Networking (Net) Overview, Net Functions, DFS_INFO_1, DFS_INFO_2, DFS_INFO_3, DFS_STORAGE_INFO, NetDfsAdd, NetDfsRemove