Commit in reactos/ntoskrnl on MAIN
include/internal/io.h+9-11.48 -> 1.49
io/pnpmgr.c+4-71.51 -> 1.52
+13-8
2 modified files
- Correctly calculate size of the CM_RESOURCE_LIST structure.

reactos/ntoskrnl/include/internal
io.h 1.48 -> 1.49
diff -u -r1.48 -r1.49
--- io.h	6 Nov 2004 04:12:59 -0000	1.48
+++ io.h	19 Nov 2004 21:31:02 -0000	1.49
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: io.h,v 1.48 2004/11/06 04:12:59 ion Exp $
+/* $Id: io.h,v 1.49 2004/11/19 21:31:02 navaraf Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -522,4 +522,12 @@
 IopRemoveTimerFromTimerList(
 	IN PIO_TIMER Timer
 );
+
+#define CM_RESOURCE_LIST_SIZE(ResList) \
+  (ResList->Count == 1) ? \
+    FIELD_OFFSET(CM_RESOURCE_LIST, List[0].PartialResourceList. \
+                 PartialDescriptors[(ResList)->List[0].PartialResourceList.Count]) \
+                        : \
+    FIELD_OFFSET(CM_RESOURCE_LIST, List)
+
 #endif

reactos/ntoskrnl/io
pnpmgr.c 1.51 -> 1.52
diff -u -r1.51 -r1.52
--- pnpmgr.c	9 Nov 2004 00:38:37 -0000	1.51
+++ pnpmgr.c	19 Nov 2004 21:31:02 -0000	1.52
@@ -1,4 +1,4 @@
-/* $Id: pnpmgr.c,v 1.51 2004/11/09 00:38:37 ion Exp $
+/* $Id: pnpmgr.c,v 1.52 2004/11/19 21:31:02 navaraf Exp $
  *
  * COPYRIGHT:      See COPYING in the top level directory
  * PROJECT:        ReactOS kernel
@@ -217,8 +217,7 @@
       Length = 0;
       if (DeviceNode->BootResources->Count != 0)
       {
-	Length = FIELD_OFFSET(CM_RESOURCE_LIST, List) +
-		 DeviceNode->BootResources->Count * sizeof(CM_FULL_RESOURCE_DESCRIPTOR);
+	Length = CM_RESOURCE_LIST_SIZE(DeviceNode->BootResources);
       }
       Data = &DeviceNode->BootResources;
       break;
@@ -228,8 +227,7 @@
       Length = 0;
       if (DeviceNode->BootResources->Count != 0)
       {
-	Length = FIELD_OFFSET(CM_RESOURCE_LIST, List) +
-		 DeviceNode->BootResources->Count * sizeof(CM_FULL_RESOURCE_DESCRIPTOR);
+	Length = CM_RESOURCE_LIST_SIZE(DeviceNode->BootResources);
       }
       Data = &DeviceNode->BootResources;
       break;
@@ -861,8 +859,7 @@
       ResCount = DeviceNode->BootResources->Count;
       if (ResCount != 0)
       {
-	ListSize = sizeof(CM_RESOURCE_LIST) +
-		   ((ResCount - 1) * sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
+	ListSize = CM_RESOURCE_LIST_SIZE(DeviceNode->BootResources);
 
 	RtlInitUnicodeString(&KeyName,
 			     L"BootConfig");
CVSspam 0.2.8