Author: hpoussin Date: Fri Dec 28 00:21:36 2007 New Revision: 31471
URL: http://svn.reactos.org/svn/reactos?rev=31471&view=rev Log: Use the captured string instead of the original one Fix little bugs introduced in r31467
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/plugplay.c (contents, props changed) trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/plugplay.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/plugplay... ============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/plugplay.c (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/plugplay.c Fri Dec 28 00:21:36 2007 @@ -371,7 +371,7 @@ }
/* Get the device object */ - DeviceObject = IopGetDeviceObjectFromDeviceInstance(&PropertyData->DeviceInstance); + DeviceObject = IopGetDeviceObjectFromDeviceInstance(&DeviceInstance); ExFreePool(DeviceInstance.Buffer); if (DeviceObject == NULL) { @@ -552,13 +552,11 @@ NTSTATUS Status = STATUS_SUCCESS;
DPRINT("IopDeviceStatus() called\n"); - DPRINT("Device name: %wZ\n", &StatusData->DeviceInstance);
Status = IopCaptureUnicodeString(&DeviceInstance, &StatusData->DeviceInstance); if (!NT_SUCCESS(Status)) - { - return Status; - } + return Status; + DPRINT("Device name: '%wZ'\n", &DeviceInstance);
_SEH_TRY { @@ -577,15 +575,13 @@
if (!NT_SUCCESS(Status)) { - if (DeviceInstance.Buffer) - { - ExFreePool(DeviceInstance.Buffer); - } - return Status; + if (DeviceInstance.Buffer) + ExFreePool(DeviceInstance.Buffer); + return Status; }
/* Get the device object */ - DeviceObject = IopGetDeviceObjectFromDeviceInstance(&StatusData->DeviceInstance); + DeviceObject = IopGetDeviceObjectFromDeviceInstance(&DeviceInstance); ExFreePool(DeviceInstance.Buffer); if (DeviceObject == NULL) return STATUS_NO_SUCH_DEVICE; @@ -649,7 +645,7 @@ }
/* Get the device object */ - DeviceObject = IopGetDeviceObjectFromDeviceInstance(&DepthData->DeviceInstance); + DeviceObject = IopGetDeviceObjectFromDeviceInstance(&DeviceInstance); ExFreePool(DeviceInstance.Buffer); if (DeviceObject == NULL) return STATUS_NO_SUCH_DEVICE;
Propchange: trunk/reactos/ntoskrnl/io/pnpmgr/plugplay.c ------------------------------------------------------------------------------ --- svn:needs-lock (original) +++ svn:needs-lock (removed) @@ -1,1 +1,0 @@ -*
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c... ============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c Fri Dec 28 00:21:36 2007 @@ -1653,6 +1653,8 @@ /* OK, value is correct ; prepare to return it */ KeyValue.Length = KeyValue.MaximumLength = (USHORT)ParentIdPrefixInformation->DataLength; KeyValue.Buffer = (PWSTR)ParentIdPrefixInformation->Data; + if (KeyValue.Length && KeyValue.Buffer[KeyValue.Length / sizeof(WCHAR) - 1] == UNICODE_NULL); + KeyValue.Length -= sizeof(WCHAR); }
/* We're done */ @@ -2461,7 +2463,11 @@ * Make sure this device node is a direct child of the parent device node * that is given as an argument */ - ASSERT(DeviceNode->Parent == ParentDeviceNode); + if (DeviceNode->Parent != ParentDeviceNode) + { + DPRINT("Not a direct child\n"); + return STATUS_UNSUCCESSFUL; + }
if (!IopDeviceNodeHasFlag(DeviceNode, DNF_DISABLED) && !IopDeviceNodeHasFlag(DeviceNode, DNF_ADDED) &&