返回资源权限的字符串表示形式
#Include <NetShare.au3>
_Net_Share_PermStr($iPerm)
$iPerm | 资源的权限: 1 - 读取数据, 并执行资源 2 - 将数据写入到资源 4 - 创建资源实例 8 - 执行资源 16 - 删除资源 32 - 修改资源的属性 64 - 修改分配给资源的权限 |
返回权限的字符串形式 |
#include <GUIConstantsEx.au3>
#include <NetShare.au3>
#include <WindowsConstants.au3>
Global $iMemo
_Main()
Func _Main()
Local $sServer, $aInfo
; 创建 GUI
GUICreate("NetShare", 400, 300)
; 创建 memo 控件
$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
$aInfo = _Net_Share_FileEnum($sServer)
MemoWrite("Error ...................: " & @error)
MemoWrite("Entries read ............: " & $aInfo[0][0])
For $iI = 1 To $aInfo[0][0]
MemoWrite("Resource ID .............: " & $aInfo[$iI][0])
MemoWrite("Resource permissions ....: " & _Net_Share_PermStr($aInfo[$iI][1]))
MemoWrite("Resource locks ..........: " & $aInfo[$iI][2])
MemoWrite("Resource path ...........: " & $aInfo[$iI][3])
MemoWrite("Resource user ...........: " & $aInfo[$iI][4])
MemoWrite()
Next
; 循环直到用户退出
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main
; 写入消息到 memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite