Sync to trunk head (r42241)
[reactos.git] / reactos / include / ddk / ndis.h
index 4925d76..0a30390 100644 (file)
@@ -2026,34 +2026,10 @@ NdisQueryPacketLength(
     IN PNDIS_PACKET  Packet,
     OUT PUINT  TotalPacketLength  OPTIONAL)
 {
-  if ((TotalPacketLength))                                                \
-  {                                                                       \
-    if (!(Packet)->Private.ValidCounts) {                                 \
-      UINT _Offset;                                                       \
-      UINT _PacketLength;                                                 \
-      PNDIS_BUFFER _NdisBuffer;                                           \
-      UINT _PhysicalBufferCount = 0;                                      \
-      UINT _TotalPacketLength   = 0;                                      \
-      UINT _Count               = 0;                                      \
-                                                                          \
-      for (_NdisBuffer = (Packet)->Private.Head;                          \
-        _NdisBuffer != (PNDIS_BUFFER)NULL;                                \
-        _NdisBuffer = _NdisBuffer->Next)                                  \
-      {                                                                   \
-        _PhysicalBufferCount += NDIS_BUFFER_TO_SPAN_PAGES(_NdisBuffer);   \
-        NdisQueryBufferOffset(_NdisBuffer, &_Offset, &_PacketLength);     \
-        _TotalPacketLength += _PacketLength;                              \
-        _Count++;                                                         \
-      }                                                                   \
-      (Packet)->Private.PhysicalCount = _PhysicalBufferCount;             \
-      (Packet)->Private.TotalLength   = _TotalPacketLength;               \
-      (Packet)->Private.Count         = _Count;                           \
-      (Packet)->Private.ValidCounts   = TRUE;                             \
-  }                                                                       \
-                                                                          \
-  if (TotalPacketLength)                                                  \
-      *((PUINT)TotalPacketLength) = (Packet)->Private.TotalLength;        \
-  } \
+  if (!(Packet)->Private.ValidCounts)                                     \
+    NdisQueryPacket(Packet, NULL, NULL, NULL, TotalPacketLength);         \
+  else                                                                    \
+    *(TotalPacketLength) = (Packet)->Private.TotalLength;                 \
 }