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.

172 lines
4.8 KiB

  1. #ifndef DATACLEN_H
  2. #define DATACLEN_H
  3. #include "common.h"
  4. class CCleanerClassFactory : public IClassFactory
  5. {
  6. private:
  7. ULONG _cRef; // Reference count
  8. DWORD _dwID; // what type of class factory are we?
  9. ~CCleanerClassFactory();
  10. public:
  11. CCleanerClassFactory(DWORD);
  12. // IUnknown
  13. STDMETHODIMP QueryInterface(REFIID, void **);
  14. STDMETHODIMP_(ULONG) AddRef(void);
  15. STDMETHODIMP_(ULONG) Release(void);
  16. // IClassFactory
  17. STDMETHODIMP CreateInstance(IUnknown *, REFIID, void **);
  18. STDMETHODIMP LockServer(BOOL);
  19. };
  20. // This is the actual Data Driven Cleaner Class
  21. class CDataDrivenCleaner : public IEmptyVolumeCache
  22. {
  23. private:
  24. ULONG _cRef; // reference count
  25. ULARGE_INTEGER _cbSpaceUsed;
  26. ULARGE_INTEGER _cbSpaceFreed;
  27. FILETIME _ftMinLastAccessTime;
  28. TCHAR _szVolume[MAX_PATH];
  29. TCHAR _szFolder[MAX_PATH];
  30. DWORD _dwFlags;
  31. TCHAR _filelist[MAX_PATH];
  32. TCHAR _szCleanupCmdLine[MAX_PATH];
  33. BOOL _bPurged; // TRUE if Purge() method was run
  34. PCLEANFILESTRUCT _head; // head of the linked list of files
  35. BOOL WalkForUsedSpace(LPCTSTR lpPath, IEmptyVolumeCacheCallBack *picb);
  36. BOOL WalkAllFiles(LPCTSTR lpPath, IEmptyVolumeCacheCallBack *picb);
  37. BOOL AddFileToList(LPCTSTR lpFile, ULARGE_INTEGER filesize, BOOL bDirectory);
  38. void PurgeFiles(IEmptyVolumeCacheCallBack *picb, BOOL bDoDirectories);
  39. void FreeList(PCLEANFILESTRUCT pCleanFile);
  40. BOOL LastAccessisOK(FILETIME ftFileLastAccess);
  41. ~CDataDrivenCleaner(void);
  42. public:
  43. CDataDrivenCleaner(void);
  44. // IUnknown
  45. STDMETHODIMP QueryInterface(REFIID, void **);
  46. STDMETHODIMP_(ULONG) AddRef(void);
  47. STDMETHODIMP_(ULONG) Release(void);
  48. // IEmptyVolumeCache
  49. STDMETHODIMP Initialize(
  50. HKEY hRegKey,
  51. LPCWSTR pszVolume,
  52. LPWSTR *ppszDisplayName,
  53. LPWSTR *ppszDescription,
  54. DWORD *pdwFlags
  55. );
  56. STDMETHODIMP GetSpaceUsed(
  57. DWORDLONG *pdwSpaceUsed,
  58. IEmptyVolumeCacheCallBack *picb
  59. );
  60. STDMETHODIMP Purge(
  61. DWORDLONG dwSpaceToFree,
  62. IEmptyVolumeCacheCallBack *picb
  63. );
  64. STDMETHODIMP ShowProperties(
  65. HWND hwnd
  66. );
  67. STDMETHODIMP Deactivate(
  68. DWORD *pdwFlags
  69. );
  70. };
  71. /*
  72. **------------------------------------------------------------------------------
  73. ** Class: CDataDrivenPropBag
  74. ** Purpose: This is the property bag used to allow string localization for the
  75. ** default data cleaner. This class implements multiple GUIDs each of
  76. ** which will return different values for the three valid properties.
  77. ** Notes:
  78. ** Mod Log: Created by ToddB (9/98)
  79. **------------------------------------------------------------------------------
  80. */
  81. class CDataDrivenPropBag : public IPropertyBag
  82. {
  83. private:
  84. ULONG _cRef; // reference count
  85. // We use this object for several different property bags. Based on the CLSID used
  86. // to create this object we set the value of _dwFilter to a known value so that we
  87. // know which property bag we are.
  88. DWORD _dwFilter;
  89. ~CDataDrivenPropBag(void);
  90. public:
  91. CDataDrivenPropBag (DWORD);
  92. // IUnknown
  93. STDMETHODIMP QueryInterface(REFIID, void **);
  94. STDMETHODIMP_(ULONG) AddRef(void);
  95. STDMETHODIMP_(ULONG) Release(void);
  96. // IPropertyBag
  97. STDMETHODIMP Read(LPCOLESTR, VARIANT *, IErrorLog *);
  98. STDMETHODIMP Write(LPCOLESTR, VARIANT *);
  99. };
  100. class CContentIndexCleaner : public IEmptyVolumeCache
  101. {
  102. private:
  103. IEmptyVolumeCache * _pDataDriven;
  104. LONG _cRef;
  105. ~CContentIndexCleaner(void);
  106. public:
  107. CContentIndexCleaner(void);
  108. // IUnknown
  109. STDMETHODIMP QueryInterface(REFIID, void **);
  110. STDMETHODIMP_(ULONG) AddRef(void);
  111. STDMETHODIMP_(ULONG) Release(void);
  112. // IEmptyVolumeCache
  113. STDMETHODIMP Initialize(
  114. HKEY hRegKey,
  115. LPCWSTR pszVolume,
  116. LPWSTR *ppszDisplayName,
  117. LPWSTR *ppszDescription,
  118. DWORD *pdwFlags
  119. );
  120. STDMETHODIMP GetSpaceUsed(
  121. DWORDLONG *pdwSpaceUsed,
  122. IEmptyVolumeCacheCallBack *picb
  123. );
  124. STDMETHODIMP Purge(
  125. DWORDLONG dwSpaceToFree,
  126. IEmptyVolumeCacheCallBack *picb
  127. );
  128. STDMETHODIMP ShowProperties(
  129. HWND hwnd
  130. );
  131. STDMETHODIMP Deactivate(
  132. DWORD *pdwFlags
  133. );
  134. };
  135. #endif // DATACLEN_H