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.

653 lines
17 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. long lVal;
  290. ULONG ulVal;
  291. float fltVal;
  292. SCODE scode;
  293. LARGE_INTEGER hVal;
  294. ULARGE_INTEGER uhVal;
  295. double dblVal;
  296. CY cyVal;
  297. DATE date;
  298. FILETIME filetime;
  299. CLSID *puuid;
  300. BLOB blob;
  301. CLIPDATA *pclipdata;
  302. IStream *pStream;
  303. IStorage *pStorage;
  304. BSTR bstrVal;
  305. LPSTR pszVal;
  306. LPWSTR pwszVal;
  307. CAUB caub;
  308. CAI cai;
  309. CAUI caui;
  310. CABOOL cabool;
  311. CAL cal;
  312. CAUL caul;
  313. CAFLT caflt;
  314. CASCODE cascode;
  315. CAH cah;
  316. CAUH cauh;
  317. CADBL cadbl;
  318. CACY cacy;
  319. CADATE cadate;
  320. CAFILETIME cafiletime;
  321. CACLSID cauuid;
  322. CACLIPDATA caclipdata;
  323. CABSTR cabstr;
  324. CALPSTR calpstr;
  325. CALPWSTR calpwstr;
  326. CAPROPVARIANT capropvar;
  327. };
  328. };
  329. typedef struct tagPROPVARIANT *LPPROPVARIANT;
  330. /* Reserved global Property IDs */
  331. #define PID_DICTIONARY ( 0 )
  332. #define PID_CODEPAGE ( 0x1 )
  333. #define PID_FIRST_USABLE ( 0x2 )
  334. #define PID_FIRST_NAME_DEFAULT ( 0xfff )
  335. #define PID_LOCALE ( 0x80000000 )
  336. #define PID_MODIFY_TIME ( 0x80000001 )
  337. #define PID_SECURITY ( 0x80000002 )
  338. #define PID_ILLEGAL ( 0xffffffff )
  339. /* Property IDs for the SummaryInformation Property Set */
  340. #define PIDSI_TITLE 0x00000002L /* VT_LPSTR*/
  341. #define PIDSI_SUBJECT 0x00000003L /* VT_LPSTR*/
  342. #define PIDSI_AUTHOR 0x00000004L /* VT_LPSTR*/
  343. #define PIDSI_KEYWORDS 0x00000005L /* VT_LPSTR*/
  344. #define PIDSI_COMMENTS 0x00000006L /* VT_LPSTR*/
  345. #define PIDSI_TEMPLATE 0x00000007L /* VT_LPSTR*/
  346. #define PIDSI_LASTAUTHOR 0x00000008L /* VT_LPSTR*/
  347. #define PIDSI_REVNUMBER 0x00000009L /* VT_LPSTR*/
  348. #define PIDSI_EDITTIME 0x0000000aL /* VT_FILETIME (UTC)*/
  349. #define PIDSI_LASTPRINTED 0x0000000bL /* VT_FILETIME (UTC)*/
  350. #define PIDSI_CREATE_DTM 0x0000000cL /* VT_FILETIME (UTC)*/
  351. #define PIDSI_LASTSAVE_DTM 0x0000000dL /* VT_FILETIME (UTC)*/
  352. #define PIDSI_PAGECOUNT 0x0000000eL /* VT_I4*/
  353. #define PIDSI_WORDCOUNT 0x0000000fL /* VT_I4*/
  354. #define PIDSI_CHARCOUNT 0x00000010L /* VT_I4*/
  355. #define PIDSI_THUMBNAIL 0x00000011L /* VT_CF*/
  356. #define PIDSI_APPNAME 0x00000012L /* VT_LPSTR*/
  357. #define PIDSI_DOC_SECURITY 0x00000013L /* VT_I4*/
  358. #define PRSPEC_INVALID ( 0xffffffff )
  359. #define PRSPEC_LPWSTR ( 0 )
  360. #define PRSPEC_PROPID ( 1 )
  361. typedef struct tagPROPSPEC
  362. {
  363. ULONG ulKind;
  364. union
  365. {
  366. PROPID propid;
  367. LPOLESTR lpwstr;
  368. };
  369. } PROPSPEC;
  370. typedef struct tagSTATPROPSTG
  371. {
  372. LPOLESTR lpwstrName;
  373. PROPID propid;
  374. VARTYPE vt;
  375. } STATPROPSTG;
  376. inline WORD OSVERHI(DWORD dwOSVer)
  377. {
  378. return (WORD) (dwOSVer >> 16);
  379. }
  380. inline WORD OSVERLOW(DWORD dwOSVer)
  381. {
  382. return (WORD) (dwOSVer & ((unsigned)~((DWORD) 0) >> 16));
  383. }
  384. #ifndef LOBYTE
  385. /* code from MSDN */
  386. #define LOBYTE(a) (BYTE) ((a) & ((unsigned)~0>>CHAR_BIT))
  387. #define HIBYTE(a) (BYTE) ((unsigned)(a) >> CHAR_BIT)
  388. #endif
  389. /* Macros for parsing the OS Version of the Property Set Header*/
  390. #define PROPSETHDR_OSVER_KIND(dwOSVer) OSVERHI( (dwOSVer) )
  391. #define PROPSETHDR_OSVER_MAJOR(dwOSVer) LOBYTE( OSVERLOW( (dwOSVer) ))
  392. #define PROPSETHDR_OSVER_MINOR(dwOSVer) HIBYTE( OSVERLOW( (dwOSVer) ))
  393. #define PROPSETHDR_OSVERSION_UNKNOWN 0xFFFFFFFF
  394. typedef struct tagSTATPROPSETSTG
  395. {
  396. FMTID fmtid;
  397. CLSID clsid;
  398. DWORD grfFlags;
  399. FILETIME mtime;
  400. FILETIME ctime;
  401. FILETIME atime;
  402. DWORD dwOSVersion;
  403. } STATPROPSETSTG;
  404. EXTERN_C const IID IID_IPropertyStorage;
  405. /****************************************************************
  406. *
  407. * Header for interface: IPropertyStorage
  408. *
  409. ****************************************************************/
  410. interface IPropertyStorage : public IUnknown
  411. {
  412. public:
  413. virtual HRESULT STDMETHODCALLTYPE ReadMultiple(
  414. /* [in] */ ULONG cpspec,
  415. /* [in] */ const PROPSPEC rgpspec[ ],
  416. /* [out] */ PROPVARIANT rgpropvar[ ]) = 0;
  417. virtual HRESULT STDMETHODCALLTYPE WriteMultiple(
  418. /* [in] */ ULONG cpspec,
  419. /* [in] */ const PROPSPEC rgpspec[ ],
  420. /* [in] */ const PROPVARIANT rgpropvar[ ],
  421. /* [in] */ PROPID propidNameFirst) = 0;
  422. virtual HRESULT STDMETHODCALLTYPE DeleteMultiple(
  423. /* [in] */ ULONG cpspec,
  424. /* [in] */ const PROPSPEC rgpspec[ ]) = 0;
  425. virtual HRESULT STDMETHODCALLTYPE ReadPropertyNames(
  426. /* [in] */ ULONG cpropid,
  427. /* [in] */ const PROPID rgpropid[ ],
  428. /* [out] */ LPOLESTR rglpwstrName[ ]) = 0;
  429. virtual HRESULT STDMETHODCALLTYPE WritePropertyNames(
  430. /* [in] */ ULONG cpropid,
  431. /* [in] */ const PROPID rgpropid[ ],
  432. /* [in] */ const LPOLESTR rglpwstrName[ ]) = 0;
  433. virtual HRESULT STDMETHODCALLTYPE DeletePropertyNames(
  434. /* [in] */ ULONG cpropid,
  435. /* [in] */ const PROPID rgpropid[ ]) = 0;
  436. virtual HRESULT STDMETHODCALLTYPE Commit(
  437. /* [in] */ DWORD grfCommitFlags) = 0;
  438. virtual HRESULT STDMETHODCALLTYPE Revert( void) = 0;
  439. virtual HRESULT STDMETHODCALLTYPE Enum(
  440. /* [out] */ IEnumSTATPROPSTG **ppenum) = 0;
  441. virtual HRESULT STDMETHODCALLTYPE SetTimes(
  442. /* [in] */ const FILETIME *pctime,
  443. /* [in] */ const FILETIME *patime,
  444. /* [in] */ const FILETIME *pmtime) = 0;
  445. virtual HRESULT STDMETHODCALLTYPE SetClass(
  446. /* [in] */ REFCLSID clsid) = 0;
  447. virtual HRESULT STDMETHODCALLTYPE Stat(
  448. /* [out] */ STATPROPSETSTG *pstatpsstg) = 0;
  449. };
  450. /****************************************************************
  451. *
  452. * Header for interface: IPropertySetStorage
  453. *
  454. ****************************************************************/
  455. EXTERN_C const IID IID_IPropertySetStorage;
  456. interface IPropertySetStorage : public IUnknown
  457. {
  458. public:
  459. virtual HRESULT STDMETHODCALLTYPE Create(
  460. /* [in] */ REFFMTID rfmtid,
  461. /* [in] */ const CLSID *pclsid,
  462. /* [in] */ DWORD grfFlags,
  463. /* [in] */ DWORD grfMode,
  464. /* [out] */ IPropertyStorage **ppprstg) = 0;
  465. virtual HRESULT STDMETHODCALLTYPE Open(
  466. /* [in] */ REFFMTID rfmtid,
  467. /* [in] */ DWORD grfMode,
  468. /* [out] */ IPropertyStorage **ppprstg) = 0;
  469. virtual HRESULT STDMETHODCALLTYPE Delete(
  470. /* [in] */ REFFMTID rfmtid) = 0;
  471. virtual HRESULT STDMETHODCALLTYPE Enum(
  472. /* [out] */ IEnumSTATPROPSETSTG **ppenum) = 0;
  473. };
  474. typedef IPropertySetStorage *LPPROPERTYSETSTORAGE;
  475. /****************************************************************
  476. *
  477. * Header for interface: IEnumSTATPROPSTG
  478. *
  479. ****************************************************************/
  480. typedef IEnumSTATPROPSTG *LPENUMSTATPROPSTG;
  481. EXTERN_C const IID IID_IEnumSTATPROPSTG;
  482. interface IEnumSTATPROPSTG : public IUnknown
  483. {
  484. public:
  485. virtual HRESULT STDMETHODCALLTYPE Next(
  486. /* [in] */ ULONG celt,
  487. /* [out] */ STATPROPSTG *rgelt,
  488. /* [out] */ ULONG *pceltFetched) = 0;
  489. virtual HRESULT STDMETHODCALLTYPE Skip(
  490. /* [in] */ ULONG celt) = 0;
  491. virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
  492. virtual HRESULT STDMETHODCALLTYPE Clone(
  493. /* [out] */ IEnumSTATPROPSTG **ppenum) = 0;
  494. };
  495. typedef IEnumSTATPROPSETSTG *LPENUMSTATPROPSETSTG;
  496. EXTERN_C const IID IID_IEnumSTATPROPSETSTG;
  497. /****************************************************************
  498. *
  499. * Header for interface: IEnumSTATPROPSETSTG
  500. *
  501. ****************************************************************/
  502. interface IEnumSTATPROPSETSTG : public IUnknown
  503. {
  504. public:
  505. virtual HRESULT STDMETHODCALLTYPE Next(
  506. /* [in] */ ULONG celt,
  507. /* [out] */ STATPROPSETSTG *rgelt,
  508. /* [out] */ ULONG *pceltFetched) = 0;
  509. virtual HRESULT STDMETHODCALLTYPE Skip(
  510. /* [in] */ ULONG celt) = 0;
  511. virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
  512. virtual HRESULT STDMETHODCALLTYPE Clone(
  513. /* [out] */ IEnumSTATPROPSETSTG **ppenum) = 0;
  514. };
  515. #ifdef __cplusplus
  516. extern "C" {
  517. #endif
  518. STDAPI PropVariantCopy( PROPVARIANT * pvarDest,
  519. const PROPVARIANT * pvarSrc );
  520. STDAPI PropVariantClear( PROPVARIANT * pvar );
  521. STDAPI FreePropVariantArray( ULONG cVariants, PROPVARIANT * rgvars );
  522. STDAPI_(void) SysFreeString(BSTR bstr);
  523. STDAPI_(BSTR) SysAllocString(LPOLECHAR pwsz);
  524. #ifdef __cplusplus
  525. };
  526. #endif
  527. #include <memory.h>
  528. #ifdef __cplusplus
  529. inline void PropVariantInit ( PROPVARIANT * pvar )
  530. {
  531. memset ( pvar, 0, sizeof(PROPVARIANT) );
  532. }
  533. #else
  534. #define PropVariantInit(pvar) memset ( pvar, 0, sizeof(PROPVARIANT) )
  535. #endif
  536. #endif /*#ifndef _PROP_H_*/