Use the captured string instead of the original one

Fix little bugs introduced in r31467

svn path=/trunk/; revision=31471
This commit is contained in:
Hervé Poussineau 2007-12-27 21:21:36 +00:00
parent 707c10cf78
commit 3875bcd631
2 changed files with 15 additions and 13 deletions

View file

@ -371,7 +371,7 @@ IopGetDeviceProperty(PPLUGPLAY_CONTROL_PROPERTY_DATA PropertyData)
}
/* Get the device object */
DeviceObject = IopGetDeviceObjectFromDeviceInstance(&PropertyData->DeviceInstance);
DeviceObject = IopGetDeviceObjectFromDeviceInstance(&DeviceInstance);
ExFreePool(DeviceInstance.Buffer);
if (DeviceObject == NULL)
{
@ -552,13 +552,11 @@ IopDeviceStatus(PPLUGPLAY_CONTROL_STATUS_DATA StatusData)
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 @@ IopDeviceStatus(PPLUGPLAY_CONTROL_STATUS_DATA StatusData)
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 @@ IopGetDeviceDepth(PPLUGPLAY_CONTROL_DEPTH_DATA DepthData)
}
/* Get the device object */
DeviceObject = IopGetDeviceObjectFromDeviceInstance(&DepthData->DeviceInstance);
DeviceObject = IopGetDeviceObjectFromDeviceInstance(&DeviceInstance);
ExFreePool(DeviceInstance.Buffer);
if (DeviceObject == NULL)
return STATUS_NO_SUCH_DEVICE;

View file

@ -1653,6 +1653,8 @@ IopGetParentIdPrefix(PDEVICE_NODE DeviceNode,
/* 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 @@ IopActionInitChildServices(PDEVICE_NODE DeviceNode,
* 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) &&