验证一个 SID 是否有效
#include <Security.au3>
_Security__IsValidSid($pSID)
$pSID | 一个指向 SID 的指针 |
成功: | 返回 True: SID 有效 |
失败: | 返回 False: SID 无效 |
在MSDN中搜索
#include <Security.au3>
Local $tSID = _Security__GetAccountSid(@ComputerName)
If Not @error Then
; $tSID is structure filled with SID data for spesified account
; Check this SID for validity:
Local $fValid = _Security__IsValidSid($tSID)
If $fValid Then
ConsoleWrite("The SID is valid." & @CRLF)
; ... The rest of the script here...
Else
ConsoleWrite("The SID is NOT valid." & @CRLF)
Exit
EndIf
EndIf