Make the LSAP_POLICY_AUDIT_EVENTS_DATA structure compatible to the one used in Windows, so that the registry data is compatible between Windows and ReactOS lsasrv. Windows does not actually use dynamically sized structures, but always stores a full structure and the AuditEventsCount is AFTER the AuditEvents array, so that it is in fact pretty pointless. But that's how it works.

svn path=/trunk/; revision=61626
This commit is contained in:
Timo Kreuzer 2014-01-14 20:24:43 +00:00
parent 1ae9a47dbe
commit 96008c8ec0
2 changed files with 8 additions and 12 deletions

View file

@ -241,8 +241,6 @@ LsapCreateDatabaseObjects(VOID)
PSID AccountDomainSid = NULL;
PSECURITY_DESCRIPTOR PolicySd = NULL;
ULONG PolicySdSize = 0;
ULONG AuditEventsCount;
ULONG AuditEventsSize;
ULONG i;
NTSTATUS Status;
@ -263,17 +261,15 @@ LsapCreateDatabaseObjects(VOID)
AuditLogInfo.NextAuditRecordId = 0; // DWORD
/* Initialize the Audit Events attribute */
AuditEventsCount = AuditCategoryAccountLogon - AuditCategorySystem + 1;
AuditEventsSize = sizeof(LSAP_POLICY_AUDIT_EVENTS_DATA) + AuditEventsCount * sizeof(DWORD);
AuditEventsInfo = RtlAllocateHeap(RtlGetProcessHeap(),
HEAP_ZERO_MEMORY,
AuditEventsSize);
sizeof(LSAP_POLICY_AUDIT_EVENTS_DATA));
if (AuditEventsInfo == NULL)
return STATUS_INSUFFICIENT_RESOURCES;
AuditEventsInfo->AuditingMode = FALSE;
AuditEventsInfo->MaximumAuditEventCount = AuditEventsCount;
for (i = 0; i < AuditEventsCount; i++)
AuditEventsInfo->MaximumAuditEventCount = POLICY_AUDIT_EVENT_TYPE_COUNT;
for (i = 0; i < POLICY_AUDIT_EVENT_TYPE_COUNT; i++)
AuditEventsInfo->AuditEvents[i] = 0;
/* Initialize the DNS Domain GUID attribute */
@ -351,7 +347,7 @@ LsapCreateDatabaseObjects(VOID)
LsapSetObjectAttribute(PolicyObject,
L"PolAdtEv",
AuditEventsInfo,
AuditEventsSize);
sizeof(LSAP_POLICY_AUDIT_EVENTS_DATA));
/* Set the DNS Domain Name attribute */
LsapSetObjectAttribute(PolicyObject,
@ -984,7 +980,7 @@ LsapSetObjectAttribute(PLSA_DB_OBJECT DbObject,
NULL);
if (!NT_SUCCESS(Status))
{
ERR("NtCreateKey failed for '%S' with status 0x%lx\n",
ERR("NtCreateKey failed for '%S' with status 0x%lx\n",
AttributeName, Status);
return Status;
}
@ -998,7 +994,7 @@ LsapSetObjectAttribute(PLSA_DB_OBJECT DbObject,
if (!NT_SUCCESS(Status))
{
ERR("RtlpNtSetValueKey failed for '%S' with status 0x%lx\n",
ERR("RtlpNtSetValueKey failed for '%S' with status 0x%lx\n",
AttributeName, Status);
}

View file

@ -65,12 +65,12 @@ typedef struct _LSA_DB_OBJECT
#define LSAP_DB_SIGNATURE 0x12345678
#define POLICY_AUDIT_EVENT_TYPE_COUNT (AuditCategoryAccountLogon - AuditCategorySystem + 1)
typedef struct _LSAP_POLICY_AUDIT_EVENTS_DATA
{
BOOLEAN AuditingMode;
DWORD AuditEvents[POLICY_AUDIT_EVENT_TYPE_COUNT];
DWORD MaximumAuditEventCount;
DWORD AuditEvents[0];
} LSAP_POLICY_AUDIT_EVENTS_DATA, *PLSAP_POLICY_AUDIT_EVENTS_DATA;
typedef struct _LSAP_LOGON_CONTEXT