PrivilegedServiceAuditAlarm

The PrivilegedServiceAuditAlarm function generates an audit message in the security event log. A protected server can use this function to log attempts by a client to use a specified set of privileges.

Alarms are not supported in the current version of Windows NT.

BOOL PrivilegedServiceAuditAlarm(
  LPCTSTR SubsystemName,      // address of string for subsystem name
  LPCTSTR ServiceName,        // address of string for service name
  HANDLE ClientToken,         // handle of access token
  PPRIVILEGE_SET Privileges,  // address of privileges
  BOOL AccessGranted          // flag for granted access rights
);
 

Parameters

SubsystemName
Pointer to a null-terminated string specifying the name of the subsystem calling the function. This information appears in the security event log record.
ServiceName
Pointer to a null-terminated string specifying the name of the privileged subsystem service. This information appears in the security event log record.
ClientToken
Identifies an access token representing the client that requested the operation. This handle must have been obtained by opening the token of a thread impersonating the client. The token must be open for TOKEN_QUERY access. The function uses this token to get the identity of the client for the security event log record.
Privileges
Pointer to a PRIVILEGE_SET structure containing the privileges that the client attempted to use. The names of the privileges appear in the security event log record.
AccessGranted
Specifies a flag indicating whether the client's attempt to use the privileges was successful. If this flag is TRUE, the security event log record indicates success. If this flag is FALSE, the security event log record indicates failure.

Return Values

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.

Remarks

The PrivilegedServiceAuditAlarm function does not check the client's access token to determine whether the privileges are held or enabled. Typically, you would first call the PrivilegeCheck function to determine whether the specified privileges are enabled in the access token, and then call PrivilegedServiceAuditAlarm to log the results.

The PrivilegedServiceAuditAlarm function requires the calling process to have SE_AUDIT_NAME privilege enabled. The test for this privilege is always performed against the primary token of the calling process. This allows the calling process to impersonate a client during the call.

QuickInfo

  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.

See Also

Client/Server Access Control Overview, Client/Server Access Control Functions, ObjectPrivilegeAuditAlarm, PrivilegeCheck, PRIVILEGE_SET