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.
NetDfsGetInfo (netapi32)
.
C# Signature:
[DllImport("Netapi32.dll", CharSet=CharSet.Unicode, SetLastError=true)]
public static extern int NetDfsGetInfo(
[MarshalAs(UnmanagedType.LPWStr)] string DfsEntryPath, // DFS entry path for the volume
[MarshalAs(UnmanagedType.LPWStr)] string ServerName, // This parameter is currently ignored and should be NULL
[MarshalAs(UnmanagedType.LPWStr)] string ShareName, // This parameter is currently ignored and should be NULL.
int Level, // Level of information requested
out IntPtr Buffer // API allocates and returns buffer with requested info
);
VB Signature:
<DllImport("Netapi32.dll", CharSet:=CharSet.Unicode, SetLastError:=True)> _
Public Function NetDfsGetInfo( _
<MarshalAs(UnmanagedType.LPWStr)> ByVal entryPath As String, _
<MarshalAs(UnmanagedType.LPWStr)> ByVal serverName As String, _
<MarshalAs(UnmanagedType.LPWStr)> ByVal shareName As String, _
ByVal level As Integer, _
ByRef buffer As IntPtr) As Integer
static void Main(string[] args)
{
IntPtr buf;
if (args[0] != "")
{
int res=NetDfsGetInfo(args[0], null, null, 4, out buf);
if (res == 0)
{
try
{
DFS_INFO_4 info = (DFS_INFO_4)Marshal.PtrToStructure(buf, typeof(DFS_INFO_4));
Console.WriteLine("{0}, {1}, {2} ", info.EntryPath, info.Comment, info.NumberOfStorages);
for (int i = 0; i < info.NumberOfStorages; i++)
{
IntPtr pStorage = new IntPtr(info.Storage.ToInt64() + i * Marshal.SizeOf(typeof(DFS_STORAGE_INFO)));
DFS_STORAGE_INFO storage = (DFS_STORAGE_INFO)Marshal.PtrToStructure(pStorage, typeof(DFS_STORAGE_INFO));
Console.WriteLine(" {0}, {1}, {2} ", storage.ServerName, storage.ShareName, storage.State);
}
}
finally
{
NetApiBufferFree(buf);
}
}
}
}
Alternative Managed API:
Do you know one? Please contribute it!
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).