Merge 15381:15421 from trunk.
Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/reactos/reactos.c
Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/reactos/setupldr.c
Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/ui/ui.c
Modified: branches/cache_manager_rewrite/reactos/drivers/bus/acpi/ospm/acpisys.c
Modified: branches/cache_manager_rewrite/reactos/drivers/bus/acpi/ospm/fdo.c
Modified: branches/cache_manager_rewrite/reactos/drivers/bus/acpi/ospm/include/acpisys.h
Modified: branches/cache_manager_rewrite/reactos/drivers/bus/acpi/ospm/osl.c
Modified: branches/cache_manager_rewrite/reactos/drivers/bus/acpi/ospm/pdo.c
Modified: branches/cache_manager_rewrite/reactos/drivers/bus/pci/pci.c
Modified: branches/cache_manager_rewrite/reactos/drivers/bus/pci/pdo.c
Modified: branches/cache_manager_rewrite/reactos/drivers/dd/serial/legacy.c
Modified: branches/cache_manager_rewrite/reactos/drivers/dd/serial/pnp.c
Modified: branches/cache_manager_rewrite/reactos/drivers/dd/serial/serial.h
Modified: branches/cache_manager_rewrite/reactos/drivers/input/i8042prt/i8042prt.h
Modified: branches/cache_manager_rewrite/reactos/drivers/input/i8042prt/mouse.c
Modified: branches/cache_manager_rewrite/reactos/drivers/net/afd/afd/info.c
Modified: branches/cache_manager_rewrite/reactos/include/ddk/obfuncs.h
Modified: branches/cache_manager_rewrite/reactos/lib/kernel32/mem/section.c
Modified: branches/cache_manager_rewrite/reactos/lib/kernel32/synch/event.c
Modified: branches/cache_manager_rewrite/reactos/lib/kernel32/synch/mutex.c
Modified: branches/cache_manager_rewrite/reactos/lib/kernel32/synch/sem.c
Modified: branches/cache_manager_rewrite/reactos/lib/kernel32/synch/timer.c
Modified: branches/cache_manager_rewrite/reactos/lib/msacm/msacm.rc
Added: branches/cache_manager_rewrite/reactos/lib/msacm/msacm_Sv.rc
Added: branches/cache_manager_rewrite/reactos/lib/setupapi/Sv.rc
Modified: branches/cache_manager_rewrite/reactos/lib/setupapi/setupapi.rc
Added: branches/cache_manager_rewrite/reactos/lib/shdocvw/Sv.rc
Modified: branches/cache_manager_rewrite/reactos/lib/shdocvw/shdocvw.rc
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/cm/cm.h
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/cm/ntfunc.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/cm/registry.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/cm/regobj.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ex/init.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/include/internal/io.h
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/include/internal/ob.h
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/io/device.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/io/driver.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/io/file.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/io/fs.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/io/iocomp.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/io/iomgr.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/io/pnpmgr.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/kdbg/kdb_cli.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ke/bug.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ke/clock.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ke/gate.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ke/i386/main.S
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ldr/loader.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/mm/section.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ob/dirobj.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ob/handle.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ob/namespc.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ob/ntobj.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/ob/object.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/rtl/nls.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/se/sd.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/se/semgr.c
Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/se/token.c
Modified: branches/cache_manager_rewrite/reactos/subsys/system/cmd/dir.c
Modified: branches/cache_manager_rewrite/reactos/subsys/system/cmd/internal.c
Modified: branches/cache_manager_rewrite/reactos/subsys/system/dhcp/dhclient.c
Modified: branches/cache_manager_rewrite/reactos/subsys/system/usetup/cabinet.c
Modified: branches/cache_manager_rewrite/reactos/subsys/system/usetup/cabinet.h
Modified: branches/cache_manager_rewrite/reactos/subsys/system/usetup/filesup.c
Modified: branches/cache_manager_rewrite/reactos/subsys/system/usetup/format.c
Modified: branches/cache_manager_rewrite/reactos/subsys/system/usetup/progress.c
Modified: branches/cache_manager_rewrite/reactos/subsys/system/usetup/progress.h
Modified: branches/cache_manager_rewrite/reactos/subsys/system/usetup/usetup.c
Modified: branches/cache_manager_rewrite/reactos/subsys/win32k/include/csr.h
Modified: branches/cache_manager_rewrite/reactos/subsys/win32k/ntuser/csr.c
Modified: branches/cache_manager_rewrite/reactos/subsys/win32k/ntuser/desktop.c
Modified: branches/cache_manager_rewrite/reactos/tools/cabman/dfp.cxx
Modified: branches/cache_manager_rewrite/reactos/tools/cabman/main.cxx
Modified: branches/cache_manager_rewrite/reactos/tools/rsym.c
Modified: branches/cache_manager_rewrite/reactos/w32api/include/ddk/winddk.h
Property changes on: branches/cache_manager_rewrite/reactos/apps/utils
___________________________________________________________________
Name: svn:ignore
   + 

Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/reactos/reactos.c
--- branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/reactos/reactos.c	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/reactos/reactos.c	2005-06-04 17:35:39 UTC (rev 15773)
@@ -756,6 +756,16 @@
 	if (!FrLdrLoadDriver(szHalName, 10))
 		return;
 
+#if 0
+    /* Load bootvid */
+		strcpy(value, "INBV.DLL");
+		strcpy(szHalName, szBootPath);
+		strcat(szHalName, "SYSTEM32\\");
+		strcat(szHalName, value);
+
+	if (!FrLdrLoadDriver(szHalName, 10))
+		return;
+#endif
 	/*
 	 * Load the System hive from disk
 	 */

Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/reactos/setupldr.c
--- branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/reactos/setupldr.c	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/reactos/setupldr.c	2005-06-04 17:35:39 UTC (rev 15773)
@@ -34,7 +34,7 @@
 #include "registry.h"
 
 
-//#define USE_UI
+#define USE_UI
 
 
 static BOOL
@@ -88,7 +88,7 @@
    * Update the status bar with the current file
    */
 #ifdef USE_UI
-  sprintf(szBuffer, "Reading %s", szShortName);
+  sprintf(szBuffer, "Setup is loading files (%s)", szShortName);
   UiDrawStatusText(szBuffer);
 #else
   printf("Reading %s\n", szShortName);
@@ -155,7 +155,7 @@
    * Update the status bar with the current file
    */
 #ifdef USE_UI
-  sprintf(szBuffer, "Reading %s", szShortName);
+  sprintf(szBuffer, "Setup is loading files (%s)", szShortName);
   UiDrawStatusText(szBuffer);
 #else
   printf("Reading %s\n", szShortName);
@@ -220,7 +220,7 @@
    * Update the status bar with the current file
    */
 #ifdef USE_UI
-  sprintf(szBuffer, "Reading %s", szShortName);
+  sprintf(szBuffer, "Setup is loading files (%s)", szShortName);
   UiDrawStatusText(szBuffer);
 #else
   printf("Reading %s\n", szShortName);
@@ -232,6 +232,7 @@
   return(TRUE);
 }
 
+BOOL SetupUiInitialize(VOID);
 
 VOID RunLoader(VOID)
 {
@@ -294,7 +295,7 @@
 #endif
 
 #ifdef USE_UI
-  UiInitialize();
+  SetupUiInitialize();
   UiDrawStatusText("");
 #endif
 

Modified: branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/ui/ui.c
--- branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/ui/ui.c	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/boot/freeldr/freeldr/ui/ui.c	2005-06-04 17:35:39 UTC (rev 15773)
@@ -27,6 +27,7 @@
 #include <inifile.h>
 #include <version.h>
 #include <video.h>
+#include <reactos/buildno.h>
 
 ULONG	UiScreenWidth = 80;							// Screen Width
 ULONG	UiScreenHeight = 25;							// Screen Height
@@ -197,7 +198,40 @@
 	UserInterfaceUp = TRUE;
 
 	DbgPrint((DPRINT_UI, "UiInitialize() returning TRUE.\n"));
+	return TRUE;
+}
 
+BOOL SetupUiInitialize(VOID)
+{
+
+	CHAR	DisplayModeText[260];
+	ULONG	Depth;
+
+	
+	DisplayModeText[0] = '\0';
+	
+
+	UiDisplayMode = MachVideoSetDisplayMode(DisplayModeText, TRUE);
+	MachVideoGetDisplaySize(&UiScreenWidth, &UiScreenHeight, &Depth);
+
+	TuiInitialize();
+
+	// Draw the backdrop and fade it in if special effects are enabled
+	TuiFillArea(0,
+			0,
+			UiScreenWidth - 1,
+			UiScreenHeight - 2,
+			0,
+			ATTR(UiBackdropFgColor, UiBackdropBgColor));
+
+    UiStatusBarBgColor = 7;
+	UserInterfaceUp = TRUE;
+    
+    TuiDrawText(4, 1, "ReactOS " KERNEL_VERSION_STR " Setup", ATTR(COLOR_GRAY, UiBackdropBgColor));
+    TuiDrawText(3, 2, "\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD", ATTR(COLOR_GRAY, UiBackdropBgColor));
+
+	DbgPrint((DPRINT_UI, "UiInitialize() returning TRUE.\n"));
+
 	return TRUE;
 }
 

Modified: branches/cache_manager_rewrite/reactos/drivers/bus/acpi/ospm/acpisys.c
--- branches/cache_manager_rewrite/reactos/drivers/bus/acpi/ospm/acpisys.c	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/drivers/bus/acpi/ospm/acpisys.c	2005-06-04 17:35:39 UTC (rev 15773)
@@ -162,7 +162,7 @@
   IN PDRIVER_OBJECT DriverObject,
   IN PUNICODE_STRING RegistryPath)
 {
-  DbgPrint("Advanced Configuration and Power Interface Bus Driver\n");
+  DPRINT("Advanced Configuration and Power Interface Bus Driver\n");
 
   DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = (PDRIVER_DISPATCH) ACPIDispatchDeviceControl;
   DriverObject->MajorFunction[IRP_MJ_PNP] = (PDRIVER_DISPATCH) ACPIPnpControl;

Modified: branches/cache_manager_rewrite/reactos/drivers/bus/acpi/ospm/fdo.c
--- branches/cache_manager_rewrite/reactos/drivers/bus/acpi/ospm/fdo.c	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/drivers/bus/acpi/ospm/fdo.c	2005-06-04 17:35:39 UTC (rev 15773)
@@ -119,12 +119,16 @@
 static BOOLEAN
 AcpiCreateResourceList(PCM_RESOURCE_LIST* pResourceList,
                        PULONG ResourceListSize,
+                       PIO_RESOURCE_REQUIREMENTS_LIST* pRequirementsList,
+                       PULONG RequirementsListSize,
                        RESOURCE* resources)
 {
   BOOLEAN Done;
   ULONG NumberOfResources = 0;
   PCM_RESOURCE_LIST ResourceList;
+  PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList;
   PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor;
+  PIO_RESOURCE_DESCRIPTOR RequirementDescriptor;
   RESOURCE* resource;
   ULONG i;
   KIRQL Dirql;
@@ -176,6 +180,24 @@
   ResourceList->List[0].PartialResourceList.Count = NumberOfResources;
   ResourceDescriptor = ResourceList->List[0].PartialResourceList.PartialDescriptors;
 
+  *RequirementsListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) + sizeof(IO_RESOURCE_DESCRIPTOR) * (NumberOfResources - 1);
+  RequirementsList = (PIO_RESOURCE_REQUIREMENTS_LIST)ExAllocatePool(PagedPool, *RequirementsListSize);
+  *pRequirementsList = RequirementsList;
+  if (!RequirementsList)
+  {
+    ExFreePool(ResourceList);
+    return FALSE;
+  }
+  RequirementsList->ListSize = *RequirementsListSize;
+  RequirementsList->InterfaceType = ResourceList->List[0].InterfaceType;
+  RequirementsList->BusNumber = ResourceList->List[0].BusNumber;
+  RequirementsList->SlotNumber = 0; /* Not used by WDM drivers */
+  RequirementsList->AlternativeLists = 1;
+  RequirementsList->List[0].Version = 1;
+  RequirementsList->List[0].Revision = 1;
+  RequirementsList->List[0].Count = NumberOfResources;
+  RequirementDescriptor = RequirementsList->List[0].Descriptors;
+
   /* Fill resources list structure */
   Done = FALSE;
   resource = resources;
@@ -199,7 +221,16 @@
             &Dirql,
             &ResourceDescriptor->u.Interrupt.Affinity);
           ResourceDescriptor->u.Interrupt.Level = (ULONG)Dirql;
+
+          RequirementDescriptor->Option = 0; /* Required */
+          RequirementDescriptor->Type = ResourceDescriptor->Type;
+          RequirementDescriptor->ShareDisposition = ResourceDescriptor->ShareDisposition;
+          RequirementDescriptor->Flags = ResourceDescriptor->Flags;
+          RequirementDescriptor->u.Interrupt.MinimumVector = RequirementDescriptor->u.Interrupt.MaximumVector
+            = irq_data->interrupts[i];
+
           ResourceDescriptor++;
+          RequirementDescriptor++;
         }
         break;
       }
@@ -225,7 +256,16 @@
             case TRANSFER_8_16: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_8_AND_16; break;
           }
           ResourceDescriptor->u.Dma.Channel = dma_data->channels[i];
+
+          RequirementDescriptor->Option = 0; /* Required */
+          RequirementDescriptor->Type = ResourceDescriptor->Type;
+          RequirementDescriptor->ShareDisposition = ResourceDescriptor->ShareDisposition;
+          RequirementDescriptor->Flags = ResourceDescriptor->Flags;
+          RequirementDescriptor->u.Dma.MinimumChannel = RequirementDescriptor->u.Dma.MaximumChannel
+            = ResourceDescriptor->u.Dma.Channel;
+
           ResourceDescriptor++;
+          RequirementDescriptor++;
         }
         break;
       }
@@ -242,7 +282,18 @@
         ResourceDescriptor->u.Port.Start.u.HighPart = 0;
         ResourceDescriptor->u.Port.Start.u.LowPart = io_data->min_base_address;
         ResourceDescriptor->u.Port.Length = io_data->range_length;
+
+        RequirementDescriptor->Option = 0; /* Required */
+        RequirementDescriptor->Type = ResourceDescriptor->Type;
+        RequirementDescriptor->ShareDisposition = ResourceDescriptor->ShareDisposition;
+        RequirementDescriptor->Flags = ResourceDescriptor->Flags;
+        RequirementDescriptor->u.Port.Length = ResourceDescriptor->u.Port.Length;
+        RequirementDescriptor->u.Port.Alignment = 1; /* Start address is specified, so it doesn't matter */
+        RequirementDescriptor->u.Port.MinimumAddress = RequirementDescriptor->u.Port.MaximumAddress
+          = ResourceDescriptor->u.Port.Start;
+
         ResourceDescriptor++;
+        RequirementDescriptor++;
         break;
       }
       case end_tag:
@@ -366,6 +417,8 @@
           }
           if (!AcpiCreateResourceList(&PdoDeviceExtension->ResourceList,
                                       &PdoDeviceExtension->ResourceListSize,
+                                      &PdoDeviceExtension->ResourceRequirementsList,
+                                      &PdoDeviceExtension->ResourceRequirementsListSize,
                                       (RESOURCE*)Buffer.pointer))
           {
             ASSERT(FALSE);
@@ -573,7 +626,9 @@
     }
   }
 
+#ifndef NDEBUG
   ACPIPrintInfo(DeviceExtension);
+#endif
 
   /* Initialize ACPI bus manager */
   AcpiStatus = bm_initialize();

Modified: branches/cache_manager_rewrite/reactos/drivers/bus/acpi/ospm/include/acpisys.h
--- branches/cache_manager_rewrite/reactos/drivers/bus/acpi/ospm/include/acpisys.h	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/drivers/bus/acpi/ospm/include/acpisys.h	2005-06-04 17:35:39 UTC (rev 15773)
@@ -50,6 +50,9 @@
   // Resource list
   PCM_RESOURCE_LIST ResourceList;
   ULONG ResourceListSize;
+  // Requirement list
+  PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirementsList;
+  ULONG ResourceRequirementsListSize;
 } PDO_DEVICE_EXTENSION, *PPDO_DEVICE_EXTENSION;
 
 

Modified: branches/cache_manager_rewrite/reactos/drivers/bus/acpi/ospm/osl.c
--- branches/cache_manager_rewrite/reactos/drivers/bus/acpi/ospm/osl.c	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/drivers/bus/acpi/ospm/osl.c	2005-06-04 17:35:39 UTC (rev 15773)
@@ -98,7 +98,7 @@
 	static char Buffer[512];
   LONG Size = vsprintf(Buffer, fmt, args);
 
-	DbgPrint("%s", Buffer);
+	DPRINT("%s", Buffer);
 	return Size;
 }
 

Modified: branches/cache_manager_rewrite/reactos/drivers/bus/acpi/ospm/pdo.c
--- branches/cache_manager_rewrite/reactos/drivers/bus/acpi/ospm/pdo.c	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/drivers/bus/acpi/ospm/pdo.c	2005-06-04 17:35:39 UTC (rev 15773)
@@ -108,6 +108,35 @@
 
 
 static NTSTATUS
+PdoQueryResourceRequirements(
+  IN PDEVICE_OBJECT DeviceObject,
+  IN PIRP Irp,
+  PIO_STACK_LOCATION IrpSp)
+{
+  PPDO_DEVICE_EXTENSION DeviceExtension;
+  PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirementsList;
+
+  DeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+
+  if (DeviceExtension->ResourceRequirementsListSize == 0)
+  {
+    return Irp->IoStatus.Status;
+  }
+
+  ResourceRequirementsList = ExAllocatePool(PagedPool, DeviceExtension->ResourceRequirementsListSize);
+  if (!ResourceRequirementsList)
+  {
+    Irp->IoStatus.Information = 0;
+    return STATUS_INSUFFICIENT_RESOURCES;
+  }
+
+  RtlCopyMemory(ResourceRequirementsList, DeviceExtension->ResourceRequirementsList, DeviceExtension->ResourceRequirementsListSize);
+  Irp->IoStatus.Information = (ULONG_PTR)ResourceRequirementsList;
+  return STATUS_SUCCESS;
+}
+
+
+static NTSTATUS
 PdoQueryResources(
   IN PDEVICE_OBJECT DeviceObject,
   IN PIRP Irp,
@@ -227,6 +256,9 @@
     break;
 
   case IRP_MN_QUERY_RESOURCE_REQUIREMENTS:
+    Status = PdoQueryResourceRequirements(DeviceObject,
+                                          Irp,
+                                          IrpSp);
     break;
 
   case IRP_MN_QUERY_RESOURCES:

Modified: branches/cache_manager_rewrite/reactos/drivers/bus/pci/pci.c
--- branches/cache_manager_rewrite/reactos/drivers/bus/pci/pci.c	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/drivers/bus/pci/pci.c	2005-06-04 17:35:39 UTC (rev 15773)
@@ -172,7 +172,7 @@
   IN PDRIVER_OBJECT DriverObject,
   IN PUNICODE_STRING RegistryPath)
 {
-  DbgPrint("Peripheral Component Interconnect Bus Driver\n");
+  DPRINT("Peripheral Component Interconnect Bus Driver\n");
 
   DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = PciDispatchDeviceControl;
   DriverObject->MajorFunction[IRP_MJ_PNP] = PciPnpControl;

Modified: branches/cache_manager_rewrite/reactos/drivers/bus/pci/pdo.c
--- branches/cache_manager_rewrite/reactos/drivers/bus/pci/pdo.c	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/drivers/bus/pci/pdo.c	2005-06-04 17:35:39 UTC (rev 15773)
@@ -409,6 +409,8 @@
 
   ResourceList->ListSize = ListSize;
   ResourceList->InterfaceType = PCIBus;
+  ResourceList->BusNumber = DeviceExtension->BusNumber,
+  ResourceList->SlotNumber = DeviceExtension->SlotNumber.u.AsULONG,
   ResourceList->AlternativeLists = 1;
 
   ResourceList->List[0].Version = 1;

Modified: branches/cache_manager_rewrite/reactos/drivers/dd/serial/legacy.c
--- branches/cache_manager_rewrite/reactos/drivers/dd/serial/legacy.c	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/drivers/dd/serial/legacy.c	2005-06-04 17:35:39 UTC (rev 15773)
@@ -83,12 +83,13 @@
 {
 	ULONG ResourceListSize;
 	PCM_RESOURCE_LIST ResourceList;
+	PCM_RESOURCE_LIST ResourceListTranslated;
 	PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor;
+	PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptorTranslated;
 	BOOLEAN ConflictDetected;
 	UART_TYPE UartType;
 	PDEVICE_OBJECT Pdo = NULL;
 	PDEVICE_OBJECT Fdo;
-	KIRQL Dirql;
 	NTSTATUS Status;
 
 	/* Create resource list */
@@ -96,29 +97,60 @@
 	ResourceList = (PCM_RESOURCE_LIST)ExAllocatePoolWithTag(PagedPool, ResourceListSize, SERIAL_TAG);
 	if (!ResourceList)
 		return STATUS_INSUFFICIENT_RESOURCES;
-	ResourceList->Count = 1;
-	ResourceList->List[0].InterfaceType = InterfaceTypeUndefined;
-	ResourceList->List[0].BusNumber = -1; /* unknown */
-	ResourceList->List[0].PartialResourceList.Version = 1;
-	ResourceList->List[0].PartialResourceList.Revision = 1;
-	ResourceList->List[0].PartialResourceList.Count = 2;
+	ResourceListTranslated = (PCM_RESOURCE_LIST)ExAllocatePoolWithTag(PagedPool, ResourceListSize, SERIAL_TAG);
+	if (!ResourceListTranslated)
+	{
+		ExFreePoolWithTag(ResourceList, SERIAL_TAG);
+		return STATUS_INSUFFICIENT_RESOURCES;
+	}
+
+	/* Resource header */
+	ResourceList->Count = ResourceListTranslated->Count
+		= 1;
+	ResourceList->List[0].InterfaceType = ResourceListTranslated->List[0].InterfaceType
+		= InterfaceTypeUndefined;
+	ResourceList->List[0].BusNumber = ResourceListTranslated->List[0].BusNumber
+		= -1; /* unknown */
+	ResourceList->List[0].PartialResourceList.Version = ResourceListTranslated->List[0].PartialResourceList.Version
+		= 1;
+	ResourceList->List[0].PartialResourceList.Revision = ResourceListTranslated->List[0].PartialResourceList.Revision
+		= 1;
+	ResourceList->List[0].PartialResourceList.Count = ResourceListTranslated->List[0].PartialResourceList.Count
+		= 2;
+
+	/* I/O port */
 	ResourceDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[0];
-	ResourceDescriptor->Type = CmResourceTypePort;
-	ResourceDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
-	ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
-	ResourceDescriptor->u.Port.Start.u.HighPart = 0;
-	ResourceDescriptor->u.Port.Start.u.LowPart = ComPortBase;
-	ResourceDescriptor->u.Port.Length = 8;
+	ResourceDescriptorTranslated = &ResourceListTranslated->List[0].PartialResourceList.PartialDescriptors[0];
+	ResourceDescriptor->Type = ResourceDescriptorTranslated->Type
+		= CmResourceTypePort;
+	ResourceDescriptor->ShareDisposition = ResourceDescriptorTranslated->ShareDisposition
+		= CmResourceShareDriverExclusive;
+	ResourceDescriptor->Flags = ResourceDescriptorTranslated->Flags
+		= CM_RESOURCE_PORT_IO;
+	ResourceDescriptor->u.Port.Start.u.HighPart = ResourceDescriptorTranslated->u.Port.Start.u.HighPart
+		= 0;
+	ResourceDescriptor->u.Port.Start.u.LowPart = ResourceDescriptorTranslated->u.Port.Start.u.LowPart
+		= ComPortBase;
+	ResourceDescriptor->u.Port.Length = ResourceDescriptorTranslated->u.Port.Length
+		= 8;
 
 	ResourceDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[1];
-	ResourceDescriptor->Type = CmResourceTypeInterrupt;
-	ResourceDescriptor->ShareDisposition = CmResourceShareShared;
-	ResourceDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
-	ResourceDescriptor->u.Interrupt.Vector = HalGetInterruptVector(
-		Internal, 0, 0, Irq,
-		&Dirql,
+	ResourceDescriptorTranslated = &ResourceListTranslated->List[0].PartialResourceList.PartialDescriptors[1];
+	ResourceDescriptor->Type = ResourceDescriptorTranslated->Type
+		= CmResourceTypeInterrupt;
+	ResourceDescriptor->ShareDisposition = ResourceDescriptorTranslated->ShareDisposition
+		= CmResourceShareShared;
+	ResourceDescriptor->Flags = ResourceDescriptorTranslated->Flags
+		= CM_RESOURCE_INTERRUPT_LATCHED;
+	ResourceDescriptor->u.Interrupt.Level = Irq;
+	ResourceDescriptorTranslated->u.Interrupt.Vector = HalGetInterruptVector(
+		ResourceList->List[0].InterfaceType,
+		ResourceList->List[0].BusNumber,
+		ResourceDescriptor->u.Interrupt.Level,
+		ResourceDescriptor->u.Interrupt.Vector,
+		(PKIRQL)&ResourceDescriptorTranslated->u.Interrupt.Level,
 		&ResourceDescriptor->u.Interrupt.Affinity);
-	ResourceDescriptor->u.Interrupt.Level = (ULONG)Dirql;
+	ResourceDescriptorTranslated->u.Interrupt.Affinity = ResourceDescriptor->u.Interrupt.Affinity;
 
 	/* Report resource list */
 	Status = IoReportResourceForDetection(
@@ -129,11 +161,13 @@
 	{
 		DPRINT("Serial: conflict detected for serial port at 0x%lx (Irq %lu)\n", ComPortBase, Irq);
 		ExFreePoolWithTag(ResourceList, SERIAL_TAG);
+		ExFreePoolWithTag(ResourceListTranslated, SERIAL_TAG);
 		return STATUS_DEVICE_NOT_CONNECTED;
 	}
 	if (!NT_SUCCESS(Status))
 	{
 		ExFreePoolWithTag(ResourceList, SERIAL_TAG);
+		ExFreePoolWithTag(ResourceListTranslated, SERIAL_TAG);
 		return Status;
 	}
 
@@ -154,7 +188,7 @@
 			Status = SerialAddDeviceInternal(DriverObject, Pdo, UartType, pComPortNumber, &Fdo);
 			if (NT_SUCCESS(Status))
 			{
-				Status = SerialPnpStartDevice(Fdo, ResourceList);
+				Status = SerialPnpStartDevice(Fdo, ResourceList, ResourceListTranslated);
 			}
 		}
 	}
@@ -168,6 +202,7 @@
 		Status = STATUS_DEVICE_NOT_CONNECTED;
 	}
 	ExFreePoolWithTag(ResourceList, SERIAL_TAG);
+	ExFreePoolWithTag(ResourceListTranslated, SERIAL_TAG);
 	return Status;
 }
 

Modified: branches/cache_manager_rewrite/reactos/drivers/dd/serial/pnp.c
--- branches/cache_manager_rewrite/reactos/drivers/dd/serial/pnp.c	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/drivers/dd/serial/pnp.c	2005-06-04 17:35:39 UTC (rev 15773)
@@ -126,7 +126,8 @@
 NTSTATUS STDCALL
 SerialPnpStartDevice(
 	IN PDEVICE_OBJECT DeviceObject,
-	IN PCM_RESOURCE_LIST ResourceList)
+	IN PCM_RESOURCE_LIST ResourceList,
+	IN PCM_RESOURCE_LIST ResourceListTranslated)
 {
 	PSERIAL_DEVICE_EXTENSION DeviceExtension;
 	WCHAR DeviceNameBuffer[32];
@@ -174,8 +175,8 @@
 				case CmResourceTypeInterrupt:
 					if (Dirql != 0)
 						return STATUS_UNSUCCESSFUL;
-					Dirql = (KIRQL)PartialDescriptor->u.Interrupt.Level;
-					Vector = PartialDescriptor->u.Interrupt.Vector;
+					Dirql = (KIRQL)ResourceListTranslated->List[i].PartialResourceList.PartialDescriptors[j].u.Interrupt.Level;
+					Vector = ResourceListTranslated->List[i].PartialResourceList.PartialDescriptors[j].u.Interrupt.Vector;
 					Affinity = PartialDescriptor->u.Interrupt.Affinity;
 					if (PartialDescriptor->Flags & CM_RESOURCE_INTERRUPT_LATCHED)
 						InterruptMode = Latched;
@@ -338,16 +339,9 @@
 			BOOLEAN ConflictDetected;
 			DPRINT("Serial: IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
 
-			/* FIXME: first HACK: PnP manager can send multiple
-			 * IRP_MN_START_DEVICE for one device
-			 */
-			if (((PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->PnpState != dsStopped)
-			{
-				DPRINT1("Serial: device already started. Ignoring this irp!\n");
-				Status = STATUS_SUCCESS;
-				break;
-			}
-			/* FIXME: second HACK: verify that we have some allocated resources.
+			ASSERT(((PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->PnpState == dsStopped);
+
+			/* FIXME: HACK: verify that we have some allocated resources.
 			 * It seems not to be always the case on some hardware
 			 */
 			if (Stack->Parameters.StartDevice.AllocatedResources == NULL)
@@ -357,7 +351,7 @@
 				Status = STATUS_INSUFFICIENT_RESOURCES;
 				break;
 			}
-			/* FIXME: third HACK: verify that we don't have resource conflict,
+			/* FIXME: HACK: verify that we don't have resource conflict,
 			 * because PnP manager doesn't do it automatically
 			 */
 			Status = IoReportResourceForDetection(
@@ -377,7 +371,8 @@
 			if (NT_SUCCESS(Status))
 				Status = SerialPnpStartDevice(
 					DeviceObject,
-					Stack->Parameters.StartDevice.AllocatedResources);
+					Stack->Parameters.StartDevice.AllocatedResources,
+					Stack->Parameters.StartDevice.AllocatedResourcesTranslated);
 			break;
 		}
 		case IRP_MN_QUERY_DEVICE_RELATIONS: /* (optional) 0x7 */

Modified: branches/cache_manager_rewrite/reactos/drivers/dd/serial/serial.h
--- branches/cache_manager_rewrite/reactos/drivers/dd/serial/serial.h	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/drivers/dd/serial/serial.h	2005-06-04 17:35:39 UTC (rev 15773)
@@ -327,7 +327,8 @@
 NTSTATUS STDCALL
 SerialPnpStartDevice(
 	IN PDEVICE_OBJECT DeviceObject,
-	IN PCM_RESOURCE_LIST ResourceList);
+	IN PCM_RESOURCE_LIST ResourceList,
+	IN PCM_RESOURCE_LIST ResourceListTranslated);
 
 NTSTATUS STDCALL
 SerialPnp(

Modified: branches/cache_manager_rewrite/reactos/drivers/input/i8042prt/i8042prt.h
--- branches/cache_manager_rewrite/reactos/drivers/input/i8042prt/i8042prt.h	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/drivers/input/i8042prt/i8042prt.h	2005-06-04 17:35:39 UTC (rev 15773)
@@ -86,7 +86,7 @@
 	DWORD OverrideKeyboardType;
 	DWORD OverrideKeyboardSubtype;
 	DWORD MouseResendStallTime;
-	DWORD MouseSynchIn100ns;
+	DWORD MouseSynchIn100ns;      /* done */
 	DWORD MouseResolution;        /* done */
 	DWORD NumberOfButtons;
 	DWORD EnableWheelDetection;
@@ -169,6 +169,7 @@
 	MOUSE_INPUT_DATA *MouseBuffer;
 	ULONG MouseInBuffer;
 	USHORT MouseButtonState;
+	ULARGE_INTEGER MousePacketStartTime;
 
 	UCHAR MouseLogiBuffer[3];
 	UCHAR MouseLogitechID;

Modified: branches/cache_manager_rewrite/reactos/drivers/input/i8042prt/mouse.c
--- branches/cache_manager_rewrite/reactos/drivers/input/i8042prt/mouse.c	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/drivers/input/i8042prt/mouse.c	2005-06-04 17:35:39 UTC (rev 15773)
@@ -45,6 +45,39 @@
 	                           WaitForAck);
 }
 
+/* Test if packets are taking too long to come in. If they do, we
+ * might have gotten out of sync and should just drop what we have.
+ *
+ * If we want to be totally right, we'd also have to keep a count of
+ * errors, and totally reset the mouse after too much of them (can
+ * happen if the user is using a KVM switch and an OS on another port
+ * resets the mouse, or if the user hotplugs the mouse, or if we're just
+ * generally unlucky). Also note the input parsing routine where we
+ * drop invalid input packets.
+ */
+static VOID STDCALL I8042MouseInputTestTimeout(PDEVICE_EXTENSION DevExt)
+{
+	ULARGE_INTEGER Now;
+
+	if (DevExt->MouseState == MouseExpectingACK ||
+	    DevExt->MouseState == MouseResetting)
+		return;
+
+	Now.QuadPart = KeQueryInterruptTime();
+
+	if (DevExt->MouseState != MouseIdle) {
+		/* Check if the last byte came too long ago */
+		if (Now.QuadPart - DevExt->MousePacketStartTime.QuadPart >
+		                           DevExt->Settings.MouseSynchIn100ns) {
+			DPRINT1("Mouse input packet timeout\n");
+			DevExt->MouseState = MouseIdle;
+		}
+	}
+
+	if (DevExt->MouseState == MouseIdle)
+		DevExt->MousePacketStartTime.QuadPart = Now.QuadPart;
+}
+
 /*
  * Call the customization hook. The Ret2 parameter is about wether
  * we should go on with the interrupt. The return value is what
@@ -517,6 +550,8 @@
 		return TRUE;
 	}
 
+	I8042MouseInputTestTimeout(DevExt);
+
 	if (I8042MouseResetIsr(DevExt, PortStatus, &Output)) {
 		DPRINT("Handled by ResetIsr or hooked Isr\n");
 		if (NoChange != DevExt->MouseTimeoutState) {

Modified: branches/cache_manager_rewrite/reactos/drivers/net/afd/afd/info.c
--- branches/cache_manager_rewrite/reactos/drivers/net/afd/afd/info.c	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/drivers/net/afd/afd/info.c	2005-06-04 17:35:39 UTC (rev 15773)
@@ -141,7 +141,7 @@
 	}
 
 	/* MmUnlockPages( Mdl ); */
-	IoFreeMdl( Mdl );
+	/* IoFreeMdl( Mdl ); */
     } else {
     	Status = STATUS_INSUFFICIENT_RESOURCES;
     }

Modified: branches/cache_manager_rewrite/reactos/include/ddk/obfuncs.h
--- branches/cache_manager_rewrite/reactos/include/ddk/obfuncs.h	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/include/ddk/obfuncs.h	2005-06-04 17:35:39 UTC (rev 15773)
@@ -63,6 +63,15 @@
                         PSECURITY_DESCRIPTOR SecurityDescriptor,
                         PULONG BufferLength);
 
+typedef struct _OBJECT_HEADER_NAME_INFO
+{
+    struct _DIRECTORY_OBJECT *Directory;
+    UNICODE_STRING Name;
+    ULONG QueryReferences;
+    ULONG Reserved2;
+    ULONG DbgReferenceCount;
+} OBJECT_HEADER_NAME_INFO, *POBJECT_HEADER_NAME_INFO;
+
 typedef struct _OBJECT_CREATE_INFORMATION 
 {
     ULONG Attributes;

Modified: branches/cache_manager_rewrite/reactos/lib/kernel32/mem/section.c
--- branches/cache_manager_rewrite/reactos/lib/kernel32/mem/section.c	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/lib/kernel32/mem/section.c	2005-06-04 17:35:39 UTC (rev 15773)
@@ -77,7 +77,7 @@
    InitializeObjectAttributes(&ObjectAttributes,
 			      (lpName ? &UnicodeName : NULL),
 			      0,
-			      hBaseDir,
+			      (lpName ? hBaseDir : NULL),
 			      SecurityDescriptor);
 
    Status = NtCreateSection(&SectionHandle,
@@ -155,7 +155,7 @@
    InitializeObjectAttributes(&ObjectAttributes,
 			      (lpName ? &UnicodeName : NULL),
 			      0,
-			      hBaseDir,
+			      (lpName ? hBaseDir : NULL),
 			      SecurityDescriptor);
 
    Status = NtCreateSection(&SectionHandle,

Modified: branches/cache_manager_rewrite/reactos/lib/kernel32/synch/event.c
--- branches/cache_manager_rewrite/reactos/lib/kernel32/synch/event.c	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/lib/kernel32/synch/event.c	2005-06-04 17:35:39 UTC (rev 15773)
@@ -77,7 +77,7 @@
    InitializeObjectAttributes(&ObjectAttributes,
 			      (lpName ? &UnicodeName : NULL),
 			      0,
-			      hBaseDir,
+			      (lpName ? hBaseDir : NULL),
 			      NULL);
 
    if (lpEventAttributes != NULL)

Modified: branches/cache_manager_rewrite/reactos/lib/kernel32/synch/mutex.c
--- branches/cache_manager_rewrite/reactos/lib/kernel32/synch/mutex.c	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/lib/kernel32/synch/mutex.c	2005-06-04 17:35:39 UTC (rev 15773)
@@ -76,7 +76,7 @@
    InitializeObjectAttributes(&ObjectAttributes,
 			      (lpName ? &UnicodeName : NULL),
 			      0,
-			      hBaseDir,
+			      (lpName ? hBaseDir : NULL),
 			      NULL);
 
    if (lpMutexAttributes != NULL)

Modified: branches/cache_manager_rewrite/reactos/lib/kernel32/synch/sem.c
--- branches/cache_manager_rewrite/reactos/lib/kernel32/synch/sem.c	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/lib/kernel32/synch/sem.c	2005-06-04 17:35:39 UTC (rev 15773)
@@ -77,7 +77,7 @@
    InitializeObjectAttributes(&ObjectAttributes,
 			      (lpName ? &UnicodeName : NULL),
 			      0,
-			      hBaseDir,
+			      (lpName ? hBaseDir : NULL),
 			      NULL);
 
    if (lpSemaphoreAttributes != NULL)

Modified: branches/cache_manager_rewrite/reactos/lib/kernel32/synch/timer.c
--- branches/cache_manager_rewrite/reactos/lib/kernel32/synch/timer.c	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/lib/kernel32/synch/timer.c	2005-06-04 17:35:39 UTC (rev 15773)
@@ -38,7 +38,7 @@
    InitializeObjectAttributes(&ObjectAttributes,
 			      (lpTimerName ? &UnicodeName : NULL),
 			      0,
-			      hBaseDir,
+			      (lpTimerName ? hBaseDir : NULL),
 			      NULL);
 
    if (lpTimerAttributes != NULL)

Modified: branches/cache_manager_rewrite/reactos/lib/msacm/msacm.rc
--- branches/cache_manager_rewrite/reactos/lib/msacm/msacm.rc	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/lib/msacm/msacm.rc	2005-06-04 17:35:39 UTC (rev 15773)
@@ -30,3 +30,4 @@
 #include "msacm_Ja.rc"
 #include "msacm_Nl.rc"
 #include "msacm_Pt.rc"
+#include "msacm_Sv.rc"

Copied: branches/cache_manager_rewrite/reactos/lib/msacm/msacm_Sv.rc (from rev 15421, trunk/reactos/lib/msacm/msacm_Sv.rc)

Copied: branches/cache_manager_rewrite/reactos/lib/setupapi/Sv.rc (from rev 15421, trunk/reactos/lib/setupapi/Sv.rc)

Modified: branches/cache_manager_rewrite/reactos/lib/setupapi/setupapi.rc
--- branches/cache_manager_rewrite/reactos/lib/setupapi/setupapi.rc	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/lib/setupapi/setupapi.rc	2005-06-04 17:35:39 UTC (rev 15773)
@@ -35,3 +35,4 @@
 #include "Nl.rc"
 #include "Pt.rc"
 #include "Ru.rc"
+#include "Sv.rc"

Copied: branches/cache_manager_rewrite/reactos/lib/shdocvw/Sv.rc (from rev 15421, trunk/reactos/lib/shdocvw/Sv.rc)

Modified: branches/cache_manager_rewrite/reactos/lib/shdocvw/shdocvw.rc
--- branches/cache_manager_rewrite/reactos/lib/shdocvw/shdocvw.rc	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/lib/shdocvw/shdocvw.rc	2005-06-04 17:35:39 UTC (rev 15773)
@@ -29,3 +29,4 @@
 #include "Fr.rc"
 #include "Nl.rc"
 #include "Pt.rc"
+#include "Sv.rc"

Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/cm/cm.h
--- branches/cache_manager_rewrite/reactos/ntoskrnl/cm/cm.h	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/ntoskrnl/cm/cm.h	2005-06-04 17:35:39 UTC (rev 15773)
@@ -744,4 +744,11 @@
 CmiSaveTempHive (PREGISTRY_HIVE Hive,
 		 HANDLE FileHandle);
 
+/* TEMPORARY HACK UNTIL PROPER PARSE ROUTINES SOON. DO NOT REMOVE -- Alex */         
+NTSTATUS
+CmpFindObject(POBJECT_ATTRIBUTES ObjectAttributes,
+	     PVOID* ReturnedObject,
+	     PUNICODE_STRING RemainingPath,
+	     POBJECT_TYPE ObjectType);
+
 #endif /*__INCLUDE_CM_H*/

Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/cm/ntfunc.c
--- branches/cache_manager_rewrite/reactos/ntoskrnl/cm/ntfunc.c	2005-06-04 16:09:39 UTC (rev 15772)
+++ branches/cache_manager_rewrite/reactos/ntoskrnl/cm/ntfunc.c	2005-06-04 17:35:39 UTC (rev 15773)
@@ -30,6 +30,138 @@
 
 /* FUNCTIONS ****************************************************************/
 
+/* TEMPORARY HACK UNTIL PROPER PARSE ROUTINES SOON. DO NOT REMOVE -- Alex */
+NTSTATUS
+CmpFindObject(POBJECT_ATTRIBUTES ObjectAttributes,
+	     PVOID* ReturnedObject,
+	     PUNICODE_STRING RemainingPath,
+	     POBJECT_TYPE ObjectType)
+{
+  PVOID NextObject;
+  PVOID CurrentObject;
+  PVOID RootObject;
+  POBJECT_HEADER CurrentHeader;
+  NTSTATUS Status;
+  PWSTR current;
+  UNICODE_STRING PathString;
+  ULONG Attributes;
+  PUNICODE_STRING ObjectName;
+
+  PAGED_CODE();
+
+  DPRINT("CmpFindObject(ObjectAttributes %x, ReturnedObject %x, "
+	 "RemainingPath %x)\n",ObjectAttributes,ReturnedObject,RemainingPath);
+  DPRINT("ObjectAttributes->ObjectName %wZ\n",
+	 ObjectAttributes->ObjectName);
+
+  RtlInitUnicodeString (RemainingPath, NULL);
+
+  if (ObjectAttributes->RootDirectory == NULL)
+    {
+      ObReferenceObjectByPointer(NameSpaceRoot,
+				 DIRECTORY_TRAVERSE,
+				 NULL,
+				 UserMode);
+      CurrentObject = NameSpaceRoot;
+    }
+  else
+    {
+      Status = ObReferenceObjectByHandle(ObjectAttributes->RootDirectory,
+					 0,
+					 NULL,
+					 UserMode,
+					 &CurrentObject,
+					 NULL);
+      if (!NT_SUCCESS(Status))
+	{
+	  return Status;
+	}
+    }
+
+  ObjectName = ObjectAttributes->ObjectName;
+  if (ObjectName->Length == 0 ||
+      ObjectName->Buffer[0] == UNICODE_NULL)
+    {
+      *ReturnedObject = CurrentObject;
+      return STATUS_SUCCESS;
+    }
+
+  if (ObjectAttributes->RootDirectory == NULL &&
+      ObjectName->Buffer[0] != L'\\')
+    {
+      ObDereferenceObject (CurrentObject);
+      return STATUS_UNSUCCESSFUL;
+    }
+
+  /* Create a zero-terminated copy of the object name */
+  PathString.Length = ObjectName->Length;
+  PathString.MaximumLength = ObjectName->Length + sizeof(WCHAR);
+  PathString.Buffer = ExAllocatePool (NonPagedPool,
+				      PathString.MaximumLength);
+  if (PathString.Buffer == NULL)
+    {
+      ObDereferenceObject (CurrentObject);
+      return STATUS_INSUFFICIENT_RESOURCES;
+    }
+
+  RtlCopyMemory (PathString.Buffer,
+		 ObjectName->Buffer,
+		 ObjectName->Length);
+  PathString.Buffer[PathString.Length / sizeof(WCHAR)] = UNICODE_NULL;
+
+  current = PathString.Buffer;
+
+  RootObject = CurrentObject;
+  Attributes = ObjectAttributes->Attributes;
+  if (ObjectType == ObSymbolicLinkType)
+    Attributes |= OBJ_OPENLINK;
+
+  while (TRUE)
+    {
+	DPRINT("current %S\n",current);
+	CurrentHeader = BODY_TO_HEADER(CurrentObject);
+
+	DPRINT("Current ObjectType %wZ\n",
+	       &CurrentHeader->ObjectType->TypeName);
+
+	if (CurrentHeader->ObjectType->TypeInfo.ParseProcedure == NULL)
+	  {
+	     DPRINT("Current object can't parse\n");
+	     break;
+	  }
+	Status = CurrentHeader->ObjectType->TypeInfo.ParseProcedure(CurrentObject,
+						  &NextObject,
+						  &PathString,
+						  &current,
+						  Attributes);
+	if (Status == STATUS_REPARSE)
+	  {
+	     /* reparse the object path */
+	     NextObject = NameSpaceRoot;
+	     current = PathString.Buffer;
+
+	     ObReferenceObjectByPointer(NextObject,
+					DIRECTORY_TRAVERSE,
+					NULL,
+					UserMode);
+	  }
+
+	if (NextObject == NULL)
+	  {
+	     break;
+	  }
+	ObDereferenceObject(CurrentObject);
+	CurrentObject = NextObject;
+    }
+
+  if (current)
+     RtlpCreateUnicodeString (RemainingPath, current, NonPagedPool);
+  RtlFreeUnicodeString (&PathString);
+  *ReturnedObject = CurrentObject;
+
+  return STATUS_SUCCESS;
+}
+
 /*
  * @implemented
  */
@@ -199,13 +331,13 @@
 	 KeyHandle,
 	 ObjectAttributes->RootDirectory);
 
-  Status = ObFindObject(ObjectAttributes,
+  Status = CmpFindObject(ObjectAttributes,
 			&Object,
 			&RemainingPath,
 			CmiKeyType);
   if (!NT_SUCCESS(Status))
     {
-      DPRINT("ObFindObject failed, Status: 0x%x\n", Status);
+      DPRINT("CmpFindObject failed, Status: 0x%x\n", Status);
       return(Status);
     }
 
@@ -379,7 +511,7 @@
 
   PAGED_CODE();
 
-  DPRINT1("NtDeleteKey(KeyHandle %x) called\n", KeyHandle);
+  DPRINT("NtDeleteKey(KeyHandle %x) called\n", KeyHandle);
 
   PreviousMode = ExGetPreviousMode();
 
@@ -418,7 +550,7 @@
   ExReleaseResourceLite(&CmiRegistryLock);
   KeLeaveCriticalRegion();
 
-  DPRINT1("PointerCount %lu\n", ObGetObjectPointerCount((PVOID)KeyObject));
+  DPRINT("PointerCount %lu\n", ObGetObjectPointerCount((PVOID)KeyObject));
 
   /* Dereference the object */
   ObDereferenceObject(KeyObject);
@@ -1146,14 +1278,14 @@
 	  return(STATUS_BUFFER_OVERFLOW);*/
 
   RemainingPath.Buffer = NULL;
-  Status = ObFindObject(ObjectAttributes,
+  Status = CmpFindObject(ObjectAttributes,
 			&Object,
 			&RemainingPath,
 			CmiKeyType);
   if (!NT_SUCCESS(Status))
     {
-      DPRINT("ObFindObject() returned 0x%08lx\n", Status);
-	  Status = STATUS_INVALID_HANDLE; /* Because ObFindObject returns STATUS_UNSUCCESSFUL */
+      DPRINT("CmpFindObject() returned 0x%08lx\n", Status);
+	  Status = STATUS_INVALID_HANDLE; /* Because CmpFindObject returns STATUS_UNSUCCESSFUL */
 	  hKey = *KeyHandle; /* Preserve hkResult value */
 	  goto openkey_cleanup;
     }

Modified: branches/cache_manager_rewrite/reactos/ntoskrnl/cm/registry.c
[truncated at 1000 lines; 6720 more skipped]