Author: fireball
Date: Wed Jan 30 13:32:22 2008
New Revision: 32051
URL:
http://svn.reactos.org/svn/reactos?rev=32051&view=rev
Log:
- Allocate memory for groups list dynamically, and make it enough (4096 bytes) for a
really long list of groups. This makes Windows 2003 booting up to explorer without
crashing.
Modified:
trunk/reactos/boot/freeldr/freeldr/windows/wlregistry.c
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 (original)
+++ trunk/reactos/boot/freeldr/freeldr/windows/wlregistry.c Wed Jan 30 13:32:22 2008
@@ -429,7 +429,7 @@
{
LONG rc = 0;
FRLDRHKEY hGroupKey, hOrderKey, hServiceKey, hDriverKey;
- WCHAR GroupNameBuffer[512];
+ LPWSTR GroupNameBuffer;
WCHAR ServiceName[256];
ULONG OrderList[128];
ULONG BufferSize;
@@ -480,7 +480,8 @@
}
/* Get the Name Group */
- BufferSize = sizeof(GroupNameBuffer);
+ BufferSize = 4096;
+ GroupNameBuffer = MmHeapAlloc(BufferSize);
rc = RegQueryValue(hGroupKey, L"List", NULL, (PUCHAR)GroupNameBuffer,
&BufferSize);
DbgPrint((DPRINT_REACTOS, "RegQueryValue(): rc %d\n", (int)rc));
if (rc != ERROR_SUCCESS)
@@ -515,7 +516,10 @@
if (rc == ERROR_NO_MORE_ITEMS)
break;
if (rc != ERROR_SUCCESS)
+ {
+ MmHeapFree(GroupNameBuffer);
return;
+ }
//DbgPrint((DPRINT_REACTOS, "Service %d: '%S'\n", (int)Index,
ServiceName));
/* open driver Key */
@@ -591,7 +595,10 @@
if (rc == ERROR_NO_MORE_ITEMS)
break;
if (rc != ERROR_SUCCESS)
+ {
+ MmHeapFree(GroupNameBuffer);
return;
+ }
//DbgPrint((DPRINT_REACTOS, "Service %d: '%S'\n", (int)Index,
ServiceName));
/* open driver Key */
@@ -657,6 +664,9 @@
/* Move to the next group name */
GroupName = GroupName + wcslen(GroupName) + 1;
}
+
+ /* Free allocated memory */
+ MmHeapFree(GroupNameBuffer);
}
BOOLEAN