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.

95 lines
2.8 KiB

  1. //*** CEMDBLog --
  2. //
  3. #define XXX_CACHE 1 // caching on
  4. class CEMDBLog : public IUASession
  5. {
  6. public:
  7. ULONG AddRef(void)
  8. {
  9. return InterlockedIncrement(&_cRef);
  10. }
  11. ULONG Release(void)
  12. {
  13. if (InterlockedDecrement(&_cRef))
  14. return _cRef;
  15. delete this;
  16. return 0;
  17. }
  18. //*** THISCLASS
  19. virtual HRESULT Initialize(HKEY hkey, DWORD grfMode);
  20. HRESULT SetRoot(HKEY hkey, DWORD grfMode);
  21. HRESULT ChDir(LPCTSTR pszSubKey);
  22. // fast versions, no OLESTR nonsense
  23. HRESULT QueryValueStr(LPCTSTR pszName, LPTSTR pszValue, LPDWORD pcbValue);
  24. HRESULT SetValueStr(LPCTSTR pszName, LPCTSTR pszValue);
  25. HRESULT SetValueStrEx(LPCTSTR pszName, DWORD dwType, LPCTSTR pszValue);
  26. /*virtual HRESULT Initialize(HKEY hk, DWORD grfMode);*/
  27. HRESULT QueryValue(LPCTSTR pszName, BYTE *pbData, LPDWORD pcbData);
  28. HRESULT SetValue(LPCTSTR pszName, DWORD dwType, const BYTE *pbData, DWORD cbData);
  29. HRESULT DeleteValue(LPCTSTR pszName);
  30. HRESULT RmDir(LPCTSTR pszName, BOOL fRecurse);
  31. HKEY GetHkey() { return _hkey; }
  32. // IUASession
  33. virtual void SetSession(UAQUANTUM uaq, BOOL fForce);
  34. virtual int GetSessionId();
  35. // THISCLASS
  36. HRESULT GetCount(LPCTSTR pszCmd);
  37. HRESULT IncCount(LPCTSTR pszCmd);
  38. FILETIME GetFileTime(LPCTSTR pszCmd);
  39. HRESULT SetCount(LPCTSTR pszCmd, int cCnt);
  40. HRESULT SetFileTime(LPCTSTR pszCmd, const FILETIME *pft);
  41. DWORD _SetFlags(DWORD dwMask, DWORD dwFlags);
  42. HRESULT GarbageCollect(BOOL fForce);
  43. protected:
  44. CEMDBLog();
  45. friend CEMDBLog *CEMDBLog_Create();
  46. friend void CEMDBLog_CleanUp();
  47. friend class CGCTask;
  48. // THISCLASS helpers
  49. HRESULT _GetCountWithDefault(LPCTSTR pszCmd, BOOL fDefault, CUACount *pCnt);
  50. HRESULT _GetCountRW(LPCTSTR pszCmd, BOOL fUpdate);
  51. static HRESULT s_Read(void *pvBuf, DWORD cbBuf, PNRWINFO prwi);
  52. static HRESULT s_Write(void *pvBuf, DWORD cbBuf, PNRWINFO prwi);
  53. static HRESULT s_Delete(void *pvBuf, DWORD cbBuf, PNRWINFO prwi);
  54. #if XXX_CACHE
  55. typedef enum e_cacheop { CO_READ=0, CO_WRITE=1, CO_DELETE=2, } CACHEOP;
  56. HRESULT CacheOp(CACHEOP op, void *pvBuf, DWORD cbBuf, PNRWINFO prwi);
  57. #endif
  58. TCHAR *_MayEncrypt(LPCTSTR pszSrcPlain, LPTSTR pszDstEnc, int cchDst);
  59. HRESULT IsDead(LPCTSTR pszCmd);
  60. HRESULT _GarbageCollectSlow();
  61. static FNNRW3 s_Nrw3Info;
  62. #if XXX_CACHE
  63. struct
  64. {
  65. UINT cbSize;
  66. void* pv;
  67. } _rgCache[2];
  68. #endif
  69. protected:
  70. virtual ~CEMDBLog();
  71. long _cRef;
  72. HKEY _hkey;
  73. int _grfMode; // read/write (subset of STGM_* values)
  74. BITBOOL _fNoPurge : 1; // 1:...
  75. BITBOOL _fBackup : 1; // 1:simulate delete (debug)
  76. BITBOOL _fNoEncrypt : 1; // 1:...
  77. BITBOOL _fNoDecay : 1; // 1:...
  78. private:
  79. };