From 42771ef723932e0db2ff0e0d6a15a57381c9539b Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Thu, 4 Jun 2009 14:16:57 +0000 Subject: [PATCH] - Revert 40694 as FIELD_OFFSET is perfectly working code and the new one might not work on some compilers - Add informal debug traces for bug 4354 svn path=/trunk/; revision=41285 --- reactos/drivers/video/videoprt/dispatch.c | 11 ++++++----- reactos/drivers/video/videoprt/resource.c | 3 +++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/reactos/drivers/video/videoprt/dispatch.c b/reactos/drivers/video/videoprt/dispatch.c index d0642e001ff..0f9d12e8f2a 100644 --- a/reactos/drivers/video/videoprt/dispatch.c +++ b/reactos/drivers/video/videoprt/dispatch.c @@ -340,11 +340,9 @@ IntVideoPortPnPStartDevice( /* Save the resource list */ ResourceCount = AllocatedResources->List[0].PartialResourceList.Count; - ResourceListSize = sizeof(CM_RESOURCE_LIST); - - if (ResourceCount > 1) - ResourceListSize += (ResourceCount-1) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR); - + ResourceListSize = + FIELD_OFFSET(CM_RESOURCE_LIST, List[0].PartialResourceList. + PartialDescriptors[ResourceCount]); DeviceExtension->AllocatedResources = ExAllocatePool(PagedPool, ResourceListSize); if (DeviceExtension->AllocatedResources == NULL) { @@ -360,6 +358,9 @@ IntVideoPortPnPStartDevice( FullList < AllocatedResources->List + AllocatedResources->Count; FullList++) { + INFO_(VIDEOPRT, "InterfaceType %u BusNumber List %u Device BusNumber %u Version %u Revision %u\n", + FullList->InterfaceType, FullList->BusNumber, DeviceExtension->SystemIoBusNumber, FullList->PartialResourceList.Version, FullList->PartialResourceList.Revision); + /* FIXME: Is this ASSERT ok for resources from the PNP manager? */ ASSERT(FullList->InterfaceType == PCIBus && FullList->BusNumber == DeviceExtension->SystemIoBusNumber && diff --git a/reactos/drivers/video/videoprt/resource.c b/reactos/drivers/video/videoprt/resource.c index 4bac62be053..2ab6a28cc1a 100644 --- a/reactos/drivers/video/videoprt/resource.c +++ b/reactos/drivers/video/videoprt/resource.c @@ -520,6 +520,9 @@ VideoPortGetAccessRanges( FullList < AllocatedResources->List + AllocatedResources->Count; FullList++) { + INFO_(VIDEOPRT, "InterfaceType %u BusNumber List %u Device BusNumber %u Version %u Revision %u\n", + FullList->InterfaceType, FullList->BusNumber, DeviceExtension->SystemIoBusNumber, FullList->PartialResourceList.Version, FullList->PartialResourceList.Revision); + ASSERT(FullList->InterfaceType == PCIBus && FullList->BusNumber == DeviceExtension->SystemIoBusNumber && 1 == FullList->PartialResourceList.Version &&