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/db3x_10.vcxproj | 27 +++++++++++++++++++++++++++ plugins/Db3x/db3x_10.vcxproj.filters | 30 ++++++++++++++++++++++++++++++ plugins/Db3x/src/init.cpp | 23 ++++++++++++++++++++++- 3 files changed, 79 insertions(+), 1 deletion(-) (limited to 'plugins/Db3x') diff --git a/plugins/Db3x/db3x_10.vcxproj b/plugins/Db3x/db3x_10.vcxproj index ca0c4a5cbd..a3424d5068 100644 --- a/plugins/Db3x/db3x_10.vcxproj +++ b/plugins/Db3x/db3x_10.vcxproj @@ -206,6 +206,33 @@ + + ..\commonheaders.h + + + ..\commonheaders.h + + + ..\commonheaders.h + + + ..\commonheaders.h + + + ..\commonheaders.h + + + ..\commonheaders.h + + + ..\commonheaders.h + + + ..\commonheaders.h + + + ..\commonheaders.h + diff --git a/plugins/Db3x/db3x_10.vcxproj.filters b/plugins/Db3x/db3x_10.vcxproj.filters index a5829dde98..59595fa5ab 100644 --- a/plugins/Db3x/db3x_10.vcxproj.filters +++ b/plugins/Db3x/db3x_10.vcxproj.filters @@ -16,6 +16,9 @@ {640c5715-0e22-4240-8520-f7dedfc9fb87} + + {1603e383-8555-4ad2-b245-83442f3c44ee} + @@ -48,6 +51,33 @@ Mmap + + Mmap\Checker + + + Mmap\Checker + + + Mmap\Checker + + + Mmap\Checker + + + Mmap\Checker + + + Mmap\Checker + + + Mmap\Checker + + + Mmap\Checker + + + Mmap\Checker + 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