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.
{
/// <summary>
/// Unicode string specifying the name of the computer that established the session.
/// </summary>
[MarshalAs(UnmanagedType.LPWStr)]public string sesi502_cname;
/// <summary>
/// <value>Unicode string specifying the name of the user who established the session.</value>
/// </summary>
[MarshalAs(UnmanagedType.LPWStr)]public string sesi502_username;
/// <summary>
/// <value>Specifies the number of files, devices, and pipes opened during the session.</value>
/// </summary>
public uint sesi502_num_opens;
/// <summary>
/// <value>Specifies the number of seconds the session has been active. </value>
/// </summary>
public uint sesi502_time;
/// <summary>
/// <value>Specifies the number of seconds the session has been idle.</value>
/// </summary>
public uint sesi502_idle_time;
/// <summary>
/// <value>Specifies a value that describes how the user established the session.</value>
/// </summary>
public uint sesi502_user_flags;
/// <summary>
/// <value>Unicode string that specifies the type of client that established the session.</value>
/// </summary>
[MarshalAs(UnmanagedType.LPWStr)]public string sesi502_cltype_name;
/// <summary>
/// <value>Specifies the name of the transport that the client is using to communicate with the server.</value>
/// </summary>
[MarshalAs(UnmanagedType.LPWStr)]public string sesi502_transport;
}
public enum NERR
{
/// <summary>
/// Operation was a success.
/// </summary>
NERR_Success = 0,
/// <summary>
/// More data available to read. dderror getting all data.
/// </summary>
ERROR_MORE_DATA = 234,
/// <summary>
/// Network browsers not available.
/// </summary>
ERROR_NO_BROWSER_SERVERS_FOUND = 6118,
/// <summary>
/// LEVEL specified is not valid for this call.
/// </summary>
ERROR_INVALID_LEVEL = 124,
/// <summary>
/// Security context does not have permission to make this call.
/// </summary>
ERROR_ACCESS_DENIED = 5,
/// <summary>
/// Parameter was incorrect.
/// </summary>
ERROR_INVALID_PARAMETER = 87,
/// <summary>
/// Out of memory.
/// </summary>
ERROR_NOT_ENOUGH_MEMORY = 8,
/// <summary>
/// Unable to contact resource. Connection timed out.
/// </summary>
ERROR_NETWORK_BUSY = 54,
/// <summary>
/// Network Path not found.
/// </summary>
ERROR_BAD_NETPATH = 53,
/// <summary>
/// No available network connection to make call.
/// </summary>
ERROR_NO_NETWORK = 1222,
/// <summary>
/// Pointer is not valid.
/// </summary>
ERROR_INVALID_HANDLE_STATE = 1609,
/// <summary>
/// Extended Error.
/// </summary>
ERROR_EXTENDED_ERROR= 1208,
/// <summary>
/// Base.
/// </summary>
NERR_BASE = 2100,
/// <summary>
/// Unknown Directory.
/// </summary>
NERR_UnknownDevDir = (NERR_BASE + 16),
/// <summary>
/// Duplicate Share already exists on server.
/// </summary>
NERR_DuplicateShare = (NERR_BASE + 18),
/// <summary>
/// Memory allocation was to small.
/// </summary>
NERR_BufTooSmall = (NERR_BASE + 23)
}
Alternative Managed API:
Do you know one? Please contribute it!
Notes:
None.
Tips & Tricks:
Please add some!
Sample Code:
/// <summary>
/// Returns all SESSIONS of the specified server. Returns an array of SESSION_INFO_502 structures.
/// </summary>
/// <param name="server">Server to get shares for without preceding backslashes.</param>
/// <returns>SESSION_INFO_502 STRUCTURE ARRAY</returns>
public static SESSION_INFO_502[] EnumSessions(string server)
{
IntPtr BufPtr;
int res = 0;
Int32 er=0,tr=0,resume=0;
BufPtr = (IntPtr)Marshal.SizeOf(typeof(SESSION_INFO_502));
SESSION_INFO_502[] results = new SESSION_INFO_502[0];
do
{
res = NetSessionEnum(server,null,null,502,out BufPtr,-1,ref er,ref tr,ref resume);
results = new SESSION_INFO_502[er];
if (res == (int)NERR.ERROR_MORE_DATA || res == (int)NERR.NERR_Success)
{
Int32 p = BufPtr.ToInt32();
for (int i = 0;i <er;i++)
{
SESSION_INFO_502 si = (SESSION_INFO_502)Marshal.PtrToStructure(new IntPtr(p),typeof(SESSION_INFO_502));
results[i] = si;
p += Marshal.SizeOf(typeof(SESSION_INFO_502));
}
}
Marshal.FreeHGlobal(BufPtr);
}
while (res==(int)NERR.ERROR_MORE_DATA);
return results;
}
The NetSessionEnum function provides information about sessions established on a server.
8/18/2010 7:06:30 AM - -64.68.212.66
TODO - a short description
3/16/2007 8:17:31 AM - -63.69.129.2
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).