You can execute the SetSecurityInfoEx or SetNamedSecurityInfoEx function as an asynchronous operation. This can be useful when the function call involves a time-consuming operation, such as propagating inherited ACEs to the child objects of a file, registry, or DS object.
To start an asynchronous operation, specify a valid ACTRL_OVERLAPPED structure when you call SetSecurityInfoEx or SetNamedSecurityInfoEx. The function returns immediately, and the ACTRL_OVERLAPPED structure contains a handle to an event object that the system signals when the operation has been completed. You can call the GetOverlappedAccessResults function to wait for the operation to be completed and retrieve the results of the asynchronous operation.
Alternatively, you can call one of the wait functions, such as WaitForSingleObject, to wait for the event object to be signaled, and then call GetOverlappedAccessResults to determine the results of the operation. The wait functions also allow you to specify a time-out interval; if the interval elapses before the event is signaled, you can call the CancelOverlappedAccess function to cancel the asynchronous operation.