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.

80 lines
2.6 KiB

  1. // 10/12/99 scotthan created
  2. #ifndef __FILTGREP_H__
  3. #define __FILTGREP_H__
  4. #if WINNT
  5. #ifndef _USE_FILTERGREP_
  6. #define _USE_FILTERGREP_
  7. #endif//_USE_FILTERGREP_
  8. #include <filter.h> // STAT_CHUNK
  9. // CFilterGrep::Initialize() dwFlags values:
  10. #define FGIF_CASESENSITIVE 0x00000001 // grep in case-sensitive manner
  11. #define FGIF_GREPFILENAME 0x00000002 // grep filename
  12. #define FGIF_GREPCONTENT 0x00000004 // grep content
  13. #define FGIF_GREPPROPERTIES 0x00000008 // grep properties
  14. #define FGIF_BLANKETGREP (FGIF_GREPCONTENT|FGIF_GREPPROPERTIES)
  15. #ifdef __cplusplus
  16. class CGrepTokens;
  17. class CFilterGrep // filtergrep state engine
  18. {
  19. public:
  20. // Methods
  21. STDMETHODIMP Initialize(UINT nCodePage, LPCWSTR pszMatch, LPCWSTR pszExclude, DWORD dwFlags);
  22. STDMETHODIMP Grep(IShellFolder *psf, LPCITEMIDLIST pidl, LPCTSTR pszName);
  23. STDMETHODIMP Reset();
  24. // Properties
  25. STDMETHODIMP GetCodePage( UINT* pnCodePage ) const;
  26. STDMETHODIMP GetMatchTokens( OUT LPWSTR pszMatch, UINT cchMatch ) const;
  27. STDMETHODIMP GetExcludeTokens( OUT LPWSTR pszMatch, UINT cchMatch ) const;
  28. STDMETHODIMP GetFlags( DWORD* pdwFlags ) const;
  29. private:
  30. // Helpers
  31. STDMETHODIMP _GetThreadGrepBuffer( DWORD dwThreadID, ULONG cchNeed, LPWSTR* ppszBuf );
  32. STDMETHODIMP _FreeThreadGrepBuffer( DWORD dwThreadID );
  33. STDMETHODIMP_(void) _ClearGrepBuffers();
  34. STDMETHODIMP _GrepText( IFilter* pFilter, STAT_CHUNK* pstat, DWORD dwThreadID );
  35. STDMETHODIMP _GrepValue( IFilter* pFilter, STAT_CHUNK* pstat );
  36. STDMETHODIMP _GrepProperties(IPropertySetStorage *pss);
  37. STDMETHODIMP _GrepPropStg(IPropertyStorage* pstg, ULONG cspec, PROPSPEC rgspec[]);
  38. STDMETHODIMP _GrepEnumPropStg(IPropertyStorage* pstg);
  39. STDMETHODIMP_(BOOL) _IsRestrictedFileType(LPCWSTR pwszFile);
  40. void _EnterCritical() { EnterCriticalSection( &_critsec ); }
  41. void _LeaveCritical() { LeaveCriticalSection( &_critsec ); }
  42. // Data
  43. HDPA _hdpaGrepBuffers;
  44. CRITICAL_SECTION _critsec;
  45. CGrepTokens* _pTokens;
  46. DWORD _dwFlags;
  47. LPWSTR _pwszContentRestricted,
  48. _pwszPropertiesRestricted;
  49. public:
  50. // Ctor, Dtor
  51. CFilterGrep();
  52. ~CFilterGrep();
  53. };
  54. #endif //__cplusplus
  55. #define FACILITY_FILTERGREP 77 // arbitrary
  56. #define MAKE_FILTGREP_ERROR(sc) MAKE_HRESULT(SEVERITY_ERROR,FACILITY_FILTERGREP,sc)
  57. #define MAKE_FILTGREP_WARNING(sc) MAKE_HRESULT(SEVERITY_SUCCESS,FACILITY_FILTERGREP,sc)
  58. #define FG_E_NOFILTER MAKE_FILTGREP_ERROR(0x0001)
  59. #endif WINNT
  60. #endif __FILTGREP_H__