Partager via


TR_COMPARE_NETWORK_ADDRESSES (Windows Embedded CE 6.0)

1/6/2010

This macro uses an arbitrary ordering to set a caller-supplied variable to a value indicating whether a given Token Ring address is greater than, less than, or equal to another given Token Ring address.

Syntax

VOID TR_COMPARE_NETWORK_ADDRESSES(
  PCHAR _A,
  PCHAR _B,
  PINT _Result
);

Parameters

  • _A
    Points to the first network address.
  • _B
    Points to the second network address.
  • _Result
    Points to a caller-supplied variable in which this macro returns the result of its comparison. The following table shows how _Result relates to the ordering of _A to _B.

    Value Description

    < 0

    _A is less than _B.

    > 0

    _A is greater than _B.

    = 0

    _A equals _B.

Return Value

None.

Remarks

Token Ring network addresses do not have a defined ordering relationship. Consequently, the results of this macro for unequal addresses depend on the argument ordering.

The TR_COMPARE_NETWORK_ADDRESSES macro is defined as follows.

#define TR_COMPARE_NETWORK_ADDRESSES(_A, _B, _Result)           \
{                                                               \
    if (*(ULONG UNALIGNED *)&(_A)[2] >                          \
        *(ULONG UNALIGNED *)&(_B)[2])                           \
    {                                                           \
        *(_Result) = 1;                                         \
    }                                                           \
    else if (*(ULONG UNALIGNED *)&(_A)[2] <                     \
             *(ULONG UNALIGNED *)&(_B)[2])                      \
    {                                                           \
        *(_Result) = (UINT)-1;                                  \
    }                                                           \
    else if (*(USHORT UNALIGNED *)(_A) >                        \
             *(USHORT UNALIGNED *)(_B))                         \
    {                                                           \
        *(_Result) = 1;                                         \
    }                                                           \
    else if (*(USHORT UNALIGNED *)(_A) <                        \
             *(USHORT UNALIGNED *)(_B))                         \
    {                                                           \
        *(_Result) = (UINT)-1;                                  \
    }                                                           \
    else                                                        \
    {                                                           \
        *(_Result) = 0;                                         \
    }                                                           \
}

Requirements

Header ndis.h
Windows Embedded CE Windows CE .NET 4.0 and later

See Also

Reference

Network Driver Macros
TR_COPY_NETWORK_ADDRESS