Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than netapi32, prefix the name with the module name and a period.
NetDfsEnum (netapi32)
.
C# Signature:
/// <summary>
/// The NetDfsEnum function enumerates all the Distributed File System (Dfs) links in the named Dfs root. The function returns information about the Dfs links based on information specified by the Level parameter.
/// </summary>
/// <param name="DfsName">[in] Pointer to a string that specifies the name of the DFS root or a DFS link. </param>
/// <param name="Level">[in] Specifies the information level of the request. This parameter can be one of the following values. </param>
/// <param name="PrefMaxLen">[in] Specifies the preferred maximum number of bytes that should be returned by this enumeration function call 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.</param>
/// <param name="Buffer">[out] Pointer to the address of 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. </param>
/// <param name="EntriesRead">[out] Pointer to a value that receives the actual enumerated DFS link count. </param>
/// <param name="ResumeHandle">[in, out] Pointer to a value that contains a handle which is used to continue the enumeration. 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 stored.</param>
/// <returns>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</returns>
[DllImport("Netapi32.dll", CharSet = CharSet.Auto/*, SetLastError=true //Return value (NET_API_STATUS) contains error */)]
[DllImport("Netapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int NetDfsEnum(
[MarshalAs(UnmanagedType.LPWStr)]string DfsName,
int Level,
int PrefMaxLen,
out IntPtr Buffer,
[MarshalAs(UnmanagedType.I4)]out int EntriesRead,
[MarshalAs(UnmanagedType.I4)]ref int ResumeHandle);
[MarshalAs(UnmanagedType.SysUInt)]out int EntriesRead,
[MarshalAs(UnmanagedType.SysUInt)]ref int ResumeHandle);
VB Signature:
<DllImport("Netapi32.dll", CharSet:=CharSet.Auto, SetLastError:=True)> _
Public Shared Function NetDfsEnum( _
<MarshalAs(UnmanagedType.LPWStr)> ByVal DfsName As String, _
ByVal Level As Integer, _
ByVal PrefMaxLen As Integer, _
ByRef Buffer As IntPtr, _
ByRef EntriesRead As Integer, _
ByRef ResumeHandle As Integer) As Integer
End Function
User-Defined Types:
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)> _
Public Structure DFS_INFO_1
<MarshalAs(UnmanagedType.LPWStr)> Public EntryPath As String
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)> _
Public Structure DFS_INFO_3
<MarshalAs(UnmanagedType.LPWStr)> Dim EntryPath As String
<MarshalAs(UnmanagedType.LPWStr)> Dim Comment As String
Dim State As UInt32
Dim NumberOfStorages As UInt32
Dim Storages As IntPtr
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)> _
Public Structure DFS_STORAGE_INFO
Dim state As DFS_STORAGE_STATES
<MarshalAs(UnmanagedType.LPWStr)> Dim ServerName As String
<MarshalAs(UnmanagedType.LPWStr)> Dim ShareName As String
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)> _
Public Structure SHARE_INFO_0
Public shi0_netname As String
End Structure
Frees the memory allocated by network management functions.
6/21/2016 8:26:32 AM - -63.226.251.37
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).