Beispiel #1
0
 /// <summary>
 ///     Maps the managed ShareInfo502 Object to a native ShareInfo502 Struct.
 /// </summary>
 /// <param name="shareInfo">The managed source ShareInfo502 Object.</param>
 /// <returns>A native ShareInfo502 Struct.</returns>
 internal static Structs.ShareInfo502 MapToNativeShareInfo502(ShareInfo502 shareInfo)
 {
     return(new Structs.ShareInfo502
     {
         shi502_current_uses = shareInfo.CurrentUsers,
         shi502_max_uses = shareInfo.MaxUsers,
         shi502_netname = shareInfo.NetName,
         shi502_passwd = shareInfo.Password,
         shi502_path = shareInfo.Path,
         shi502_permissions = (int)shareInfo.Permissions,
         shi502_remark = shareInfo.Remark,
         shi502_reserved = shareInfo.Reserved,
         shi502_security_descriptor = shareInfo.SecurityDescriptor,
         shi502_type = (int)shareInfo.ShareType
     });
 }
 /// <summary>
 ///     Shares a server resource.
 /// </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="shareInfo502">
 ///     Specifies the information level of the data. This parameter can be one of the following
 ///     values.
 /// </param>
 /// <returns>Returns a NetApiResult Enumeration.</returns>
 public static Enum.NetApiResult Create(string servername, ShareInfo502 shareInfo502)
 {
     var nativeShareInfo502 = ShareInfo502.MapToNativeShareInfo502(shareInfo502);
     uint error = 0;
     return (Enum.NetApiResult) DllImports.NetShareAdd(servername, 502, ref nativeShareInfo502, out error);
 }
 /// <summary>
 ///     Shares a server resource.
 /// </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="shareInfo502">
 ///     Specifies the information level of the data. This parameter can be one of the following
 ///     values.
 /// </param>
 /// <returns>Returns a NetApiResult Enumeration.</returns>
 public static Enum.NetApiResult Create(string servername, ShareInfo502 shareInfo502)
 {
     return Shares.Create(servername, shareInfo502);
 }
 /// <summary>
 ///     Maps the managed ShareInfo502 Object to a native ShareInfo502 Struct.
 /// </summary>
 /// <param name="shareInfo">The managed source ShareInfo502 Object.</param>
 /// <returns>A native ShareInfo502 Struct.</returns>
 internal static Structs.ShareInfo502 MapToNativeShareInfo502(ShareInfo502 shareInfo)
 {
     return new Structs.ShareInfo502
     {
         shi502_current_uses = shareInfo.CurrentUsers,
         shi502_max_uses = shareInfo.MaxUsers,
         shi502_netname = shareInfo.NetName,
         shi502_passwd = shareInfo.Password,
         shi502_path = shareInfo.Path,
         shi502_permissions = (int) shareInfo.Permissions,
         shi502_remark = shareInfo.Remark,
         shi502_reserved = shareInfo.Reserved,
         shi502_security_descriptor = shareInfo.SecurityDescriptor,
         shi502_type = (int) shareInfo.ShareType
     };
 }