C# Class UlteriusServer.Utilities.Extensions.NetworkBrowser

Provides a mechanism for supplying This collection of PC names is used in the form This class makes use of a DllImport instruction. The purpose of which is as follows: When a DllImport declaration is made in managed code (C#) it is a call to a legacy unmanaged code module, normally a C++ Dynamic Link Library. These C++ Dll's are usually part of the operating system API, or some other vendors API, and must be used to carry out operations that are not native within the managed code C# framework. This is fairly normal within the windows world. The only thing that needs careful consideration is the construction of the correct type of STRUCTS, object pointers, and attribute markers, which all contribute to making the link between managed (C#) and unmanaged code (C++) more seamless This class makes use of the following Dll calls Netapi32.dll : NetServerEnum, The NetServerEnum function lists all servers of the specified type that are visible in a domain. For example, an application can call NetServerEnum to list all domain controllers only or all SQL servers only. You can combine bit masks to list several types. For example, a value of 0x00000003 combines the bit masks for SV_TYPE_WORKSTATION (0x00000001) and SV_TYPE_SERVER (0x00000002). Netapi32.dll : NetApiBufferFree, The NetApiBufferFree function frees the memory that the NetApiBufferAllocate function allocates. Call NetApiBufferFree to free the memory that other network management functions return.
Show file Open project: Ulterius/server

Public Methods

Method Description
getNetworkComputers ( ) : List

Uses the DllImport : NetServerEnum with all its required parameters (see http://msdn.microsoft.com/library/default.asp? url=/library/en-us/netmgmt/netmgmt/netserverenum.asp for full details or method signature) to retrieve a list of domain SV_TYPE_WORKSTATION and SV_TYPE_SERVER PC's

Private Methods

Method Description
NetApiBufferFree ( IntPtr pBuf ) : int

Netapi32.dll : The NetApiBufferFree function frees the memory that the NetApiBufferAllocate function allocates. Call NetApiBufferFree to free the memory that other network management functions return.

NetServerEnum ( string ServerNane, int dwLevel, IntPtr &pBuf, int dwPrefMaxLen, int &dwEntriesRead, int &dwTotalEntries, int dwServerType, string domain, int &dwResumeHandle ) : int

Netapi32.dll : The NetServerEnum function lists all servers of the specified type that are visible in a domain. For example, an application can call NetServerEnum to list all domain controllers only or all SQL servers only. You can combine bit masks to list several types. For example, a value of 0x00000003 combines the bit masks for SV_TYPE_WORKSTATION (0x00000001) and SV_TYPE_SERVER (0x00000002)

Method Details

getNetworkComputers() public method

Uses the DllImport : NetServerEnum with all its required parameters (see http://msdn.microsoft.com/library/default.asp? url=/library/en-us/netmgmt/netmgmt/netserverenum.asp for full details or method signature) to retrieve a list of domain SV_TYPE_WORKSTATION and SV_TYPE_SERVER PC's
public getNetworkComputers ( ) : List
return List