diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-27 15:33:58 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-27 15:33:58 +0000 |
commit | df77e258df8cec689a001ec92031538298661b1b (patch) | |
tree | 56ec236ca9675f049c4806e8d41986c40b537f07 /plugins/Db3x_mmap/src/dbintf.h | |
parent | 414ffc78d69f09d48fc43051e0806a30e8fb5c67 (diff) |
merge of dbtool & database plugins
git-svn-id: http://svn.miranda-ng.org/main/trunk@1213 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Db3x_mmap/src/dbintf.h')
-rw-r--r-- | plugins/Db3x_mmap/src/dbintf.h | 52 |
1 files changed, 42 insertions, 10 deletions
diff --git a/plugins/Db3x_mmap/src/dbintf.h b/plugins/Db3x_mmap/src/dbintf.h index c13bdc5eb0..f3d04d0959 100644 --- a/plugins/Db3x_mmap/src/dbintf.h +++ b/plugins/Db3x_mmap/src/dbintf.h @@ -47,6 +47,9 @@ DBHeader #define DB_THIS_VERSION 0x00000700u
#define DB_SETTINGS_RESIZE_GRANULARITY 128
+#define WSOFS_END 0xFFFFFFFF
+#define WS_ERROR 0xFFFFFFFF
+
struct DBSignature {
char name[15];
BYTE eof;
@@ -156,7 +159,7 @@ struct DBCachedContactValueList #define MAXCACHEDREADSIZE 65536
-struct CDb3Base : public MIDatabase, public MZeroedObject
+struct CDb3Base : public MIDatabase, public MIDatabaseChecker, public MZeroedObject
{
CDb3Base(const TCHAR* tszFileName);
~CDb3Base();
@@ -205,8 +208,14 @@ protected: STDMETHODIMP_(BOOL) EnumResidentSettings(DBMODULEENUMPROC pFunc, void *pParam);
protected:
+ STDMETHODIMP_(BOOL) Start(DBCHeckCallback *callback);
+ STDMETHODIMP_(BOOL) CheckDb(int phase, int firstTime);
+ STDMETHODIMP_(VOID) Destroy();
+
+protected:
virtual DWORD GetSettingsGroupOfsByModuleNameOfs(DBContact *dbc,DWORD ofsContact,DWORD ofsModuleName) = 0;
- virtual void InvalidateSettingsGroupOfsCacheEntry(DWORD ofsSettingsGroup) {}
+ virtual void InvalidateSettingsGroupOfsCacheEntry(DWORD ofsSettingsGroup) {}
+ virtual int WorkInitialCheckHeaders(void);
virtual void DBMoveChunk(DWORD ofsDest, DWORD ofsSource, int bytes) = 0;
virtual PBYTE DBRead(DWORD ofs, int bytesRequired, int *bytesAvail) = 0;
@@ -222,12 +231,12 @@ protected: virtual void DecodeDBWrite(DWORD ofs, void *src, int size);
public: // Check functions
- int WorkInitialChecks(DBCHeckCallback*, int);
- int WorkModuleChain(DBCHeckCallback*, int);
- int WorkUser(DBCHeckCallback*, int);
- int WorkContactChain(DBCHeckCallback*, int);
- int WorkAggressive(DBCHeckCallback*, int);
- int WorkFinalTasks(DBCHeckCallback*, int);
+ int WorkInitialChecks(int);
+ int WorkModuleChain(int);
+ int WorkUser(int);
+ int WorkContactChain(int);
+ int WorkAggressive(int);
+ int WorkFinalTasks(int);
protected:
TCHAR* m_tszProfileName;
@@ -242,6 +251,7 @@ public: UINT_PTR m_flushBuffersTimerId;
DWORD m_flushFailTick;
PBYTE m_pDbCache;
+ HANDLE m_hMap;
protected:
DWORD m_dwFileSize;
@@ -297,6 +307,29 @@ protected: int InitModuleNames(void);
DWORD GetModuleNameOfs(const char *szName);
char *GetModuleNameByOfs(DWORD ofs);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // checker
+
+ int PeekSegment(DWORD ofs, PVOID buf, int cbBytes);
+ int ReadSegment(DWORD ofs, PVOID buf, int cbBytes);
+ int ReadWrittenSegment(DWORD ofs, PVOID buf, int cbBytes);
+ int SignatureValid(DWORD ofs, DWORD signature);
+ void FreeModuleChain();
+
+ DWORD ConvertModuleNameOfs(DWORD ofsOld);
+ void ConvertOldEvent(DBEvent*& dbei);
+
+ int WorkSettingsChain(DWORD ofsContact, DBContact *dbc, int firstTime);
+ int WorkEventChain(DWORD ofsContact, DBContact *dbc, int firstTime);
+
+ DWORD WriteSegment(DWORD ofs, PVOID buf, int cbBytes);
+ DWORD WriteEvent(DBEvent *dbe);
+ void WriteOfsNextToPrevious(DWORD ofsPrev,DBContact *dbc,DWORD ofsNext);
+ void FinishUp(DWORD ofsLast,DBContact *dbc);
+
+ DBCHeckCallback *cb;
+ DWORD sourceFileSize, ofsAggrCur;
};
struct CDb3Mmap : public CDb3Base
@@ -315,10 +348,9 @@ protected: protected:
PBYTE m_pNull;
- HANDLE m_hMap;
void Map();
void ReMap(DWORD needed);
};
-typedef int (CDb3Mmap::*CheckWorker)(DBCHeckCallback*, int);
+typedef int (CDb3Base::*CheckWorker)(int);
|