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.

77 lines
2.0 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994 - 1994.
  5. //
  6. // File: propdata.hxx
  7. //
  8. // Contents: Static tables describing types of properties
  9. //
  10. // Classes: CTableVariant - PROPVARIANT wrapper; adds useful methods
  11. //
  12. // History: 28 Jan 1994 AlanW Created
  13. //
  14. //--------------------------------------------------------------------------
  15. #pragma once
  16. //
  17. // PropType gives the type of standard properties
  18. //
  19. struct PROP_TYPE {
  20. PROPID propid; // a standard property ID
  21. VARENUM vtPropType; // the guaranteed type of propid
  22. };
  23. extern const PROP_TYPE aPropType[];
  24. extern const unsigned cPropType;
  25. //+-------------------------------------------------------------------------
  26. //
  27. // Function: PropIdToType, inline public
  28. //
  29. // Synopsis: If the input propid is a system property, return its type.
  30. //
  31. // Arguments: [prop] - the property ID to be mapped
  32. //
  33. // Returns: VARENUM - the variant type of the property if it is in
  34. // the mapping table; VT_NULL otherwise.
  35. //
  36. //--------------------------------------------------------------------------
  37. inline VARENUM PropIdToType (PROPID prop)
  38. {
  39. for (unsigned iProp = 0;
  40. iProp < cPropType;
  41. iProp++) {
  42. if (aPropType[iProp].propid == prop)
  43. return aPropType[iProp].vtPropType;
  44. }
  45. return VT_NULL;
  46. }
  47. //+-------------------------------------------------------------------------
  48. //
  49. // Macro: ALIGN
  50. //
  51. // Synopsis: Align a pointer, ptr, to an address alignment, algn.
  52. //
  53. // Effects: The input parameter ptr is modified.
  54. //
  55. // Arguments: [ptr] - the pointer to be aligned
  56. // [algn] - the unit of alignment
  57. //
  58. // Requires: algn must be a power of two.
  59. // ptr must be an lvalue, typically a pointer to byte.
  60. //
  61. //--------------------------------------------------------------------------
  62. #define ALIGN(ptr, algn) ((ptr) = (((ptr) + ((algn)-1)) & (~(algn-1))))