Author: fireball
Date: Wed Dec 12 00:52:12 2007
New Revision: 31172
URL:
http://svn.reactos.org/svn/reactos?rev=31172&view=rev
Log:
- Fix default buffer size for user-mode RtlQueryRegistryValues queries, this removes
warnings on debug log about buffer being too small (it was!).
- Remove ARC tree dump since this code has now been proven to work.
- Sync PointerFree with WINE, removing the unhandled data type=warning.
Modified:
trunk/reactos/dll/ntdll/rtl/libsupp.c
trunk/reactos/dll/win32/rpcrt4/ndr_marshall.c
trunk/reactos/lib/rtl/registry.c
trunk/reactos/ntoskrnl/config/cmconfig.c
trunk/reactos/ntoskrnl/rtl/libsupp.c
Modified: trunk/reactos/dll/ntdll/rtl/libsupp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/rtl/libsupp.c?re…
==============================================================================
--- trunk/reactos/dll/ntdll/rtl/libsupp.c (original)
+++ trunk/reactos/dll/ntdll/rtl/libsupp.c Wed Dec 12 00:52:12 2007
@@ -12,6 +12,8 @@
#include <ntdll.h>
#define NDEBUG
#include <debug.h>
+
+SIZE_T RtlpAllocDeallocQueryBufferSize = PAGE_SIZE;
/* FUNCTIONS ***************************************************************/
Modified: trunk/reactos/dll/win32/rpcrt4/ndr_marshall.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/ndr_marsh…
==============================================================================
--- trunk/reactos/dll/win32/rpcrt4/ndr_marshall.c (original)
+++ trunk/reactos/dll/win32/rpcrt4/ndr_marshall.c Wed Dec 12 00:52:12 2007
@@ -904,36 +904,24 @@
pFormat += 2;
if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
else desc = pFormat + *(const SHORT*)pFormat;
+
+ if (!Pointer) return;
+
if (attr & RPC_FC_P_DEREF) {
- Pointer = *(unsigned char**)Pointer;
- TRACE("deref => %p\n", Pointer);
- }
-
- if (!Pointer) return;
-
+ Pointer = *(unsigned char**)Pointer;
+ TRACE("deref => %p\n", Pointer);
+ }
+
m = NdrFreer[*desc & NDR_TABLE_MASK];
if (m) m(pStubMsg, Pointer, desc);
- /* hmm... is this sensible?
- * perhaps we should check if the memory comes from NdrAllocate,
+ /* we should check if the memory comes from NdrAllocate,
* and deallocate only if so - checking if the pointer is between
- * BufferStart and BufferEnd is probably no good since the buffer
+ * BufferStart and BufferEnd will not always work since the buffer
* may be reallocated when the server wants to marshal the reply */
- switch (*desc) {
- case RPC_FC_BOGUS_STRUCT:
- case RPC_FC_BOGUS_ARRAY:
- case RPC_FC_USER_MARSHAL:
- break;
- default:
- FIXME("unhandled data type=%02x\n", *desc);
- case RPC_FC_CARRAY:
- case RPC_FC_C_CSTRING:
- case RPC_FC_C_WSTRING:
- if (pStubMsg->ReuseBuffer) goto notfree;
- break;
- case RPC_FC_IP:
- goto notfree;
- }
+ if (Pointer >= (unsigned char *)pStubMsg->RpcMsg->Buffer ||
+ Pointer <= (unsigned char *)pStubMsg->RpcMsg->Buffer +
pStubMsg->BufferLength)
+ goto notfree;
if (attr & RPC_FC_P_ONSTACK) {
TRACE("not freeing stack ptr %p\n", Pointer);
Modified: trunk/reactos/lib/rtl/registry.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/registry.c?rev=311…
==============================================================================
--- trunk/reactos/lib/rtl/registry.c (original)
+++ trunk/reactos/lib/rtl/registry.c Wed Dec 12 00:52:12 2007
@@ -14,6 +14,8 @@
#include <debug.h>
#define TAG_RTLREGISTRY TAG('R', 'q', 'r', 'v')
+
+extern SIZE_T RtlpAllocDeallocQueryBufferSize;
/* DATA **********************************************************************/
@@ -970,7 +972,7 @@
NTSTATUS Status;
PKEY_VALUE_FULL_INFORMATION KeyValueInfo = NULL;
HANDLE KeyHandle, CurrentKey;
- SIZE_T BufferSize = 128, InfoSize;
+ SIZE_T BufferSize, InfoSize;
UNICODE_STRING KeyPath, KeyValueName;
OBJECT_ATTRIBUTES ObjectAttributes;
ULONG i, Value;
@@ -985,6 +987,7 @@
(RelativeTo & RTL_REGISTRY_HANDLE) ? NULL : Path);
/* Allocate a query buffer */
+ BufferSize = RtlpAllocDeallocQueryBufferSize;
KeyValueInfo = RtlpAllocDeallocQueryBuffer(&BufferSize, NULL, 0, &Status);
if (!KeyValueInfo)
{
Modified: trunk/reactos/ntoskrnl/config/cmconfig.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmconfig.c…
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmconfig.c (original)
+++ trunk/reactos/ntoskrnl/config/cmconfig.c Wed Dec 12 00:52:12 2007
@@ -207,37 +207,10 @@
ULONG Interface = InterfaceType, Bus = BusNumber, i;
NTSTATUS Status;
HANDLE NewHandle;
- static ULONG t, tabLevel;
- PCHAR InterfaceStrings[MaximumInterfaceType + 1] =
- {
- "Internal",
- "Isa",
- "Eisa",
- "MicroChannel",
- "TurboChannel",
- "PCIBus",
- "VMEBus",
- "NuBus",
- "PCMCIABus",
- "CBus",
- "MPIBus",
- "MPSABus",
- "ProcessorInternal",
- "InternalPowerBus",
- "PNPISABus",
- "PNPBus",
- "Unknown"
- };
/* Loop each entry */
while (CurrentEntry)
{
- for (t = 0; t < tabLevel; t++) DbgPrint("\t");
- DbgPrint("Dumping node @ 0x%p\n", CurrentEntry);
- for (t = 0; t < tabLevel; t++) DbgPrint("\t");
- DbgPrint("Parent @ 0x%p Sibling @ 0x%p Child @ 0x%p\n",
- CurrentEntry->Parent, CurrentEntry->Sibling,
CurrentEntry->Child);
-
/* Check if this is an adapter */
Component = &CurrentEntry->ComponentEntry;
if ((Component->Class == AdapterClass) &&
@@ -303,35 +276,7 @@
}
/* Dump information on the component */
- for (t = 0; t < tabLevel; t++) DbgPrint("\t");
- DbgPrint("Component Type: %wZ\n",
&CmTypeName[Component->Type]);
- for (t = 0; t < tabLevel; t++) DbgPrint("\t");
- DbgPrint("Class: %wZ\n", &CmClassName[Component->Class]);
- if (Component->Class != SystemClass)
- {
- for (t = 0; t < tabLevel; t++) DbgPrint("\t");
- DbgPrint("Device Index: %lx\n",
DeviceIndexTable[Component->Type]);
- }
- for (t = 0; t < tabLevel; t++) DbgPrint("\t");
- DbgPrint("Component Information:\n");
- for (t = 0; t < tabLevel; t++) DbgPrint("\t");
- DbgPrint("\tFlags: %lx\n", Component->Flags);
- for (t = 0; t < tabLevel; t++) DbgPrint("\t");
- DbgPrint("\tVersion: %lx\n", Component->Version);
- for (t = 0; t < tabLevel; t++) DbgPrint("\t");
- DbgPrint("\tAffinity: %lx\n", Component->AffinityMask);
- if (Component->IdentifierLength)
- {
- for (t = 0; t < tabLevel; t++) DbgPrint("\t");
- DbgPrint("Identifier: %S\n", Component->Identifier);
- }
- for (t = 0; t < tabLevel; t++) DbgPrint("\t");
- DbgPrint("Configuration Data: %p\n",
CurrentEntry->ConfigurationData);
- for (t = 0; t < tabLevel; t++) DbgPrint("\t");
- DbgPrint("Interface Type: %s Bus Number: %d\n\n",
- InterfaceStrings[Interface],
- Bus);
-
+
/* Setup the hardware node */
Status = CmpInitializeRegistryNode(CurrentEntry,
ParentHandle,
@@ -345,12 +290,10 @@
if (CurrentEntry->Child)
{
/* Recurse child */
- tabLevel++;
Status = CmpSetupConfigurationTree(CurrentEntry->Child,
NewHandle,
Interface,
Bus);
- tabLevel--;
if (!NT_SUCCESS(Status))
{
/* Fail */
@@ -433,8 +376,6 @@
if (LoaderBlock->ConfigurationRoot)
{
/* Setup the configuration tree */
- DPRINT1("ARC Hardware Tree Received @ 0x%p. Dumping HW Info:\n\n",
- LoaderBlock->ConfigurationRoot);
Status = CmpSetupConfigurationTree(LoaderBlock->ConfigurationRoot,
KeyHandle,
-1,
@@ -455,3 +396,4 @@
+
Modified: trunk/reactos/ntoskrnl/rtl/libsupp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/rtl/libsupp.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/rtl/libsupp.c (original)
+++ trunk/reactos/ntoskrnl/rtl/libsupp.c Wed Dec 12 00:52:12 2007
@@ -22,6 +22,7 @@
} RTL_RANGE_ENTRY, *PRTL_RANGE_ENTRY;
PAGED_LOOKASIDE_LIST RtlpRangeListEntryLookasideList;
+SIZE_T RtlpAllocDeallocQueryBufferSize = 128;
/* FUNCTIONS *****************************************************************/