Leaked source code of windows server 2003
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.

193 lines
4.5 KiB

  1. /*+--------------------------------------------------------------------------
  2. *
  3. * Microsoft Windows
  4. * Copyright (C) Microsoft Corporation, 1993
  5. *
  6. * File: propset.h
  7. *
  8. * Contents: OLE Appendix B property set structure definitions
  9. *
  10. ---------------------------------------------------------------------------*/
  11. #ifndef _PROPSET_HXX_
  12. #define _PROPSET_HXX_
  13. #include "propmac.hxx"
  14. /* CBMAXPROPSETSTREAM must be a power of 2.*/
  15. #define CBMAXPROPSETSTREAM (256 * 1024)
  16. /* this is the 'correct' value of 0xFFFE */
  17. #define PROPSET_BYTEORDER 0xFFFE
  18. /* Defines for the high order WORD of dwOSVer:*/
  19. #define OSKIND_WINDOWS 0x0000
  20. #define OSKIND_MACINTOSH 0x0001
  21. #define OSKIND_WIN32 0x0002
  22. #define OSKIND_REF 0x0003
  23. typedef struct tagFORMATIDOFFSET
  24. {
  25. FMTID fmtid;
  26. DWORD dwOffset;
  27. } FORMATIDOFFSET;
  28. #define CB_FORMATIDOFFSET sizeof(FORMATIDOFFSET)
  29. typedef struct tagPROPERTYSETHEADER /* ph*/
  30. {
  31. WORD wByteOrder; /* Always 0xfffe*/
  32. WORD wFormat; /* Always 0*/
  33. DWORD dwOSVer; /* System version*/
  34. CLSID clsid; /* Application CLSID*/
  35. DWORD reserved; /* reserved (must be at least 1)*/
  36. } PROPERTYSETHEADER;
  37. #define CB_PROPERTYSETHEADER sizeof(PROPERTYSETHEADER)
  38. typedef struct tagPROPERTYIDOFFSET /* po*/
  39. {
  40. DWORD propid;
  41. DWORD dwOffset;
  42. } PROPERTYIDOFFSET;
  43. #define CB_PROPERTYIDOFFSET sizeof(PROPERTYIDOFFSET)
  44. // use these 2 member accessors for unaligned pointers
  45. // NOTE: these functions need to be changed manually when the structures
  46. // are changed.
  47. inline DWORD PIDOFFSET_GetPropid(PROPERTYIDOFFSET UNALIGNED *ppo)
  48. {
  49. #if i386 == 0
  50. DWORD dwResult;
  51. memcpy(&dwResult,
  52. Add2Ptr(ppo, FIELD_OFFSET(PROPERTYIDOFFSET, propid)),
  53. sizeof(DWORD));
  54. return dwResult;
  55. #else
  56. return ppo->propid;
  57. #endif
  58. }
  59. inline DWORD PIDOFFSET_GetOffset(PROPERTYIDOFFSET UNALIGNED *ppo)
  60. {
  61. #if i386==0
  62. DWORD dwResult;
  63. memcpy(&dwResult,
  64. Add2Ptr(ppo, FIELD_OFFSET(PROPERTYIDOFFSET, dwOffset)),
  65. sizeof(DWORD));
  66. return dwResult;
  67. #else
  68. return ppo->dwOffset;
  69. #endif
  70. }
  71. typedef struct tagPROPERTYSECTIONHEADER /* sh*/
  72. {
  73. DWORD cbSection;
  74. DWORD cProperties;
  75. PROPERTYIDOFFSET rgprop[1];
  76. } PROPERTYSECTIONHEADER;
  77. #define CB_PROPERTYSECTIONHEADER FIELD_OFFSET(PROPERTYSECTIONHEADER, rgprop)
  78. typedef struct tagSERIALIZEDPROPERTYVALUE /* prop*/
  79. {
  80. DWORD dwType;
  81. BYTE rgb[1];
  82. } SERIALIZEDPROPERTYVALUE;
  83. #define CB_SERIALIZEDPROPERTYVALUE FIELD_OFFSET(SERIALIZEDPROPERTYVALUE, rgb)
  84. inline DWORD SPV_GetType(const SERIALIZEDPROPERTYVALUE *pprop)
  85. {
  86. #if i386==0
  87. DWORD dwResult; /* use temp var because it might not be aligned */
  88. memcpy(&dwResult,
  89. Add2Ptr(pprop, FIELD_OFFSET(SERIALIZEDPROPERTYVALUE, dwType)),
  90. sizeof(DWORD));
  91. return dwResult;
  92. #else
  93. return pprop->dwType;
  94. #endif
  95. }
  96. inline BYTE* SPV_GetRgb(const SERIALIZEDPROPERTYVALUE *pprop)
  97. {
  98. return (BYTE*) Add2Ptr(pprop, CB_SERIALIZEDPROPERTYVALUE);
  99. }
  100. typedef struct tagENTRY /* ent*/
  101. {
  102. DWORD propid;
  103. DWORD cch; /* Includes trailing '\0' or L'\0'*/
  104. char sz[1]; /* WCHAR if UNICODE CodePage*/
  105. } ENTRY;
  106. #define CB_ENTRY FIELD_OFFSET(ENTRY, sz)
  107. inline DWORD ENTRY_GetPropid(const ENTRY *pent)
  108. {
  109. #if i386 == 0
  110. DWORD dwResult; /* use temp var because it might not be aligned */
  111. memcpy(&dwResult,
  112. Add2Ptr(pent, FIELD_OFFSET(ENTRY, propid)),
  113. sizeof(DWORD));
  114. return dwResult;
  115. #else
  116. return pent->propid;
  117. #endif
  118. }
  119. inline void ENTRY_SetPropid(ENTRY *pent, DWORD propid)
  120. {
  121. #if i386 == 0
  122. memcpy(Add2Ptr(pent, FIELD_OFFSET(ENTRY, propid)),
  123. &propid, sizeof(DWORD));
  124. #else
  125. pent->propid = propid;
  126. #endif
  127. }
  128. inline DWORD ENTRY_GetCch(const ENTRY *pent)
  129. {
  130. #if i386 == 0
  131. DWORD dwResult; /* use temp var because it might not be aligned */
  132. memcpy(&dwResult,
  133. Add2Ptr(pent, FIELD_OFFSET(ENTRY, cch)),
  134. sizeof(DWORD));
  135. return dwResult;
  136. #else
  137. return pent->cch;
  138. #endif
  139. }
  140. inline void ENTRY_SetCch(ENTRY *pent, DWORD cch)
  141. {
  142. #if i386 == 0
  143. memcpy(Add2Ptr(pent, FIELD_OFFSET(ENTRY, cch)),
  144. &cch, sizeof(DWORD));
  145. #else
  146. pent->cch = cch;
  147. #endif
  148. }
  149. inline char* ENTRY_GetSz(const ENTRY *pent)
  150. {
  151. // note: since sz is an array, doing pent->sz is okay even when pent is
  152. // not aligned properly
  153. return (char*) Add2Ptr(pent, CB_ENTRY);
  154. }
  155. typedef struct tagDICTIONARY /* dy*/
  156. {
  157. DWORD cEntries;
  158. ENTRY rgEntry[1];
  159. } DICTIONARY;
  160. #define CB_DICTIONARY FIELD_OFFSET(DICTIONARY, rgEntry)
  161. #endif /* _PROPSET_HXX_*/