/// <summary> /// Maps the managed ShareInfo503 Object to a native ShareInfo503 Struct. /// </summary> /// <param name="shareInfo">The managed source ShareInfo503 Object.</param> /// <returns>A native ShareInfo503 Struct.</returns> internal static Structs.ShareInfo503 MapToNativeShareInfo503(ShareInfo503 shareInfo) { return(new Structs.ShareInfo503 { shi503_current_uses = shareInfo.CurrentUsers, shi503_max_uses = shareInfo.MaxUsers, shi503_netname = shareInfo.NetName, shi503_passwd = shareInfo.Password, shi503_path = shareInfo.Path, shi503_permissions = (int)shareInfo.Permissions, shi503_remark = shareInfo.Remark, shi503_reserved = shareInfo.Reserved, shi503_security_descriptor = shareInfo.SecurityDescriptor, shi503_type = (int)shareInfo.ShareType, shi503_servername = shareInfo.Servername }); }
/// <summary> /// Retrieves information about a particular shared resource on a server. /// </summary> /// <param name="serverName"> /// 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. /// </param> /// <param name="netName">Pointer to a string that specifies the name of the share for which to return information.</param> /// <param name="shareInfo503"> /// 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. /// </param> /// <returns>Returns a NetApiResult Enumeration.</returns> public static Enum.NetApiResult SetInfo(string serverName, string netName, ShareInfo503 shareInfo503) { uint error = 0; Object nativeShareInfo503 = ShareInfo503.MapToNativeShareInfo503(shareInfo503); return (Enum.NetApiResult) NetworkShareManagementFunctions.NetShareSetInfo.DllImports.NetShareSetInfo(serverName, netName, 503, ref nativeShareInfo503, out error); }
/// <summary> /// Maps the managed ShareInfo503 Object to a native ShareInfo503 Struct. /// </summary> /// <param name="shareInfo">The managed source ShareInfo503 Object.</param> /// <returns>A native ShareInfo503 Struct.</returns> internal static Structs.ShareInfo503 MapToNativeShareInfo503(ShareInfo503 shareInfo) { return new Structs.ShareInfo503 { shi503_current_uses = shareInfo.CurrentUsers, shi503_max_uses = shareInfo.MaxUsers, shi503_netname = shareInfo.NetName, shi503_passwd = shareInfo.Password, shi503_path = shareInfo.Path, shi503_permissions = (int) shareInfo.Permissions, shi503_remark = shareInfo.Remark, shi503_reserved = shareInfo.Reserved, shi503_security_descriptor = shareInfo.SecurityDescriptor, shi503_type = (int) shareInfo.ShareType, shi503_servername = shareInfo.Servername }; }
/// <summary> /// Retrieves information about a particular shared resource on a server. /// </summary> /// <param name="serverName"> /// 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. /// </param> /// <param name="netName">Pointer to a string that specifies the name of the share for which to return information.</param> /// <returns>A managed ShareInfo503 Object.</returns> public static ShareInfo503 GetInfo(string serverName, string netName) { var returnValue = new ShareInfo503(); IntPtr pBuffer; var status = NetworkShareManagementFunctions.NetShareGetInfo.DllImports.NetShareGetInfo(serverName, netName, 503, out pBuffer); if (status == 0) { var shareinfoType = typeof (Structs.FileInfo3); var pItem = new IntPtr(pBuffer.ToInt32()); var shareInfo503 = (Structs.ShareInfo503) Marshal.PtrToStructure(pItem, shareinfoType); returnValue = ShareInfo503.MapToShareInfo503(shareInfo503); ApiBuffer.FreeBuffer(pBuffer); } return returnValue; }
/// <summary> /// Retrieves information about a particular shared resource on a server. /// </summary> /// <param name="serverName"> /// 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. /// </param> /// <param name="netName">Pointer to a string that specifies the name of the share for which to return information.</param> /// <param name="shareInfo503"> /// 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. /// </param> /// <returns>Returns a NetApiResult Enumeration.</returns> public static Enum.NetApiResult SetInfo(string serverName, string netName, ShareInfo503 shareInfo503) { return Shares.SetInfo(serverName, netName, shareInfo503); }