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.

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