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
93 lines
2.7 KiB
//*** CEMDBLog --
|
|
//
|
|
#define XXX_CACHE 1 // caching on
|
|
|
|
class CEMDBLog : public IUASession
|
|
{
|
|
public:
|
|
ULONG AddRef(void)
|
|
{
|
|
return InterlockedIncrement(&_cRef);
|
|
}
|
|
|
|
ULONG Release(void)
|
|
{
|
|
ASSERT( 0 != _cRef );
|
|
ULONG cRef = InterlockedDecrement(&_cRef);
|
|
if ( 0 == cRef )
|
|
{
|
|
delete this;
|
|
}
|
|
return cRef;
|
|
}
|
|
|
|
//*** THISCLASS
|
|
virtual HRESULT Initialize(HKEY hkey, DWORD grfMode);
|
|
HRESULT SetRoot(HKEY hkey, DWORD grfMode);
|
|
HRESULT ChDir(LPCTSTR pszSubKey);
|
|
|
|
/*virtual HRESULT Initialize(HKEY hk, DWORD grfMode);*/
|
|
HRESULT QueryValue(LPCTSTR pszName, BYTE *pbData, LPDWORD pcbData);
|
|
HRESULT SetValue(LPCTSTR pszName, DWORD dwType, const BYTE *pbData, DWORD cbData);
|
|
HRESULT DeleteValue(LPCTSTR pszName);
|
|
HRESULT RmDir(LPCTSTR pszName, BOOL fRecurse);
|
|
|
|
HKEY GetHkey() { return _hkey; }
|
|
|
|
// IUASession
|
|
virtual void SetSession(UAQUANTUM uaq, BOOL fForce);
|
|
virtual int GetSessionId();
|
|
|
|
// THISCLASS
|
|
HRESULT GetCount(LPCTSTR pszCmd);
|
|
HRESULT IncCount(LPCTSTR pszCmd);
|
|
FILETIME GetFileTime(LPCTSTR pszCmd);
|
|
HRESULT SetCount(LPCTSTR pszCmd, int cCnt);
|
|
HRESULT SetFileTime(LPCTSTR pszCmd, const FILETIME *pft);
|
|
DWORD _SetFlags(DWORD dwMask, DWORD dwFlags);
|
|
HRESULT GarbageCollect(BOOL fForce);
|
|
|
|
|
|
protected:
|
|
CEMDBLog();
|
|
friend CEMDBLog *CEMDBLog_Create();
|
|
friend void CEMDBLog_CleanUp();
|
|
friend class CGCTask;
|
|
|
|
// THISCLASS helpers
|
|
HRESULT _GetCountWithDefault(LPCTSTR pszCmd, BOOL fDefault, CUACount *pCnt);
|
|
HRESULT _GetCountRW(LPCTSTR pszCmd, BOOL fUpdate);
|
|
static HRESULT s_Read(void *pvBuf, DWORD cbBuf, PNRWINFO prwi);
|
|
static HRESULT s_Write(void *pvBuf, DWORD cbBuf, PNRWINFO prwi);
|
|
static HRESULT s_Delete(void *pvBuf, DWORD cbBuf, PNRWINFO prwi);
|
|
#if XXX_CACHE
|
|
typedef enum e_cacheop { CO_READ=0, CO_WRITE=1, CO_DELETE=2, } CACHEOP;
|
|
HRESULT CacheOp(CACHEOP op, void *pvBuf, DWORD cbBuf, PNRWINFO prwi);
|
|
#endif
|
|
TCHAR *_MayEncrypt(LPCTSTR pszSrcPlain, LPTSTR pszDstEnc, int cchDst);
|
|
HRESULT IsDead(LPCTSTR pszCmd);
|
|
HRESULT _GarbageCollectSlow();
|
|
|
|
static FNNRW3 s_Nrw3Info;
|
|
#if XXX_CACHE
|
|
struct
|
|
{
|
|
UINT cbSize;
|
|
void* pv;
|
|
} _rgCache[2];
|
|
#endif
|
|
protected:
|
|
virtual ~CEMDBLog();
|
|
|
|
long _cRef;
|
|
HKEY _hkey;
|
|
int _grfMode; // read/write (subset of STGM_* values)
|
|
|
|
|
|
BITBOOL _fNoPurge : 1; // 1:...
|
|
BITBOOL _fBackup : 1; // 1:simulate delete (debug)
|
|
BITBOOL _fNoEncrypt : 1; // 1:...
|
|
BITBOOL _fNoDecay : 1; // 1:...
|
|
|
|
private:
|
|
};
|