The AccessCheckAndAuditAlarm function determines whether a security descriptor grants a specified set of access rights to the client being impersonated by the calling thread. If the security descriptor has a SACL with ACEs that apply to the client, the function generates any necessary audit messages in the security event log. Alarms are not supported in the current version of Windows NT.
BOOL AccessCheckAndAuditAlarm(
  LPCTSTR SubsystemName,     // subsystem name
  LPVOID HandleId,           // object's handle identifier
  LPTSTR ObjectTypeName,     // type of object
  LPTSTR ObjectName,         // name of object
  PSECURITY_DESCRIPTOR SecurityDescriptor,
                             // address of security descriptor
  DWORD DesiredAccess,       // mask for requested access rights
  PGENERIC_MAPPING GenericMapping,
                             // address of GENERIC_MAPPING
  BOOL ObjectCreation,       // flag is TRUE if creating an object
  LPDWORD GrantedAccess,     // retrieves mask of granted rights
  LPBOOL AccessStatus        // retrieves results of access check
  LPBOOL pfGenerateOnClose   // retrieves flag for audit generation
);
 If this parameter is MAXIMUM_ALLOWED, the function sets the GrantedAccess access mask to indicate the maximum access rights the security descriptor allows the client.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
The AccessCheckAndAuditAlarm function requires the calling process to have the SE_AUDIT_NAME privilege enabled. The test for this privilege is performed against the primary token of the calling process, not the impersonation token of the thread.
The AccessCheckAndAuditAlarm function fails if the calling thread is not impersonating a client.
  Windows NT: Requires version 3.1 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in winbase.h.
  Import Library: Use advapi32.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT.
Client/Server Access Control Overview, Client/Server Access Control Functions, AccessCheck, GENERIC_MAPPING, MapGenericMask, ObjectCloseAuditAlarm, ObjectOpenAuditAlarm, ObjectPrivilegeAuditAlarm, PrivilegeCheck, PrivilegedServiceAuditAlarm, SECURITY_DESCRIPTOR