回复 2# pusofalse
P大:
我怎么用这段代码也是不行了,如果输入未存在的帐号是会提示: 帐户名与安全标识间无任何映射完成
但输入存在的帐号则会报错:
Const $USER_TEST = "test1"
Local $pSid = _SeLookupAccountName($USER_TEST)
If $pSid = 0 Then
MsgBox(48, "Error", _SeFormatMsg())
Exit
EndIf
Local $pAdminsSid = _SeGetWellKnownAccountSid($SE_WELLKNOWN_ADMINS)
;~ MsgBox(0,0,$pAdminsSid)
Local $pDacl = _SeSetEntriesInAcl1($pAdminsSid, 1, $SE_GRANT_ACCESS, $SE_NO_INHERITANCE)
;~ MsgBox(0,0,$pDacl)
If _SeGetEffectiveRightsFromAcl($pDacl, $pSid) Then
MsgBox(48, "OK", StringFormat("'%s' is an administrator.", $USER_TEST))
Else
MsgBox(48, "OK", StringFormat("'%s' is not an administrator.", $USER_TEST))
EndIf
_SeLocalFree($pDacl)
_SeFreeSid($pAdminsSid)
_SeHeapFree($pSid)
|