16,551
社区成员
发帖
与我相关
我的任务
分享
// Declare and initialize variables.
BOOL bResult = TRUE;
DWORD dwError;
AUTHZ_SECURITY_EVENT_PROVIDER_HANDLE hEventProvider = NULL;
// Register the audit provider.
bResult = AuthzRegisterSecurityEventSource(
0,
AUDIT_SOURCE_NAME,
&hEventProvider);
if (!bResult)
{
dwError = GetLastError();
wprintf(
L"AuthzRegisterSecurityEventSource %d\n",
dwError);
goto Cleanup;
}
wprintf(L"Registered provider.\n");
// Generate the audit.
bResult = AuthzReportSecurityEvent(
APF_AuditSuccess,
hEventProvider,
AUDITID_BIRTHDAY,
NULL,
3,
APT_String, L"Jay Hamlin",
APT_String, L"March 21, 1960",
APT_Ulong, 45);
if (!bResult)
{
dwError = GetLastError();
wprintf(
L"AuthzReportSecurityEvent %d\n",
dwError);
goto Cleanup;
}
wprintf(L"Generated audit.\n");
Cleanup:
if (hEventProvider)
{
AuthzUnregisterSecurityEventSource(
0,
&hEventProvider);
}