Modify

#3632 closed Bug (Fixed)

The second parameter for _Net_Share_ShareCheck is incorrectly documented and inconsistent with related functions

Reported by: big_daddy Owned by: Jpm
Milestone: 3.3.15.1 Component: Standard UDFs
Version: 3.3.14.5 Severity: None
Keywords: NetShare.au3 Cc:

Description

Per the documentation, the second parameter for _Net_Share_ShareCheck is a share name. This would be consistent with the related functions; ShareAdd, ShareDel, ShareGetInfo. However, when given a share name the function returns -1 with extended 2311. The example script in the help file for this function fails when you comment the ShareDel line and run the script a second time.

I found that this function requires the share path to functions as expected. The code below shows that when given a share name the function returns -1. Swapping lines 6 and 7 shows that it functions as expected when passed the local path gathered from ShareGetInfo.

#include <NetShare.au3>

$sComputerName = @ComputerName
$aInfo = _Net_Share_ShareEnum($sComputerName)
For $iI = 1 To $aInfo[0][0]
	;If CheckShareByName($sComputerName, $aInfo[$iI][0]) = -1 Then
	If _Net_Share_ShareCheck ($sComputerName, $aInfo[$iI][0]) = -1 Then
		ConsoleWrite("Share " & $aInfo[$iI][0] & " does not exist" & @CRLF)
	Else
		ConsoleWrite("Share Name: " & $aInfo[$iI][0] & @CRLF)
		ConsoleWrite("Share Type: " & _Net_Share_ResourceStr($aInfo[$iI][1]) & @CRLF)
		ConsoleWrite("Share Path: " & $aInfo[$iI][6] & @CRLF & @CRLF)
	EndIf
Next

Func CheckShareByName($sServer, $sShareName)
	Local $aReturn = _Net_Share_ShareGetInfo($sServer, $sShareName)
	If @error Then Return SetError(@error, 0, -1)
	Return _Net_Share_ShareCheck($sServer, $aReturn[6])
EndFunc

Attachments (0)

Change History (1)

comment:1 Changed 19 months ago by Jpm

  • Milestone set to 3.3.15.1
  • Owner set to Jpm
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed by revision [12152] in version: 3.3.15.1

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Jpm.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.