home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 25: Programming / pc_actual_25.iso / C_C++ / BorlandCompiler / freecommandLinetools.exe / Include / ntquery.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-27  |  13.9 KB  |  383 lines

  1. //+---------------------------------------------------------------------------
  2. //
  3. //  Microsoft Windows
  4. //  Copyright (C) Microsoft Corporation, 1996-1999.
  5. //
  6. //  File:       NtQuery.h
  7. //
  8. //  Contents:   Main query header; Defines all exported query API
  9. //
  10. //----------------------------------------------------------------------------
  11.  
  12. #if !defined(__NTQUERY_H__)
  13. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  14. #define __NTQUERY_H__
  15.  
  16. #if _MSC_VER > 1000
  17. #pragma once
  18. #endif
  19.  
  20. #if defined(__cplusplus)
  21. extern "C"
  22. {
  23. #endif
  24.  
  25. //
  26. // Use this path for the null catalog, one that doesn't have an index.
  27. // Use it to search for properties of files that are not indexed.
  28. //
  29.  
  30. #define CINULLCATALOG L"::_noindex_::"
  31.  
  32. //
  33. // Use this path to connect to the server for administration work
  34. // (i.e. DocStoreAdmin.) No catalog is associated with the connection
  35. //
  36.  
  37. #define CIADMIN L"::_nodocstore_::"
  38.  
  39. //
  40. // Minimal support for persistent handlers.
  41. //
  42.  
  43. STDAPI LoadIFilter( WCHAR const * pwcsPath,
  44.                     IUnknown *    pUnkOuter,
  45.                     void **       ppIUnk );
  46.  
  47. STDAPI BindIFilterFromStorage( IStorage * pStg,
  48.                                IUnknown * pUnkOuter,
  49.                                void **    ppIUnk );
  50.  
  51. STDAPI BindIFilterFromStream( IStream *  pStm,
  52.                               IUnknown * pUnkOuter,
  53.                               void **    ppIUnk );
  54.  
  55. STDAPI LocateCatalogsW( WCHAR const * pwszScope,
  56.                         ULONG         iBmk,
  57.                         WCHAR *       pwszMachine,
  58.                         ULONG *       pccMachine,
  59.                         WCHAR *       pwszCat,
  60.                         ULONG *       pccCat );
  61.  
  62. //
  63. // For calling from VB
  64. //
  65.  
  66. STDAPI LocateCatalogsA( char const * pwszScope,
  67.                         ULONG        iBmk,
  68.                         char  *      pwszMachine,
  69.                         ULONG *      pccMachine,
  70.                         char *       pwszCat,
  71.                         ULONG *      pccCat );
  72.  
  73. #ifdef UNICODE
  74. #define LocateCatalogs  LocateCatalogsW
  75. #else
  76. #define LocateCatalogs  LocateCatalogsA
  77. #endif // !UNICODE
  78.  
  79. // The Index Server Data Source Object CLSID
  80.  
  81. #define CLSID_INDEX_SERVER_DSO \
  82.     { 0xF9AE8980, 0x7E52, 0x11d0, \
  83.       { 0x89, 0x64, 0x00, 0xC0, 0x4F, 0xD6, 0x11, 0xD7 } }
  84.  
  85.  
  86. // The storage property set
  87.  
  88. #define PSGUID_STORAGE \
  89.     { 0xb725f130, 0x47ef, 0x101a, \
  90.       { 0xa5, 0xf1, 0x02, 0x60, 0x8c, 0x9e, 0xeb, 0xac } }
  91.  
  92. //#define PID_STG_DICTIONARY            ((PROPID) 0x00000000) //reserved
  93. //#define PID_STG_CODEPAGE              ((PROPID) 0x00000001) //reserved
  94. #define PID_STG_DIRECTORY               ((PROPID) 0x00000002)
  95. #define PID_STG_CLASSID                 ((PROPID) 0x00000003)
  96. #define PID_STG_STORAGETYPE             ((PROPID) 0x00000004)
  97. #define PID_STG_VOLUME_ID               ((PROPID) 0x00000005)
  98. #define PID_STG_PARENT_WORKID           ((PROPID) 0x00000006)
  99. #define PID_STG_SECONDARYSTORE          ((PROPID) 0x00000007)
  100. #define PID_STG_FILEINDEX               ((PROPID) 0x00000008)
  101. #define PID_STG_LASTCHANGEUSN           ((PROPID) 0x00000009)
  102. #define PID_STG_NAME                    ((PROPID) 0x0000000a)
  103. #define PID_STG_PATH                    ((PROPID) 0x0000000b)
  104. #define PID_STG_SIZE                    ((PROPID) 0x0000000c)
  105. #define PID_STG_ATTRIBUTES              ((PROPID) 0x0000000d)
  106. #define PID_STG_WRITETIME               ((PROPID) 0x0000000e)
  107. #define PID_STG_CREATETIME              ((PROPID) 0x0000000f)
  108. #define PID_STG_ACCESSTIME              ((PROPID) 0x00000010)
  109. #define PID_STG_CHANGETIME              ((PROPID) 0x00000011)
  110. #define PID_STG_ALLOCSIZE               ((PROPID) 0x00000012)
  111. #define PID_STG_CONTENTS                ((PROPID) 0x00000013)
  112. #define PID_STG_SHORTNAME               ((PROPID) 0x00000014)
  113. #define PID_STG_MAX                     PID_STG_SHORTNAME
  114. #define CSTORAGEPROPERTY                0x15
  115.  
  116. // File System Content Index Framework property set
  117.  
  118. #define DBPROPSET_FSCIFRMWRK_EXT \
  119.     { 0xA9BD1526, 0x6A80, 0x11D0, \
  120.       { 0x8C, 0x9D, 0x00, 0x20, 0xAF, 0x1D, 0x74, 0x0E } }
  121.  
  122. #define DBPROP_CI_CATALOG_NAME     2
  123. #define DBPROP_CI_INCLUDE_SCOPES   3
  124. #define DBPROP_CI_DEPTHS           4 // obsolete
  125. #define DBPROP_CI_SCOPE_FLAGS      4
  126. #define DBPROP_CI_EXCLUDE_SCOPES   5
  127. #define DBPROP_CI_SECURITY_ID      6
  128. #define DBPROP_CI_QUERY_TYPE       7
  129.  
  130. // Query Extension property set
  131.  
  132. #define DBPROPSET_QUERYEXT \
  133.     { 0xA7AC77ED, 0xF8D7, 0x11CE, \
  134.       { 0xA7, 0x98, 0x00, 0x20, 0xF8, 0x00, 0x80, 0x25 } }
  135.  
  136. #define DBPROP_USECONTENTINDEX           2
  137. #define DBPROP_DEFERNONINDEXEDTRIMMING   3
  138. #define DBPROP_USEEXTENDEDDBTYPES        4
  139.  
  140. // Content Index Framework Core property set
  141.  
  142. #define DBPROPSET_CIFRMWRKCORE_EXT \
  143.     { 0xafafaca5, 0xb5d1, 0x11d0, \
  144.       { 0x8c, 0x62, 0x00, 0xc0, 0x4f, 0xc2, 0xdb, 0x8d } }
  145.  
  146. #define DBPROP_MACHINE      2
  147. #define DBPROP_CLIENT_CLSID 3
  148.  
  149. // MSIDXS Rowset property set
  150.  
  151. #define DBPROPSET_MSIDXS_ROWSETEXT \
  152.     { 0xaa6ee6b0, 0xe828, 0x11d0, \
  153.       { 0xb2, 0x3e, 0x00, 0xaa, 0x00, 0x47, 0xfc, 0x01 } }
  154.  
  155. #define MSIDXSPROP_ROWSETQUERYSTATUS        2
  156. #define MSIDXSPROP_COMMAND_LOCALE_STRING    3
  157. #define MSIDXSPROP_QUERY_RESTRICTION        4
  158.  
  159. //
  160. // Query status values returned by MSIDXSPROP_ROWSETQUERYSTATUS
  161. //
  162. // Bits   Effect
  163. // -----  -----------------------------------------------------
  164. // 00-02  Fill Status: How data is being updated, if at all.
  165. // 03-15  Bitfield query reliability: How accurate the result is
  166.  
  167. #define STAT_BUSY                       ( 0 )
  168. #define STAT_ERROR                      ( 0x1 )
  169. #define STAT_DONE                       ( 0x2 )
  170. #define STAT_REFRESH                    ( 0x3 )
  171. #define QUERY_FILL_STATUS(x)            ( ( x ) & 0x7 )
  172.  
  173. #define STAT_PARTIAL_SCOPE              ( 0x8 )
  174. #define STAT_NOISE_WORDS                ( 0x10 )
  175. #define STAT_CONTENT_OUT_OF_DATE        ( 0x20 )
  176. #define STAT_REFRESH_INCOMPLETE         ( 0x40 )
  177. #define STAT_CONTENT_QUERY_INCOMPLETE   ( 0x80 )
  178. #define STAT_TIME_LIMIT_EXCEEDED        ( 0x100 )
  179. #define STAT_SHARING_VIOLATION          ( 0x200 )
  180. #define QUERY_RELIABILITY_STATUS(x)     ( ( x ) & 0xFFF8 )
  181.  
  182. // Scope flags
  183.  
  184. #define QUERY_SHALLOW        0
  185. #define QUERY_DEEP           1
  186. #define QUERY_PHYSICAL_PATH  0
  187. #define QUERY_VIRTUAL_PATH   2
  188.  
  189. // query property set (PSGUID_QUERY) properties not defined in oledb.h
  190.  
  191. #define PROPID_QUERY_WORKID        5
  192. #define PROPID_QUERY_UNFILTERED    7
  193. #define PROPID_QUERY_VIRTUALPATH   9
  194. #define PROPID_QUERY_LASTSEENTIME 10
  195.  
  196. //
  197. // Change or get the current state of a catalog specified.
  198. //
  199. #define CICAT_STOPPED     0x1
  200. #define CICAT_READONLY    0x2
  201. #define CICAT_WRITABLE    0x4
  202. #define CICAT_NO_QUERY    0x8
  203. #define CICAT_GET_STATE   0x10
  204.  
  205. STDAPI SetCatalogState ( WCHAR const * pwcsCat,
  206.                          WCHAR const * pwcsMachine,
  207.                          DWORD dwNewState,
  208.                          DWORD * pdwOldState );
  209.  
  210. //
  211. // Query catalog state
  212. //
  213.  
  214. #define CI_STATE_SHADOW_MERGE          0x0001    // Index is performing a shadow merge
  215. #define CI_STATE_MASTER_MERGE          0x0002    // Index is performing a master merge
  216. #define CI_STATE_CONTENT_SCAN_REQUIRED 0x0004    // Index is likely corrupt, and a rescan is required
  217. #define CI_STATE_ANNEALING_MERGE       0x0008    // Index is performing an annealing (optimizing) merge
  218. #define CI_STATE_SCANNING              0x0010    // Scans are in-progress
  219. #define CI_STATE_RECOVERING            0x0020    // Index metadata is being recovered
  220. #define CI_STATE_INDEX_MIGRATION_MERGE 0x0040    // Reserved for future use
  221. #define CI_STATE_LOW_MEMORY            0x0080    // Indexing is paused due to low memory availability
  222. #define CI_STATE_HIGH_IO               0x0100    // Indexing is paused due to a high rate of I/O
  223. #define CI_STATE_MASTER_MERGE_PAUSED   0x0200    // Master merge is paused
  224. #define CI_STATE_READ_ONLY             0x0400    // Indexing has been manually paused (read-only)
  225. #define CI_STATE_BATTERY_POWER         0x0800    // Indexing is paused to conserve battery life
  226. #define CI_STATE_USER_ACTIVE           0x1000    // Indexing is paused due to high user activity (keyboard/mouse)
  227. #define CI_STATE_STARTING              0x2000    // Index is still starting up
  228. #define CI_STATE_READING_USNS          0x4000    // USNs on NTFS volumes are being processed
  229.  
  230. #ifndef CI_STATE_DEFINED
  231. #define CI_STATE_DEFINED
  232. #include <pshpack4.h>
  233. typedef struct  _CI_STATE
  234.     {
  235.     DWORD cbStruct;
  236.     DWORD cWordList;
  237.     DWORD cPersistentIndex;
  238.     DWORD cQueries;
  239.     DWORD cDocuments;
  240.     DWORD cFreshTest;
  241.     DWORD dwMergeProgress;
  242.     DWORD eState;
  243.     DWORD cFilteredDocuments;
  244.     DWORD cTotalDocuments;
  245.     DWORD cPendingScans;
  246.     DWORD dwIndexSize;
  247.     DWORD cUniqueKeys;
  248.     DWORD cSecQDocuments;
  249.     DWORD dwPropCacheSize;
  250.     }   CI_STATE;
  251.  
  252. #include <poppack.h>
  253. #endif   // CI_STATE_DEFINED
  254.  
  255. STDAPI CIState( WCHAR const * pwcsCat,
  256.                 WCHAR const * pwcsMachine,
  257.                 CI_STATE *    pCiState );
  258.  
  259. #if defined __ICommand_INTERFACE_DEFINED__
  260.  
  261. //
  262. // Create an ICommand, specifying scopes, catalogs, and machines
  263. //
  264. STDAPI CIMakeICommand( ICommand **           ppCommand,
  265.                        ULONG                 cScope,
  266.                        DWORD const *         aDepths,
  267.                        WCHAR const * const * awcsScope,
  268.                        WCHAR const * const * awcsCatalogs,
  269.                        WCHAR const * const * awcsMachine );
  270.  
  271. //
  272. // Create an ICommand, specifying a catalog and machine
  273. //
  274.  
  275. STDAPI CICreateCommand( IUnknown **   ppCommand,     // New object
  276.                         IUnknown *    pUnkOuter,     // Outer unknown
  277.                         REFIID        riid,          // IID of returned object.
  278.                                                      // Must be IID_IUnknown unless pUnkOuter == 0
  279.                         WCHAR const * pwcsCatalog,   // Catalog
  280.                         WCHAR const * pwcsMachine ); // Machine
  281.  
  282.  
  283. #if defined __ICommandTree_INTERFACE_DEFINED__
  284.  
  285. typedef struct tagCIPROPERTYDEF
  286. {
  287.     LPWSTR wcsFriendlyName;
  288.     DWORD  dbType;
  289.     DBID   dbCol;
  290. } CIPROPERTYDEF;
  291.  
  292. //
  293. // Values for ulDialect in CITextToSelectTreeEx and CITextToFullTreeEx
  294. //
  295.  
  296. #define ISQLANG_V1 1 // Same as the non-Ex versions
  297. #define ISQLANG_V2 2
  298.  
  299. //
  300. // Convert pwszRestriction in Triplish to a command tree.
  301. //
  302. STDAPI CITextToSelectTree( WCHAR const *     pwszRestriction,
  303.                            DBCOMMANDTREE * * ppTree,
  304.                            ULONG             cProperties,
  305.              /*optional*/  CIPROPERTYDEF *   pProperties,
  306.                            LCID              LocaleID );
  307.  
  308. STDAPI CITextToSelectTreeEx( WCHAR const *     pwszRestriction,
  309.                              ULONG             ulDialect,
  310.                              DBCOMMANDTREE * * ppTree,
  311.                              ULONG             cProperties,
  312.                /*optional*/  CIPROPERTYDEF *   pProperties,
  313.                              LCID              LocaleID );
  314.  
  315. //
  316. // Convert pwszRestriction in Triplish, project columns, sort columns
  317. // and grouping columns to a command tree.
  318. //
  319. STDAPI CITextToFullTree( WCHAR const *     pwszRestriction,
  320.                          WCHAR const *     pwszColumns,
  321.                          WCHAR const *     pwszSortColumns, // may be NULL
  322.                          WCHAR const *     pwszGroupings,   // may be NULL
  323.                          DBCOMMANDTREE * * ppTree,
  324.                          ULONG             cProperties,
  325.            /*optional*/  CIPROPERTYDEF *   pProperties,
  326.                          LCID              LocaleID );
  327.  
  328. STDAPI CITextToFullTreeEx( WCHAR const *     pwszRestriction,
  329.                            ULONG             ulDialect,
  330.                            WCHAR const *     pwszColumns,
  331.                            WCHAR const *     pwszSortColumns, // may be NULL
  332.                            WCHAR const *     pwszGroupings,   // may be NULL
  333.                            DBCOMMANDTREE * * ppTree,
  334.                            ULONG             cProperties,
  335.              /*optional*/  CIPROPERTYDEF *   pProperties,
  336.                            LCID              LocaleID );
  337.  
  338. //
  339. // Build a simple restriction node.
  340. //
  341.  
  342. STDAPI CIBuildQueryNode( WCHAR const *wcsProperty,    // friendly property name
  343.                          DBCOMMANDOP dbOperator,    // enumerated constant
  344.                          PROPVARIANT const *pvarPropertyValue, // value of the property
  345.                          DBCOMMANDTREE ** ppTree, // ptr to tree returned here. should be non-null
  346.                          ULONG cProperties,
  347.                          CIPROPERTYDEF const * pProperty, // Can be 0.
  348.                          LCID LocaleID );  // locale id to interpret strings
  349.  
  350. //
  351. // Build a restriction tree from an existing tree (could be empty) and a newly added node/tree.
  352. //
  353.  
  354. STDAPI CIBuildQueryTree( DBCOMMANDTREE const *pExistingTree,  // existing tree. can be null.
  355.                          DBCOMMANDOP dbBoolOp,   // enumerator constant
  356.                          ULONG cSiblings, // number of siblings in the array
  357.                          DBCOMMANDTREE const * const *ppSibsToCombine,
  358.                          DBCOMMANDTREE ** ppTree);   // ptr to tree returned here. should be non-null
  359.  
  360. //
  361. // Convert restriction tree, project columns, sort columns
  362. // and grouping columns to a command tree.
  363. //
  364. STDAPI CIRestrictionToFullTree( DBCOMMANDTREE const *pTree,
  365.                          WCHAR const * pwszColumns,
  366.                          WCHAR const * pwszSortColumns, // may be NULL
  367.                          WCHAR const * pwszGroupings,   // may be NULL
  368.                          DBCOMMANDTREE * * ppTree,
  369.                          ULONG cProperties,
  370.            /*optional*/  CIPROPERTYDEF * pReserved,
  371.                          LCID LocaleID );
  372.  
  373. #endif  // __ICommandTree_INTERFACE_DEFINED__
  374. #endif  // __ICommand_INTERFACE_DEFINED__
  375.  
  376. #if defined(__cplusplus)
  377. }
  378. #endif
  379.  
  380. #pragma option pop /*P_O_Pop*/
  381. #endif // __NTQUERY_H__
  382.  
  383.