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.

374 lines
7.7 KiB

  1. /* ostm2stg.h
  2. Used by ostm2stg.cpp only
  3. Defines a generic object structure which stores all the data necessary
  4. to construct either a 2.0 IStorage or a 1.0 OLESTREAM
  5. */
  6. #define OLE_PRESENTATION_STREAM_1 OLESTR("\2OlePres001")
  7. // We will need to do conversions to and from WIN16 and WIN32 bitmaps, so
  8. // define what a BITMAP used to be under WIN16 (Same for METAFILEPICT).
  9. #pragma pack(1) // Ensure the structure is not expanded
  10. // for alignment reasons
  11. typedef struct tagWIN16BITMAP
  12. {
  13. short bmType;
  14. short bmWidth;
  15. short bmHeight;
  16. short bmWidthBytes;
  17. BYTE bmPlanes;
  18. BYTE bmBitsPixel;
  19. void FAR* bmBits;
  20. } WIN16BITMAP, * LPWIN16BITMAP;
  21. typedef struct tagWIN16METAFILEPICT
  22. {
  23. short mm;
  24. short xExt;
  25. short yExt;
  26. WORD hMF;
  27. } WIN16METAFILEPICT, * LPWIN16METAFILEPICT;
  28. #pragma pack() // Resume normal packing
  29. // Version number written to stream, From OLE 1.0 ole.h
  30. const DWORD dwVerToFile = 0x0501;
  31. typedef enum { ctagNone, ctagCLSID, ctagString } CLASSTAG;
  32. typedef enum { ftagNone, ftagClipFormat, ftagString } FORMATTAG;
  33. class CClass : public CPrivAlloc
  34. {
  35. public:
  36. CLSID m_clsid; // These two should always represent
  37. LPOLESTR m_szClsid; // the same CLSID
  38. INTERNAL Set (REFCLSID clsid, LPSTORAGE pstg);
  39. INTERNAL SetSz (LPOLESTR pcsz);
  40. INTERNAL Reset (REFCLSID clsid);
  41. CClass (void);
  42. ~CClass (void);
  43. };
  44. typedef CClass CLASS;
  45. class CData : public CPrivAlloc
  46. {
  47. public:
  48. ULONG m_cbSize;
  49. LPVOID m_pv; // the same memory
  50. HANDLE m_h;
  51. BOOL m_fNoFree; // Free memory in destructor?
  52. CData (void);
  53. ~CData (void);
  54. };
  55. typedef CData DATA;
  56. typedef CData *PDATA;
  57. class CFormat : public CPrivAlloc
  58. {
  59. public:
  60. FORMATTAG m_ftag;
  61. struct
  62. {
  63. CLIPFORMAT m_cf;
  64. DATA m_dataFormatString;
  65. };
  66. CFormat (void);
  67. inline BOOL operator== (const CFormat FAR&)
  68. {
  69. Win4Assert(0 && "Format == Used");
  70. return FALSE;
  71. };
  72. };
  73. typedef CFormat FORMAT;
  74. typedef CFormat *PFORMAT;
  75. class CPres : public CPrivAlloc
  76. {
  77. public:
  78. FORMAT m_format;
  79. ULONG m_ulHeight;
  80. ULONG m_ulWidth;
  81. DATA m_data;
  82. CPres (void);
  83. };
  84. typedef CPres PRES;
  85. typedef CPres *PPRES;
  86. // OLE 1.0 values. Used in m_lnkupdopt
  87. #define UPDATE_ALWAYS 0L
  88. #define UPDATE_ONSAVE 1L
  89. #define UPDATE_ONCALL 2L
  90. #define UPDATE_ONCLOSE 3L
  91. // OLE 1.0 format id's
  92. // These never change.
  93. #define FMTID_LINK 1L
  94. #define FMTID_EMBED 2L
  95. #define FMTID_STATIC 3L
  96. #define FMTID_PRES 5L
  97. class CGenericObject : CPrivAlloc
  98. {
  99. public:
  100. CLASS m_class;
  101. CLASS m_classLast;
  102. PPRES m_ppres;
  103. DATA m_dataNative;
  104. BOOL m_fLink;
  105. BOOL m_fStatic;
  106. BOOL m_fNoBlankPres;
  107. LPOLESTR m_szTopic;
  108. LPOLESTR m_szItem;
  109. ULONG m_lnkupdopt;
  110. CGenericObject (void);
  111. ~CGenericObject (void);
  112. };
  113. typedef CGenericObject GENOBJ;
  114. typedef CGenericObject FAR* PGENOBJ;
  115. typedef const GENOBJ FAR * PCGENOBJ;
  116. static INTERNAL OLESTREAMToGenericObject
  117. (LPOLESTREAM pos,
  118. PGENOBJ pgenobj)
  119. ;
  120. static INTERNAL GetStaticObject
  121. (LPOLESTREAM pos,
  122. PGENOBJ pgenobj)
  123. ;
  124. static INTERNAL GetPresentationObject
  125. (LPOLESTREAM pos,
  126. PGENOBJ pgenobj,
  127. BOOL fStatic = FALSE)
  128. ;
  129. static INTERNAL GetStandardPresentation
  130. (LPOLESTREAM pos,
  131. PGENOBJ pgenobj,
  132. CLIPFORMAT cf)
  133. ;
  134. static INTERNAL GetGenericPresentation
  135. (LPOLESTREAM pos,
  136. PGENOBJ pgenobj)
  137. ;
  138. static INTERNAL GetSizedDataOLE1Stm
  139. (LPOLESTREAM pos,
  140. PDATA pdata)
  141. ;
  142. static INTERNAL OLE1StreamToUL
  143. (LPOLESTREAM pos,
  144. ULONG FAR* pul)
  145. ;
  146. static INTERNAL GenericObjectToOLESTREAM
  147. (const GENOBJ FAR& genobj,
  148. LPOLESTREAM pos)
  149. ;
  150. static INTERNAL OLE1StmToString
  151. (LPOLESTREAM pos,
  152. LPOLESTR FAR* psz)
  153. ;
  154. static INTERNAL PutPresentationObject
  155. (LPOLESTREAM pos,
  156. const PRES FAR* pres,
  157. const CLASS FAR& cls,
  158. BOOL fStatic = FALSE)
  159. ;
  160. static INTERNAL PutStandardPresentation
  161. (LPOLESTREAM pos,
  162. const PRES FAR* pres)
  163. ;
  164. static INTERNAL PutGenericPresentation
  165. (LPOLESTREAM pos,
  166. const PRES FAR* pres,
  167. LPCOLESTR szClass)
  168. ;
  169. static INTERNAL StringToOLE1Stm
  170. (LPOLESTREAM pos,
  171. LPCOLESTR sz)
  172. ;
  173. static INTERNAL SizedDataToOLE1Stm
  174. (LPOLESTREAM pos,
  175. const DATA FAR& data)
  176. ;
  177. static INTERNAL PutNetworkInfo
  178. (LPOLESTREAM pos,
  179. LPOLESTR szTopic)
  180. ;
  181. static INTERNAL Read20OleStream
  182. (LPSTORAGE pstg,
  183. PGENOBJ pgenobj)
  184. ;
  185. static INTERNAL Read20PresStream
  186. (LPSTORAGE pstg,
  187. PGENOBJ pgenobj,
  188. BOOL fObjFmtKnown)
  189. ;
  190. static INTERNAL StorageToGenericObject
  191. (LPSTORAGE pstg,
  192. PGENOBJ pgenobj)
  193. ;
  194. static INTERNAL MonikerIntoGenObj
  195. (PGENOBJ pgenobj,
  196. REFCLSID clsidLast,
  197. LPMONIKER pmk)
  198. ;
  199. static INTERNAL OLE2StmToSizedData
  200. (LPSTREAM pstm,
  201. PDATA pdata,
  202. ULONG cbSizeDelta=0,
  203. ULONG cbSizeKnown=0)
  204. ;
  205. static INTERNAL Read20NativeStreams
  206. (LPSTORAGE pstg,
  207. PDATA pdata)
  208. ;
  209. static INTERNAL GenObjToOLE2Stm
  210. (LPSTORAGE pstg,
  211. const GENOBJ FAR& genobj)
  212. ;
  213. FARINTERNAL GenericObjectToIStorage
  214. (const GENOBJ FAR& genobj,
  215. LPSTORAGE pstg,
  216. const DVTARGETDEVICE FAR* ptd)
  217. ;
  218. static INTERNAL PresToNewOLE2Stm
  219. (LPSTORAGE pstg,
  220. BOOL fLink,
  221. const PRES FAR& pres,
  222. const DVTARGETDEVICE FAR* ptd,
  223. LPOLESTR szStream,
  224. BOOL fPBrushNative = FALSE);
  225. ;
  226. static INTERNAL PresToIStorage
  227. (LPSTORAGE pstg,
  228. const GENOBJ FAR& genobj,
  229. const DVTARGETDEVICE FAR* ptd)
  230. ;
  231. static INTERNAL Write20NativeStreams
  232. (LPSTORAGE pstg,
  233. const GENOBJ FAR& genobj)
  234. ;
  235. static INTERNAL WriteFormat
  236. (LPSTREAM pstm,
  237. const FORMAT FAR& format)
  238. ;
  239. static INTERNAL ReadFormat
  240. (LPSTREAM pstm,
  241. PFORMAT pformat)
  242. ;
  243. static INTERNAL DataObjToOLE2Stm
  244. (LPSTREAM pstm,
  245. const DATA FAR& data)
  246. ;
  247. static INTERNAL OLE2StmToUL
  248. (LPSTREAM pstm,
  249. ULONG FAR* pul)
  250. ;
  251. inline static INTERNAL ULToOLE2Stm
  252. (LPSTREAM pstm,
  253. ULONG ul)
  254. ;
  255. inline static INTERNAL FTToOle2Stm (LPSTREAM pstm);
  256. static INTERNAL FindPresStream
  257. (LPSTORAGE pstg,
  258. LPSTREAM FAR* ppstm,
  259. BOOL fObjFmtKnown)
  260. ;
  261. static INTERNAL MonikerToOLE2Stm
  262. (LPSTREAM pstm,
  263. LPOLESTR szFile,
  264. LPOLESTR szItem,
  265. CLSID clsid)
  266. ;
  267. static INTERNAL OLE2StmToMoniker
  268. (LPSTREAM pstm,
  269. LPMONIKER FAR* ppmk)
  270. ;
  271. static INTERNAL ReadRealClassStg
  272. (LPSTORAGE pstg,
  273. LPCLSID pclsid)
  274. ;
  275. INTERNAL wCLSIDFromProgID(LPOLESTR szClass, LPCLSID pclsid,
  276. BOOL fForceAssign);
  277. INTERNAL wProgIDFromCLSID
  278. (REFCLSID clsid,
  279. LPOLESTR FAR* pszClass)
  280. ;
  281. INTERNAL wWriteFmtUserType
  282. (LPSTORAGE,
  283. REFCLSID)
  284. ;
  285. INTERNAL_(BOOL) wIsValidHandle
  286. (HANDLE h,
  287. CLIPFORMAT cf)
  288. ;
  289. inline INTERNAL_(VOID) ConvertBM32to16(LPBITMAP lpsrc, LPWIN16BITMAP lpdest);
  290. inline INTERNAL_(VOID) ConvertBM16to32(LPWIN16BITMAP lpsrc, LPBITMAP lpdest);
  291. inline INTERNAL_(VOID) ConvertMF16to32(
  292. LPWIN16METAFILEPICT lpsrc,
  293. LPMETAFILEPICT lpdest );
  294. inline INTERNAL_(VOID) ConvertMF32to16(
  295. LPMETAFILEPICT lpsrc,
  296. LPWIN16METAFILEPICT lpdest );