using System; using System.Runtime.InteropServices; namespace Vanara.PInvoke { public static partial class NetApi32 { /// Flags used by SESSION_INFO_XX structures [PInvokeData("lmshare.h", MSDNShortId = "a86a00ae-f60a-4b12-a9ac-4b96f9abd6a2")] [Flags] public enum SESS { /// The user specified by the sesi502_username member established the session using a guest account. SESS_GUEST = 0x00000001, /// The user specified by the sesi502_username member established the session without using password encryption. SESS_NOENCRYPTION = 0x00000002, } /// /// Indicates the shared resource's permissions for servers running with share-level security. A server running user-level security /// ignores this member. /// [PInvokeData("lmshare.h", MSDNShortId = "cd152ccd-cd60-455f-b25c-c4939c65e0ab")] [Flags] public enum ShareLevelAccess { /// No access. ACCESS_NONE = 0, /// Permission to read, write, create, execute, and delete resources, and to modify their attributes and permissions. ACCESS_ALL = ACCESS_READ | ACCESS_WRITE | ACCESS_CREATE | ACCESS_EXEC | ACCESS_DELETE | ACCESS_ATRIB | ACCESS_PERM, /// Permission to read data from a resource and, by default, to execute the resource. ACCESS_READ = 0x01, /// Permission to write data to the resource. ACCESS_WRITE = 0x02, /// /// Permission to create an instance of the resource (such as a file); data can be written to the resource as the resource is created. /// ACCESS_CREATE = 0x04, /// Permission to execute the resource. ACCESS_EXEC = 0x08, /// Permission to delete the resource. ACCESS_DELETE = 0x10, /// Permission to modify the resource's attributes (such as the date and time when a file was last modified). ACCESS_ATRIB = 0x20, /// /// Permission to modify the permissions (read, write, create, execute, and delete) assigned to a resource for a user or application. /// ACCESS_PERM = 0x40, } /// A bitmask of flags that specify information about the shared resource. [PInvokeData("lmshare.h", MSDNShortId = "9fb3e0ae-76b5-4432-80dd-f3361738aa7c")] [Flags] public enum SHI1005_FLAGS { /// The specified share is present in a Dfs tree structure. This flag cannot be set with NetShareSetInfo. SHI1005_FLAGS_DFS = 0x0001, /// The specified share is the root volume in a Dfs tree structure. This flag cannot be set with NetShareSetInfo. SHI1005_FLAGS_DFS_ROOT = 0x0002, /// The specified share disallows exclusive file opens, where reads to an open file are disallowed. SHI1005_FLAGS_RESTRICT_EXCLUSIVE_OPENS = 0x0100, /// Shared files in the specified share can be forcibly deleted. SHI1005_FLAGS_FORCE_SHARED_DELETE = 0x0200, /// Clients are allowed to cache the namespace of the specified share. SHI1005_FLAGS_ALLOW_NAMESPACE_CACHING = 0x0400, /// /// The server will filter directory entries based on the access permissions that the user on the client computer has for the /// server on which the files reside. Only files for which the user has read access and directories for which the user has /// FILE_LIST_DIRECTORY access will be returned. If the user has SeBackupPrivilege, all available information will be returned. /// For more information about file and directory access, see File Security and Access Rights. /// For more information about SeBackupPrivilege, see Privilege Constants. /// Note This flag is supported only on servers running Windows Server 2003 with SP1 or later. /// SHI1005_FLAGS_ACCESS_BASED_DIRECTORY_ENUM = 0x0800, /// /// Prevents exclusive caching modes that can cause delays for highly shared read-only data. /// Note This flag is supported only on servers running Windows Server 2008 R2 or later. /// SHI1005_FLAGS_FORCE_LEVELII_OPLOCK = 0x1000, /// /// Enables server-side functionality needed for peer caching support. Clients on high-latency or low-bandwidth connections can /// use alternate methods to retrieve data from peers if available, instead of sending requests to the server. This is only /// supported on shares configured for manual caching (CSC_CACHE_MANUAL_REINT). /// Note This flag is supported only on servers running Windows Server 2008 R2 or later. /// SHI1005_FLAGS_ENABLE_HASH = 0x2000, /// /// Enables Continuous Availability on a cluster share. Handles that are opened against a continuously available share can /// survive network failures as well as cluster node failures. /// Note This flag can only be set on a scoped share on a server that meets the following conditions: /// It is running Windows Server 2012 or later. /// It is in a cluster configuration. /// It has the "Services for Continuously Available shares" role service installed. /// Windows 7, Windows Server 2008 R2, Windows Vista, Windows Server 2008 and Windows Server 2003: This flag is not supported. /// SHI1005_FLAGS_ENABLE_CA = 0X4000, /// Undocumented. SHI1005_FLAGS_ENCRYPT_DATA = 0x08000, /// Undocumented. SHI1005_FLAGS_RESERVED = 0x10000, /// Undocumented. SHI1005_FLAGS_DISABLE_CLIENT_BUFFERING = 0x20000, /// Undocumented. SHI1005_FLAGS_IDENTITY_REMOTING = 0x40000, /// Undocumented. SHI1005_FLAGS_CLUSTER_MANAGED = 0x80000, /// Used to mask off the following states (including SHI1005_FLAGS_ENABLE_HASH) CSC_MASK_EXT = 0x2030, /// Used to mask off the following states CSC_MASK = 0x0030, /// No automatic file by file reintegration CSC_CACHE_MANUAL_REINT = 0x0000, /// File by file reintegration is OK CSC_CACHE_AUTO_REINT = 0x0010, /// no need to flow opens CSC_CACHE_VDO = 0x0020, /// no CSC for this share CSC_CACHE_NONE = 0x0030, } /// Type of shared device. [PInvokeData("lmshare.h", MSDNShortId = "8453dcd2-5c58-4fe4-9426-0fd51647394d")] [Flags] public enum STYPE : uint { /// Disk drive. STYPE_DISKTREE = 0, /// Print queue. STYPE_PRINTQ = 1, /// Communication device. STYPE_DEVICE = 2, /// Interprocess communication (IPC). STYPE_IPC = 3, /// Mask STYPE_MASK = 0x000000FF, /// Reserved. STYPE_RESERVED1 = 0x01000000, /// Reserved. STYPE_RESERVED2 = 0x02000000, /// Reserved. STYPE_RESERVED3 = 0x04000000, /// Reserved. STYPE_RESERVED4 = 0x08000000, /// Reserved. STYPE_RESERVED5 = 0x00100000, /// Reserved. STYPE_RESERVED_ALL = 0x3FFFFF00, /// A temporary share. STYPE_TEMPORARY = 0x40000000, /// /// Special share reserved for interprocess communication (IPC$) or remote administration of the server (ADMIN$). Can also refer /// to administrative shares such as C$, D$, E$, and so forth. For more information, see Network Share Functions. /// STYPE_SPECIAL = 0x80000000, } /// /// Lists all connections made to a shared resource on the server or all connections established from a particular computer. If there /// is more than one user using this connection, then it is possible to get more than one structure for the same connection, but with /// a different user 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. /// /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE is defined. /// /// /// /// Pointer to a string that specifies a share name or computer name for the connections of interest. If it is a share name, then all /// the connections made to that share name are listed. If it is a computer name (for example, it starts with two backslash /// characters), then NetConnectionEnum lists all connections made from that computer to the server specified. /// /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE is defined. /// /// /// Specifies the information level of the data. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// 0 /// Return connection identifiers. The bufptr parameter is a pointer to an array of CONNECTION_INFO_0 structures. /// /// /// 1 /// /// Return connection identifiers and connection information. The bufptr parameter is a pointer to an array of CONNECTION_INFO_1 structures. /// /// /// /// /// /// /// Pointer to the address of the buffer that receives the information. 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. /// /// /// Pointer to a value that contains a resume handle which is used to continue an existing connection search. The handle should be /// zero on the first call and left unchanged for subsequent calls. If this parameter is NULL, then no resume handle is stored. /// /// /// If the function succeeds, the return value is NERR_Success. /// If the function fails, the return value is a system error code. For a list of error codes, see System Error Codes. /// /// /// /// Administrator, Server or Print Operator, or Power User group membership is required to successfully execute the /// NetConnectionEnum function. /// /// Examples /// /// The following code sample demonstrates how to list the connections made to a shared resource with a call to the /// NetConnectionEnum function. The sample calls NetConnectionEnum, specifying information level 1 (CONNECTION_INFO_1). /// If there are entries to return, it prints the values of the coni1_username and coni1_netname members. If there are /// no entries to return, the sample prints an appropriate message. Finally, the code sample frees the memory allocated for the /// information buffer. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/nf-lmshare-netconnectionenum NET_API_STATUS NET_API_FUNCTION // NetConnectionEnum( LMSTR servername, LMSTR qualifier, DWORD level, LPBYTE *bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD // totalentries, LPDWORD resume_handle ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("lmshare.h", MSDNShortId = "935ac6e9-78e0-42ae-a454-0a14b03ddc21")] public static extern Win32Error NetConnectionEnum([Optional] string servername, string qualifier, uint level, out SafeNetApiBuffer bufptr, uint prefmaxlen, out uint entriesread, out uint totalentries, ref uint resume_handle); /// /// Forces a resource to close. This function can be used when an error prevents closure by any other means. You should use /// NetFileClose with caution because it does not write data cached on the client system to the file before closing the file. /// /// /// /// 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. /// /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE is defined. /// /// Specifies the file identifier of the opened resource instance to close. /// /// 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_FILE_NOT_FOUND /// The file was not found. /// /// /// /// /// Only members of the Administrators or Server Operators local group can successfully execute the NetFileClose function. /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/nf-lmshare-netfileclose NET_API_STATUS NET_API_FUNCTION NetFileClose( // LMSTR servername, DWORD fileid ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true)] [PInvokeData("lmshare.h", MSDNShortId = "36a5f464-fec3-4b4f-91c3-447ff5ff70af")] public static extern Win32Error NetFileClose([MarshalAs(UnmanagedType.LPWStr)] string servername, uint fileid); /// Returns information about some or all open files on a server, depending on the parameters specified. /// /// /// 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. /// /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE is defined. /// /// /// /// Pointer to a string that specifies a qualifier for the returned information. If this parameter is NULL, all open resources /// are enumerated. If this parameter is not NULL, the function enumerates only resources that have the value of the basepath /// parameter as a prefix. (A prefix is the portion of a path that comes before a backslash.) /// /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE is defined. /// /// /// /// Pointer to a string that specifies the name of the user or the name of the connection. If the string begins with two backslashes /// ("\"), then it indicates the name of the connection, for example, "\127.0.0.1" or "\ClientName". The part of the connection name /// after the backslashes is the same as the client name in the session information structure returned by the NetSessionEnum /// function. If the string does not begin with two backslashes, then it indicates the name of the user. If this parameter is not /// NULL, its value serves as a qualifier for the enumeration. The files returned are limited to those that have user names or /// connection names that match the qualifier. If this parameter is NULL, no user-name qualifier is used. /// /// /// Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This parameter is a pointer to a string that /// specifies the name of the user. If this parameter is not NULL, its value serves as a qualifier for the enumeration. The /// files returned are limited to those that have user names matching the qualifier. If this parameter is NULL, no user-name /// qualifier is used. /// /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE is defined. /// /// /// Specifies the information level of the data. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// 2 /// Return the file identification number. The bufptr parameter points to an array of FILE_INFO_2 structures. /// /// /// 3 /// Return information about the file. The bufptr parameter points to an array of FILE_INFO_3 structures. /// /// /// /// /// /// Pointer to the address of the buffer that receives the information. 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. /// /// /// Pointer to a value that contains a resume handle which is used to continue an existing file search. The handle should be zero on /// the first call and left unchanged for subsequent calls. If this parameter is NULL, 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 not valid. /// /// /// 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 members of the Administrators or Server Operators local group can successfully execute the NetFileEnum function. /// You can call the NetFileGetInfo function to retrieve information about a particular opening of a server resource. /// /// 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 NetFileEnum. For more information, see IADsResource and IADsFileServiceOperations. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/nf-lmshare-netfileenum NET_API_STATUS NET_API_FUNCTION NetFileEnum( // LMSTR servername, LMSTR basepath, LMSTR username, DWORD level, LPBYTE *bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD // totalentries, PDWORD_PTR resume_handle ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("lmshare.h", MSDNShortId = "1375b337-efb0-4be1-94f7-473456a825b5")] public static extern Win32Error NetFileEnum([Optional] string servername, [Optional] string basepath, [Optional] string username, uint level, out SafeNetApiBuffer bufptr, uint prefmaxlen, out uint entriesread, out uint totalentries, ref IntPtr resume_handle); /// Retrieves information about a particular opening of a server resource. /// /// /// 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. /// /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE is defined. /// /// /// Specifies the file identifier of the open resource for which to return information. The value of this parameter must have been /// returned in a previous enumeration call. For more information, see the following Remarks section. /// /// /// Specifies the information level of the data. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// 2 /// Return the file identification number. The bufptr parameter is a pointer to a FILE_INFO_2 structure. /// /// /// 3 /// /// Return the file identification number and other information about the file. The bufptr parameter is a pointer to a FILE_INFO_3 structure. /// /// /// /// /// /// Pointer to the address of the buffer that receives the information. 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. For more information, /// see Network Management Function Buffers and Network Management Function Buffer Lengths. /// /// /// 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_FILE_NOT_FOUND /// The file was not found. /// /// /// ERROR_INVALID_LEVEL /// The value specified for the level parameter is not valid. /// /// /// ERROR_NOT_ENOUGH_MEMORY /// Insufficient memory is available. /// /// /// NERR_BufTooSmall /// The supplied buffer is too small. /// /// /// /// /// /// Only members of the Administrators or Server Operators local group can successfully execute the NetFileGetInfo function. /// /// You can call the NetFileEnum function to retrieve information about multiple files open on a server. /// /// 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 NetFileGetInfo. For more information, see IADsResource and IADsFileServiceOperations. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/nf-lmshare-netfilegetinfo NET_API_STATUS NET_API_FUNCTION // NetFileGetInfo( LMSTR servername, DWORD fileid, DWORD level, LPBYTE *bufptr ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("lmshare.h", MSDNShortId = "d50c05e7-7ddd-4a7d-96f6-51878e52373c")] public static extern Win32Error NetFileGetInfo(string servername, uint fileid, uint level, out SafeNetApiBuffer bufptr); /// Ends a network session between a server and a workstation. /// /// 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 string that specifies the computer name of the client to disconnect. If the UncClientName parameter is NULL, /// then all the sessions of the user identified by the username parameter will be deleted on the server specified by the servername /// parameter. For more information, see NetSessionEnum. /// /// /// Pointer to a string that specifies the name of the user whose session is to be terminated. If this parameter is NULL, all /// users' sessions from the client specified by the UncClientName parameter are to be terminated. /// /// /// 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 not valid. /// /// /// ERROR_NOT_ENOUGH_MEMORY /// Insufficient memory is available. /// /// /// NERR_ClientNameNotFound /// A session does not exist with that computer name. /// /// /// /// /// Only members of the Administrators or Server Operators local group can successfully execute the NetSessionDel 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 session functions. For more information, see /// IADsSession and IADsFileServiceOperations. /// /// Examples /// /// The following code sample demonstrates how to terminate a session between a server and a workstation using a call to the /// NetSessionDel function. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/nf-lmshare-netsessiondel NET_API_STATUS NET_API_FUNCTION // NetSessionDel( LMSTR servername, LMSTR UncClientName, LMSTR username ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("lmshare.h", MSDNShortId = "a1360f5d-9fd0-44af-b9f5-ab9bc057dfe6")] public static extern Win32Error NetSessionDel(string servername, string UncClientName, string username); /// Provides information about sessions established on a 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. /// /// /// Pointer to a string that specifies the name of the computer session for which information is to be returned. If this parameter is /// NULL, NetSessionEnum returns information for all computer sessions on the server. /// /// /// Pointer to a string that specifies the name of the user for which information is to be returned. If this parameter is /// NULL, NetSessionEnum returns information for all users. /// /// /// Specifies the information level of the data. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// 0 /// /// Return the name of the computer that established the session. The bufptr parameter points to an array of SESSION_INFO_0 structures. /// /// /// /// 1 /// /// Return the name of the computer, name of the user, and open files, pipes, and devices on the computer. The bufptr parameter /// points to an array of SESSION_INFO_1 structures. /// /// /// /// 2 /// /// In addition to the information indicated for level 1, return the type of client and how the user established the session. The /// bufptr parameter points to an array of SESSION_INFO_2 structures. /// /// /// /// 10 /// /// Return the name of the computer, name of the user, and active and idle times for the session. The bufptr parameter points to an /// array of SESSION_INFO_10 structures. /// /// /// /// 502 /// /// Return the name of the computer; name of the user; open files, pipes, and devices on the computer; and the name of the transport /// the client is using. The bufptr parameter points to an array of SESSION_INFO_502 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. /// /// /// Pointer to a value that contains a resume handle which is used to continue an existing session search. The handle should be zero /// on the first call and left unchanged for subsequent calls. If resume_handle is NULL, 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 not valid. /// /// /// ERROR_INVALID_PARAMETER /// The specified parameter is not valid. /// /// /// 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_ClientNameNotFound /// A session does not exist with the computer name. /// /// /// NERR_InvalidComputer /// The computer name is not valid. /// /// /// NERR_UserNotFound /// The user name could not be found. /// /// /// /// /// /// Only members of the Administrators or Server Operators local group can successfully execute the NetSessionEnum function at /// level 1 or level 2. No special group membership is required for level 0 or level 10 calls. /// /// /// 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 session functions. For more information, see /// IADsSession and IADsFileServiceOperations. /// /// Examples /// /// The following code sample demonstrates how to retrieve information about current sessions using a call to the /// NetSessionEnum function. The sample calls NetSessionEnum, specifying information level 10 ( SESSION_INFO_10). The /// sample loops through the entries and prints the retrieved information. Finally, the code prints the total number of sessions /// enumerated and frees the memory allocated for the information buffer. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/nf-lmshare-netsessionenum NET_API_STATUS NET_API_FUNCTION // NetSessionEnum( LMSTR servername, LMSTR UncClientName, LMSTR username, DWORD level, LPBYTE *bufptr, DWORD prefmaxlen, LPDWORD // entriesread, LPDWORD totalentries, LPDWORD resume_handle ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("lmshare.h", MSDNShortId = "5923a8cc-bf7a-4ffa-b089-fd7f26ee42d2")] public static extern Win32Error NetSessionEnum([Optional] string servername, string UncClientName, [Optional] string username, uint level, out SafeNetApiBuffer bufptr, uint prefmaxlen, out uint entriesread, out uint totalentries, ref uint resume_handle); /// Retrieves information about a session established between a particular server and workstation. /// /// 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 string that specifies the name of the computer session for which information is to be returned. This parameter is /// required and cannot be NULL. For more information, see NetSessionEnum. /// /// /// Pointer to a string that specifies the name of the user whose session information is to be returned. This parameter is required /// and cannot be NULL. /// /// /// Specifies the information level of the data. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// 0 /// Return the name of the computer that established the session. The bufptr parameter points to a SESSION_INFO_0 structure. /// /// /// 1 /// /// Return the name of the computer, name of the user, and open files, pipes, and devices on the computer. The bufptr parameter /// points to a SESSION_INFO_1 structure. /// /// /// /// 2 /// /// In addition to the information indicated for level 1, return the type of client and how the user established the session. The /// bufptr parameter points to a SESSION_INFO_2 structure. /// /// /// /// 10 /// /// Return the name of the computer; name of the user; and active and idle times for the session. The bufptr parameter points to a /// SESSION_INFO_10 structure. /// /// /// /// /// /// /// Pointer to the buffer that receives the data. The format of this data depends on the value of the level parameter. For more /// information, see Network Management Function Buffers and Network Management Function Buffer Lengths. /// /// 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. /// 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 not valid. /// /// /// ERROR_INVALID_PARAMETER /// The specified parameter is not valid. /// /// /// ERROR_NOT_ENOUGH_MEMORY /// Insufficient memory is available. /// /// /// NERR_ClientNameNotFound /// A session does not exist with the computer name. /// /// /// NERR_InvalidComputer /// The computer name is not valid. /// /// /// NERR_UserNotFound /// The user name could not be found. /// /// /// /// /// /// Only members of the Administrators or Server Operators local group can successfully execute the NetSessionGetInfo function /// at level 1 or level 2. No special group membership is required for level 0 or level 10 calls. /// /// /// 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 session functions. For more information, see /// IADsSession and IADsFileServiceOperations. /// /// /// If you call this function at information level 1 or 2 on a member server or workstation, all authenticated users can view the information. /// /// Examples /// /// The following code sample demonstrates how to retrieve information about a session using a call to the NetSessionGetInfo /// function. The sample calls NetSessionGetInfo, specifying information level 10 ( SESSION_INFO_10). If the call succeeds, /// the code prints information about the session. Finally, the sample frees the memory allocated for the information buffer. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/nf-lmshare-netsessiongetinfo NET_API_STATUS NET_API_FUNCTION // NetSessionGetInfo( LMSTR servername, LMSTR UncClientName, LMSTR username, DWORD level, LPBYTE *bufptr ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("lmshare.h", MSDNShortId = "d44fb8d8-2b64-4268-8603-7784e2c5f2d5")] public static extern Win32Error NetSessionGetInfo([Optional] string servername, string UncClientName, string username, uint level, out SafeNetApiBuffer bufptr); /// Shares a server resource. /// /// 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 /// /// /// 2 /// /// Specifies information about the shared resource, including the name of the resource, type and permissions, and number of /// connections. The buf parameter points to a SHARE_INFO_2 structure. /// /// /// /// 502 /// /// Specifies information about the shared resource, including the name of the resource, type and permissions, number of connections, /// and other pertinent information. The buf parameter points to a SHARE_INFO_502 structure. /// /// /// /// 503 /// /// Specifies information about the shared resource, including the name of the resource, type and permissions, number of connections, /// and other pertinent information. The buf parameter points to a SHARE_INFO_503 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. /// /// /// Pointer to a value that receives the index of the first member of the share 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 NetShareSetInfo function. /// /// /// 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 not valid. /// /// /// ERROR_INVALID_NAME /// The character or file system name is not valid. /// /// /// ERROR_INVALID_PARAMETER /// The specified parameter is not valid. /// /// /// NERR_DuplicateShare /// The share name is already in use on this server. /// /// /// NERR_RedirectedPath /// The operation is not valid for a redirected resource. The specified device name is assigned to a shared resource. /// /// /// NERR_UnknownDevDir /// The device or directory does not exist. /// /// /// /// /// /// This function applies only to Server Message Block (SMB) shares. For other types of shares, such as Distributed File System (DFS) /// or WebDAV shares, use Windows Networking (WNet) functions, which support all types of shares. /// /// /// Only members of the Administrators, System Operators, or Power Users local group can add file shares with a call to the /// NetShareAdd function. The Print Operator can add printer shares. /// /// /// 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 share functions. For more information, see IADsFileShare. /// /// /// If 503 is specified for the level parameter, the remote server specified in the shi503_servername member of the /// SHARE_INFO_503 structure must have been bound to a transport protocol using the NetServerTransportAddEx function. In the call to /// NetServerTransportAddEx, either 2 or 3 must have been specified for the level parameter, and the SVTI2_SCOPED_NAME /// flag must have been specified in the SERVER_TRANSPORT_INFO_2 structure for the transport protocol. /// /// Examples /// /// The following code sample demonstrates how to share a network resource using a call to the NetShareAdd function. The code /// sample fills in the members of the SHARE_INFO_2 structure and calls NetShareAdd, specifying information level 2. A /// password is not required because these platforms do not support share-level security. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/nf-lmshare-netshareadd NET_API_STATUS NET_API_FUNCTION NetShareAdd( // LMSTR servername, DWORD level, LPBYTE buf, LPDWORD parm_err ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("lmshare.h", MSDNShortId = "8b51c155-24e8-4d39-b818-eb2d1bb0ee8b")] public static extern Win32Error NetShareAdd([Optional] string servername, uint level, IntPtr buf, out uint parm_err); /// Checks whether or not a server is sharing a device. /// /// 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 string that specifies the name of the device to check for shared access. /// /// /// Pointer to a variable that receives a bitmask of flags that specify the type of the shared device. This parameter is set only if /// the function returns successfully. /// /// One of the following flags may be specified. /// /// /// Value /// Meaning /// /// /// STYPE_DISKTREE /// Disk drive. /// /// /// STYPE_PRINTQ /// Print queue. /// /// /// STYPE_DEVICE /// Communication device. /// /// /// STYPE_IPC /// Interprocess communication (IPC). /// /// /// In addition, one or both of the following flags may be specified. /// /// /// Value /// Meaning /// /// /// STYPE_SPECIAL /// /// Special share reserved for interprocess communication (IPC$) or remote administration of the server (ADMIN$). Can also refer to /// administrative shares such as C$, D$, E$, and so forth. For more information, see Network Share Functions. /// /// /// /// STYPE_TEMPORARY /// A temporary share. /// /// /// /// /// 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_NOT_ENOUGH_MEMORY /// Insufficient memory is available. /// /// /// NERR_DeviceNotShared /// The device is not shared. /// /// /// /// /// /// This function applies only to Server Message Block (SMB) shares. For other types of shares, such as Distributed File System (DFS) /// or WebDAV shares, use Windows Networking (WNet) functions, which support all types of shares. /// /// No special group membership is required to successfully execute the NetShareCheck 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 share functions. For more information, see IADsFileShare. /// /// Examples /// /// The following code sample demonstrates how to check whether a server is sharing a device, using a call to the /// NetShareCheck function. The function returns the type of device being shared, as described in the preceding documentation /// for the type parameter. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/nf-lmshare-netsharecheck NET_API_STATUS NET_API_FUNCTION // NetShareCheck( LMSTR servername, LMSTR device, LPDWORD type ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("lmshare.h", MSDNShortId = "8453dcd2-5c58-4fe4-9426-0fd51647394d")] public static extern Win32Error NetShareCheck([Optional] string servername, string device, out STYPE type); /// /// Deletes a share name from a server's list of shared resources, disconnecting all connections to the shared resource. /// /// The extended function NetShareDelEx allows the caller to specify a SHARE_INFO_0, SHARE_INFO_1, SHARE_INFO_2, SHARE_INFO_502, or /// SHARE_INFO_503 structure. /// /// /// /// /// 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. /// /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE is defined. /// /// /// Pointer to a string that specifies the name of the share to delete. /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE is defined. /// /// Reserved, must be 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 /// Description /// /// /// ERROR_ACCESS_DENIED /// The user does not have access to the requested information. /// /// /// ERROR_INVALID_PARAMETER /// The specified parameter is not valid. /// /// /// ERROR_NOT_ENOUGH_MEMORY /// Insufficient memory is available. /// /// /// NERR_NetNameNotFound /// The share name does not exist. /// /// /// /// /// /// This function applies only to Server Message Block (SMB) shares. For other types of shares, such as Distributed File System (DFS) /// or WebDAV shares, use Windows Networking (WNet) functions, which support all types of shares. /// /// /// Only members of the Administrators, Server Operators, or Power Users local group, or those with Server Operator group membership, /// can successfully delete file shares with a call to the NetShareDel function. The Print Operator can delete printer shares. /// /// /// 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 share functions. For more information, see IADsFileShare. /// /// Examples /// The following code sample demonstrates how to delete a share using a call to the NetShareDel function. /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/nf-lmshare-netsharedel NET_API_STATUS NET_API_FUNCTION NetShareDel( // LMSTR servername, LMSTR netname, DWORD reserved ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("lmshare.h", MSDNShortId = "374b8f81-b3d6-4967-bd4a-ffd3fdc3cf7c")] public static extern Win32Error NetShareDel([Optional] string servername, string netname, uint reserved = 0); /// /// Deletes a share name from a server's list of shared resources, which disconnects all connections to that share. This function, /// which is an extended version of the NetShareDel function, allows the caller to specify a SHARE_INFO_0, SHARE_INFO_1, /// SHARE_INFO_2, SHARE_INFO_502, or SHARE_INFO_503 structure. /// /// /// /// 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. /// /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE is defined. /// /// /// Specifies the information level of the data. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// 0, 1, 2, or 502 /// /// Specifies information about the shared resource, including the name of the resource, type and permissions, and number of /// connections. The buf parameter points to a SHARE_INFO_0, SHARE_INFO_1, SHARE_INFO_2, or SHARE_INFO_502 structure. /// /// /// /// 503 /// /// Specifies information about the shared resource, including the name of the resource, type and permissions, number of connections, /// and other pertinent information. The buf parameter points to a SHARE_INFO_503 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_INTERNAL_ERROR /// An internal error occurred. /// /// /// ERROR_INVALID_LEVEL /// The value specified for the level parameter is not valid. /// /// /// ERROR_NOT_SUPPORTED /// The request is not supported. /// /// /// /// /// /// If 503 is specified for the level parameter, the buf parameter points to a SHARE_INFO_503 structure, and the /// shi503_netname and shi503_servername members of that structure are used to look up the shared resource on the /// server; the other members are ignored. The remote server specified in the shi503_servername member must have been bound to /// a transport protocol using the NetServerTransportAddEx function. In the call to NetServerTransportAddEx, either 2 or 3 /// must have been specified for the level parameter, and the SVTI2_SCOPED_NAME flag must have been specified in the /// SERVER_TRANSPORT_INFO_2 structure for the transport protocol. /// /// /// If 0, 1, 2, or 502 is specified for the level parameter, the buf parameter points to a SHARE_INFO_0, SHARE_INFO_1, SHARE_INFO_2, /// or SHARE_INFO_502 structure, and the shi0_netname, shi1_netname, shi2_netname, or shi502_netname /// member of that structure is used; the other members are ignored. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/nf-lmshare-netsharedelex NET_API_STATUS NET_API_FUNCTION // NetShareDelEx( LMSTR servername, DWORD level, LPBYTE buf ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("lmshare.h", MSDNShortId = "2461c533-351b-48f4-b660-cb17ac3398fa")] public static extern Win32Error NetShareDelEx([Optional] string servername, uint level, IntPtr buf); /// /// Retrieves information about each shared resource on a server. /// /// You can also use the WNetEnumResource function to retrieve resource information. However, WNetEnumResource does not /// enumerate hidden shares or users connected to a share. /// /// /// /// 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 share names. The bufptr parameter points to an array of SHARE_INFO_0 structures. /// /// /// 1 /// /// Return information about shared resources, including the name and type of the resource, and a comment associated with the /// resource. The bufptr parameter points to an array of SHARE_INFO_1 structures. /// /// /// /// 2 /// /// Return information about shared resources, including name of the resource, type and permissions, password, and number of /// connections. The bufptr parameter points to an array of SHARE_INFO_2 structures. /// /// /// /// 502 /// /// Return information about shared resources, including name of the resource, type and permissions, number of connections, and other /// pertinent information. The bufptr parameter points to an array of SHARE_INFO_502 structures. Shares from different scopes are not /// returned. For more information about scoping, see the Remarks section of the documentation for the NetServerTransportAddEx function. /// /// /// /// 503 /// /// Return information about shared resources, including the name of the resource, type and permissions, number of connections, and /// other pertinent information. The bufptr parameter points to an array of SHARE_INFO_503 structures. Shares from all scopes are /// returned. If the shi503_servername member of this structure is "*", there is no configured server name and the NetShareEnum /// function enumerates shares for all the unscoped names. Windows Server 2003 and Windows XP: This information level is not supported. /// /// /// /// /// /// 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. Note that applications should /// consider this value only as a hint. /// /// /// Pointer to a value that contains a resume handle which is used to continue an existing share search. The handle should be zero on /// the first call and left unchanged for subsequent calls. If resume_handle is NULL, then no resume handle is stored. /// /// /// If the function succeeds, the return value is NERR_Success. /// If the function fails, the return value is a system error code. For a list of error codes, see System Error Codes. /// /// /// /// This function applies only to Server Message Block (SMB) shares. For other types of shares, such as Distributed File System (DFS) /// or WebDAV shares, use Windows Networking (WNet) functions, which support all types of shares. /// /// /// For interactive users (users who are logged on locally to the machine), no special group membership is required to execute the /// NetShareEnum function. For non-interactive users, Administrator, Power User, Print Operator, or Server Operator group /// membership is required to successfully execute the NetShareEnum function at levels 2, 502, and 503. No special group /// membership is required for level 0 or level 1 calls. /// /// /// Windows Server 2003 and Windows XP: For all users, Administrator, Power User, Print Operator, or Server Operator group /// membership is required to successfully execute the NetShareEnum function at levels 2 and 502. /// /// /// To retrieve a value that indicates whether a share is the root volume in a DFS tree structure, you must call the NetShareGetInfo /// function and specify information level 1005. /// /// /// 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 share functions. For more information, see IADsFileShare. /// /// Examples /// /// The following code sample demonstrates how to retrieve information about each shared resource on a server using a call to the /// NetShareEnum function. The sample calls NetShareEnum, specifying information level 502 (SHARE_INFO_502). If the /// call succeeds, the code loops through the entries and prints information about each share. The sample also calls the /// IsValidSecurityDescriptor function to validate the shi502_security_descriptor member. Finally, the code sample frees the /// memory allocated for the information buffer. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/nf-lmshare-netshareenum NET_API_STATUS NET_API_FUNCTION NetShareEnum( // 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("lmshare.h", MSDNShortId = "9114c54d-3905-4d40-9162-b3ea605f6fcb")] public static extern Win32Error NetShareEnum([Optional] string servername, uint level, out SafeNetApiBuffer bufptr, uint prefmaxlen, out uint entriesread, out uint totalentries, ref uint resume_handle); /// Retrieves information about a particular shared resource on a 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. /// /// Pointer to a string that specifies the name of the share for which to return information. /// /// Specifies the information level of the data. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// 0 /// Return the share name. The bufptr parameter points to a SHARE_INFO_0 structure. /// /// /// 1 /// /// Return information about the shared resource, including the name and type of the resource, and a comment associated with the /// resource. The bufptr parameter points to a SHARE_INFO_1 structure. /// /// /// /// 2 /// /// Return information about the shared resource, including name of the resource, type and permissions, password, and number of /// connections. The bufptr parameter points to a SHARE_INFO_2 structure. /// /// /// /// 501 /// /// Return the name and type of the resource, and a comment associated with the resource. The bufptr parameter points to a /// SHARE_INFO_501 structure. /// /// /// /// 502 /// /// Return information about the shared resource, including name of the resource, type and permissions, number of connections, and /// other pertinent information. The bufptr parameter points to a SHARE_INFO_502 structure. /// /// /// /// 503 /// /// Specifies information about the shared resource, including the name of the resource, type and permissions, number of connections, /// and other pertinent information. The buf parameter points to a SHARE_INFO_503 structure. If the shi503_servername member of this /// structure is "*", there is no configured server name. Windows Server 2003 and Windows XP: This information level is not supported. /// /// /// /// 1005 /// /// Return a value that indicates whether the share is the root volume in a Dfs tree structure. The bufptr parameter points to a /// SHARE_INFO_1005 structure. /// /// /// /// /// /// /// Pointer to the buffer that receives the data. The format of this data depends on the value of the level parameter. For more /// information, see Network Management Function Buffers. /// /// 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. /// 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 not valid. /// /// /// ERROR_INVALID_PARAMETER /// The specified parameter is not valid. /// /// /// ERROR_NOT_ENOUGH_MEMORY /// Insufficient memory is available. /// /// /// NERR_NetNameNotFound /// The share name does not exist. /// /// /// /// /// /// This function applies only to Server Message Block (SMB) shares. For other types of shares, such as Distributed File System (DFS) /// or WebDAV shares, use Windows Networking (WNet) functions, which support all types of shares. /// /// /// For interactive users (users who are logged on locally to the machine), no special group membership is required to execute the /// NetShareGetInfo function. For non-interactive users, Administrator, Power User, Print Operator, or Server Operator group /// membership is required to successfully execute the NetShareEnum function at levels 2, 502, and 503. No special group membership /// is required for level 0 or level 1 calls. /// /// /// Windows Server 2003 and Windows XP: For all users, Administrator, Power User, Print Operator, or Server Operator group /// membership is required to successfully execute the NetShareGetInfo function at levels 2 and 502. /// /// /// 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 share functions. For more information, see IADsFileShare. /// /// /// If 503 is specified for the level parameter, the remote server specified in the shi503_servername member of the /// SHARE_INFO_503 structure must have been bound to a transport protocol using the NetServerTransportAddEx function. In the call to /// NetServerTransportAddEx, either 2 or 3 must have been specified for the level parameter, and the SVTI2_SCOPED_NAME /// flag must have been specified in the SERVER_TRANSPORT_INFO_2 structure for the transport protocol. /// /// Examples /// /// The following code sample demonstrates how to retrieve information about a particular shared resource using a call to the /// NetShareGetInfo function. The sample calls NetShareGetInfo, specifying information level 502 ( SHARE_INFO_502). If /// the call succeeds, the code prints the retrieved data. The sample also calls the IsValidSecurityDescriptor function to validate /// the shi502_security_descriptor member. Finally, the sample frees the memory allocated for the information buffer. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/nf-lmshare-netsharegetinfo NET_API_STATUS NET_API_FUNCTION // NetShareGetInfo( LMSTR servername, LMSTR netname, DWORD level, LPBYTE *bufptr ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("lmshare.h", MSDNShortId = "672ea208-4048-4d2f-9606-ee3e2133765b")] public static extern Win32Error NetShareGetInfo([Optional] string servername, string netname, uint level, out SafeNetApiBuffer bufptr); /// Sets the parameters of a shared resource. /// /// 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 string that specifies the name of the share to set information on. /// /// Specifies the information level of the data. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// 1 /// /// Specifies information about the shared resource, including the name and type of the resource, and a comment associated with the /// resource. The buf parameter points to a SHARE_INFO_1 structure. /// /// /// /// 2 /// /// Specifies information about the shared resource, including the name of the resource, type and permissions, password, and number /// of connections. The buf parameter points to a SHARE_INFO_2 structure. /// /// /// /// 502 /// /// Specifies information about the shared resource, including the name and type of the resource, required permissions, number of /// connections, and other pertinent information. The buf parameter points to a SHARE_INFO_502 structure. /// /// /// /// 503 /// /// Specifies the name of the shared resource. The buf parameter points to a SHARE_INFO_503 structure. All members of this structure /// except shi503_servername are ignored by the NetShareSetInfo function. Windows Server 2003 and Windows XP: This information level /// is not supported. /// /// /// /// 1004 /// Specifies a comment associated with the shared resource. The buf parameter points to a SHARE_INFO_1004 structure. /// /// /// 1005 /// Specifies a set of flags describing the shared resource. The buf parameter points to a SHARE_INFO_1005 structure. /// /// /// 1006 /// /// Specifies the maximum number of concurrent connections that the shared resource can accommodate. The buf parameter points to a /// SHARE_INFO_1006 structure. /// /// /// /// 1501 /// Specifies the SECURITY_DESCRIPTOR associated with the specified share. The buf parameter points to a SHARE_INFO_1501 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. /// /// /// Pointer to a value that receives the index of the first member of the share 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 not valid. /// /// /// ERROR_INVALID_PARAMETER /// The specified parameter is not valid. For more information, see the following Remarks section. /// /// /// NERR_NetNameNotFound /// The share name does not exist. /// /// /// /// /// /// This function applies only to Server Message Block (SMB) shares. For other types of shares, such as Distributed File System (DFS) /// or WebDAV shares, use Windows Networking (WNet) functions, which support all types of shares. /// /// /// Only members of the Administrators or Power Users local group, or those with Print or Server Operator group membership, can /// successfully execute the NetShareSetInfo function. The Print Operator can set information only about Printer shares. /// /// /// If the NetShareSetInfo function returns ERROR_INVALID_PARAMETER, you can use the parm_err parameter to indicate the /// first member of the share information structure that is not valid. (A share information structure begins with SHARE_INFO_ /// and its format is specified by the level parameter.) The following table lists the values that can be returned in the parm_err /// parameter and the corresponding structure member that is in error. (The prefix shi* indicates that the member can begin /// with multiple prefixes, for example, shi2 or shi502_.) /// /// /// /// Value /// Member /// /// /// SHARE_NETNAME_PARMNUM /// shi*_netname /// /// /// SHARE_TYPE_PARMNUM /// shi*_type /// /// /// SHARE_REMARK_PARMNUM /// shi*_remark /// /// /// SHARE_PERMISSIONS_PARMNUM /// shi*_permissions /// /// /// SHARE_MAX_USES_PARMNUM /// shi*_max_uses /// /// /// SHARE_CURRENT_USES_PARMNUM /// shi*_current_uses /// /// /// SHARE_PATH_PARMNUM /// shi*_path /// /// /// SHARE_PASSWD_PARMNUM /// shi*_passwd /// /// /// SHARE_FILE_SD_PARMNUM /// shi*_security_descriptor /// /// /// /// 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 share functions. For more information, see IADsFileShare. /// /// /// If 503 is specified for the level parameter, the remote server specified in the shi503_servername member of the /// SHARE_INFO_503 structure must have been bound to a transport protocol using the NetServerTransportAddEx function. In the call to /// NetServerTransportAddEx, either 2 or 3 must have been specified for the level parameter, and the SVTI2_SCOPED_NAME /// flag must have been specified in the SERVER_TRANSPORT_INFO_2 structure for the transport protocol. /// /// Examples /// /// The following code sample demonstrates how to set the comment associated with a shared resource using a call to the /// NetShareSetInfo function. To do this, the sample specifies information level 1004 (SHARE_INFO_1004). /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/nf-lmshare-netsharesetinfo NET_API_STATUS NET_API_FUNCTION // NetShareSetInfo( LMSTR servername, LMSTR netname, DWORD level, LPBYTE buf, LPDWORD parm_err ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("lmshare.h", MSDNShortId = "216b0b78-87da-4734-ad07-5ad1c9edf494")] public static extern Win32Error NetShareSetInfo([Optional] string servername, string netname, uint level, IntPtr buf, out uint parm_err); /// Contains the identification number of a connection. // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/ns-lmshare-_connection_info_0 typedef struct _CONNECTION_INFO_0 { // DWORD coni0_id; } CONNECTION_INFO_0, *PCONNECTION_INFO_0, *LPCONNECTION_INFO_0; [PInvokeData("lmshare.h", MSDNShortId = "aebafe24-1216-48ab-92db-df8f77d36f26")] [StructLayout(LayoutKind.Sequential)] public struct CONNECTION_INFO_0 { /// Specifies a connection identification number. public uint coni0_id; } /// /// Contains the identification number of a connection, number of open files, connection time, number of users on the connection, and /// the type of connection. /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/ns-lmshare-connection_info_1 typedef struct _CONNECTION_INFO_1 { // DWORD coni1_id; DWORD coni1_type; DWORD coni1_num_opens; DWORD coni1_num_users; DWORD coni1_time; LMSTR coni1_username; LMSTR // coni1_netname; } CONNECTION_INFO_1, *PCONNECTION_INFO_1, *LPCONNECTION_INFO_1; [PInvokeData("lmshare.h", MSDNShortId = "9904c448-dcc4-47cc-a2e0-7df8d4d37f3f")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct CONNECTION_INFO_1 { /// Specifies a connection identification number. public uint coni1_id; /// /// A combination of values that specify the type of connection made from the local device name to the shared resource. /// One of the following values may be specified. You can isolate these values by using the STYPE_MASK value. /// /// /// Value /// Meaning /// /// /// STYPE_DISKTREE /// Disk drive. /// /// /// STYPE_PRINTQ /// Print queue. /// /// /// STYPE_DEVICE /// Communication device. /// /// /// STYPE_IPC /// Interprocess communication (IPC). /// /// /// In addition, one or both of the following values may be specified. /// /// /// Value /// Meaning /// /// /// STYPE_SPECIAL /// /// Special share reserved for interprocess communication (IPC$) or remote administration of the server (ADMIN$). Can also refer /// to administrative shares such as C$, D$, E$, and so forth. For more information, see Network Share Functions. /// /// /// /// STYPE_TEMPORARY /// A temporary share. /// /// /// public STYPE coni1_type; /// Specifies the number of files currently open as a result of the connection. public uint coni1_num_opens; /// Specifies the number of users on the connection. public uint coni1_num_users; /// Specifies the number of seconds that the connection has been established. public uint coni1_time; /// /// /// Pointer to a string. If the server sharing the resource is running with user-level security, the coni1_username member /// describes which user made the connection. If the server is running with share-level security, coni1_username describes /// which computer (computername) made the connection. Note that Windows does not support share-level security. /// /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string coni1_username; /// /// /// Pointer to a string that specifies either the share name of the server's shared resource or the computername of the client. /// The value of this member depends on which name was specified as the qualifier parameter to the NetConnectionEnum function. /// The name not specified in the qualifier parameter to NetConnectionEnum is automatically supplied to coni1_netname. /// /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string coni1_netname; } /// Contains the identification number for a file, device, or pipe. // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/ns-lmshare-_file_info_2 typedef struct _FILE_INFO_2 { DWORD fi2_id; } // FILE_INFO_2, *PFILE_INFO_2, *LPFILE_INFO_2; [PInvokeData("lmshare.h", MSDNShortId = "c80090d5-7064-4809-9185-02116f7ac2ef")] [StructLayout(LayoutKind.Sequential)] public struct FILE_INFO_2 { /// Specifies a DWORD value that contains the identification number assigned to the resource when it is opened. public uint fi2_id; } /// Contains the identification number and other pertinent information about files, devices, and pipes. // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/ns-lmshare-_file_info_3 typedef struct _FILE_INFO_3 { DWORD fi3_id; // DWORD fi3_permissions; DWORD fi3_num_locks; LMSTR fi3_pathname; LMSTR fi3_username; } FILE_INFO_3, *PFILE_INFO_3, *LPFILE_INFO_3; [PInvokeData("lmshare.h", MSDNShortId = "67f5fa89-12c7-46fb-a118-de4bfed96923")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct FILE_INFO_3 { /// Specifies a DWORD value that contains the identification number assigned to the resource when it is opened. public uint fi3_id; /// /// /// Specifies a DWORD value that contains the access permissions associated with the opening application. This member can be one /// or more of the following values. /// /// /// /// Value /// Meaning /// /// /// PERM_FILE_READ /// Permission to read a resource and, by default, execute the resource. /// /// /// PERM_FILE_WRITE /// Permission to write to a resource. /// /// /// PERM_FILE_CREATE /// Permission to create a resource; data can be written when creating the resource. /// /// /// public uint fi3_permissions; /// Specifies a DWORD value that contains the number of file locks on the file, device, or pipe. public uint fi3_num_locks; /// /// Pointer to a string that specifies the path of the opened resource. /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string fi3_pathname; /// /// /// Pointer to a string that specifies which user (on servers that have user-level security) or which computer (on servers that /// have share-level security) opened the resource. Note that Windows does not support share-level security. /// /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string fi3_username; } /// Contains the name of the computer that established the session. // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/ns-lmshare-_session_info_0 typedef struct _SESSION_INFO_0 { LMSTR // sesi0_cname; } SESSION_INFO_0, *PSESSION_INFO_0, *LPSESSION_INFO_0; [PInvokeData("lmshare.h", MSDNShortId = "6b39df47-f25c-41dd-ba15-6e6806c4ec89")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct SESSION_INFO_0 { /// /// Pointer to a Unicode string that contains the name of the computer that established the session. This string cannot contain a /// backslash (). /// public string sesi0_cname; } /// /// Contains information about the session, including name of the computer; name of the user; and open files, pipes, and devices on /// the computer. /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/ns-lmshare-_session_info_1 typedef struct _SESSION_INFO_1 { LMSTR // sesi1_cname; LMSTR sesi1_username; DWORD sesi1_num_opens; DWORD sesi1_time; DWORD sesi1_idle_time; DWORD sesi1_user_flags; } // SESSION_INFO_1, *PSESSION_INFO_1, *LPSESSION_INFO_1; [PInvokeData("lmshare.h", MSDNShortId = "bc1c985e-b8af-4134-9ae4-511d82e3909b")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct SESSION_INFO_1 { /// /// Pointer to a Unicode string specifying the name of the computer that established the session. This string cannot contain a /// backslash (). /// public string sesi1_cname; /// Pointer to a Unicode string specifying the name of the user who established the session. public string sesi1_username; /// Specifies a DWORD value that contains the number of files, devices, and pipes opened during the session. public uint sesi1_num_opens; /// Specifies a DWORD value that contains the number of seconds the session has been active. public uint sesi1_time; /// Specifies a DWORD value that contains the number of seconds the session has been idle. public uint sesi1_idle_time; /// /// /// Specifies a DWORD value that describes how the user established the session. This member can be one of the following values. /// /// /// /// Value /// Meaning /// /// /// SESS_GUEST /// The user specified by the sesi1_username member established the session using a guest account. /// /// /// SESS_NOENCRYPTION /// The user specified by the sesi1_username member established the session without using password encryption. /// /// /// public SESS sesi1_user_flags; } /// /// Contains information about the session, including name of the computer; name of the user; and active and idle times for the session. /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/ns-lmshare-_session_info_10 typedef struct _SESSION_INFO_10 { LMSTR // sesi10_cname; LMSTR sesi10_username; DWORD sesi10_time; DWORD sesi10_idle_time; } SESSION_INFO_10, *PSESSION_INFO_10, *LPSESSION_INFO_10; [PInvokeData("lmshare.h", MSDNShortId = "a23a5647-f99d-4cb8-9d84-93653a3e7428")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct SESSION_INFO_10 { /// /// Pointer to a Unicode string specifying the name of the computer that established the session. This string cannot contain a /// backslash (). /// public string sesi10_cname; /// Pointer to a Unicode string specifying the name of the user who established the session. public string sesi10_username; /// Specifies the number of seconds the session has been active. public uint sesi10_time; /// Specifies the number of seconds the session has been idle. public uint sesi10_idle_time; } /// /// Contains information about the session, including name of the computer; name of the user; open files, pipes, and devices on the /// computer; and the type of client that established the session. /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/ns-lmshare-_session_info_2 typedef struct _SESSION_INFO_2 { LMSTR // sesi2_cname; LMSTR sesi2_username; DWORD sesi2_num_opens; DWORD sesi2_time; DWORD sesi2_idle_time; DWORD sesi2_user_flags; LMSTR // sesi2_cltype_name; } SESSION_INFO_2, *PSESSION_INFO_2, *LPSESSION_INFO_2; [PInvokeData("lmshare.h", MSDNShortId = "c3429eba-4277-4dc7-9255-cd2ff18dc583")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct SESSION_INFO_2 { /// /// Pointer to a Unicode string specifying the name of the computer that established the session. This string cannot contain a /// backslash (). /// public string sesi2_cname; /// Pointer to a Unicode string specifying the name of the user who established the session. public string sesi2_username; /// Specifies a DWORD value that contains the number of files, devices, and pipes opened during the session. public uint sesi2_num_opens; /// Specifies a DWORD value that contains the number of seconds the session has been active. public uint sesi2_time; /// Specifies a DWORD value that contains the number of seconds the session has been idle. public uint sesi2_idle_time; /// /// /// Specifies a DWORD value that describes how the user established the session. This member can be one of the following values. /// /// /// /// Value /// Meaning /// /// /// SESS_GUEST /// The user specified by the sesi2_username member established the session using a guest account. /// /// /// SESS_NOENCRYPTION /// The user specified by the sesi2_username member established the session without using password encryption. /// /// /// public SESS sesi2_user_flags; /// /// /// Pointer to a Unicode string that specifies the type of client that established the session. Following are the defined types /// for LAN Manager servers. /// /// /// /// Value /// Meaning /// /// /// DOS LM 1.0 /// LAN Manager for MS-DOS 1.0 clients /// /// /// DOS LM 2.0 /// LAN Manager for MS-DOS 2.0 clients /// /// /// OS/2 LM 1.0 /// LAN Manager for MS-OS/2 1.0 clients /// /// /// OS/2 LM 2.0 /// LAN Manager for MS-OS/2 2.0 clients /// /// /// Sessions from LAN Manager servers running UNIX also will appear as LAN Manager 2.0. /// public string sesi2_cltype_name; } /// /// Contains information about the session, including name of the computer; name of the user; open files, pipes, and devices on the /// computer; and the name of the transport the client is using. /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/ns-lmshare-_session_info_502 typedef struct _SESSION_INFO_502 { LMSTR // sesi502_cname; LMSTR sesi502_username; DWORD sesi502_num_opens; DWORD sesi502_time; DWORD sesi502_idle_time; DWORD // sesi502_user_flags; LMSTR sesi502_cltype_name; LMSTR sesi502_transport; } SESSION_INFO_502, *PSESSION_INFO_502, *LPSESSION_INFO_502; [PInvokeData("lmshare.h", MSDNShortId = "a86a00ae-f60a-4b12-a9ac-4b96f9abd6a2")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct SESSION_INFO_502 { /// /// Pointer to a Unicode string specifying the name of the computer that established the session. This string cannot contain a /// backslash (). /// public string sesi502_cname; /// Pointer to a Unicode string specifying the name of the user who established the session. public string sesi502_username; /// Specifies the number of files, devices, and pipes opened during the session. public uint sesi502_num_opens; /// Specifies the number of seconds the session has been active. public uint sesi502_time; /// Specifies the number of seconds the session has been idle. public uint sesi502_idle_time; /// /// Specifies a value that describes how the user established the session. This member can be one of the following values. /// /// /// Value /// Meaning /// /// /// SESS_GUEST /// The user specified by the sesi502_username member established the session using a guest account. /// /// /// SESS_NOENCRYPTION /// The user specified by the sesi502_username member established the session without using password encryption. /// /// /// public SESS sesi502_user_flags; /// /// /// Pointer to a Unicode string that specifies the type of client that established the session. Following are the defined types /// for LAN Manager servers. /// /// /// /// Value /// Meaning /// /// /// DOS LM 1.0 /// LAN Manager for MS-DOS 1.0 clients. /// /// /// DOS LM 2.0 /// LAN Manager for MS-DOS 2.0 clients. /// /// /// OS/2 LM 1.0 /// LAN Manager for MS-OS/2 1.0 clients. /// /// /// OS/2 LM 2.0 /// LAN Manager for MS-OS/2 2.0 clients. /// /// /// Sessions from LAN Manager servers running UNIX also will appear as LAN Manager 2.0. /// public string sesi502_cltype_name; /// Specifies the name of the transport that the client is using to communicate with the server. public string sesi502_transport; } /// Contains the name of the shared resource. // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/ns-lmshare-_share_info_0 typedef struct _SHARE_INFO_0 { LMSTR // shi0_netname; } SHARE_INFO_0, *PSHARE_INFO_0, *LPSHARE_INFO_0; [PInvokeData("lmshare.h", MSDNShortId = "47a74c71-1fcb-4c49-93b5-ea7cf3a0e567")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct SHARE_INFO_0 { /// Pointer to a Unicode string specifying the share name of a resource. public string shi0_netname; } /// /// Contains information about the shared resource, including the name and type of the resource, and a comment associated with the resource. /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/ns-lmshare-_share_info_1 typedef struct _SHARE_INFO_1 { LMSTR // shi1_netname; DWORD shi1_type; LMSTR shi1_remark; } SHARE_INFO_1, *PSHARE_INFO_1, *LPSHARE_INFO_1; [PInvokeData("lmshare.h", MSDNShortId = "9bc69340-4ea5-4180-ae5c-667c0a245b66")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct SHARE_INFO_1 { /// /// Pointer to a Unicode string specifying the share name of a resource. Calls to the NetShareSetInfo function ignore this member. /// public string shi1_netname; /// /// /// A combination of values that specify the type of the shared resource. Calls to the NetShareSetInfo function ignore /// this member. /// /// One of the following values may be specified. You can isolate these values by using the STYPE_MASK value. /// /// /// Value /// Meaning /// /// /// STYPE_DISKTREE /// Disk drive. /// /// /// STYPE_PRINTQ /// Print queue. /// /// /// STYPE_DEVICE /// Communication device. /// /// /// STYPE_IPC /// Interprocess communication (IPC). /// /// /// In addition, one or both of the following values may be specified. /// /// /// Value /// Meaning /// /// /// STYPE_SPECIAL /// /// Special share reserved for interprocess communication (IPC$) or remote administration of the server (ADMIN$). Can also refer /// to administrative shares such as C$, D$, E$, and so forth. For more information, see Network Share Functions. /// /// /// /// STYPE_TEMPORARY /// A temporary share. /// /// /// public STYPE shi1_type; /// Pointer to a Unicode string specifying an optional comment about the shared resource. public string shi1_remark; } /// Contains a comment associated with the shared resource. // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/ns-lmshare-_share_info_1004 typedef struct _SHARE_INFO_1004 { LMSTR // shi1004_remark; } SHARE_INFO_1004, *PSHARE_INFO_1004, *LPSHARE_INFO_1004; [PInvokeData("lmshare.h", MSDNShortId = "41749066-d0e2-4a6b-aea5-216af9a530f4")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct SHARE_INFO_1004 { /// Pointer to a Unicode string that contains an optional comment about the shared resource. public string shi1004_remark; } /// Contains information about the shared resource. /// /// This structure can be retrieved by calling the NetShareGetInfo function. It can be set by calling the NetShareSetInfo function. /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/ns-lmshare-_share_info_1005 typedef struct _SHARE_INFO_1005 { DWORD // shi1005_flags; } SHARE_INFO_1005, *PSHARE_INFO_1005, *LPSHARE_INFO_1005; [PInvokeData("lmshare.h", MSDNShortId = "9fb3e0ae-76b5-4432-80dd-f3361738aa7c")] [StructLayout(LayoutKind.Sequential)] public struct SHARE_INFO_1005 { /// /// A bitmask of flags that specify information about the shared resource. /// /// /// Value /// Meaning /// /// /// SHI1005_FLAGS_DFS 0x0001 /// The specified share is present in a Dfs tree structure. This flag cannot be set with NetShareSetInfo. /// /// /// SHI1005_FLAGS_DFS_ROOT 0x0002 /// The specified share is the root volume in a Dfs tree structure. This flag cannot be set with NetShareSetInfo. /// /// /// SHI1005_FLAGS_RESTRICT_EXCLUSIVE_OPENS 0x0100 /// The specified share disallows exclusive file opens, where reads to an open file are disallowed. /// /// /// SHI1005_FLAGS_FORCE_SHARED_DELETE 0x0200 /// Shared files in the specified share can be forcibly deleted. /// /// /// SHI1005_FLAGS_ALLOW_NAMESPACE_CACHING 0x0400 /// Clients are allowed to cache the namespace of the specified share. /// /// /// SHI1005_FLAGS_ACCESS_BASED_DIRECTORY_ENUM 0x0800 /// /// The server will filter directory entries based on the access permissions that the user on the client computer has for the /// server on which the files reside. Only files for which the user has read access and directories for which the user has /// FILE_LIST_DIRECTORY access will be returned. If the user has SeBackupPrivilege, all available information will be returned. /// For more information about file and directory access, see File Security and Access Rights. For more information about /// SeBackupPrivilege, see Privilege Constants. /// /// /// /// SHI1005_FLAGS_FORCE_LEVELII_OPLOCK 0x1000 /// Prevents exclusive caching modes that can cause delays for highly shared read-only data. /// /// /// SHI1005_FLAGS_ENABLE_HASH 0x2000 /// /// Enables server-side functionality needed for peer caching support. Clients on high-latency or low-bandwidth connections can /// use alternate methods to retrieve data from peers if available, instead of sending requests to the server. This is only /// supported on shares configured for manual caching (CSC_CACHE_MANUAL_REINT). /// /// /// /// SHI1005_FLAGS_ENABLE_CA 0X4000 /// /// Enables Continuous Availability on a cluster share. Handles that are opened against a continuously available share can /// survive network failures as well as cluster node failures. Windows 7, Windows Server 2008 R2, Windows Vista, Windows Server /// 2008 and Windows Server 2003: This flag is not supported. /// /// /// /// The CSC_MASK and CSC_MASK_EXT mask values can be used to apply flags that are specific to client-side caching (CSC). /// /// /// Value /// Meaning /// /// /// CSC_MASK 0x0030 /// /// Provides a mask for the following CSC states. CSC_CACHE_MANUAL_REINT 0x0000 CSC_CACHE_AUTO_REINT 0x0010 CSC_CACHE_VDO 0x0020 /// CSC_CACHE_NONE 0x0030 /// /// /// /// CSC_MASK_EXT 0x2030 /// /// Provides a mask for the following CSC states and options. CSC_CACHE_MANUAL_REINT 0x0000 CSC_CACHE_AUTO_REINT 0x0010 /// CSC_CACHE_VDO 0x0020 CSC_CACHE_NONE 0x0030 SHI1005_FLAGS_ENABLE_HASH 0x2000 /// /// /// /// public SHI1005_FLAGS shi1005_flags; } /// Specifies the maximum number of concurrent connections that the shared resource can accommodate. // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/ns-lmshare-share_info_1006 typedef struct _SHARE_INFO_1006 { DWORD // shi1006_max_uses; } SHARE_INFO_1006, *PSHARE_INFO_1006, *LPSHARE_INFO_1006; [PInvokeData("lmshare.h", MSDNShortId = "645a8670-5661-4d6c-8d9e-67c1bbb0f1d7")] [StructLayout(LayoutKind.Sequential)] public struct SHARE_INFO_1006 { /// /// Specifies a DWORD value that indicates the maximum number of concurrent connections that the shared resource can accommodate. /// The number of connections is unlimited if the value specified in this member is –1. /// public uint shi1006_max_uses; } /// Contains the security descriptor associated with the specified share. For more information, see Security Descriptors. // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/ns-lmshare-share_info_1501 typedef struct _SHARE_INFO_1501 { DWORD // shi1501_reserved; PSECURITY_DESCRIPTOR shi1501_security_descriptor; } SHARE_INFO_1501, *PSHARE_INFO_1501, *LPSHARE_INFO_1501; [PInvokeData("lmshare.h", MSDNShortId = "ef5d4936-8c0b-4a3c-b2b9-34868eb01a2e")] [StructLayout(LayoutKind.Sequential)] public struct SHARE_INFO_1501 { /// Reserved; must be zero. public uint shi1501_reserved; /// Specifies the SECURITY_DESCRIPTOR associated with the share. public PSECURITY_DESCRIPTOR shi1501_security_descriptor; } /// Contains the filter associated with the specified share. [PInvokeData("lmshare.h")] [StructLayout(LayoutKind.Sequential)] public struct SHARE_INFO_1503 { /// Undocumented. public Guid shi1503_sharefilter; } /// /// Contains information about the shared resource, including name of the resource, type and permissions, and the number of current /// connections. For more information about controlling access to securable objects, see Access Control, Privileges, and Securable Objects. /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/ns-lmshare-_share_info_2 typedef struct _SHARE_INFO_2 { LMSTR // shi2_netname; DWORD shi2_type; LMSTR shi2_remark; DWORD shi2_permissions; DWORD shi2_max_uses; DWORD shi2_current_uses; LMSTR // shi2_path; LMSTR shi2_passwd; } SHARE_INFO_2, *PSHARE_INFO_2, *LPSHARE_INFO_2; [PInvokeData("lmshare.h", MSDNShortId = "cd152ccd-cd60-455f-b25c-c4939c65e0ab")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct SHARE_INFO_2 { /// /// Pointer to a Unicode string specifying the share name of a resource. Calls to the NetShareSetInfo function ignore this member. /// public string shi2_netname; /// /// /// A combination of values that specify the type of the shared resource. Calls to the NetShareSetInfo function ignore /// this member. /// /// One of the following values may be specified. You can isolate these values by using the STYPE_MASK value. /// /// /// Value /// Meaning /// /// /// STYPE_DISKTREE /// Disk drive. /// /// /// STYPE_PRINTQ /// Print queue. /// /// /// STYPE_DEVICE /// Communication device. /// /// /// STYPE_IPC /// Interprocess communication (IPC). /// /// /// In addition, one or both of the following values may be specified. /// /// /// Value /// Meaning /// /// /// STYPE_SPECIAL /// /// Special share reserved for interprocess communication (IPC$) or remote administration of the server (ADMIN$). Can also refer /// to administrative shares such as C$, D$, E$, and so forth. For more information, see Network Share Functions. /// /// /// /// STYPE_TEMPORARY /// A temporary share. /// /// /// public STYPE shi2_type; /// Pointer to a Unicode string that contains an optional comment about the shared resource. public string shi2_remark; /// /// /// Specifies a DWORD value that indicates the shared resource's permissions for servers running with share-level security. A /// server running user-level security ignores this member. This member can be one or more of the following values. Calls to the /// NetShareSetInfo function ignore this member. /// /// Note that Windows does not support share-level security. /// /// /// Value /// Meaning /// /// /// ACCESS_READ /// Permission to read data from a resource and, by default, to execute the resource. /// /// /// ACCESS_WRITE /// Permission to write data to the resource. /// /// /// ACCESS_CREATE /// /// Permission to create an instance of the resource (such as a file); data can be written to the resource as the resource is created. /// /// /// /// ACCESS_EXEC /// Permission to execute the resource. /// /// /// ACCESS_DELETE /// Permission to delete the resource. /// /// /// ACCESS_ATRIB /// Permission to modify the resource's attributes (such as the date and time when a file was last modified). /// /// /// ACCESS_PERM /// /// Permission to modify the permissions (read, write, create, execute, and delete) assigned to a resource for a user or application. /// /// /// /// ACCESS_ALL /// Permission to read, write, create, execute, and delete resources, and to modify their attributes and permissions. /// /// /// public ShareLevelAccess shi2_permissions; /// /// Specifies a DWORD value that indicates the maximum number of concurrent connections that the shared resource can accommodate. /// The number of connections is unlimited if the value specified in this member is –1. /// public uint shi2_max_uses; /// /// Specifies a DWORD value that indicates the number of current connections to the resource. Calls to the NetShareSetInfo /// function ignore this member. /// public uint shi2_current_uses; /// /// Pointer to a Unicode string specifying the local path for the shared resource. For disks, shi2_path is the path being /// shared. For print queues, shi2_path is the name of the print queue being shared. Calls to the NetShareSetInfo /// function ignore this member. /// public string shi2_path; /// /// Pointer to a Unicode string that specifies the share's password when the server is running with share-level security. If the /// server is running with user-level security, this member is ignored. The shi2_passwd member can be no longer than /// SHPWLEN+1 bytes (including a terminating null character). Calls to the NetShareSetInfo function ignore this member. /// Note that Windows does not support share-level security. /// public string shi2_passwd; } /// /// Contains information about the shared resource, including name of the resource, type, remark and flags. For more information /// about controlling access to securable objects, see Access Control, Privileges, and Securable Objects. /// [PInvokeData("lmshare.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct SHARE_INFO_501 { /// /// Pointer to a Unicode string specifying the share name of a resource. Calls to the NetShareSetInfo function ignore this member. /// public string shi501_netname; /// /// /// A combination of values that specify the type of the shared resource. Calls to the NetShareSetInfo function ignore /// this member. /// /// One of the following values may be specified. You can isolate these values by using the STYPE_MASK value. /// /// /// Value /// Meaning /// /// /// STYPE_DISKTREE /// Disk drive. /// /// /// STYPE_PRINTQ /// Print queue. /// /// /// STYPE_DEVICE /// Communication device. /// /// /// STYPE_IPC /// Interprocess communication (IPC). /// /// /// In addition, one or both of the following values may be specified. /// /// /// Value /// Meaning /// /// /// STYPE_SPECIAL /// /// Special share reserved for interprocess communication (IPC$) or remote administration of the server (ADMIN$). Can also refer /// to administrative shares such as C$, D$, E$, and so forth. For more information, see Network Share Functions. /// /// /// /// STYPE_TEMPORARY /// A temporary share. /// /// /// public STYPE shi501_type; /// Pointer to a Unicode string that contains an optional comment about the shared resource. public string shi501_remark; /// /// A bitmask of flags that specify information about the shared resource. /// /// /// Value /// Meaning /// /// /// SHI1005_FLAGS_DFS 0x0001 /// The specified share is present in a Dfs tree structure. This flag cannot be set with NetShareSetInfo. /// /// /// SHI1005_FLAGS_DFS_ROOT 0x0002 /// The specified share is the root volume in a Dfs tree structure. This flag cannot be set with NetShareSetInfo. /// /// /// SHI1005_FLAGS_RESTRICT_EXCLUSIVE_OPENS 0x0100 /// The specified share disallows exclusive file opens, where reads to an open file are disallowed. /// /// /// SHI1005_FLAGS_FORCE_SHARED_DELETE 0x0200 /// Shared files in the specified share can be forcibly deleted. /// /// /// SHI1005_FLAGS_ALLOW_NAMESPACE_CACHING 0x0400 /// Clients are allowed to cache the namespace of the specified share. /// /// /// SHI1005_FLAGS_ACCESS_BASED_DIRECTORY_ENUM 0x0800 /// /// The server will filter directory entries based on the access permissions that the user on the client computer has for the /// server on which the files reside. Only files for which the user has read access and directories for which the user has /// FILE_LIST_DIRECTORY access will be returned. If the user has SeBackupPrivilege, all available information will be returned. /// For more information about file and directory access, see File Security and Access Rights. For more information about /// SeBackupPrivilege, see Privilege Constants. /// /// /// /// SHI1005_FLAGS_FORCE_LEVELII_OPLOCK 0x1000 /// Prevents exclusive caching modes that can cause delays for highly shared read-only data. /// /// /// SHI1005_FLAGS_ENABLE_HASH 0x2000 /// /// Enables server-side functionality needed for peer caching support. Clients on high-latency or low-bandwidth connections can /// use alternate methods to retrieve data from peers if available, instead of sending requests to the server. This is only /// supported on shares configured for manual caching (CSC_CACHE_MANUAL_REINT). /// /// /// /// SHI1005_FLAGS_ENABLE_CA 0X4000 /// /// Enables Continuous Availability on a cluster share. Handles that are opened against a continuously available share can /// survive network failures as well as cluster node failures. Windows 7, Windows Server 2008 R2, Windows Vista, Windows Server /// 2008 and Windows Server 2003: This flag is not supported. /// /// /// /// The CSC_MASK and CSC_MASK_EXT mask values can be used to apply flags that are specific to client-side caching (CSC). /// /// /// Value /// Meaning /// /// /// CSC_MASK 0x0030 /// /// Provides a mask for the following CSC states. CSC_CACHE_MANUAL_REINT 0x0000 CSC_CACHE_AUTO_REINT 0x0010 CSC_CACHE_VDO 0x0020 /// CSC_CACHE_NONE 0x0030 /// /// /// /// CSC_MASK_EXT 0x2030 /// /// Provides a mask for the following CSC states and options. CSC_CACHE_MANUAL_REINT 0x0000 CSC_CACHE_AUTO_REINT 0x0010 /// CSC_CACHE_VDO 0x0020 CSC_CACHE_NONE 0x0030 SHI1005_FLAGS_ENABLE_HASH 0x2000 /// /// /// /// public SHI1005_FLAGS shi501_flags; } /// /// Contains information about the shared resource, including name of the resource, type and permissions, number of connections, and /// other pertinent information. /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/ns-lmshare-_share_info_502 typedef struct _SHARE_INFO_502 { LMSTR // shi502_netname; DWORD shi502_type; LMSTR shi502_remark; DWORD shi502_permissions; DWORD shi502_max_uses; DWORD // shi502_current_uses; LMSTR shi502_path; LMSTR shi502_passwd; DWORD shi502_reserved; PSECURITY_DESCRIPTOR // shi502_security_descriptor; } SHARE_INFO_502, *PSHARE_INFO_502, *LPSHARE_INFO_502; [PInvokeData("lmshare.h", MSDNShortId = "306e6704-2068-42da-bcc4-c0772c719ee8")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct SHARE_INFO_502 { /// /// Pointer to a Unicode string specifying the name of a shared resource. Calls to the NetShareSetInfo function ignore this member. /// public string shi502_netname; /// /// A combination of values that specify the type of share. Calls to the NetShareSetInfo function ignore this member. /// One of the following values may be specified. You can isolate these values by using the STYPE_MASK value. /// /// /// Value /// Meaning /// /// /// STYPE_DISKTREE /// Disk Drive. /// /// /// STYPE_PRINTQ /// Print Queue. /// /// /// STYPE_DEVICE /// Communication device. /// /// /// STYPE_IPC /// Interprocess communication (IPC). /// /// /// In addition, one or both of the following values may be specified. /// /// /// Value /// Meaning /// /// /// STYPE_SPECIAL /// /// Special share reserved for interprocess communication (IPC$) or remote administration of the server (ADMIN$). Can also refer /// to administrative shares such as C$, D$, E$, and so forth. For more information, see the network share functions. /// /// /// /// STYPE_TEMPORARY /// A temporary share. /// /// /// public STYPE shi502_type; /// Pointer to a Unicode string specifying an optional comment about the shared resource. public string shi502_remark; /// /// /// Specifies a DWORD value that indicates the shared resource's permissions for servers running with share-level security. This /// member is ignored on a server running user-level security. This member can be any of the following values. Calls to the /// NetShareSetInfo function ignore this member. /// /// /// Note that Windows does not support share-level security. For more information about controlling access to securable objects, /// see Access Control, Privileges, and Securable Objects. /// /// /// /// Value /// Meaning /// /// /// ACCESS_READ /// Permission to read data from a resource and, by default, to execute the resource. /// /// /// ACCESS_WRITE /// Permission to write data to the resource. /// /// /// ACCESS_CREATE /// /// Permission to create an instance of the resource (such as a file); data can be written to the resource as the resource is created. /// /// /// /// ACCESS_EXEC /// Permission to execute the resource. /// /// /// ACCESS_DELETE /// Permission to delete the resource. /// /// /// ACCESS_ATRIB /// Permission to modify the resource's attributes (such as the date and time when a file was last modified). /// /// /// ACCESS_PERM /// /// Permission to modify the permissions (read, write, create, execute, and delete) assigned to a resource for a user or application. /// /// /// /// ACCESS_ALL /// Permission to read, write, create, execute, and delete resources, and to modify their attributes and permissions. /// /// /// public ShareLevelAccess shi502_permissions; /// /// Specifies a DWORD value that indicates the maximum number of concurrent connections that the shared resource can accommodate. /// The number of connections is unlimited if the value specified in this member is –1. /// public uint shi502_max_uses; /// /// Specifies a DWORD value that indicates the number of current connections to the resource. Calls to the NetShareSetInfo /// function ignore this member. /// public uint shi502_current_uses; /// /// Pointer to a Unicode string that contains the local path for the shared resource. For disks, this member is the path being /// shared. For print queues, this member is the name of the print queue being shared. Calls to the NetShareSetInfo /// function ignore this member. /// public string shi502_path; /// /// /// Pointer to a Unicode string that specifies the share's password (when the server is running with share-level security). If /// the server is running with user-level security, this member is ignored. Note that Windows does not support share-level security. /// /// /// This member can be no longer than SHPWLEN+1 bytes (including a terminating null character). Calls to the /// NetShareSetInfo function ignore this member. /// /// public string shi502_passwd; /// Reserved; must be zero. Calls to the NetShareSetInfo function ignore this member. public uint shi502_reserved; /// Specifies the SECURITY_DESCRIPTOR associated with this share. public PSECURITY_DESCRIPTOR shi502_security_descriptor; } /// /// Contains information about the shared resource. It is identical to the SHARE_INFO_502 structure, except that it also contains the /// server name. /// /// /// The remote server specified in the shi503_servername member must have been bound to a transport protocol using the /// NetServerTransportAddEx function. In the call to NetServerTransportAddEx, either 2 or 3 must have been specified for the /// level parameter, and the SVTI2_SCOPED_NAME value must have been specified in the SERVER_TRANSPORT_INFO_2 structure for the /// transport protocol. /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmshare/ns-lmshare-_share_info_503 typedef struct _SHARE_INFO_503 { LMSTR // shi503_netname; DWORD shi503_type; LMSTR shi503_remark; DWORD shi503_permissions; DWORD shi503_max_uses; DWORD // shi503_current_uses; LMSTR shi503_path; LMSTR shi503_passwd; LMSTR shi503_servername; DWORD shi503_reserved; PSECURITY_DESCRIPTOR // shi503_security_descriptor; } SHARE_INFO_503, *PSHARE_INFO_503, *LPSHARE_INFO_503; [PInvokeData("lmshare.h", MSDNShortId = "12650bc0-f67d-464e-8386-a0fd53cdc749")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct SHARE_INFO_503 { /// /// A pointer to a Unicode string specifying the name of a shared resource. Calls to the NetShareSetInfo function ignore this member. /// public string shi503_netname; /// /// A combination of values that specify the type of share. Calls to the NetShareSetInfo function ignore this member. /// One of the following values may be specified. You can isolate these values by using the STYPE_MASK value. /// /// /// Value /// Meaning /// /// /// STYPE_DISKTREE 0x00000000 /// Disk drive. /// /// /// STYPE_PRINTQ 0x00000001 /// Print queue. /// /// /// STYPE_DEVICE 0x00000002 /// Communication device. /// /// /// STYPE_IPC 0x00000003 /// Interprocess communication (IPC). /// /// /// In addition, one or both of the following values may be specified. /// /// /// Value /// Meaning /// /// /// STYPE_SPECIAL 0x80000000 /// /// Special share reserved for interprocess communication (IPC$) or remote administration of the server (ADMIN$). Can also refer /// to administrative shares such as C$, D$, E$, and so forth. For more information, see the network share functions. /// /// /// /// STYPE_TEMPORARY 0x40000000 /// A temporary share. /// /// /// public STYPE shi503_type; /// A pointer to a Unicode string specifying an optional comment about the shared resource. public string shi503_remark; /// /// /// Specifies a DWORD value that indicates the shared resource's permissions for servers running with share-level security. Note /// that Windows does not support share-level security. This member is ignored on a server running user-level security. For more /// information about controlling access to securable objects, see Access Control, Privileges, and Securable Objects. /// /// Calls to the NetShareSetInfo function ignore this member. /// This member can be any of the following values. /// /// /// Value /// Meaning /// /// /// ACCESS_READ 0x00000001 /// Permission to read data from a resource and, by default, to execute the resource. /// /// /// ACCESS_WRITE 0x00000002 /// Permission to write data to the resource. /// /// /// ACCESS_CREATE 0x00000004 /// /// Permission to create an instance of the resource (such as a file); data can be written to the resource as the resource is created. /// /// /// /// ACCESS_EXEC 0x00000008 /// Permission to execute the resource. /// /// /// ACCESS_DELETE 0x00000010 /// Permission to delete the resource. /// /// /// ACCESS_ATRIB 0x00000020 /// Permission to modify the resource's attributes (such as the date and time when a file was last modified). /// /// /// ACCESS_PERM 0x00000040 /// /// Permission to modify the permissions (read, write, create, execute, and delete) assigned to a resource for a user or application. /// /// /// /// ACCESS_ALL 0x00008000 /// Permission to read, write, create, execute, and delete resources, and to modify their attributes and permissions. /// /// /// public ShareLevelAccess shi503_permissions; /// /// Specifies a DWORD value that indicates the maximum number of concurrent connections that the shared resource can accommodate. /// The number of connections is unlimited if the value specified in this member is –1. /// public uint shi503_max_uses; /// /// Specifies a DWORD value that indicates the number of current connections to the resource. Calls to the NetShareSetInfo /// function ignore this member. /// public uint shi503_current_uses; /// /// A pointer to a Unicode string that contains the local path for the shared resource. For disks, this member is the path being /// shared. For print queues, this member is the name of the print queue being shared. Calls to the NetShareSetInfo function /// ignore this member. /// public string shi503_path; /// /// /// A pointer to a Unicode string that specifies the share's password (when the server is running with share-level security). If /// the server is running with user-level security, this member is ignored. Note that Windows does not support share-level security. /// /// /// This member can be no longer than SHPWLEN+1 bytes (including a terminating null character). Calls to the NetShareSetInfo /// function ignore this member. /// /// public string shi503_passwd; /// /// A pointer to a string that specifies the DNS or NetBIOS name of the remote server on which the shared resource resides. A /// value of "*" indicates no configured server name. /// public string shi503_servername; /// Reserved; must be zero. Calls to the NetShareSetInfo function ignore this member. public uint shi503_reserved; /// Specifies the SECURITY_DESCRIPTOR associated with this share. public PSECURITY_DESCRIPTOR shi503_security_descriptor; } } }