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.

81 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 GetMatchTokens( OUT LPWSTR pszMatch, UINT cchMatch ) const;
  26. STDMETHODIMP GetExcludeTokens( OUT LPWSTR pszMatch, UINT cchMatch ) const;
  27. private:
  28. // Helpers
  29. STDMETHODIMP _GetThreadGrepBuffer( DWORD dwThreadID, ULONG cchNeed, LPWSTR* ppszBuf );
  30. STDMETHODIMP_(void) _ClearGrepBuffers();
  31. STDMETHODIMP _GrepText( IFilter* pFilter, STAT_CHUNK* pstat, DWORD dwThreadID );
  32. STDMETHODIMP _GrepValue( IFilter* pFilter, STAT_CHUNK* pstat );
  33. STDMETHODIMP _GrepProperties(IPropertySetStorage *pss);
  34. STDMETHODIMP _GrepPropStg(IPropertyStorage* pstg, ULONG cspec, PROPSPEC rgspec[]);
  35. STDMETHODIMP _GrepEnumPropStg(IPropertyStorage* pstg);
  36. STDMETHODIMP_(BOOL) _IsRestrictedFileType(LPCWSTR pwszFile);
  37. void _EnterCritical() { EnterCriticalSection( &_critsec ); }
  38. void _LeaveCritical() { LeaveCriticalSection( &_critsec ); }
  39. // Data
  40. HDPA _hdpaGrepBuffers;
  41. CRITICAL_SECTION _critsec;
  42. BOOL _fcritsec;
  43. CGrepTokens* _pTokens;
  44. DWORD _dwFlags;
  45. LPWSTR _pwszContentRestricted,
  46. _pwszPropertiesRestricted;
  47. public:
  48. // Ctor, Dtor
  49. CFilterGrep();
  50. ~CFilterGrep();
  51. STDMETHODIMP InitSelf(void);
  52. };
  53. #endif //__cplusplus
  54. #define FACILITY_FILTERGREP 77 // arbitrary
  55. #define MAKE_FILTGREP_ERROR(sc) MAKE_HRESULT(SEVERITY_ERROR,FACILITY_FILTERGREP,sc)
  56. #define MAKE_FILTGREP_WARNING(sc) MAKE_HRESULT(SEVERITY_SUCCESS,FACILITY_FILTERGREP,sc)
  57. #define FG_E_NOFILTER MAKE_FILTGREP_ERROR(0x0001)
  58. #endif WINNT
  59. #endif __FILTGREP_H__