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.

656 lines
16 KiB

  1. /* FILE: prop.h*/
  2. /* Description: This is the exported include file that should be */
  3. /* included to declare and make use of the property */
  4. /* set Interfaces (IPropertyStorage and IPropertySetStorage */
  5. #ifndef _PROP_H_
  6. #define _PROP_H_
  7. #include "ref.hxx"
  8. #include "tchar.h"
  9. #include "../props/olechar.h"
  10. typedef double DATE;
  11. typedef union tagCY {
  12. struct _split {
  13. #if BIGENDIAN /* big end in first */
  14. long Hi;
  15. unsigned long Lo;
  16. #else /* little end in first */
  17. unsigned long Lo;
  18. long Hi;
  19. #endif
  20. } split; /* need to name this to make it portable */
  21. LONGLONG int64; /* the above split is need to be compatiable */
  22. /* with the def of the union */
  23. } CY;
  24. typedef OLECHAR *BSTR;
  25. typedef BSTR *LPBSTR;
  26. /* 0 == FALSE, -1 == TRUE */
  27. typedef short VARIANT_BOOL;
  28. /* for backward compatibility */
  29. typedef VARIANT_BOOL _VARIANT_BOOL;
  30. #define VARIANT_TRUE ((VARIANT_BOOL)0xffff)
  31. #define VARIANT_FALSE ((VARIANT_BOOL)0)
  32. typedef struct tagBLOB
  33. {
  34. ULONG cbSize;
  35. BYTE *pBlobData;
  36. } BLOB;
  37. typedef struct tagBLOB *LPBLOB;
  38. typedef unsigned short VARTYPE;
  39. typedef struct tagCLIPDATA
  40. {
  41. ULONG cbSize; // includes sizeof(ulClipFmt)
  42. long ulClipFmt;
  43. BYTE *pClipData;
  44. } CLIPDATA;
  45. /*
  46. * VARENUM usage key,
  47. *
  48. * * [V] - may appear in a VARIANT
  49. * * [T] - may appear in a TYPEDESC
  50. * * [P] - may appear in an OLE property set
  51. * * [S] - may appear in a Safe Array
  52. *
  53. *
  54. * VT_EMPTY [V] [P] nothing
  55. * VT_NULL [V] [P] SQL style Null
  56. * VT_I2 [V][T][P][S] 2 byte signed int
  57. * VT_I4 [V][T][P][S] 4 byte signed int
  58. * VT_R4 [V][T][P][S] 4 byte real
  59. * VT_R8 [V][T][P][S] 8 byte real
  60. * VT_CY [V][T][P][S] currency
  61. * VT_DATE [V][T][P][S] date
  62. * VT_BSTR [V][T][P][S] OLE Automation string
  63. * VT_DISPATCH [V][T][P][S] IDispatch *
  64. * VT_ERROR [V][T][P][S] SCODE
  65. * VT_BOOL [V][T][P][S] True=-1, False=0
  66. * VT_VARIANT [V][T][P][S] VARIANT *
  67. * VT_UNKNOWN [V][T] [S] IUnknown *
  68. * VT_DECIMAL [V][T] [S] 16 byte fixed point
  69. * VT_I1 [T] signed char
  70. * VT_UI1 [V][T][P][S] unsigned char
  71. * VT_UI2 [T][P] unsigned short
  72. * VT_UI4 [T][P] unsigned short
  73. * VT_I8 [T][P] signed 64-bit int
  74. * VT_UI8 [T][P] unsigned 64-bit int
  75. * VT_INT [T] signed machine int
  76. * VT_UINT [T] unsigned machine int
  77. * VT_VOID [T] C style void
  78. * VT_HRESULT [T] Standard return type
  79. * VT_PTR [T] pointer type
  80. * VT_SAFEARRAY [T] (use VT_ARRAY in VARIANT)
  81. * VT_CARRAY [T] C style array
  82. * VT_USERDEFINED [T] user defined type
  83. * VT_LPSTR [T][P] null terminated string
  84. * VT_LPWSTR [T][P] wide null terminated string
  85. * VT_FILETIME [P] FILETIME
  86. * VT_BLOB [P] Length prefixed bytes
  87. * VT_STREAM [P] Name of the stream follows
  88. * VT_STORAGE [P] Name of the storage follows
  89. * VT_STREAMED_OBJECT [P] Stream contains an object
  90. * VT_STORED_OBJECT [P] Storage contains an object
  91. * VT_BLOB_OBJECT [P] Blob contains an object
  92. * VT_CF [P] Clipboard format
  93. * VT_CLSID [P] A Class ID
  94. * VT_VECTOR [P] simple counted array
  95. * VT_ARRAY [V] SAFEARRAY*
  96. * VT_BYREF [V] void* for local use
  97. */
  98. enum VARENUM
  99. { VT_EMPTY = 0,
  100. VT_NULL = 1,
  101. VT_I2 = 2,
  102. VT_I4 = 3,
  103. VT_R4 = 4,
  104. VT_R8 = 5,
  105. VT_CY = 6,
  106. VT_DATE = 7,
  107. VT_BSTR = 8,
  108. VT_DISPATCH = 9,
  109. VT_ERROR = 10,
  110. VT_BOOL = 11,
  111. VT_VARIANT = 12,
  112. VT_UNKNOWN = 13,
  113. VT_DECIMAL = 14,
  114. VT_I1 = 16,
  115. VT_UI1 = 17,
  116. VT_UI2 = 18,
  117. VT_UI4 = 19,
  118. VT_I8 = 20,
  119. VT_UI8 = 21,
  120. VT_INT = 22,
  121. VT_UINT = 23,
  122. VT_VOID = 24,
  123. VT_HRESULT = 25,
  124. VT_PTR = 26,
  125. VT_SAFEARRAY = 27,
  126. VT_CARRAY = 28,
  127. VT_USERDEFINED = 29,
  128. VT_LPSTR = 30,
  129. VT_LPWSTR = 31,
  130. VT_FILETIME = 64,
  131. VT_BLOB = 65,
  132. VT_STREAM = 66,
  133. VT_STORAGE = 67,
  134. VT_STREAMED_OBJECT = 68,
  135. VT_STORED_OBJECT = 69,
  136. VT_BLOB_OBJECT = 70,
  137. VT_CF = 71,
  138. VT_CLSID = 72,
  139. VT_VECTOR = 0x1000,
  140. VT_ARRAY = 0x2000,
  141. VT_BYREF = 0x4000,
  142. VT_RESERVED = 0x8000,
  143. VT_ILLEGAL = 0xffff,
  144. VT_ILLEGALMASKED = 0xfff,
  145. VT_TYPEMASK = 0xfff
  146. };
  147. typedef ULONG PROPID;
  148. /* Macro to calculate the size of the above pClipData */
  149. #define CBPCLIPDATA(clipdata) \
  150. ( (clipdata).cbSize - sizeof((clipdata).ulClipFmt) )
  151. typedef GUID FMTID;
  152. typedef const FMTID& REFFMTID;
  153. /* Well-known Property Set Format IDs*/
  154. extern const FMTID FMTID_SummaryInformation;
  155. extern const FMTID FMTID_DocSummaryInformation;
  156. extern const FMTID FMTID_UserDefinedProperties;
  157. inline BOOL operator==(REFFMTID g1, REFFMTID g2)
  158. { return IsEqualGUID(g1, g2); }
  159. inline BOOL operator!=(REFFMTID g1, REFFMTID g2)
  160. { return !IsEqualGUID(g1, g2); }
  161. /* Flags for IPropertySetStorage::Create*/
  162. #define PROPSETFLAG_DEFAULT ( 0 )
  163. #define PROPSETFLAG_NONSIMPLE ( 1 )
  164. #define PROPSETFLAG_ANSI ( 2 )
  165. /* FORWARD REFERENCES */
  166. interface IPropertyStorage;
  167. interface IEnumSTATPROPSTG;
  168. interface IEnumSTATPROPSETSTG;
  169. typedef IPropertyStorage *LPPROPERTYSTORAGE;
  170. typedef struct tagPROPVARIANT PROPVARIANT;
  171. typedef struct tagCAUB
  172. {
  173. ULONG cElems;
  174. unsigned char *pElems;
  175. } CAUB;
  176. typedef struct tagCAI
  177. {
  178. ULONG cElems;
  179. short *pElems;
  180. } CAI;
  181. typedef struct tagCAUI
  182. {
  183. ULONG cElems;
  184. USHORT *pElems;
  185. } CAUI;
  186. typedef struct tagCAL
  187. {
  188. ULONG cElems;
  189. long *pElems;
  190. } CAL;
  191. typedef struct tagCAUL
  192. {
  193. ULONG cElems;
  194. ULONG *pElems;
  195. } CAUL;
  196. typedef struct tagCAFLT
  197. {
  198. ULONG cElems;
  199. float *pElems;
  200. } CAFLT;
  201. typedef struct tagCADBL
  202. {
  203. ULONG cElems;
  204. double *pElems;
  205. } CADBL;
  206. typedef struct tagCACY
  207. {
  208. ULONG cElems;
  209. CY *pElems;
  210. } CACY;
  211. typedef struct tagCADATE
  212. {
  213. ULONG cElems;
  214. DATE *pElems;
  215. } CADATE;
  216. typedef struct tagCABSTR
  217. {
  218. ULONG cElems;
  219. BSTR *pElems;
  220. } CABSTR;
  221. typedef struct tagCABOOL
  222. {
  223. ULONG cElems;
  224. VARIANT_BOOL *pElems;
  225. } CABOOL;
  226. typedef struct tagCASCODE
  227. {
  228. ULONG cElems;
  229. SCODE *pElems;
  230. } CASCODE;
  231. typedef struct tagCAPROPVARIANT
  232. {
  233. ULONG cElems;
  234. PROPVARIANT *pElems;
  235. } CAPROPVARIANT;
  236. typedef struct tagCAH
  237. {
  238. ULONG cElems;
  239. LARGE_INTEGER *pElems;
  240. } CAH;
  241. typedef struct tagCAUH
  242. {
  243. ULONG cElems;
  244. ULARGE_INTEGER *pElems;
  245. } CAUH;
  246. typedef struct tagCALPSTR
  247. {
  248. ULONG cElems;
  249. LPSTR *pElems;
  250. } CALPSTR;
  251. typedef struct tagCALPWSTR
  252. {
  253. ULONG cElems;
  254. LPWSTR *pElems;
  255. } CALPWSTR;
  256. typedef struct tagCAFILETIME
  257. {
  258. ULONG cElems;
  259. FILETIME *pElems;
  260. } CAFILETIME;
  261. typedef struct tagCACLIPDATA
  262. {
  263. ULONG cElems;
  264. CLIPDATA *pElems;
  265. } CACLIPDATA;
  266. typedef struct tagCACLSID
  267. {
  268. ULONG cElems;
  269. CLSID *pElems;
  270. } CACLSID;
  271. /* Disable the warning about the obsolete member named 'bool'*/
  272. /* 'bool', 'true', 'false', 'mutable', 'explicit', & 'typename'*/
  273. /* are reserved keywords*/
  274. #ifdef _MSC_VER
  275. #pragma warning(disable:4237)
  276. #endif
  277. struct tagPROPVARIANT
  278. {
  279. VARTYPE vt;
  280. WORD wReserved1;
  281. WORD wReserved2;
  282. WORD wReserved3;
  283. union
  284. {
  285. UCHAR bVal;
  286. short iVal;
  287. USHORT uiVal;
  288. VARIANT_BOOL boolVal;
  289. #ifndef __GNUC__ /* in GCC this obsolete member causes conflicts */
  290. _VARIANT_BOOL bool;
  291. #endif
  292. long lVal;
  293. ULONG ulVal;
  294. float fltVal;
  295. SCODE scode;
  296. LARGE_INTEGER hVal;
  297. ULARGE_INTEGER uhVal;
  298. double dblVal;
  299. CY cyVal;
  300. DATE date;
  301. FILETIME filetime;
  302. CLSID *puuid;
  303. BLOB blob;
  304. CLIPDATA *pclipdata;
  305. IStream *pStream;
  306. IStorage *pStorage;
  307. BSTR bstrVal;
  308. LPSTR pszVal;
  309. LPWSTR pwszVal;
  310. CAUB caub;
  311. CAI cai;
  312. CAUI caui;
  313. CABOOL cabool;
  314. CAL cal;
  315. CAUL caul;
  316. CAFLT caflt;
  317. CASCODE cascode;
  318. CAH cah;
  319. CAUH cauh;
  320. CADBL cadbl;
  321. CACY cacy;
  322. CADATE cadate;
  323. CAFILETIME cafiletime;
  324. CACLSID cauuid;
  325. CACLIPDATA caclipdata;
  326. CABSTR cabstr;
  327. CALPSTR calpstr;
  328. CALPWSTR calpwstr;
  329. CAPROPVARIANT capropvar;
  330. };
  331. };
  332. typedef struct tagPROPVARIANT *LPPROPVARIANT;
  333. /* Reserved global Property IDs */
  334. #define PID_DICTIONARY ( 0 )
  335. #define PID_CODEPAGE ( 0x1 )
  336. #define PID_FIRST_USABLE ( 0x2 )
  337. #define PID_FIRST_NAME_DEFAULT ( 0xfff )
  338. #define PID_LOCALE ( 0x80000000 )
  339. #define PID_MODIFY_TIME ( 0x80000001 )
  340. #define PID_SECURITY ( 0x80000002 )
  341. #define PID_ILLEGAL ( 0xffffffff )
  342. /* Property IDs for the SummaryInformation Property Set */
  343. #define PIDSI_TITLE 0x00000002L /* VT_LPSTR*/
  344. #define PIDSI_SUBJECT 0x00000003L /* VT_LPSTR*/
  345. #define PIDSI_AUTHOR 0x00000004L /* VT_LPSTR*/
  346. #define PIDSI_KEYWORDS 0x00000005L /* VT_LPSTR*/
  347. #define PIDSI_COMMENTS 0x00000006L /* VT_LPSTR*/
  348. #define PIDSI_TEMPLATE 0x00000007L /* VT_LPSTR*/
  349. #define PIDSI_LASTAUTHOR 0x00000008L /* VT_LPSTR*/
  350. #define PIDSI_REVNUMBER 0x00000009L /* VT_LPSTR*/
  351. #define PIDSI_EDITTIME 0x0000000aL /* VT_FILETIME (UTC)*/
  352. #define PIDSI_LASTPRINTED 0x0000000bL /* VT_FILETIME (UTC)*/
  353. #define PIDSI_CREATE_DTM 0x0000000cL /* VT_FILETIME (UTC)*/
  354. #define PIDSI_LASTSAVE_DTM 0x0000000dL /* VT_FILETIME (UTC)*/
  355. #define PIDSI_PAGECOUNT 0x0000000eL /* VT_I4*/
  356. #define PIDSI_WORDCOUNT 0x0000000fL /* VT_I4*/
  357. #define PIDSI_CHARCOUNT 0x00000010L /* VT_I4*/
  358. #define PIDSI_THUMBNAIL 0x00000011L /* VT_CF*/
  359. #define PIDSI_APPNAME 0x00000012L /* VT_LPSTR*/
  360. #define PIDSI_DOC_SECURITY 0x00000013L /* VT_I4*/
  361. #define PRSPEC_INVALID ( 0xffffffff )
  362. #define PRSPEC_LPWSTR ( 0 )
  363. #define PRSPEC_PROPID ( 1 )
  364. typedef struct tagPROPSPEC
  365. {
  366. ULONG ulKind;
  367. union
  368. {
  369. PROPID propid;
  370. LPOLESTR lpwstr;
  371. };
  372. } PROPSPEC;
  373. typedef struct tagSTATPROPSTG
  374. {
  375. LPOLESTR lpwstrName;
  376. PROPID propid;
  377. VARTYPE vt;
  378. } STATPROPSTG;
  379. inline WORD OSVERHI(DWORD dwOSVer)
  380. {
  381. return (WORD) (dwOSVer >> 16);
  382. }
  383. inline WORD OSVERLOW(DWORD dwOSVer)
  384. {
  385. return (WORD) (dwOSVer & ((unsigned)~((DWORD) 0) >> 16));
  386. }
  387. #ifndef LOBYTE
  388. /* code from MSDN */
  389. #define LOBYTE(a) (BYTE) ((a) & ((unsigned)~0>>CHAR_BIT))
  390. #define HIBYTE(a) (BYTE) ((unsigned)(a) >> CHAR_BIT)
  391. #endif
  392. /* Macros for parsing the OS Version of the Property Set Header*/
  393. #define PROPSETHDR_OSVER_KIND(dwOSVer) OSVERHI( (dwOSVer) )
  394. #define PROPSETHDR_OSVER_MAJOR(dwOSVer) LOBYTE( OSVERLOW( (dwOSVer) ))
  395. #define PROPSETHDR_OSVER_MINOR(dwOSVer) HIBYTE( OSVERLOW( (dwOSVer) ))
  396. #define PROPSETHDR_OSVERSION_UNKNOWN 0xFFFFFFFF
  397. typedef struct tagSTATPROPSETSTG
  398. {
  399. FMTID fmtid;
  400. CLSID clsid;
  401. DWORD grfFlags;
  402. FILETIME mtime;
  403. FILETIME ctime;
  404. FILETIME atime;
  405. DWORD dwOSVersion;
  406. } STATPROPSETSTG;
  407. EXTERN_C const IID IID_IPropertyStorage;
  408. /****************************************************************
  409. *
  410. * Header for interface: IPropertyStorage
  411. *
  412. ****************************************************************/
  413. interface IPropertyStorage : public IUnknown
  414. {
  415. public:
  416. virtual HRESULT STDMETHODCALLTYPE ReadMultiple(
  417. /* [in] */ ULONG cpspec,
  418. /* [in] */ const PROPSPEC rgpspec[ ],
  419. /* [out] */ PROPVARIANT rgpropvar[ ]) = 0;
  420. virtual HRESULT STDMETHODCALLTYPE WriteMultiple(
  421. /* [in] */ ULONG cpspec,
  422. /* [in] */ const PROPSPEC rgpspec[ ],
  423. /* [in] */ const PROPVARIANT rgpropvar[ ],
  424. /* [in] */ PROPID propidNameFirst) = 0;
  425. virtual HRESULT STDMETHODCALLTYPE DeleteMultiple(
  426. /* [in] */ ULONG cpspec,
  427. /* [in] */ const PROPSPEC rgpspec[ ]) = 0;
  428. virtual HRESULT STDMETHODCALLTYPE ReadPropertyNames(
  429. /* [in] */ ULONG cpropid,
  430. /* [in] */ const PROPID rgpropid[ ],
  431. /* [out] */ LPOLESTR rglpwstrName[ ]) = 0;
  432. virtual HRESULT STDMETHODCALLTYPE WritePropertyNames(
  433. /* [in] */ ULONG cpropid,
  434. /* [in] */ const PROPID rgpropid[ ],
  435. /* [in] */ const LPOLESTR rglpwstrName[ ]) = 0;
  436. virtual HRESULT STDMETHODCALLTYPE DeletePropertyNames(
  437. /* [in] */ ULONG cpropid,
  438. /* [in] */ const PROPID rgpropid[ ]) = 0;
  439. virtual HRESULT STDMETHODCALLTYPE Commit(
  440. /* [in] */ DWORD grfCommitFlags) = 0;
  441. virtual HRESULT STDMETHODCALLTYPE Revert( void) = 0;
  442. virtual HRESULT STDMETHODCALLTYPE Enum(
  443. /* [out] */ IEnumSTATPROPSTG **ppenum) = 0;
  444. virtual HRESULT STDMETHODCALLTYPE SetTimes(
  445. /* [in] */ const FILETIME *pctime,
  446. /* [in] */ const FILETIME *patime,
  447. /* [in] */ const FILETIME *pmtime) = 0;
  448. virtual HRESULT STDMETHODCALLTYPE SetClass(
  449. /* [in] */ REFCLSID clsid) = 0;
  450. virtual HRESULT STDMETHODCALLTYPE Stat(
  451. /* [out] */ STATPROPSETSTG *pstatpsstg) = 0;
  452. };
  453. /****************************************************************
  454. *
  455. * Header for interface: IPropertySetStorage
  456. *
  457. ****************************************************************/
  458. EXTERN_C const IID IID_IPropertySetStorage;
  459. interface IPropertySetStorage : public IUnknown
  460. {
  461. public:
  462. virtual HRESULT STDMETHODCALLTYPE Create(
  463. /* [in] */ REFFMTID rfmtid,
  464. /* [in] */ const CLSID *pclsid,
  465. /* [in] */ DWORD grfFlags,
  466. /* [in] */ DWORD grfMode,
  467. /* [out] */ IPropertyStorage **ppprstg) = 0;
  468. virtual HRESULT STDMETHODCALLTYPE Open(
  469. /* [in] */ REFFMTID rfmtid,
  470. /* [in] */ DWORD grfMode,
  471. /* [out] */ IPropertyStorage **ppprstg) = 0;
  472. virtual HRESULT STDMETHODCALLTYPE Delete(
  473. /* [in] */ REFFMTID rfmtid) = 0;
  474. virtual HRESULT STDMETHODCALLTYPE Enum(
  475. /* [out] */ IEnumSTATPROPSETSTG **ppenum) = 0;
  476. };
  477. typedef IPropertySetStorage *LPPROPERTYSETSTORAGE;
  478. /****************************************************************
  479. *
  480. * Header for interface: IEnumSTATPROPSTG
  481. *
  482. ****************************************************************/
  483. typedef IEnumSTATPROPSTG *LPENUMSTATPROPSTG;
  484. EXTERN_C const IID IID_IEnumSTATPROPSTG;
  485. interface IEnumSTATPROPSTG : public IUnknown
  486. {
  487. public:
  488. virtual HRESULT STDMETHODCALLTYPE Next(
  489. /* [in] */ ULONG celt,
  490. /* [out] */ STATPROPSTG *rgelt,
  491. /* [out] */ ULONG *pceltFetched) = 0;
  492. virtual HRESULT STDMETHODCALLTYPE Skip(
  493. /* [in] */ ULONG celt) = 0;
  494. virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
  495. virtual HRESULT STDMETHODCALLTYPE Clone(
  496. /* [out] */ IEnumSTATPROPSTG **ppenum) = 0;
  497. };
  498. typedef IEnumSTATPROPSETSTG *LPENUMSTATPROPSETSTG;
  499. EXTERN_C const IID IID_IEnumSTATPROPSETSTG;
  500. /****************************************************************
  501. *
  502. * Header for interface: IEnumSTATPROPSETSTG
  503. *
  504. ****************************************************************/
  505. interface IEnumSTATPROPSETSTG : public IUnknown
  506. {
  507. public:
  508. virtual HRESULT STDMETHODCALLTYPE Next(
  509. /* [in] */ ULONG celt,
  510. /* [out] */ STATPROPSETSTG *rgelt,
  511. /* [out] */ ULONG *pceltFetched) = 0;
  512. virtual HRESULT STDMETHODCALLTYPE Skip(
  513. /* [in] */ ULONG celt) = 0;
  514. virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
  515. virtual HRESULT STDMETHODCALLTYPE Clone(
  516. /* [out] */ IEnumSTATPROPSETSTG **ppenum) = 0;
  517. };
  518. #ifdef __cplusplus
  519. extern "C" {
  520. #endif
  521. STDAPI PropVariantCopy( PROPVARIANT * pvarDest,
  522. const PROPVARIANT * pvarSrc );
  523. STDAPI PropVariantClear( PROPVARIANT * pvar );
  524. STDAPI FreePropVariantArray( ULONG cVariants, PROPVARIANT * rgvars );
  525. STDAPI_(void) SysFreeString(BSTR bstr);
  526. STDAPI_(BSTR) SysAllocString(LPOLECHAR pwsz);
  527. #ifdef __cplusplus
  528. };
  529. #endif
  530. #include <memory.h>
  531. #ifdef __cplusplus
  532. inline void PropVariantInit ( PROPVARIANT * pvar )
  533. {
  534. memset ( pvar, 0, sizeof(PROPVARIANT) );
  535. }
  536. #else
  537. #define PropVariantInit(pvar) memset ( pvar, 0, sizeof(PROPVARIANT) )
  538. #endif
  539. #endif /*#ifndef _PROP_H_*/