Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.6 KiB

  1. #ifndef __ADDRESS_H__
  2. #define __ADDRESS_H__
  3. #pragma pack(1) // avoid problems when Zp!=1
  4. #ifndef MVADDR_DEFINED
  5. #define MVADDR_DEFINED
  6. #ifndef DWORD_NIL
  7. #define DWORD_NIL ((DWORD)0xFFFFFFFF)
  8. #endif
  9. /////// MEDIAVIEW 2.0 ADDRESSES
  10. // some of the following assume that the two addresses are in the same topic.
  11. // but this is a valid assumption. Note that the elements of the addresses, the
  12. // TPID and TPO, are DWORDs, so arithmetic should be performed accordingly.
  13. #define MVAddrFromTopicUID(lp, x) ((lp)->tpid = (x), (lp)->tpo = 0L)
  14. #define MVTopicUIDFromAddr(lp) ((lp)->tpid)
  15. #define MVAddrSame(mva1, mva2) (((mva1).tpo == (mva2).tpo) && ((mva1).tpid == (mva2).tpid))
  16. #define MVAddrCompare(x1, x2) (\
  17. ((x1).tpid != (x2).tpid) ? \
  18. (((x1).tpid > (x2).tpid) ? 1 : -1) : \
  19. ( \
  20. ((x1).tpo != (x2).tpo) ? (((x1).tpo > (x2).tpo) ? 1 : -1) : 0 \
  21. ) \
  22. )
  23. #define MVAddrAssign(mva1, mva2) ((mva1) = (mva2))
  24. #define MVAddrSetNil(mva) ((mva).tpo = DWORD_NIL, (mva).tpid = DWORD_NIL)
  25. #define MVAddrAddOffset(mva, dw) ((mva).tpo += (dw), (mva))
  26. #define MVAddrSetOffset(mva, dw) ((mva).tpo = (dw), (mva))
  27. #define MVAddrDiff(mva1, mva2) ((LONG)((mva1).tpo - (mva2).tpo))
  28. #define MVAddrSwap(mva) (((mva).tpo) = SWAPLONG((mva).tpo), ((mva).tpid) = SWAPLONG((mva).tpid))
  29. #define MVAddrGetTopicId(lpmva) ((DWORD)(((LPMVADDR)(lpmva))->tpid))
  30. #define MVAddrGetTopicOffset(lpmva) ((DWORD)(((LPMVADDR)(lpmva))->tpo))
  31. #define MVAddrSetTopic(lpmvaTopic, lpmva) (((LPMVADDR)(lpmvaTopic))->tpid = (lpmva)->tpid, (lpmvaTopic)->tpo = 0L)
  32. #define MVAddrIsNil(mva) ((mva).tpo == DWORD_NIL && (mva).tpid == DWORD_NIL)
  33. #define MVAddrMake(lp, dw1, dw2) ((lp)->tpid = ((DWORD)(dw1)), (lp)->tpo = ((DWORD)(dw2)))
  34. typedef DWORD TPID; // topic unique identifier
  35. typedef DWORD TPO; // offset into text of topic
  36. typedef struct tagMVADDR {
  37. TPID tpid;
  38. TPO tpo;
  39. } MVADDR, FAR *LPMVADDR;
  40. #endif // MVADDR_DEFINED
  41. typedef MVADDR VA, FAR *QVA, FAR *LPVA;
  42. typedef MVADDR ADDR, FAR *QADDR, FAR *LPADDR;
  43. typedef MVADDR PA, FAR *QPA, FAR *LPPA;
  44. #define vaNil DWORD_NIL
  45. #define paNil DWORD_NIL
  46. // for conversion purposes, mv1.4 VA becomes the same as mv1.4 ADDR
  47. // and both of these contain a topic offset only
  48. #define OffsetToVA(pva, off) ((pva)->tpo = (off))
  49. #define VAToOffset(pva) ((pva)->tpo) // only valid within topics
  50. typedef DWORD OBJRG;
  51. typedef OBJRG FAR *QOBJRG;
  52. #define objrgNil (OBJRG) -1
  53. typedef DWORD COBJRG;
  54. typedef COBJRG FAR *QCOBJRG;
  55. #define cobjrgNil (COBJRG) -1
  56. #pragma pack() // avoid problems when Zp!=1
  57. #endif // !defined(__ADDRESS_H__)