_Net_Share_FileGetInfo
Retrieves information about a particular opening of a server resource
#include <NetShare.au3>
_Net_Share_FileGetInfo($sServer, $iFileID)
Параметры
$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. |
Возвращаемое значение
Успех: | Возвращает массив следующего формата: |
[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 | |
Ошибка: | Устанавливает @error |
Примечания
Administrator, Server or Print Operator or Power User group membership is required to execute this functionСм. также
_Net_Share_SessionGetInfo, _Net_Share_ShareGetInfoСм. также
Искать NetFileGetInfo в библиотеке MSDNПример
#include <GUIConstantsEx.au3>
#include <NetShare.au3>
#include <WindowsConstants.au3>
Global $iMemo
_Main()
Func _Main()
Local $hGUI, $sServer, $aFile, $aInfo
; Создаёт GUI
$hGUI = GUICreate("NetShare", 400, 300)
; Создаёт элемент для заметок
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()
; 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
; Цикл выполняется, пока окно не будет закрыто
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main
; Записывает строку в элемент для заметок
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite