Author: tkreuzer
Date: Tue Jan 14 20:24:43 2014
New Revision: 61626
URL: http://svn.reactos.org/svn/reactos?rev=61626&view=rev
Log:
[LSASRV]
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.
Modified:
trunk/reactos/dll/win32/lsasrv/database.c
trunk/reactos/dll/win32/lsasrv/lsasrv.h
Modified: trunk/reactos/dll/win32/lsasrv/database.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/database.…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/database.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/database.c [iso-8859-1] Tue Jan 14 20:24:43 2014
@@ -241,8 +241,6 @@
PSID AccountDomainSid = NULL;
PSECURITY_DESCRIPTOR PolicySd = NULL;
ULONG PolicySdSize = 0;
- ULONG AuditEventsCount;
- ULONG AuditEventsSize;
ULONG i;
NTSTATUS Status;
@@ -263,17 +261,15 @@
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 @@
LsapSetObjectAttribute(PolicyObject,
L"PolAdtEv",
AuditEventsInfo,
- AuditEventsSize);
+ sizeof(LSAP_POLICY_AUDIT_EVENTS_DATA));
/* Set the DNS Domain Name attribute */
LsapSetObjectAttribute(PolicyObject,
@@ -984,7 +980,7 @@
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 @@
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);
}
Modified: trunk/reactos/dll/win32/lsasrv/lsasrv.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsasrv.h?…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] Tue Jan 14 20:24:43 2014
@@ -65,12 +65,12 @@
#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
Author: tkreuzer
Date: Tue Jan 14 20:12:07 2014
New Revision: 61625
URL: http://svn.reactos.org/svn/reactos?rev=61625&view=rev
Log:
[FREELDR] Modify UiMessageBox so that it allows to pass a format string and parameters. Make use of it in WinLdrLoadBootDrivers to show the file that couldn't be loaded.
Modified:
trunk/reactos/boot/freeldr/freeldr/include/ui.h
trunk/reactos/boot/freeldr/freeldr/ui/ui.c
trunk/reactos/boot/freeldr/freeldr/windows/winldr.c
trunk/reactos/boot/freeldr/freeldr/windows/wlregistry.c
Modified: trunk/reactos/boot/freeldr/freeldr/include/ui.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/ui.h [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/ui.h [iso-8859-1] Tue Jan 14 20:12:07 2014
@@ -66,7 +66,7 @@
VOID UiDrawStatusText(PCSTR StatusText); // Draws text at the very bottom line on the screen
VOID UiUpdateDateTime(VOID); // Updates the date and time
VOID UiInfoBox(PCSTR MessageText); // Displays a info box on the screen
-VOID UiMessageBox(PCSTR MessageText); // Displays a message box on the screen with an ok button
+VOID UiMessageBox(PCSTR Format, ...); // Displays a message box on the screen with an ok button
VOID UiMessageBoxCritical(PCSTR MessageText); // Displays a message box on the screen with an ok button using no system resources
VOID UiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText); // Draws the progress bar showing nPos percent filled
VOID UiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText); // Draws the progress bar showing nPos percent filled
Modified: trunk/reactos/boot/freeldr/freeldr/ui/ui.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/ui/ui…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/ui/ui.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/ui/ui.c [iso-8859-1] Tue Jan 14 20:12:07 2014
@@ -344,9 +344,15 @@
UiDrawCenteredText(Left, Top, Right, Bottom, MessageText, ATTR(UiTextColor, UiMenuBgColor));
}
-VOID UiMessageBox(PCSTR MessageText)
-{
- UiVtbl.MessageBox(MessageText);
+VOID UiMessageBox(PCSTR Format, ...)
+{
+ CHAR Buffer[256];
+ va_list ap;
+
+ va_start(ap, Format);
+ vsnprintf(Buffer, sizeof(Buffer) - sizeof(CHAR), Format, ap);
+ UiVtbl.MessageBox(Buffer);
+ va_end(ap);
}
VOID UiMessageBoxCritical(PCSTR MessageText)
Modified: trunk/reactos/boot/freeldr/freeldr/windows/winldr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/windo…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/windows/winldr.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/windows/winldr.c [iso-8859-1] Tue Jan 14 20:12:07 2014
@@ -325,7 +325,8 @@
//FIXME: Maybe remove it from the list and try to continue?
if (!Status)
{
- UiMessageBox("Can't load boot driver!");
+ ERR("Can't load boot driver '%wZ'!", &BootDriver->FilePath);
+ UiMessageBox("Can't load boot driver '%wZ'!", &BootDriver->FilePath);
return FALSE;
}
Modified: trunk/reactos/boot/freeldr/freeldr/windows/wlregistry.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/windo…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/windows/wlregistry.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/windows/wlregistry.c [iso-8859-1] Tue Jan 14 20:12:07 2014
@@ -538,9 +538,9 @@
/* Get the Driver's Name */
ValueSize = sizeof(ServiceName);
rc = RegEnumKey(hServiceKey, Index, ServiceName, &ValueSize);
- //TRACE_CH(REACTOS, "RegEnumKey(): rc %d\n", (int)rc);
-
- /* Makre sure it's valid, and check if we're done */
+ TRACE("RegEnumKey(): rc %d\n", (int)rc);
+
+ /* Make sure it's valid, and check if we're done */
if (rc == ERROR_NO_MORE_ITEMS)
break;
if (rc != ERROR_SUCCESS)
@@ -627,7 +627,7 @@
FrLdrHeapFree(GroupNameBuffer, TAG_WLDR_NAME);
return;
}
- //TRACE_CH(REACTOS, "Service %d: '%S'\n", (int)Index, ServiceName);
+ TRACE("Service %d: '%S'\n", (int)Index, ServiceName);
/* open driver Key */
rc = RegOpenKey(hServiceKey, ServiceName, &hDriverKey);
Author: tkreuzer
Date: Tue Jan 14 19:41:01 2014
New Revision: 61624
URL: http://svn.reactos.org/svn/reactos?rev=61624&view=rev
Log:
[RTL]
Fix a nasty bug in RtlQueryRegistryValues, that caused memory corruption when the the key name or data had the "wrong" length.
Modified:
trunk/reactos/lib/rtl/registry.c
Modified: trunk/reactos/lib/rtl/registry.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/registry.c?rev=616…
==============================================================================
--- trunk/reactos/lib/rtl/registry.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/registry.c [iso-8859-1] Tue Jan 14 19:41:01 2014
@@ -211,7 +211,7 @@
/* Check if we have space to copy the data */
RequiredLength = KeyValueInfo->NameLength + sizeof(UNICODE_NULL);
- if (SpareLength < RequiredLength)
+ if ((SpareData > DataEnd) || (SpareLength < RequiredLength))
{
/* Fail and return the missing length */
*InfoSize = (ULONG)(SpareData - (PCHAR)KeyValueInfo) + RequiredLength;