IADsAccessControlList Property Methods
The property methods of the IADsAccessControlList interface get or set the properties described in the following table. For more information, see Interface Property Methods.
Properties
-
AceCount
-
-
Access type: Read/write
-
Scripting data type: LONG
-
// C++ method syntax HRESULT get_AceCount( [out] LONG* lnAceCount ); HRESULT put_AceCount( [in] LONG lnAceCount );
The number of access control entries in the access-control list.
-
-
AclRevision
-
-
Access type: Read/write
-
Scripting data type: LONG
-
// C++ method syntax HRESULT get_AclRevision( [out] LONG* lnAclRevision ); HRESULT put_AclRevision( [in] LONG lnAclRevision );
The revision level of an access-control list. This value can be ACL_REVISION or ACL_REVISION_DS. Use ACL_REVISION_DS if the ACL contains an object-specific ACE. All ACEs in an ACL must be at the same revision level.
-
Examples
The following code example displays the number of ACEs in an ACL.
Dim x as IADs
Dim sd As IADsSecurityDescriptor
Dim Dacl As IADsAccessControlList
On Error GoTo Cleanup
Set x = GetObject("LDAP://OU=Sales,DC=Fabrikam,DC=com")
Set sd = x.Get("ntSecurityDescriptor")
Set Dacl = sd.DiscretionaryAcl
Debug.Print Dacl.AceCount
Cleanup:
If (Err.Number <> 0) Then
MsgBox ("An error has occurred. " & Err.Number)
End If
Set x = Nothing
The following code example displays the number of ACEs in an ACL.
HRESULT ShowACEInACL(LPWSTR guestPath,LPWSTR user,LPWSTR passwd)
{
IADs *pObj = NULL;
IADsSecurityDescriptor *psd = NULL;
HRESULT hr = S_OK;
VARIANT var;
VariantInit(&var);
hr = ADsOpenObject(guestPath,user,passwd,ADS_SECURE_AUTHENTICATION,
IID_IADs,(void**)&pObj);
if(FAILED(hr)) {
printf("hr = %x\n",hr);
return hr;
}
else {
BSTR bstr = NULL;
pObj->get_Class(&bstr);
printf("Object class: %S\n",bstr);
SysFreeString(bstr);
}
hr = pObj->Get(CComBSTR("ntSecurityDescriptor"), &var);
pObj->Release();
if(FAILED(hr)) {
printf("Get ntSD: hr = %x\n",hr);
return hr;
}
hr = V_DISPATCH(&var)->QueryInterface(IID_IADsSecurityDescriptor,
(void**)&psd);
if(FAILED(hr)) {
printf("DISP: hr = %x\n",hr);
VariantClear(&var);
return hr;
}
IDispatch *pDisp = NULL;
hr = psd->get_DiscretionaryAcl(&pDisp);
VariantClear(&var);
if(FAILED(hr)) {
printf("get_DACL : hr = %x\n",hr);
return hr;
}
IADsAccessControlList *pAcl = NULL;
hr = pDisp->QueryInterface(IID_IADsAccessControlList,(void**)&pAcl);
pDisp->Release();
if(FAILED(hr)) {
printf("QI ACL: hr = %x\n",hr);
return hr;
}
long count = 0;
hr = pAcl->get_AceCount(&count);
pAcl->Release();
if(FAILED(hr)) {
printf("Count: hr = %x\n",hr);
return hr;
}
printf("AceCount = %d\n",count);
return hr;
}
Requirements
Requirement | Value |
---|---|
Minimum supported client |
Windows Vista |
Minimum supported server |
Windows Server 2008 |
Header |
|
DLL |
|
IID |
IID_IADsAccessControlList is defined as B7EE91CC-9BDD-11D0-852C-00C04FD8D503 |
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for