defprop.h
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 7k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. #ifndef __DEFPROP_H__
  2. #define __DEFPROP_H__
  3. #include "PTsrv32.h"
  4. //-------------------------------------//
  5. //  Helper functions
  6. EXTERN_C HRESULT LoadDefItemTags( UINT nIDS, BSTR& bstrName, BSTR& bstrDisplayName, BSTR& bstrQtip ) ;
  7. //------------------------------------------//
  8. //  Advanced properties default folder items
  9. //------------------------------------------//
  10. typedef struct tagDEFFOLDERITEM
  11. {
  12.     const PFID* ppfid ;
  13.     UINT        nIDStringRes ;
  14.     ULONG       dwSrcType ;
  15. ULONG mask ;
  16. ULONG dwAccess ;
  17.     ULONG       Reserved ;
  18. } DEFFOLDERITEM, *PDEFFOLDERITEM, *LPDEFFOLDERITEM ;
  19. //  Folder item API
  20. EXTERN_C HRESULT MakeDefFolderItem( long iDefFolder, PROPFOLDERITEM* pItem, LPARAM lParamSrc ) ;
  21. EXTERN_C BOOL    IsDefFolderPFID( long iDefFolder, REFPFID refpfid ) ;
  22. EXTERN_C BOOL    IsDefFolderStgType( long iDefFolder, ULONG dwSrcType ) ;
  23. EXTERN_C BOOL    IsDefFolderDocType( long iDefFolder, ULONG dwSrcType ) ;
  24. EXTERN_C BOOL    IsDefFolderSrcType( long iDefFolder, ULONG dwSrcType ) ;
  25. EXTERN_C int     DefFolderCount() ;
  26. //-------------------------------------//
  27. //  Advanced properties default value items
  28. //-------------------------------------//
  29. // Important: the header portion of this structure
  30. // must match the PROPVARIANT structure for cross-casting purposes.
  31. typedef struct tagDEFVAL
  32. {
  33.     VARTYPE     vt ;                
  34.     WORD wReserved1;
  35.     WORD wReserved2;
  36.     WORD wReserved3;
  37.     union       {
  38.         //  some token union members.
  39.         short               i2;
  40.         UCHAR               u1;
  41.         unsigned short      u2;
  42.         unsigned long       u4;
  43.         double              d ;
  44.         unsigned __int64    ull ;
  45.         PVOID               pv ;
  46.         CAUL                caul ;
  47.     } val ;
  48.     BOOL        fValStrRes  ;    // TRUE if u2 represents a string resource ID for a string type, otherwise FALSE.
  49.     BOOL        fDisplayStrRes ; // TRUE: lpDisplay = sring res ID, otherwise lpDisplay = string literal.
  50.     LPARAM      lpDisplay ;
  51. } DEFVAL, *PDEFVAL, *LPDEFVAL;
  52. //-------------------------------------//
  53. //  Advanced properties default property items
  54. //-------------------------------------//
  55. typedef struct tagDEFPROPERTYITEM
  56. {
  57.     LPWSTR       pszName ;
  58.     const FMTID* pFmtID ;
  59.     PROPID       propID ;
  60.     ULONG        nIDStringRes ;
  61. VARTYPE  vt ;
  62.     ULONG        dwSrcType ;
  63.     const PFID*  ppfid ;
  64.     ULONG        mask ;
  65.     ULONG        dwAccess ;
  66.     ULONG  dwFlags ;
  67. ULONG  ctlID ;
  68. BSTR  bstrDisplayFmt ;
  69.     ULONG        cDefVals ;
  70.     const DEFVAL*      pDefVals ;
  71. } DEFPROPERTYITEM, *PDEFPROPERTYITEM, *LPDEFPROPERTYITEM ; 
  72. //-------------------------------------//
  73. //  Advanced properties default value list.
  74. //  We classify property sources in terms of the complement of properties
  75. //  displayed for them:
  76. //  Bits 0-15: document type
  77. //  Bits 16-23: storage type
  78. //  Bits 24-31: context
  79. #define DOCTYPEMASK        0x0000FFFF
  80. #define STGTYPEMASK        0x00FF0000
  81. #define CXTTYPEMASK        0xFF000000
  82. #define PST_UNSUPPORTED    0x00000000
  83. #define PST_PROPTREE       0x01000000
  84. #define PST_SHELLCOLUMN    0x02000000
  85. #define PST_NOSTG          0x00010000  // No property storage backing the file.
  86. #define PST_OLESS          0x00020000  // OLE compound file property set storage.
  87. #define PST_NSS            0x00040000  // NTFS 5.0+ property set storage.
  88. #define PST_UNKNOWNDOC     0x00000001  // Unknown document type
  89. #define PST_DOCFILE        0x00000002  // Registered OLE document type.
  90. #define PST_IMAGEFILE      0x00000004  // Image file
  91. #define PST_MEDIAFILE      0x00000008  // avi, wav.
  92. #define GETCXTTYPE( srctype )       ((srctype) & CXTTYPEMASK)
  93. #define GETSTGTYPE( srctype )       ((srctype) & STGTYPEMASK)
  94. #define GETDOCTYPE( srctype )       ((srctype) & DOCTYPEMASK)
  95. #define SETSTGTYPE( pST, stgtype )  (*(pST) = (*(pST) & ~STGTYPEMASK)|(stgtype))
  96. #define SETDOCTYPE( pST, doctype )  (*(pST) = (*(pST) & ~DOCTYPEMASK)|(doctype))
  97. #define SETCXTTYPE( pST, cxttype )  (*(pST) = (*(pST) & ~CXTTYPEMASK)|(cxttype))
  98. //  Property item API
  99. EXTERN_C long    DefPropCount() ;
  100. EXTERN_C BOOL    IsDefPropStgType( long iDefFolder, ULONG dwStgType ) ;
  101. EXTERN_C BOOL    IsDefPropDocType( long iDefFolder, ULONG dwDocType ) ;
  102. EXTERN_C BOOL    IsDefPropCxtType( long iDefFolder, ULONG dwCxtType ) ;
  103. EXTERN_C BOOL    IsDefPropSrcType( long iDefFolder, ULONG dwSrcType ) ;
  104. EXTERN_C BOOL    DefPropHasFlags( long iDefProp, ULONG dwFlags ) ;
  105. EXTERN_C long    FindDefPropertyItem( IN REFFMTID fmtID, IN PROPID propID, IN VARTYPE vt ) ;
  106. EXTERN_C long    FindDefPropertyItemLite( IN REFFMTID fmtID, IN PROPID propID ) ;
  107. EXTERN_C HRESULT GetDefPropertyItem( IN long iDefProp, OUT DEFPROPERTYITEM* pItem ) ;
  108. EXTERN_C HRESULT MakeDefPropertyItem( IN long iDefProp, OUT PROPERTYITEM* pItem, IN LPARAM lParam ) ;
  109. EXTERN_C HRESULT MakeDefPropertyItemEx( IN REFFMTID fmtID, IN PROPID propID, IN VARTYPE vt, OUT PROPERTYITEM* pItem, IN LPARAM lParam ) ;
  110. EXTERN_C HRESULT GetDefPropItemID( IN long iDefProp, OUT const FMTID** pFmtID, OUT PROPID* pPropID, OUT VARTYPE* pVt ) ;
  111. EXTERN_C HRESULT GetDefPropItemValues( IN long iDefProp, OUT DEFVAL const** paDefVals, OUT ULONG* pcDefVals ) ;
  112. #define MAX_STRINGRES 255
  113. //-------------------------------------------------------------------------//
  114. //  Implementation helpers
  115. #define BEGIN_DEFFOLDER_MAP( mapname ) 
  116.     static const DEFFOLDERITEM mapname[] = {
  117. #define DEFFOLDER_ENTRY( pfid, strResID, dwSrcType, mask, access ) 
  118.     { &pfid, strResID, dwSrcType, mask, access, 0L },
  119. #define END_DEFFOLDER_MAP() 
  120.     } ;
  121. #define DEFFOLDER_ENTRY_COUNT( mapname )
  122.     (sizeof(mapname)/sizeof(DEFFOLDERITEM))
  123. #define BEGIN_DEFPROP_MAP( mapname ) 
  124.     static const DEFPROPERTYITEM mapname[] = {
  125. #define DEFPROP_ENTRY( name, fmtid, propid, strResID, type, srctype, pfid, mask, access, flags, ctlID, fmt ) 
  126.     { name, &fmtid, propid, strResID, type, srctype, &pfid, mask, access, flags, ctlID, fmt, 0, 0 },
  127. #define DEFPROP_ENUM_ENTRY( name, fmtid, propid, strResID, type, srctype, pfid, mask, access, flags, ctlID, fmt, cVals, vals ) 
  128.     { name, &fmtid, propid, strResID, type, srctype, &pfid, mask, access, flags|PTPIF_ENUM, PTCTLID_DROPLIST_COMBO, fmt, cVals, vals },
  129. #define END_DEFPROP_MAP() 
  130.     } ;
  131. #define DEFPROP_ENTRY_COUNT( mapname )
  132.     (sizeof(mapname)/sizeof(DEFPROPERTYITEM))
  133. #define VALID_DEFPROP_ENTRY( i, mapname ) 
  134.     ((i)>=0 && (i)< DEFPROP_ENTRY_COUNT( mapname ))
  135. #define BEGIN_DEFVALLIST( name ) 
  136.     static const DEFVAL name[] = { 
  137. #define DEFVALLIST_STRING_ENTRY( val, vt, fValStrRes, fDisplStrRes, display ) 
  138.     { vt, 0,0,0, val, fValStrRes, fDisplStrRes, display },
  139. #define DEFVALLIST_BOOL_ENTRY( val, fDisplStrRes, display ) 
  140.     { VT_BOOL, 0,0,0, val, FALSE, fDisplStrRes, display },
  141. #define DEFVALLIST_COUNT( name )
  142.     (sizeof(name)/sizeof(DEFVAL))
  143. #define END_DEFVALLIST()    } ;
  144.  
  145. #endif __DEFPROP_H__