From df77e258df8cec689a001ec92031538298661b1b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 27 Jul 2012 15:33:58 +0000 Subject: merge of dbtool & database plugins git-svn-id: http://svn.miranda-ng.org/main/trunk@1213 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Db3x/src/init.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'plugins/Db3x/src/init.cpp') diff --git a/plugins/Db3x/src/init.cpp b/plugins/Db3x/src/init.cpp index 406db891a6..6f021aa283 100644 --- a/plugins/Db3x/src/init.cpp +++ b/plugins/Db3x/src/init.cpp @@ -121,6 +121,26 @@ static int UnloadDatabase(MIDatabase* db) return 0; } +MIDatabaseChecker* CheckDb(const TCHAR* ptszFileName, int *error) +{ + CDb3x *tmp = new CDb3x(ptszFileName); + if (tmp->Load(true) != ERROR_SUCCESS) { + delete tmp; + if (error != NULL) *error = EGROKPRF_CANTREAD; + return NULL; + } + + int chk = tmp->CheckDbHeaders(); + if (chk != ERROR_SUCCESS) { + delete tmp; + *error = chk; + return NULL; + } + + *error = 0; + return tmp; +} + static DATABASELINK dblink = { sizeof(DATABASELINK), @@ -129,7 +149,8 @@ static DATABASELINK dblink = makeDatabase, grokHeader, LoadDatabase, - UnloadDatabase + UnloadDatabase, + CheckDb }; ///////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3