using System; using System.Runtime.InteropServices; namespace Vanara.PInvoke { /// Platform invokable enumerated types, constants and functions from netapi32.h public static partial class NetApi32 { /// /// A constant of type DWORD that is set to –1. This value is valid as an input parameter to any method that takes a /// PreferedMaximumLength parameter. When specified as an input parameter, this value indicates that the method MUST allocate as much /// space as the data requires. /// public const uint MAX_PREFERRED_LENGTH = unchecked((uint)-1); /// Filters used by . [Flags] [PInvokeData("lmserver.h", MSDNShortId = "aa370623")] public enum NetServerEnumFilter : uint { /// All workstations. SV_TYPE_WORKSTATION = 0x00000001, /// All computers that run the Server service. SV_TYPE_SERVER = 0x00000002, /// Any server that runs an instance of Microsoft SQL Server. SV_TYPE_SQLSERVER = 0x00000004, /// A server that is primary domain controller. SV_TYPE_DOMAIN_CTRL = 0x00000008, /// Any server that is a backup domain controller. SV_TYPE_DOMAIN_BAKCTRL = 0x00000010, /// Any server that runs the Timesource service. SV_TYPE_TIME_SOURCE = 0x00000020, /// Any server that runs the Apple Filing Protocol (AFP) file service. SV_TYPE_AFP = 0x00000040, /// Any server that is a Novell server. SV_TYPE_NOVELL = 0x00000080, /// Any computer that is LAN Manager 2.x domain member. SV_TYPE_DOMAIN_MEMBER = 0x00000100, /// Any computer that shares a print queue. SV_TYPE_PRINTQ_SERVER = 0x00000200, /// Any server that runs a dial-in service. SV_TYPE_DIALIN_SERVER = 0x00000400, /// Any server that is a Xenix server. SV_TYPE_XENIX_SERVER = 0x00000800, /// Any server that is a UNIX server. This is the same as the SV_TYPE_XENIX_SERVER. SV_TYPE_SERVER_UNIX = 0x00000800, /// A workstation or server. SV_TYPE_NT = 0x00001000, /// Any computer that runs Windows for Workgroups. SV_TYPE_WFW = 0x00002000, /// Any server that runs the Microsoft File and Print for NetWare service. SV_TYPE_SERVER_MFPN = 0x00004000, /// Any server that is not a domain controller. SV_TYPE_SERVER_NT = 0x00008000, /// Any computer that can run the browser service. SV_TYPE_POTENTIAL_BROWSER = 0x00010000, /// A computer that runs a browser service as backup. SV_TYPE_BACKUP_BROWSER = 0x00020000, /// A computer that runs the master browser service. SV_TYPE_MASTER_BROWSER = 0x00040000, /// A computer that runs the domain master browser. SV_TYPE_DOMAIN_MASTER = 0x00080000, /// A computer that runs OSF/1. SV_TYPE_SERVER_OSF = 0x00100000, /// A computer that runs Open Virtual Memory System (VMS). SV_TYPE_SERVER_VMS = 0x00200000, /// A computer that runs Windows. SV_TYPE_WINDOWS = 0x00400000, /// A computer that is the root of Distributed File System (DFS) tree. SV_TYPE_DFS = 0x00800000, /// Server clusters available in the domain. SV_TYPE_CLUSTER_NT = 0x01000000, /// A server running the Terminal Server service. SV_TYPE_TERMINALSERVER = 0x02000000, /// /// Cluster virtual servers available in the domain. /// Windows 2000: This value is not supported. /// SV_TYPE_CLUSTER_VS_NT = 0x04000000, /// A computer that runs IBM Directory and Security Services (DSS) or equivalent. SV_TYPE_DCE = 0x10000000, /// A computer that over an alternate transport. SV_TYPE_ALTERNATE_XPORT = 0x20000000, /// Any computer maintained in a list by the browser. See the following Remarks section. SV_TYPE_LOCAL_LIST_ONLY = 0x40000000, /// The primary domain. SV_TYPE_DOMAIN_ENUM = 0x80000000, /// All servers. This is a convenience that will return all possible servers. SV_TYPE_ALL = 0xFFFFFFFF, } /// Flags used by . [Flags] [PInvokeData("lmserver.h")] public enum SERVER_TRANSPORT_FLAGS : uint { /// /// If this value is set for an endpoint, client requests arriving over the transport to open a named pipe are rerouted /// (remapped) to the following local pipe name: /// /// /// $$\ServerName\PipeName /// /// /// SVTI2_REMAP_PIPE_NAMES = 0x02, /// /// If this value is set for an endpoint and there is an attempt to create a second transport with the same network address but a /// different transport name and conflicting settings for the SCOPED flag, this transport creation will fail. Thus, every /// registered transport for a given network address must have the same scoped setting. /// This value is defined on Windows Server 2008 and Windows Vista with SP1. /// SVTI2_SCOPED_NAME = 0x04, /// The scope belongs to clustering. SVTI2_CLUSTER_NAME = 0x08, /// The scope belongs to scale-out clustering. SVTI2_CLUSTER_DNN_NAME = 0x10, /// The transport address field passed with the server transport info struct contains a unicode string. SVTI2_UNICODE_TRANSPORT_ADDRESS = 0x20, } /// The information level to use for platform-specific information. [PInvokeData("lmserver.h", MSDNShortId = "aa370903")] public enum ServerPlatform { /// The MS-DOS platform. PLATFORM_ID_DOS = 300, /// The OS/2 platform. PLATFORM_ID_OS2 = 400, /// The Windows NT platform. PLATFORM_ID_NT = 500, /// The OSF platform. PLATFORM_ID_OSF = 600, /// The VMS platform. PLATFORM_ID_VMS = 700 } /// Inherit from this interface for any implementation of the SERVER_INFO_XXXX structures to use the helper functions. public interface INetServerInfo { } /// /// /// The NetServerComputerNameAdd function enumerates the transports on which the specified server is active, and binds the /// emulated server name to each of the transports. /// /// /// NetServerComputerNameAdd is a utility function that combines the functionality of the NetServerTransportEnum function and /// the NetServerTransportAddEx function. /// /// /// /// /// Pointer to a string that specifies the name of the remote server on which the function is to execute. If this parameter is /// NULL, the local computer is used. /// /// /// /// /// Pointer to a string that contains the domain name the specified server should use when announcing its presence using the /// EmulatedServerName. This parameter is optional. /// /// /// /// /// Pointer to a null-terminated character string that contains the emulated name the server should begin supporting in addition to /// the name specified by the ServerName parameter. /// /// /// /// /// If the function succeeds, the return value is NERR_Success. Note that NetServerComputerNameAdd succeeds if the emulated /// server name specified is added to at least one transport. /// /// If the function fails, the return value can be one of the following error codes. /// /// /// Return code /// Description /// /// /// ERROR_ACCESS_DENIED /// The user does not have access to the requested information. /// /// /// ERROR_DUP_NAME /// A duplicate name exists on the network. /// /// /// ERROR_INVALID_DOMAINNAME /// The domain name could not be found on the network. /// /// /// ERROR_INVALID_PARAMETER /// The specified parameter is invalid. /// /// /// ERROR_NOT_ENOUGH_MEMORY /// Insufficient memory is available. /// /// /// /// /// /// Only members of the Administrators or Server Operators local group can successfully execute the NetServerComputerNameAdd function. /// /// /// The server specified by the ServerName parameter continues to support all names it was supporting, and additionally begins to /// support new names supplied by successful calls to the NetServerComputerNameAdd function. /// /// /// Name emulation that results from a call to NetServerComputerNameAdd ceases when the server reboots or restarts. To /// discontinue name emulation set by a previous call to NetServerComputerNameAdd without restarting or rebooting, you can /// call the NetServerComputerNameDel function. /// /// /// The NetServerComputerNameAdd function is typically used when a system administrator replaces a server, but wants to keep /// the conversion transparent to users. /// /// Examples /// /// Following is an example of a call to the NetServerComputerNameAdd function requesting that \Server1 also respond to /// requests for \Server2. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmserver/nf-lmserver-netservercomputernameadd NET_API_STATUS NET_API_FUNCTION // NetServerComputerNameAdd( LMSTR ServerName, LMSTR EmulatedDomainName, LMSTR EmulatedServerName ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("lmserver.h", MSDNShortId = "0789fbfe-be91-4849-a31c-1e1a6ae1e70d")] public static extern Win32Error NetServerComputerNameAdd([Optional] string ServerName, string EmulatedDomainName, string EmulatedServerName); /// /// /// The NetServerComputerNameDel function causes the specified server to cease supporting the emulated server name set by a /// previous call to the NetServerComputerNameAdd function. The function does this by unbinding network transports from the emulated name. /// /// /// /// /// Pointer to a string that specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this /// parameter is NULL, the local computer is used. /// /// /// /// /// Pointer to a null-terminated character string that contains the emulated name the server should stop supporting. The server /// continues to support all other server names it was supporting. /// /// /// /// If the function succeeds, the return value is NERR_Success. /// If the function fails, the return value can be one of the following error codes. /// /// /// Return code /// Description /// /// /// ERROR_ACCESS_DENIED /// The user does not have access to the requested information. /// /// /// ERROR_INVALID_PARAMETER /// The specified parameter is invalid. /// /// /// ERROR_NOT_ENOUGH_MEMORY /// Insufficient memory is available. /// /// /// NERR_NetNameNotFound /// The share name does not exist. /// /// /// /// /// /// Only members of the Administrators or Server Operators local group can successfully execute the NetServerComputerNameDel function. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmserver/nf-lmserver-netservercomputernamedel NET_API_STATUS NET_API_FUNCTION // NetServerComputerNameDel( LMSTR ServerName, LMSTR EmulatedServerName ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("lmserver.h", MSDNShortId = "501232ad-2821-4bbd-9f16-0f49984f6101")] public static extern Win32Error NetServerComputerNameDel([Optional] string ServerName, string EmulatedServerName); /// /// The NetServerDiskEnum function retrieves a list of disk drives on a server. The function returns an array of /// three-character strings (a drive letter, a colon, and a terminating null character). /// /// /// A pointer to a string that specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this /// parameter is NULL, the local computer is used. /// /// The level of information required. A value of zero is the only valid level. /// /// A pointer to the buffer that receives the data. The data is an array of three-character strings (a drive letter, a colon, and a /// terminating null character). This buffer is allocated by the system and must be freed using the NetApiBufferFree function. Note /// that you must free the buffer even if the function fails with ERROR_MORE_DATA. /// /// /// /// The preferred maximum length of returned data, in bytes. If you specify MAX_PREFERRED_LENGTH, the function allocates the amount /// of memory required for the data. If you specify another value in this parameter, it can restrict the number of bytes that the /// function returns. If the buffer size is insufficient to hold all entries, the function returns ERROR_MORE_DATA. For more /// information, see Network Management Function Buffers and Network Management Function Buffer Lengths. /// /// Note This parameter is currently ignored. /// /// A pointer to a value that receives the count of elements actually enumerated. /// /// A pointer to a value that receives the total number of entries that could have been enumerated from the current resume position. /// Note that applications should consider this value only as a hint. /// /// /// A pointer to a value that contains a resume handle which is used to continue an existing server disk search. The handle should be /// zero on the first call and left unchanged for subsequent calls. If the resume_handle parameter is a NULL pointer, then no /// resume handle is stored. /// /// /// If the function succeeds, the return value is NERR_Success. /// If the function fails, the return value can be one of the following error codes. /// /// /// Return code /// Description /// /// /// ERROR_ACCESS_DENIED /// The user does not have access to the requested information. /// /// /// ERROR_INVALID_LEVEL /// The value specified for the level parameter is invalid. /// /// /// ERROR_MORE_DATA /// More entries are available. Specify a large enough buffer to receive all entries. /// /// /// ERROR_NOT_ENOUGH_MEMORY /// Insufficient memory is available. /// /// /// ERROR_NOT_SUPPORTED /// /// The request is not supported. This error is returned if a remote server was specified in servername parameter, the remote server /// only supports remote RPC calls using the legacy Remote Access Protocol mechanism, and this request is not supported. /// /// /// /// /// /// /// Only members of the Administrators or Server Operators local group can successfully execute the NetServerDiskEnum function /// on a remote computer. /// /// /// If you are programming for Active Directory, you may be able to call certain Active Directory Service Interface (ADSI) methods to /// achieve the same results you can achieve by calling the network management server functions. For more information, see the /// IADsComputer interface reference. /// /// Examples /// /// The following code sample demonstrates how to call the NetServerDiskEnum function to retrieve a list of disk drives on a /// server. The sample calls NetServerDiskEnum, specifying the information level 0 (required). If there are entries to return, /// and the user has access to the information, it prints a list of the drives, in the format of a three-character string: a drive /// letter, a colon, and a terminating null character. The sample also prints the total number of entries that are available and a /// hint about the number of entries actually enumerated. Finally, the code sample frees the memory allocated for the buffer. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmserver/nf-lmserver-netserverdiskenum NET_API_STATUS NET_API_FUNCTION // NetServerDiskEnum( LMSTR servername, DWORD level, LPBYTE *bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries, // LPDWORD resume_handle ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("lmserver.h", MSDNShortId = "56c981f4-7a1d-4465-bd7b-5996222c4210")] public static extern Win32Error NetServerDiskEnum([Optional] string servername, [Optional] uint level, out SafeNetApiBuffer bufptr, uint prefmaxlen, out uint entriesread, out uint totalentries, ref uint resume_handle); /// The NetServerEnum function lists all servers of the specified type that are visible in a domain. /// Reserved; must be NULL. /// /// The information level of the data requested. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// 100 /// Return server names and platform information. The bufptr parameter points to an array of SERVER_INFO_100 structures. /// /// /// 101 /// Return server names, types, and associated data. The bufptr parameter points to an array of SERVER_INFO_101 structures. /// /// /// /// /// A pointer to the buffer that receives the data. 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. Note that you must free the buffer even if the /// function fails with ERROR_MORE_DATA. /// /// /// The preferred maximum length of returned data, in bytes. If you specify MAX_PREFERRED_LENGTH, the function allocates the amount /// of memory required for the data. If you specify another value in this parameter, it can restrict the number of bytes that the /// function returns. If the buffer size is insufficient to hold all entries, the function returns ERROR_MORE_DATA. For more /// information, see Network Management Function Buffers and Network Management Function Buffer Lengths. /// /// A pointer to a value that receives the count of elements actually enumerated. /// /// A pointer to a value that receives the total number of visible servers and workstations on the network. Note that applications /// should consider this value only as a hint. /// /// /// /// A value that filters the server entries to return from the enumeration. This parameter can be a combination of the following /// values defined in the Lmserver.h header file. /// /// /// /// Value /// Meaning /// /// /// SV_TYPE_WORKSTATION 0x00000001 /// All workstations. /// /// /// SV_TYPE_SERVER 0x00000002 /// All computers that run the Server service. /// /// /// SV_TYPE_SQLSERVER 0x00000004 /// Any server that runs an instance of Microsoft SQL Server. /// /// /// SV_TYPE_DOMAIN_CTRL 0x00000008 /// A server that is primary domain controller. /// /// /// SV_TYPE_DOMAIN_BAKCTRL 0x00000010 /// Any server that is a backup domain controller. /// /// /// SV_TYPE_TIME_SOURCE 0x00000020 /// Any server that runs the Timesource service. /// /// /// SV_TYPE_AFP 0x00000040 /// Any server that runs the Apple Filing Protocol (AFP) file service. /// /// /// SV_TYPE_NOVELL 0x00000080 /// Any server that is a Novell server. /// /// /// SV_TYPE_DOMAIN_MEMBER 0x00000100 /// Any computer that is LAN Manager 2.x domain member. /// /// /// SV_TYPE_PRINTQ_SERVER 0x00000200 /// Any computer that shares a print queue. /// /// /// SV_TYPE_DIALIN_SERVER 0x00000400 /// Any server that runs a dial-in service. /// /// /// SV_TYPE_XENIX_SERVER 0x00000800 /// Any server that is a Xenix server. /// /// /// SV_TYPE_SERVER_UNIX 0x00000800 /// Any server that is a UNIX server. This is the same as the SV_TYPE_XENIX_SERVER. /// /// /// SV_TYPE_NT 0x00001000 /// A workstation or server. /// /// /// SV_TYPE_WFW 0x00002000 /// Any computer that runs Windows for Workgroups. /// /// /// SV_TYPE_SERVER_MFPN 0x00004000 /// Any server that runs the Microsoft File and Print for NetWare service. /// /// /// SV_TYPE_SERVER_NT 0x00008000 /// Any server that is not a domain controller. /// /// /// SV_TYPE_POTENTIAL_BROWSER 0x00010000 /// Any computer that can run the browser service. /// /// /// SV_TYPE_BACKUP_BROWSER 0x00020000 /// A computer that runs a browser service as backup. /// /// /// SV_TYPE_MASTER_BROWSER 0x00040000 /// A computer that runs the master browser service. /// /// /// SV_TYPE_DOMAIN_MASTER 0x00080000 /// A computer that runs the domain master browser. /// /// /// SV_TYPE_SERVER_OSF 0x00100000 /// A computer that runs OSF/1. /// /// /// SV_TYPE_SERVER_VMS 0x00200000 /// A computer that runs Open Virtual Memory System (VMS). /// /// /// SV_TYPE_WINDOWS 0x00400000 /// A computer that runs Windows. /// /// /// SV_TYPE_DFS 0x00800000 /// A computer that is the root of Distributed File System (DFS) tree. /// /// /// SV_TYPE_CLUSTER_NT 0x01000000 /// Server clusters available in the domain. /// /// /// SV_TYPE_TERMINALSERVER 0x02000000 /// A server running the Terminal Server service. /// /// /// SV_TYPE_CLUSTER_VS_NT 0x04000000 /// Cluster virtual servers available in the domain. Windows 2000: This value is not supported. /// /// /// SV_TYPE_DCE 0x10000000 /// A computer that runs IBM Directory and Security Services (DSS) or equivalent. /// /// /// SV_TYPE_ALTERNATE_XPORT 0x20000000 /// A computer that over an alternate transport. /// /// /// SV_TYPE_LOCAL_LIST_ONLY 0x40000000 /// Any computer maintained in a list by the browser. See the following Remarks section. /// /// /// SV_TYPE_DOMAIN_ENUM 0x80000000 /// The primary domain. /// /// /// SV_TYPE_ALL 0xFFFFFFFF /// All servers. This is a convenience that will return all possible servers. /// /// /// /// /// /// A pointer to a constant string that specifies the name of the domain for which a list of servers is to be returned. The domain /// name must be a NetBIOS domain name (for example, microsoft). The NetServerEnum function does not support DNS-style names /// (for example, microsoft.com). /// /// If this parameter is NULL, the primary domain is implied. /// /// Reserved; must be set to zero. /// /// If the function succeeds, the return value is NERR_Success. /// If the function fails, the return value can be one of the following error codes: /// /// /// Return code/value /// Description /// /// /// ERROR_ACCESS_DENIED 5 /// Access was denied. /// /// /// ERROR_INVALID_PARAMETER 87 /// The parameter is incorrect. /// /// /// ERROR_MORE_DATA 234 /// More entries are available. Specify a large enough buffer to receive all entries. /// /// /// ERROR_NO_BROWSER_SERVERS_FOUND 6118 /// No browser servers found. /// /// /// ERROR_NOT_SUPPORTED 50 /// The request is not supported. /// /// /// NERR_RemoteErr 2127 /// A remote error occurred with no data returned by the server. /// /// /// NERR_ServerNotStarted 2114 /// The server service is not started. /// /// /// NERR_ServiceNotInstalled 2184 /// The service has not been started. /// /// /// NERR_WkstaNotStarted 2138 /// /// The Workstation service has not been started. The local workstation service is used to communicate with a downlevel remote server. /// /// /// /// /// /// /// The NetServerEnum function is used to list 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 servers that run instances of SQL server only. /// /// /// An application combine the bit masks for various server types in the servertype parameter to list several types. For example, a /// value of SV_TYPE_WORKSTATION | SVTYPE_SERVER (0x00000003) combines the bit masks for SV_TYPE_WORKSTATION (0x00000001) and /// SV_TYPE_SERVER (0x00000002). /// /// If you require more information for a specific server, call the WNetEnumResource function. /// No special group membership is required to successfully execute the NetServerEnum function. /// /// If you specify the value SV_TYPE_LOCAL_LIST_ONLY, the NetServerEnum function returns the list of servers that the browser /// maintains internally. This has meaning only on the master browser (or on a computer that has been the master browser in the /// past). The master browser is the computer that currently has rights to determine which computers can be servers or workstations /// on the network. /// /// /// If there are no servers found that match the types specified in the servertype parameter, the NetServerEnum function /// returns the bufptr parameter as NULL and DWORD values pointed to by the entriesread and totalentries parameters are set to zero. /// /// /// The NetServerEnum function depends on the browser service being installed and running. If no browser servers are found, /// then NetServerEnum fails with ERROR_NO_BROWSER_SERVERS_FOUND. /// /// /// If you are programming for Active Directory, you may be able to call certain Active Directory Service Interface (ADSI) methods to /// achieve the same function you can achieve by calling the network management server functions. For more information, see IADsComputer. /// /// Examples /// /// The following code sample demonstrates how to list all servers that are visible in a domain with a call to the /// NetServerEnum function. The sample calls NetServerEnum, specifying information level 101 ( SERVER_INFO_101). If any /// servers are found, the sample code loops through the entries and prints the retrieved data. If the server is a domain controller, /// it identifies the server as either a primary domain controller (PDC) or a backup domain controller (BDC). The sample also prints /// the total number of entries available and a hint about the number of entries actually enumerated, warning the user if all entries /// were not enumerated. Finally, the sample frees the memory allocated for the information buffer. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmserver/nf-lmserver-netserverenum NET_API_STATUS NET_API_FUNCTION // NetServerEnum( IN LMCSTR servername, IN DWORD level, OUT LPBYTE *bufptr, IN DWORD prefmaxlen, OUT LPDWORD entriesread, OUT LPDWORD // totalentries, IN DWORD servertype, IN LMCSTR domain, IN OUT LPDWORD resume_handle ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("lmserver.h", MSDNShortId = "10012a87-805e-4817-9f09-9e5632b1fa09")] public static extern Win32Error NetServerEnum([Optional] string servername, uint level, out SafeNetApiBuffer bufptr, uint prefmaxlen, out uint entriesread, out uint totalentries, NetServerEnumFilter servertype, [Optional] string domain, [Optional] IntPtr resume_handle); /// The NetServerGetInfo function retrieves current configuration information for the specified server. /// /// Pointer to a string that specifies the name of the remote server on which the function is to execute. If this parameter is NULL, /// the local computer is used. /// /// Specifies the information level of the data. /// /// Pointer to the buffer that receives the data. 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. /// /// If the function succeeds, the return value is NERR_Success. [DllImport(Lib.NetApi32, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("lmserver.h", MSDNShortId = "aa370624")] public static extern Win32Error NetServerGetInfo([Optional] string servername, int level, out SafeNetApiBuffer bufptr); /// /// /// The NetServerSetInfo function sets a server's operating parameters; it can set them individually or collectively. The /// information is stored in a way that allows it to remain in effect after the system has been reinitialized. /// /// /// /// /// Pointer to a string that specifies the name of the remote server on which the function is to execute. If this parameter is /// NULL, the local computer is used. /// /// /// /// Specifies the information level of the data. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// 101 /// Specifies the server name, type, and associated software. The buf parameter points to a SERVER_INFO_101 structure. /// /// /// 102 /// /// Specifies the server name, type, associated software, and other attributes. The buf parameter points to a SERVER_INFO_102 structure. /// /// /// /// 402 /// Specifies detailed information about the server. The buf parameter points to a SERVER_INFO_402 structure. /// /// /// 403 /// Specifies detailed information about the server. The buf parameter points to a SERVER_INFO_403 structure. /// /// /// /// In addition, levels 1001-1006, 1009-1011, 1016-1018, 1021, 1022, 1028, 1029, 1037, and 1043 are valid based on the restrictions /// for LAN Manager systems. /// /// /// /// /// Pointer to a buffer that receives the server information. The format of this data depends on the value of the level parameter. /// For more information, see Network Management Function Buffers. /// /// /// /// /// Pointer to a value that receives the index of the first member of the server information structure that causes the /// ERROR_INVALID_PARAMETER error. If this parameter is NULL, the index is not returned on error. For more information, see /// the following Remarks section. /// /// /// /// If the function succeeds, the return value is NERR_Success. /// If the function fails, the return value can be one of the following error codes. /// /// /// Return code /// Description /// /// /// ERROR_ACCESS_DENIED /// The user does not have access to the requested information. /// /// /// ERROR_INVALID_LEVEL /// The value specified for the level parameter is invalid. /// /// /// ERROR_INVALID_PARAMETER /// The specified parameter is invalid. For more information, see the following Remarks section. /// /// /// ERROR_NOT_ENOUGH_MEMORY /// Insufficient memory is available. /// /// /// /// /// /// Only members of the Administrators or Server Operators local group can successfully execute the NetServerSetInfo function. /// /// /// If you are programming for Active Directory, you may be able to call certain Active Directory Service Interface (ADSI) methods to /// achieve the same functionality you can achieve by calling the network management server functions. For more information, see IADsComputer. /// /// /// If the NetServerSetInfo function returns ERROR_INVALID_PARAMETER, you can use the ParmError parameter to indicate the /// first member of the server information structure that is invalid. (A server information structure begins with SERVER_INFO_ and /// its format is specified by the level parameter.) The following table lists the values that can be returned in the ParmError /// parameter and the corresponding structure member that is in error. (The prefix sv*_ indicates that the member can begin with /// multiple prefixes, for example, sv101_ or sv402_.) /// /// /// /// Value /// Member /// /// /// SV_PLATFORM_ID_PARMNUM /// sv*_platform_id /// /// /// SV_NAME_PARMNUM /// sv*_name /// /// /// SV_VERSION_MAJOR_PARMNUM /// sv*_version_major /// /// /// SV_VERSION_MINOR_PARMNUM /// sv*_version_minor /// /// /// SV_TYPE_PARMNUM /// sv*_type /// /// /// SV_COMMENT_PARMNUM /// sv*_comment /// /// /// SV_USERS_PARMNUM /// sv*_users /// /// /// SV_DISC_PARMNUM /// sv*_disc /// /// /// SV_HIDDEN_PARMNUM /// sv*_hidden /// /// /// SV_ANNOUNCE_PARMNUM /// sv*_announce /// /// /// SV_ANNDELTA_PARMNUM /// sv*_anndelta /// /// /// SV_USERPATH_PARMNUM /// sv*_userpath /// /// /// SV_ULIST_MTIME_PARMNUM /// sv*_ulist_mtime /// /// /// SV_GLIST_MTIME_PARMNUM /// sv*_glist_mtime /// /// /// SV_ALIST_MTIME_PARMNUM /// sv*_alist_mtime /// /// /// SV_ALERTS_PARMNUM /// sv*_alerts /// /// /// SV_SECURITY_PARMNUM /// sv*_security /// /// /// SV_NUMADMIN_PARMNUM /// sv*_numadmin /// /// /// SV_LANMASK_PARMNUM /// sv*_lanmask /// /// /// SV_GUESTACC_PARMNUM /// sv*_guestacc /// /// /// SV_CHDEVQ_PARMNUM /// sv*_chdevq /// /// /// SV_CHDEVJOBS_PARMNUM /// sv*_chdevjobs /// /// /// SV_CONNECTIONS_PARMNUM /// sv*_connections /// /// /// SV_SHARES_PARMNUM /// sv*_shares /// /// /// SV_OPENFILES_PARMNUM /// sv*_openfiles /// /// /// SV_SESSOPENS_PARMNUM /// sv*_sessopens /// /// /// SV_SESSVCS_PARMNUM /// sv*_sessvcs /// /// /// SV_SESSREQS_PARMNUM /// sv*_sessreqs /// /// /// SV_OPENSEARCH_PARMNUM /// sv*_opensearch /// /// /// SV_ACTIVELOCKS_PARMNUM /// sv*_activelocks /// /// /// SV_NUMREQBUF_PARMNUM /// sv*_numreqbuf /// /// /// SV_SIZREQBUF_PARMNUM /// sv*_sizreqbuf /// /// /// SV_NUMBIGBUF_PARMNUM /// sv*_numbigbuf /// /// /// SV_NUMFILETASKS_PARMNUM /// sv*_numfiletasks /// /// /// SV_ALERTSCHED_PARMNUM /// sv*_alertsched /// /// /// SV_ERRORALERT_PARMNUM /// sv*_erroralert /// /// /// SV_LOGONALERT_PARMNUM /// sv*_logonalert /// /// /// SV_ACCESSALERT_PARMNUM /// sv*_accessalert /// /// /// SV_DISKALERT_PARMNUM /// sv*_diskalert /// /// /// SV_NETIOALERT_PARMNUM /// sv*_netioalert /// /// /// SV_MAXAUDITSZ_PARMNUM /// sv*_maxauditsz /// /// /// SV_SRVHEURISTICS_PARMNUM /// sv*_srvheuristics /// /// /// SV_TIMESOURCE_PARMNUM /// sv*_timesource /// /// /// Examples /// /// The following code sample demonstrates how to call the NetServerSetInfo function. The sample calls /// NetServerSetInfo, specifying the level parameter as 1005 (required) to set the sv1005_comment member of the /// SERVER_INFO_1005 structure. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmserver/nf-lmserver-netserversetinfo NET_API_STATUS NET_API_FUNCTION // NetServerSetInfo( LMSTR servername, DWORD level, LPBYTE buf, LPDWORD ParmError ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("lmserver.h", MSDNShortId = "1a04a43d-34f9-4a08-ac66-750120792af0")] public static extern Win32Error NetServerSetInfo([Optional] string servername, int level, IntPtr buf, out uint ParmError); /// /// The NetServerTransportAdd function binds the server to the transport protocol. /// /// The extended function NetServerTransportAddEx allows the calling application to specify the SERVER_TRANSPORT_INFO_1, /// SERVER_TRANSPORT_INFO_2, and SERVER_TRANSPORT_INFO_3 information levels. /// /// /// /// /// A pointer to a string that specifies the name of the remote server on which the function is to execute. If this parameter is /// NULL, the local computer is used. /// /// /// /// Specifies the information level of the data. This parameter can be the following value. /// /// /// Value /// Meaning /// /// /// 0 /// /// Specifies information about the transport protocol, including name, address, and location on the network. The bufptr parameter /// points to a SERVER_TRANSPORT_INFO_0 structure. /// /// /// /// /// /// A pointer to the buffer that contains the data. /// For more information, see Network Management Function Buffers. /// /// /// If the function succeeds, the return value is NERR_Success. /// If the function fails, the return value can be one of the following error codes. /// /// /// Return code /// Description /// /// /// ERROR_ACCESS_DENIED /// The user does not have access to the requested information. /// /// /// ERROR_DUP_NAME /// A duplicate name exists on the network. /// /// /// ERROR_INVALID_DOMAINNAME /// The domain name could not be found on the network. /// /// /// ERROR_INVALID_LEVEL /// The value specified for the level parameter is invalid. /// /// /// ERROR_INVALID_PARAMETER /// /// A parameter is invalid. This error is returned if the svti0_transportname or svti0_transportaddress member in the /// SERVER_TRANSPORT_INFO_0 structure pointed to by the bufptr parameter is NULL. This error is also returned if the /// svti0_transportaddresslength member in the SERVER_TRANSPORT_INFO_0 structure pointed to by the bufptr parameter is zero or larger /// than MAX_PATH (defined in the Windef.h header file). This error is also returned for other invalid parameters. /// /// /// /// ERROR_NOT_ENOUGH_MEMORY /// Insufficient memory is available. /// /// /// /// /// /// Only members of the Administrators or Server Operators local group can successfully execute the NetServerTransportAdd function. /// /// /// If you add a transport protocol to a server using a call to the NetServerTransportAdd function, the connection will not /// remain after the server reboots or restarts. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmserver/nf-lmserver-netservertransportadd NET_API_STATUS NET_API_FUNCTION // NetServerTransportAdd( LMSTR servername, DWORD level, LPBYTE bufptr ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("lmserver.h", MSDNShortId = "c8521aed-0762-4412-b117-c911fc77049b")] public static extern Win32Error NetServerTransportAdd([Optional] string servername, int level, IntPtr bufptr); /// /// /// The NetServerTransportAddEx function binds the specified server to the transport protocol. This extended function allows /// the calling application to specify the SERVER_TRANSPORT_INFO_0, SERVER_TRANSPORT_INFO_1, SERVER_TRANSPORT_INFO_2, or /// SERVER_TRANSPORT_INFO_3 information levels. /// /// /// /// /// A pointer to a string that specifies the name of the remote server on which the function is to execute. If this parameter is /// NULL, the local computer is used. /// /// /// /// Specifies a value that indicates the information level of the data. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// 0 /// /// Specifies information about the transport protocol, including name, address, and location on the network. The bufptr parameter /// points to a SERVER_TRANSPORT_INFO_0 structure. /// /// /// /// 1 /// /// Specifies information about the transport protocol, including name, address, network location, and domain. The bufptr parameter /// points to a SERVER_TRANSPORT_INFO_1 structure. /// /// /// /// 2 /// /// Specifies the same information as level 1, with the addition of an svti2_flags member. The bufptr parameter points to a /// SERVER_TRANSPORT_INFO_2 structure. /// /// /// /// 3 /// /// Specifies the same information as level 2, with the addition of credential information. The bufptr parameter points to a /// SERVER_TRANSPORT_INFO_3 structure. /// /// /// /// /// /// A pointer to the buffer that contains the data. The format of this data depends on the value of the level parameter. /// For more information, see Network Management Function Buffers. /// /// /// If the function succeeds, the return value is NERR_Success. /// If the function fails, the return value can be one of the following error codes. /// /// /// Return code /// Description /// /// /// ERROR_ACCESS_DENIED /// The user does not have access to the requested information. /// /// /// ERROR_DUP_NAME /// A duplicate name exists on the network. /// /// /// ERROR_INVALID_DOMAINNAME /// The domain name could not be found on the network. /// /// /// ERROR_INVALID_LEVEL /// The value specified for the level parameter is invalid. /// /// /// ERROR_INVALID_PARAMETER /// /// A parameter is invalid. This error is returned if the transport name or transport address member in the SERVER_TRANSPORT_INFO_0, /// SERVER_TRANSPORT_INFO_1, SERVER_TRANSPORT_INFO_2, or SERVER_TRANSPORT_INFO_3 structure pointed to by the bufptr parameter is /// NULL. This error is also returned if the transport address length member in the SERVER_TRANSPORT_INFO_0, SERVER_TRANSPORT_INFO_1, /// SERVER_TRANSPORT_INFO_2, or SERVER_TRANSPORT_INFO_3 structure pointed to by the bufptr parameter is zero or larger than MAX_PATH /// (defined in the Windef.h header file). This error is also returned if the flags member of the SERVER_TRANSPORT_INFO_2, or /// SERVER_TRANSPORT_INFO_3 structure pointed to by the bufptr parameter contains an illegal value. This error is also returned for /// other invalid parameters. /// /// /// /// ERROR_NOT_ENOUGH_MEMORY /// Insufficient memory is available. /// /// /// /// /// /// Only members of the Administrators or Server Operators local group can successfully execute the NetServerTransportAddEx function. /// /// /// If you add a transport protocol to a server using a call to the NetServerTransportAddEx function, the connection will not /// remain after the server reboots or restarts. /// /// /// The NetServerComputerNameAdd function is a utility function. It combines the features of the NetServerTransportEnum function and /// the NetServerTransportAddEx function, allowing you to specify an emulated server name. /// /// /// On Windows Server 2008 and Windows Vista with Service Pack 1 (SP1), every name registered with the Windows remote file server /// (SRV) is designated as either a scoped name or a non-scoped name. Every share that is added to the system will then either be /// attached to all of the non-scoped names, or to a single scoped name. Applications that wish to use the scoping features are /// responsible for both registering the new name as a scoped endpoint and then creating the shares with an appropriate scope. In /// this way, legacy uses of the Network Management and Network Share Management functions are not affected in any way since they /// continue to register shares and names as non-scoped names. /// /// /// A scoped endpoint is created by calling the NetServerTransportAddEx function with the level parameter set to 2 and the /// bufptr parameter pointed to a SERVER_TRANSPORT_INFO_2 structure with the SVTI2_SCOPED_NAME bit value set in /// svti2_flags member. A scoped endpoint is also created by calling the NetServerTransportAddEx function with the /// level parameter set to 3 and the bufptr parameter pointed to a SERVER_TRANSPORT_INFO_3 structure with the /// SVTI2_SCOPED_NAME bit value set in svti3_flags member. /// /// /// When the SVTI2_SCOPED_NAME bit value is set for a transport, then shares can be added with a corresponding server name /// (the shi503_servername member of the SHARE_INFO_503 structure) in a scoped fashion using the NetShareAdd function. If /// there is no transport registered with the SVTI2_SCOPED_NAME bit value and the name provided in shi503_servername /// member, then the share add in a scoped fashion will not succeed. /// /// /// The NetShareAdd function is used to add a scoped share on a remote server specified in the servername parameter. The remote /// server specified in the shi503_servername member of the SHARE_INFO_503 passed in the bufptr parameter must have been bound /// to a transport protocol using the NetServerTransportAddEx function as a scoped endpoint. The SVTI2_SCOPED_NAME flag /// must have been specified in the shi503_servername member of the SERVER_TRANSPORT_INFO_2 or SERVER_TRANSPORT_INFO_3 /// structure for the transport protocol. The NetShareDelEx function is used to delete a scoped share. The NetShareGetInfo and /// NetShareSetInfo functions are to used to get and set information on a scoped share. /// /// Scoped endpoints are generally used by the cluster namespace. /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmserver/nf-lmserver-netservertransportaddex NET_API_STATUS NET_API_FUNCTION // NetServerTransportAddEx( LMSTR servername, DWORD level, LPBYTE bufptr ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("lmserver.h", MSDNShortId = "d1edc75d-8313-422c-a6fb-8b51a309a252")] public static extern Win32Error NetServerTransportAddEx([Optional] string servername, int level, IntPtr bufptr); /// /// /// The NetServerTransportDel function unbinds (or disconnects) the transport protocol from the server. Effectively, the /// server can no longer communicate with clients using the specified transport protocol (such as TCP or XNS). /// /// /// /// /// Pointer to a string that specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this /// parameter is NULL, the local computer is used. /// /// /// /// Specifies the information level of the data. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// 0 /// /// Specifies information about the transport protocol, including name, address, and location on the network. The bufptr parameter /// points to a SERVER_TRANSPORT_INFO_0 structure. /// /// /// /// 1 /// /// Specifies information about the transport protocol, including name, address, network location, and domain. The bufptr parameter /// points to a SERVER_TRANSPORT_INFO_1 structure. /// /// /// /// /// /// /// Pointer to the buffer that specifies the data. The format of this data depends on the value of the level parameter. For more /// information, see Network Management Function Buffers. /// /// /// /// If the function succeeds, the return value is NERR_Success. /// If the function fails, the return value can be one of the following error codes. /// /// /// Return code /// Description /// /// /// ERROR_ACCESS_DENIED /// The user does not have access to the requested information. /// /// /// ERROR_INVALID_LEVEL /// The value specified for the level parameter is invalid. /// /// /// ERROR_INVALID_PARAMETER /// The specified parameter is invalid. /// /// /// ERROR_NOT_ENOUGH_MEMORY /// Insufficient memory is available. /// /// /// NERR_NetNameNotFound /// The share name does not exist. /// /// /// /// /// /// Only members of the Administrators or Server Operators local group can successfully execute the NetServerTransportDel function. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmserver/nf-lmserver-netservertransportdel NET_API_STATUS NET_API_FUNCTION // NetServerTransportDel( LMSTR servername, DWORD level, LPBYTE bufptr ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("lmserver.h", MSDNShortId = "69b22f30-62b1-4dcb-bbb0-aceae8d77f61")] public static extern Win32Error NetServerTransportDel([Optional] string servername, int level, IntPtr bufptr); /// /// The NetServerTransportEnum function supplies information about transport protocols that are managed by the server. /// /// /// Pointer to a string that specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this /// parameter is NULL, the local computer is used. /// /// /// Specifies the information level of the data. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// 0 /// /// Return information about the transport protocol, including name, address, and location on the network. The bufptr parameter /// points to an array of SERVER_TRANSPORT_INFO_0 structures. /// /// /// /// 1 /// /// Return information about the transport protocol, including name, address, network location, and domain. The bufptr parameter /// points to an array of SERVER_TRANSPORT_INFO_1 structures. /// /// /// /// /// /// Pointer to the buffer that receives the data. 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. Note that you must free the buffer even if the /// function fails with ERROR_MORE_DATA. /// /// /// Specifies the preferred maximum length of returned data, in bytes. If you specify MAX_PREFERRED_LENGTH, the function allocates /// the amount of memory required for the data. If you specify another value in this parameter, it can restrict the number of bytes /// that the function returns. If the buffer size is insufficient to hold all entries, the function returns ERROR_MORE_DATA. For more /// information, see Network Management Function Buffers and Network Management Function Buffer Lengths. /// /// Pointer to a value that receives the count of elements actually enumerated. /// /// Pointer to a value that receives the total number of entries that could have been enumerated from the current resume position. /// Note that applications should consider this value only as a hint. /// /// The resume handle. /// /// If the function succeeds, the return value is NERR_Success. /// If the function fails, the return value can be one of the following error codes. /// /// /// Return code /// Description /// /// /// ERROR_INVALID_LEVEL /// The value specified for the level parameter is invalid. /// /// /// ERROR_MORE_DATA /// More entries are available. Specify a large enough buffer to receive all entries. /// /// /// ERROR_NOT_ENOUGH_MEMORY /// Insufficient memory is available. /// /// /// NERR_BufTooSmall /// The supplied buffer is too small. /// /// /// /// /// /// Only Authenticated Users can successfully call this function. Windows XP/2000: No special group membership is required to /// successfully execute this function. /// /// Examples /// /// The following code sample demonstrates how to retrieve information about transport protocols that are managed by the server, /// using a call to the NetServerTransportEnum function. The sample calls NetServerTransportEnum, specifying /// information level 0 ( SERVER_TRANSPORT_INFO_0). The sample prints the name of each transport protocol and the total number /// enumerated. Finally, the code sample frees the memory allocated for the information buffer. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmserver/nf-lmserver-netservertransportenum NET_API_STATUS NET_API_FUNCTION // NetServerTransportEnum( LMSTR servername, DWORD level, LPBYTE *bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD // totalentries, LPDWORD resume_handle ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("lmserver.h", MSDNShortId = "db42ac44-d70d-4b89-882a-6ac83fd611fd")] public static extern Win32Error NetServerTransportEnum([Optional] string servername, int level, out SafeNetApiBuffer bufptr, uint prefmaxlen, out uint entriesread, out uint totalentries, ref uint resume_handle); /// The SERVER_INFO_100 structure contains information about the specified server, including the name and platform. /// [StructLayout(LayoutKind.Sequential)] [PInvokeData("lmserver.h", MSDNShortId = "aa370897")] public struct SERVER_INFO_100 : INetServerInfo { /// The information level to use for platform-specific information. public ServerPlatform sv100_platform_id; /// A pointer to a Unicode string that specifies the name of the server. [MarshalAs(UnmanagedType.LPWStr)] public string sv100_name; } /// /// The SERVER_INFO_101 structure contains information about the specified server, including name, platform, type of server, /// and associated software. /// /// [StructLayout(LayoutKind.Sequential)] [PInvokeData("lmserver.h", MSDNShortId = "aa370903")] public struct SERVER_INFO_101 : INetServerInfo { /// The information level to use for platform-specific information. public ServerPlatform sv101_platform_id; /// A pointer to a Unicode string specifying the name of a server. [MarshalAs(UnmanagedType.LPWStr)] public string sv101_name; /// /// The major version number and the server type. /// /// The major release version number of the operating system is specified in the least significant 4 bits. The server type is /// specified in the most significant 4 bits. The MAJOR_VERSION_MASK bitmask defined in the Lmserver.h header should be /// used by an application to obtain the major version number from this member. /// /// public int sv101_version_major; /// The minor release version number of the operating system. public int sv101_version_minor; /// The type of software the computer is running. public NetServerEnumFilter sv101_type; /// A pointer to a Unicode string specifying a comment describing the server. The comment can be null. [MarshalAs(UnmanagedType.LPWStr)] public string sv101_comment; /// Gets the version composed of both and . /// The version. public Version Version => new Version(sv101_version_major, sv101_version_minor); } /// /// The SERVER_INFO_102 structure contains information about the specified server, including name, platform, type of server, /// attributes, and associated software. /// /// [StructLayout(LayoutKind.Sequential)] [PInvokeData("lmserver.h", MSDNShortId = "aa370904")] public struct SERVER_INFO_102 : INetServerInfo { /// The information level to use for platform-specific information. public ServerPlatform sv102_platform_id; /// A pointer to a Unicode string specifying the name of a server. [MarshalAs(UnmanagedType.LPWStr)] public string sv102_name; /// /// The major version number and the server type. /// /// The major release version number of the operating system is specified in the least significant 4 bits. The server type is /// specified in the most significant 4 bits. The MAJOR_VERSION_MASK bitmask defined in the Lmserver.h header should be /// used by an application to obtain the major version number from this member. /// /// public int sv102_version_major; /// The minor release version number of the operating system. public int sv102_version_minor; /// The type of software the computer is running. public NetServerEnumFilter sv102_type; /// A pointer to a Unicode string specifying a comment describing the server. The comment can be null. [MarshalAs(UnmanagedType.LPWStr)] public string sv102_comment; /// /// The number of users who can attempt to log on to the system server. Note that it is the license server that determines how /// many of these users can actually log on. /// public int sv102_users; /// /// The auto-disconnect time, in minutes. A session is disconnected if it is idle longer than the period of time specified by the /// sv102_disc member. If the value of sv102_disc is SV_NODISC, auto-disconnect is not enabled. /// public int sv102_disc; /// A value that indicates whether the server is visible to other computers in the same network domain. [MarshalAs(UnmanagedType.Bool)] public bool sv102_hidden; /// /// The network announce rate, in seconds. This rate determines how often the server is announced to other computers on the network. /// public int sv102_announce; /// /// The delta value for the announce rate, in milliseconds. This value specifies how much the announce rate can vary from the /// period of time specified in the sv102_announce member. /// /// The delta value allows randomly varied announce rates. For example, if the sv102_announce member has the value 10 and the /// sv102_anndelta member has the value 1, the announce rate can vary from 9.999 seconds to 10.001 seconds. /// /// public int sv102_anndelta; /// The number of users per license. By default, this number is SV_USERS_PER_LICENSE. public int sv102_licenses; /// A pointer to a Unicode string specifying the path to user directories. [MarshalAs(UnmanagedType.LPWStr)] public string sv102_userpath; /// Gets the version composed of both and . /// The version. public Version Version => new Version(sv102_version_major, sv102_version_minor); } /// /// The SERVER_INFO_402 structure contains information about a specified server. /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmserver/ns-lmserver-_server_info_402 typedef struct _SERVER_INFO_402 { DWORD // sv402_ulist_mtime; DWORD sv402_glist_mtime; DWORD sv402_alist_mtime; LMSTR sv402_alerts; DWORD sv402_security; DWORD // sv402_numadmin; DWORD sv402_lanmask; LMSTR sv402_guestacct; DWORD sv402_chdevs; DWORD sv402_chdevq; DWORD sv402_chdevjobs; DWORD // sv402_connections; DWORD sv402_shares; DWORD sv402_openfiles; DWORD sv402_sessopens; DWORD sv402_sessvcs; DWORD sv402_sessreqs; // DWORD sv402_opensearch; DWORD sv402_activelocks; DWORD sv402_numreqbuf; DWORD sv402_sizreqbuf; DWORD sv402_numbigbuf; DWORD // sv402_numfiletasks; DWORD sv402_alertsched; DWORD sv402_erroralert; DWORD sv402_logonalert; DWORD sv402_accessalert; DWORD // sv402_diskalert; DWORD sv402_netioalert; DWORD sv402_maxauditsz; LMSTR sv402_srvheuristics; } SERVER_INFO_402, *PSERVER_INFO_402, *LPSERVER_INFO_402; [PInvokeData("lmserver.h", MSDNShortId = "51e5c27e-6a7d-45ac-9cfa-37b1f7f241f9")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct SERVER_INFO_402 : INetServerInfo { /// /// Type: DWORD /// /// The last time the user list was modified. The value is expressed as the number of seconds that have elapsed since 00:00:00, /// January 1, 1970, GMT, and applies to servers running with user-level security. /// /// public uint sv402_ulist_mtime; /// /// Type: DWORD /// /// The last time the group list was modified. The value is expressed as the number of seconds that have elapsed since 00:00:00, /// January 1, 1970, GMT, and applies to servers running with user-level security. /// /// public uint sv402_glist_mtime; /// /// Type: DWORD /// /// The last time the access control list was modified. The value is expressed as the number of seconds that have elapsed since /// 00:00:00, January 1, 1970, GMT, and applies to servers running with user-level security. /// /// public uint sv402_alist_mtime; /// /// Type: LPWSTR /// A pointer to a Unicode string that specifies the list of user names on the server. Spaces separate the names. /// public string sv402_alerts; /// /// Type: DWORD /// /// The security type of the server. This member can be one of the following values. Note that Windows NT, Windows 2000, Windows /// XP, and Windows Server 2003 operating systems do not support share-level security. /// /// /// /// Value /// Meaning /// /// /// SV_SHARESECURITY /// Share-level security /// /// /// SV_USERSECURITY /// User-level security /// /// /// public uint sv402_security; /// /// Type: DWORD /// The number of administrators the server can accommodate at one time. /// public uint sv402_numadmin; /// /// Type: DWORD /// The order in which the network device drivers are served. /// public uint sv402_lanmask; /// /// Type: LPWSTR /// /// A pointer to a Unicode string that specifies the name of a reserved account for guest users on the server. The constant UNLEN /// specifies the maximum number of characters in the string. /// /// public string sv402_guestacct; /// /// Type: DWORD /// The number of character-oriented devices that can be shared on the server. /// public uint sv402_chdevs; /// /// Type: DWORD /// The number of character-oriented device queues that can coexist on the server. /// public uint sv402_chdevq; /// /// Type: DWORD /// The number of character-oriented device jobs that can be pending at one time on the server. /// public uint sv402_chdevjobs; /// /// Type: DWORD /// The number of connections allowed on the server. /// public uint sv402_connections; /// /// Type: DWORD /// The number of share names the server can accommodate. /// public uint sv402_shares; /// /// Type: DWORD /// The number of files that can be open at once on the server. /// public uint sv402_openfiles; /// /// Type: DWORD /// The number of files that one session can open. /// public uint sv402_sessopens; /// /// Type: DWORD /// The maximum number of virtual circuits permitted per client. /// public uint sv402_sessvcs; /// /// Type: DWORD /// The number of simultaneous requests a client can make on a single virtual circuit. /// public uint sv402_sessreqs; /// /// Type: DWORD /// The number of search operations that can be carried out simultaneously. /// public uint sv402_opensearch; /// /// Type: DWORD /// The number of file locks that can be active at the same time. /// public uint sv402_activelocks; /// /// Type: DWORD /// The number of server buffers provided. /// public uint sv402_numreqbuf; /// /// Type: DWORD /// The size, in bytes, of each server buffer. /// public uint sv402_sizreqbuf; /// /// Type: DWORD /// The number of 64K server buffers provided. /// public uint sv402_numbigbuf; /// /// Type: DWORD /// The number of processes that can access the operating system at one time. /// public uint sv402_numfiletasks; /// /// Type: DWORD /// The interval, in seconds, for notifying an administrator of a network event. /// public uint sv402_alertsched; /// /// Type: DWORD /// /// The number of entries that can be written to the error log, in any one interval, before notifying an administrator. The /// interval is specified by the sv402_alertsched member. /// /// public uint sv402_erroralert; /// /// Type: DWORD /// The number of invalid logon attempts to allow a user before notifying an administrator. /// public uint sv402_logonalert; /// /// Type: DWORD /// The number of invalid file access attempts to allow before notifying an administrator. /// public uint sv402_accessalert; /// /// Type: DWORD /// /// The point at which the system sends a message notifying an administrator that free space on a disk is low. This value is /// expressed as the number of kilobytes of free disk space remaining on the disk. /// /// public uint sv402_diskalert; /// /// Type: DWORD /// The network I/O error ratio, in tenths of a percent, that is allowed before notifying an administrator. /// public uint sv402_netioalert; /// /// Type: DWORD /// The maximum size, in kilobytes, of the audit file. The audit file traces user activity. /// public uint sv402_maxauditsz; /// /// Type: LPWSTR /// A pointer to a Unicode string containing flags that control operations on a server. /// public string sv402_srvheuristics; } /// /// The SERVER_INFO_403 structure contains information about a specified server. /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmserver/ns-lmserver-_server_info_403 typedef struct _SERVER_INFO_403 { DWORD // sv403_ulist_mtime; DWORD sv403_glist_mtime; DWORD sv403_alist_mtime; LMSTR sv403_alerts; DWORD sv403_security; DWORD // sv403_numadmin; DWORD sv403_lanmask; LMSTR sv403_guestacct; DWORD sv403_chdevs; DWORD sv403_chdevq; DWORD sv403_chdevjobs; DWORD // sv403_connections; DWORD sv403_shares; DWORD sv403_openfiles; DWORD sv403_sessopens; DWORD sv403_sessvcs; DWORD sv403_sessreqs; // DWORD sv403_opensearch; DWORD sv403_activelocks; DWORD sv403_numreqbuf; DWORD sv403_sizreqbuf; DWORD sv403_numbigbuf; DWORD // sv403_numfiletasks; DWORD sv403_alertsched; DWORD sv403_erroralert; DWORD sv403_logonalert; DWORD sv403_accessalert; DWORD // sv403_diskalert; DWORD sv403_netioalert; DWORD sv403_maxauditsz; LMSTR sv403_srvheuristics; DWORD sv403_auditedevents; DWORD // sv403_autoprofile; LMSTR sv403_autopath; } SERVER_INFO_403, *PSERVER_INFO_403, *LPSERVER_INFO_403; [PInvokeData("lmserver.h", MSDNShortId = "14309dbe-ad7b-4ae0-8acc-39e9999f411b")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct SERVER_INFO_403 : INetServerInfo { /// /// Type: DWORD /// /// The last time the user list was modified. The value is expressed as the number of seconds that have elapsed since 00:00:00, /// January 1, 1970, GMT, and applies to servers running with user-level security. /// /// public uint sv403_ulist_mtime; /// /// Type: DWORD /// /// The last time the group list was modified. The value is expressed as the number of seconds that have elapsed since 00:00:00, /// January 1, 1970, GMT, and applies to servers running with user-level security. /// /// public uint sv403_glist_mtime; /// /// Type: DWORD /// /// The last time the access control list was modified. The value is expressed as the number of seconds that have elapsed since /// 00:00:00, January 1, 1970, GMT, and applies to servers running with user-level security. /// /// public uint sv403_alist_mtime; /// /// Type: LPWSTR /// A pointer to a Unicode string that specifies the list of user names on the server. Spaces separate the names. /// public string sv403_alerts; /// /// Type: DWORD /// /// The security type of the server. This member can be one of the following values. Note that Windows NT, Windows 2000, Windows /// XP, and Windows Server 2003 operating systems do not support share-level security. /// /// /// /// Value /// Meaning /// /// /// SV_SHARESECURITY /// Share-level security /// /// /// SV_USERSECURITY /// User-level security /// /// /// public uint sv403_security; /// /// Type: DWORD /// The number of administrators the server can accommodate at one time. /// public uint sv403_numadmin; /// /// Type: DWORD /// The order in which the network device drivers are served. /// public uint sv403_lanmask; /// /// Type: LPWSTR /// /// A pointer to a Unicode string that specifies the name of a reserved account for guest users on the server. The constant UNLEN /// specifies the maximum number of characters in the string. /// /// public string sv403_guestacct; /// /// Type: DWORD /// The number of character-oriented devices that can be shared on the server. /// public uint sv403_chdevs; /// /// Type: DWORD /// The number of character-oriented device queues that can coexist on the server. /// public uint sv403_chdevq; /// /// Type: DWORD /// The number of character-oriented device jobs that can be pending at one time on the server. /// public uint sv403_chdevjobs; /// /// Type: DWORD /// The number of connections allowed on the server. /// public uint sv403_connections; /// /// Type: DWORD /// The number of share names the server can accommodate. /// public uint sv403_shares; /// /// Type: DWORD /// The number of files that can be open at once on the server. /// public uint sv403_openfiles; /// /// Type: DWORD /// The number of files that one session can open. /// public uint sv403_sessopens; /// /// Type: DWORD /// The maximum number of virtual circuits permitted per client. /// public uint sv403_sessvcs; /// /// Type: DWORD /// The number of simultaneous requests a client can make on a single virtual circuit. /// public uint sv403_sessreqs; /// /// Type: DWORD /// The number of search operations that can be carried out simultaneously. /// public uint sv403_opensearch; /// /// Type: DWORD /// The number of file locks that can be active at the same time. /// public uint sv403_activelocks; /// /// Type: DWORD /// The number of server buffers provided. /// public uint sv403_numreqbuf; /// /// Type: DWORD /// The size, in bytes, of each server buffer. /// public uint sv403_sizreqbuf; /// /// Type: DWORD /// The number of 64K server buffers provided. /// public uint sv403_numbigbuf; /// /// Type: DWORD /// The number of processes that can access the operating system at one time. /// public uint sv403_numfiletasks; /// /// Type: DWORD /// The interval, in seconds, for notifying an administrator of a network event. /// public uint sv403_alertsched; /// /// Type: DWORD /// /// The number of entries that can be written to the error log, in any one interval, before notifying an administrator. The /// interval is specified by the sv403_alertsched member. /// /// public uint sv403_erroralert; /// /// Type: DWORD /// The number of invalid logon attempts to allow a user before notifying an administrator. /// public uint sv403_logonalert; /// /// Type: DWORD /// The number of invalid file access attempts to allow before notifying an administrator. /// public uint sv403_accessalert; /// /// Type: DWORD /// /// The point at which the system sends a message notifying an administrator that free space on a disk is low. This value is /// expressed as the number of kilobytes of free disk space remaining on the disk. /// /// public uint sv403_diskalert; /// /// Type: DWORD /// The network I/O error ratio, in tenths of a percent, that is allowed before notifying an administrator. /// public uint sv403_netioalert; /// /// Type: DWORD /// The maximum size, in kilobytes, of the audit file. The audit file traces user activity. /// public uint sv403_maxauditsz; /// /// Type: LPWSTR /// A pointer to a Unicode string containing flags that control operations on a server. /// public string sv403_srvheuristics; /// /// Type: DWORD /// The audit event control mask. /// public uint sv403_auditedevents; /// /// Type: DWORD /// A value that controls the action of the server on the profile. The following values are predefined. /// /// /// Value /// Meaning /// /// /// SW_AUTOPROF_LOAD_MASK /// The server loads the profile. /// /// /// SW_AUTOPROF_SAVE_MASK /// The server saves the profile. /// /// /// public uint sv403_autoprofile; /// /// Type: LPWSTR /// A pointer to a Unicode string that contains the path for the profile. /// public string sv403_autopath; } /// /// /// The SERVER_TRANSPORT_INFO_0 structure contains information about the specified transport protocol, including name, /// address, and location on the network. /// /// /// /// /// The SERVER_TRANSPORT_INFO_0 structure is used by the NetServerTransportAdd or NetServerTransportAddEx function to bind the /// specified server to the transport protocol. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmserver/ns-lmserver-_server_transport_info_0 typedef struct // _SERVER_TRANSPORT_INFO_0 { DWORD svti0_numberofvcs; LMSTR svti0_transportname; LPBYTE svti0_transportaddress; DWORD // svti0_transportaddresslength; LMSTR svti0_networkaddress; } SERVER_TRANSPORT_INFO_0, *PSERVER_TRANSPORT_INFO_0, *LPSERVER_TRANSPORT_INFO_0; [PInvokeData("lmserver.h", MSDNShortId = "5b94cf7a-74d1-4ae8-87bd-22b2daf292cb")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct SERVER_TRANSPORT_INFO_0 { /// /// Type: DWORD /// /// The number of clients connected to the server that are using the transport protocol specified by the /// svti0_transportname member. /// /// public uint svti0_numberofvcs; /// /// Type: LMSTR /// A pointer to a null-terminated character string that contains the name of a transport device; for example, /// /// /// \Device\NetBT_Tcpip_{2C9725F4-151A-11D3-AEEC-C3B211BD350B /// /// /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string svti0_transportname; /// /// Type: LPBYTE /// /// A pointer to a variable that contains the address the server is using on the transport device specified by the /// svti0_transportname member. /// /// /// This member is usually the NetBIOS name that the server is using. In these instances, the name must be 16 characters long, /// and the last character must be a blank character (0x20). /// /// public IntPtr svti0_transportaddress; /// /// Type: DWORD /// /// The length, in bytes, of the svti0_transportaddress member. For NetBIOS names, the value of this member is 16 (decimal). /// /// public uint svti0_transportaddresslength; /// /// Type: LMSTR /// /// A pointer to a NULL-terminated character string that contains the address the network adapter is using. The string is transport-specific. /// /// /// You can retrieve this value only with a call to the NetServerTransportEnum function. You cannot set this value with a call to /// the NetServerTransportAdd function or the NetServerTransportAddEx function.) /// /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string svti0_networkaddress; } /// /// /// The SERVER_TRANSPORT_INFO_1 structure contains information about the specified transport protocol, including name and /// address. This information level is valid only for the NetServerTransportAddEx function. /// /// /// /// /// The SERVER_TRANSPORT_INFO_1 structure is used by the NetServerTransportAddEx function to bind the specified server to the /// transport protocol. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmserver/ns-lmserver-_server_transport_info_1 typedef struct // _SERVER_TRANSPORT_INFO_1 { DWORD svti1_numberofvcs; LMSTR svti1_transportname; LPBYTE svti1_transportaddress; DWORD // svti1_transportaddresslength; LMSTR svti1_networkaddress; LMSTR svti1_domain; } SERVER_TRANSPORT_INFO_1, // *PSERVER_TRANSPORT_INFO_1, *LPSERVER_TRANSPORT_INFO_1; [PInvokeData("lmserver.h", MSDNShortId = "f21fed49-207a-4f64-becd-3d3c1e995eb0")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct SERVER_TRANSPORT_INFO_1 { /// /// Type: DWORD /// /// The number of clients connected to the server that are using the transport protocol specified by the /// svti1_transportname member. /// /// public uint svti1_numberofvcs; /// /// Type: LMSTR /// A pointer to a null-terminated character string that contains the name of a transport device; for example, /// /// /// \Device\NetBT_Tcpip_{2C9725F4-151A-11D3-AEEC-C3B211BD350B /// /// /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string svti1_transportname; /// /// Type: LPBYTE /// /// A pointer to a variable that contains the address the server is using on the transport device specified by the /// svti1_transportname member. /// /// /// This member is usually the NetBIOS name that the server is using. In these instances, the name must be 16 characters long, /// and the last character must be a blank character (0x20). /// /// public IntPtr svti1_transportaddress; /// /// Type: DWORD /// /// The length, in bytes, of the svti1_transportaddress member. For NetBIOS names, the value of this member is 16 (decimal). /// /// public uint svti1_transportaddresslength; /// /// Type: LMSTR /// /// A pointer to a NULL-terminated character string that contains the address the network adapter is using. The string is transport-specific. /// /// /// You can retrieve this value only with a call to the NetServerTransportEnum function. You cannot set this value with a call to /// the NetServerTransportAdd function or the NetServerTransportAddEx function.) /// /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string svti1_networkaddress; /// /// Type: LMSTR /// /// A pointer to a NULL-terminated character string that contains the name of the domain to which the server should announce its /// presence. (When you call NetServerTransportEnum, this member is the name of the domain to which the server is announcing its presence.) /// /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string svti1_domain; } /// /// /// The SERVER_TRANSPORT_INFO_2 structure contains information about the specified transport protocol, including the transport /// name and address. This information level is valid only for the NetServerTransportAddEx function. /// /// /// /// /// The SERVER_TRANSPORT_INFO_2 structure is used by the NetServerTransportAddEx function to bind the specified server to the /// transport protocol. /// /// /// An example of the use of the SVTI2_REMAP_PIPE_NAMES value follows. Call the NetServerTransportAddEx function to add a transport /// to the server, specifying the address of "MyServer" in the svti2_transportaddress member, and /// SVTI2_REMAP_PIPE_NAMES in the svti2_flags member. When a client attempts to open "Pipe" on "\MyServer" the client /// will actually open $$MyServer\Pipe instead. /// /// /// On Windows Server 2008 and Windows Vista with SP1, every name registered with the Windows remote file server (SRV) is designated /// as either a scoped name or a non-scoped name. Every share that is added to the system will then either be attached to all of the /// non-scoped names, or to a single scoped name. Applications that wish to use the scoping features are responsible for both /// registering the new name as a scoped endpoint and then creating the shares with an appropriate scope. In this way, legacy uses of /// the Network Management and Network Share Management functions are not affected in any way since they continue to register shares /// and names as non-scoped names. /// /// /// A scoped endpoint is created by calling the NetServerTransportAddEx function with the level parameter set to 2 and the bufptr /// parameter pointed to a SERVER_TRANSPORT_INFO_2 structure with the SVTI2_SCOPED_NAME bit value set in /// svti2_flags member. A scoped endpoint is also created by calling the NetServerTransportAddEx function with the /// level parameter set to 3 and the bufptr parameter pointed to a SERVER_TRANSPORT_INFO_3 structure with the /// SVTI2_SCOPED_NAME bit value set in svti3_flags member. /// /// /// When the SVTI2_SCOPED_NAME bit value is set for a transport, then shares can be added with a corresponding server name /// (the shi503_servername member of the SHARE_INFO_503 structure) in a scoped fashion using the NetShareAdd function. If /// there is no transport registered with the SVTI2_SCOPED_NAME bit value and the name provided in shi503_servername /// member, then the share add in a scoped fashion will not succeed. /// /// /// The NetShareAdd function is used to add a scoped share on a remote server specified in the servername parameter. The remote /// server specified in the shi503_servername member of the SHARE_INFO_503 passed in the bufptr parameter must have been bound /// to a transport protocol using the NetServerTransportAddEx function as a scoped endpoint. The SVTI2_SCOPED_NAME flag must /// have been specified in the shi503_servername member of the SERVER_TRANSPORT_INFO_2 or SERVER_TRANSPORT_INFO_3 /// structure for the transport protocol. The NetShareDelEx function is used to delete a scoped share. The NetShareGetInfo and /// NetShareSetInfo functions are to used to get and set information on a scoped share. /// /// Scoped endpoints are generally used by the cluster namespace. /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmserver/ns-lmserver-_server_transport_info_2 typedef struct // _SERVER_TRANSPORT_INFO_2 { DWORD svti2_numberofvcs; LMSTR svti2_transportname; LPBYTE svti2_transportaddress; DWORD // svti2_transportaddresslength; LMSTR svti2_networkaddress; LMSTR svti2_domain; ULONG svti2_flags; } SERVER_TRANSPORT_INFO_2, // *PSERVER_TRANSPORT_INFO_2, *LPSERVER_TRANSPORT_INFO_2; [PInvokeData("lmserver.h", MSDNShortId = "b422eb71-1f93-432d-8283-81432edfe568")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct SERVER_TRANSPORT_INFO_2 { /// /// Type: DWORD /// /// The number of clients connected to the server that are using the transport protocol specified by the /// svti2_transportname member. /// /// public uint svti2_numberofvcs; /// /// Type: LMSTR /// A pointer to a null-terminated character string that contains the name of a transport device; for example, /// /// /// \Device\NetBT_Tcpip_{2C9725F4-151A-11D3-AEEC-C3B211BD350B /// /// /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string svti2_transportname; /// /// Type: LPBYTE /// /// A pointer to a variable that contains the address the server is using on the transport device specified by the /// svti2_transportname member. /// /// /// This member is usually the NetBIOS name that the server is using. In these instances, the name must be 16 characters long, /// and the last character must be a blank character (0x20). /// /// public IntPtr svti2_transportaddress; /// /// Type: DWORD /// /// The length, in bytes, of the svti2_transportaddress member. For NetBIOS names, the value of this member is 16 (decimal). /// /// public uint svti2_transportaddresslength; /// /// Type: LMSTR /// /// A pointer to a NULL-terminated character string that contains the address the network adapter is using. The string is transport-specific. /// /// /// You can retrieve this value only with a call to the NetServerTransportEnum function. You cannot set this value with a call to /// the NetServerTransportAdd function or the NetServerTransportAddEx function.) /// /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string svti2_networkaddress; /// /// Type: LMSTR /// /// A pointer to a NULL-terminated character string that contains the name of the domain to which the server should announce its /// presence. (When you call NetServerTransportEnum, this member is the name of the domain to which the server is announcing its presence.) /// /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string svti2_domain; /// /// Type: ULONG /// This member can be a combination of the following bit values defined in the Lmserver.h header file. /// /// /// Value /// Meaning /// /// /// SVTI2_REMAP_PIPE_NAMES /// /// If this value is set for an endpoint, client requests arriving over the transport to open a named pipe are rerouted /// (remapped) to the following local pipe name: $$\ServerName\PipeName For more information on the use of this value, see the /// Remarks section. /// /// /// /// SVTI2_SCOPED_NAME /// /// If this value is set for an endpoint and there is an attempt to create a second transport with the same network address but a /// different transport name and conflicting settings for the SCOPED flag, this transport creation will fail. Thus, every /// registered transport for a given network address must have the same scoped setting. For more information on the use of this /// value, see the Remarks section. This value is defined on Windows Server 2008 and Windows Vista with SP1. /// /// /// /// public SERVER_TRANSPORT_FLAGS svti2_flags; } /// /// /// The SERVER_TRANSPORT_INFO_3 structure contains information about the specified transport protocol, including name, address /// and password (credentials). This information level is valid only for the NetServerTransportAddEx function. /// /// /// /// /// The SERVER_TRANSPORT_INFO_3 structure is used by the NetServerTransportAddEx function to bind the specified server to the /// transport protocol. /// /// /// An example of the use of the SVTI2_REMAP_PIPE_NAMES value follows. Call the NetServerTransportAddEx function to add a transport /// to the server, specifying the address of "MyServer" in the svti3_transportaddress member, and /// SVTI2_REMAP_PIPE_NAMES in the svti3_flags member. When a client attempts to open "Pipe" on "\MyServer" the client /// will actually open $$MyServer\Pipe instead. /// /// /// The svti3_passwordlength and svti3_password members are necessary for a client and server to perform mutual authentication. /// /// /// On Windows Server 2008 and Windows Vista with SP1, every name registered with the Windows remote file server (SRV) is designated /// as either a scoped name or a non-scoped name. Every share that is added to the system will then either be attached to all of the /// non-scoped names, or to a single scoped name. Applications that wish to use the scoping features are responsible for both /// registering the new name as a scoped endpoint and then creating the shares with an appropriate scope. In this way, legacy uses of /// the Network Management and Network Share Management functions are not affected in any way since they continue to register shares /// and names as non-scoped names. /// /// /// A scoped endpoint is created by calling the NetServerTransportAddEx function with the level parameter set to 2 and the bufptr /// parameter pointed to a SERVER_TRANSPORT_INFO_2 structure with the SVTI2_SCOPED_NAME bit value set in svti2_flags /// member. A scoped endpoint is also created by calling the NetServerTransportAddEx function with the level parameter set to /// 3 and the bufptr parameter pointed to a SERVER_TRANSPORT_INFO_3 structure with the SVTI2_SCOPED_NAME bit value set /// in svti3_flags member. /// /// /// When the SVTI2_SCOPED_NAME bit value is set for a transport, then shares can be added with a corresponding server name /// (the shi503_servername member of the SHARE_INFO_503 structure) in a scoped fashion using the NetShareAdd function. If /// there is no transport registered with the SVTI2_SCOPED_NAME bit value and the name provided in shi503_servername /// member, then the share add in a scoped fashion will not succeed. /// /// /// The NetShareAdd function is used to add a scoped share on a remote server specified in the servername parameter. The remote /// server specified in the shi503_servername member of the SHARE_INFO_503 passed in the bufptr parameter must have been bound /// to a transport protocol using the NetServerTransportAddEx function as a scoped endpoint. The SVTI2_SCOPED_NAME flag must /// have been specified in the shi503_servername member of the SERVER_TRANSPORT_INFO_2 or SERVER_TRANSPORT_INFO_3 /// structure for the transport protocol. The NetShareDelEx function is used to delete a scoped share. The NetShareGetInfo and /// NetShareSetInfo functions are to used to get and set information on a scoped share. /// /// Scoped endpoints are generally used by the cluster namespace. /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmserver/ns-lmserver-_server_transport_info_3 typedef struct // _SERVER_TRANSPORT_INFO_3 { DWORD svti3_numberofvcs; LMSTR svti3_transportname; LPBYTE svti3_transportaddress; DWORD // svti3_transportaddresslength; LMSTR svti3_networkaddress; LMSTR svti3_domain; ULONG svti3_flags; DWORD svti3_passwordlength; BYTE // svti3_password[256]; } SERVER_TRANSPORT_INFO_3, *PSERVER_TRANSPORT_INFO_3, *LPSERVER_TRANSPORT_INFO_3; [PInvokeData("lmserver.h", MSDNShortId = "045d60d4-518f-4ce4-b611-e23d1588d5d3")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct SERVER_TRANSPORT_INFO_3 { /// /// Type: DWORD /// /// The number of clients connected to the server that are using the transport protocol specified by the /// svti3_transportname member. /// /// public uint svti3_numberofvcs; /// /// Type: LMSTR /// A pointer to a null-terminated character string that contains the name of a transport device; for example, /// /// /// \Device\NetBT_Tcpip_{2C9725F4-151A-11D3-AEEC-C3B211BD350B /// /// /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string svti3_transportname; /// /// Type: LPBYTE /// /// A pointer to a variable that contains the address the server is using on the transport device specified by the /// svti3_transportname member. /// /// /// This member is usually the NetBIOS name that the server is using. In these instances, the name must be 16 characters long, /// and the last character must be a blank character (0x20). /// /// public IntPtr svti3_transportaddress; /// /// Type: DWORD /// /// The length, in bytes, of the svti3_transportaddress member. For NetBIOS names, the value of this member is 16 (decimal). /// /// public uint svti3_transportaddresslength; /// /// Type: LMSTR /// /// A pointer to a NULL-terminated character string that contains the address the network adapter is using. The string is transport-specific. /// /// /// You can retrieve this value only with a call to the NetServerTransportEnum function. You cannot set this value with a call to /// the NetServerTransportAdd function or the NetServerTransportAddEx function.) /// /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string svti3_networkaddress; /// /// Type: LMSTR /// /// A pointer to a NULL-terminated character string that contains the name of the domain to which the server should announce its /// presence. (When you call NetServerTransportEnum, this member is the name of the domain to which the server is announcing its presence.) /// /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string svti3_domain; /// /// Type: ULONG /// This member can be a combination of the following bit values defined in the Lmserver.h header file. /// /// /// Value /// Meaning /// /// /// SVTI2_REMAP_PIPE_NAMES /// /// If this value is set for an endpoint, client requests arriving over the transport to open a named pipe are rerouted /// (remapped) to the following local pipe name: $$\ServerName\PipeName For more information on the use of this value, see the /// Remarks section. /// /// /// /// SVTI2_SCOPED_NAME /// /// If this value is set for an endpoint and there is an attempt to create a second transport with the same network address but a /// different transport name and conflicting settings for the SCOPED flag, this transport creation will fail. Thus, every /// registered transport for a given network address must have the same scoped setting. For more information on the use of this /// value, see the Remarks section. This value is defined on Windows Server 2008 and Windows Vista with SP1. /// /// /// /// public SERVER_TRANSPORT_FLAGS svti3_flags; /// /// Type: DWORD /// The number of valid bytes in the svti3_password member. /// public uint svti3_passwordlength; /// /// Type: BYTE[256] /// /// The credentials to use for the new transport address. If the svti3_passwordlength member is zero, the credentials for /// the server are used. /// /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] svti3_password; } /* SERVER_INFO_1005 structure SERVER_INFO_1010 structure SERVER_INFO_1016 structure SERVER_INFO_1017 structure SERVER_INFO_1018 structure SERVER_INFO_1107 structure SERVER_INFO_1501 structure SERVER_INFO_1502 structure SERVER_INFO_1503 structure SERVER_INFO_1506 structure SERVER_INFO_1509 structure SERVER_INFO_1510 structure SERVER_INFO_1511 structure SERVER_INFO_1512 structure SERVER_INFO_1513 structure SERVER_INFO_1515 structure SERVER_INFO_1516 structure SERVER_INFO_1518 structure SERVER_INFO_1523 structure SERVER_INFO_1528 structure SERVER_INFO_1529 structure SERVER_INFO_1530 structure SERVER_INFO_1533 structure SERVER_INFO_1536 structure SERVER_INFO_1538 structure SERVER_INFO_1539 structure SERVER_INFO_1540 structure SERVER_INFO_1541 structure SERVER_INFO_1542 structure SERVER_INFO_1544 structure SERVER_INFO_1550 structure SERVER_INFO_1552 structure SERVER_INFO_502 structure SERVER_INFO_503 structure*/ } }