Function Reference


_Net_Share_FileGetInfo

Retrieves information about a particular opening of a server resource

#include <NetShare.au3>
_Net_Share_FileGetInfo ( $sServer, $iFileID )

Parameters

$sServer Specifies the DNS or NetBIOS name of the remote server on which the function is to execute.
If this parameter is blank, the local computer is used.
$iFileID File identifier of the resource for which to return information.
The value of this parameter must have been returned in a previous enumeration call.

Return Value

Success: an array with the following format:
    [0] - ID number assigned to the resource when it is opened
    [1] - Access permissions associated with the opening application:
        1 - Permission to read a resource and execute the resource
        2 - Permission to write to a resource.
        4 - Permission to create a resource
        8 - Execute permission
        16 - Delete permission
        32 - Change attribute permission
        64 - Change ACL permission
    [2] - Contains the number of file locks on the resource
    [3] - Specifies the path of the opened resource
    [4] - Specifies which user or which computer opened the resource
Failure: sets the @error flag to non-zero.

Remarks

Administrator, Server or Print Operator or Power User group membership is required to execute this function.

Related

_Net_Share_SessionGetInfo, _Net_Share_ShareGetInfo

See Also

Search NetFileGetInfo in MSDN Library.

Example

#include <GUIConstantsEx.au3>
#include <NetShare.au3>
#include <WindowsConstants.au3>

Global $g_idMemo

Example()

Func Example()
    Local $sServer, $aFile, $aInfo

    ; Create GUI
    GUICreate("NetShare", 400, 300)

    ; Create memo control
    $g_idMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
    GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
    GUISetState(@SW_SHOW)

    ; Get server and share information
    $sServer = InputBox("NetWork Demo", "Enter Server Name:", "\\MyServer", "", 200, 130)
    If @error Then Exit

    ; Enumerate open files on the server
    $aFile = _Net_Share_FileEnum($sServer)
    MemoWrite("Error ...................: " & @error)
    MemoWrite("Entries read ............: " & $aFile[0][0])
    MemoWrite()

    ; Get information for each open file (same as $aFile info)
    For $iI = 1 To $aFile[0][0]
        $aInfo = _Net_Share_FileGetInfo($sServer, $aFile[$iI][0])
        MemoWrite("Error ...................: " & @error)
        MemoWrite("File permissions ........: " & _Net_Share_PermStr($aInfo[1]))
        MemoWrite("File locks ..............: " & $aInfo[2])
        MemoWrite("File path ...............: " & $aInfo[3])
        MemoWrite("File user ...............: " & $aInfo[4])
        MemoWrite()
    Next

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>Example

; Write message to memo
Func MemoWrite($sMessage = "")
    GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite