diff options
-rw-r--r-- | include/m_db_int.h | 26 | ||||
-rw-r--r-- | plugins/DbChecker/dbchecker_10.vcxproj | 2 | ||||
-rw-r--r-- | plugins/DbChecker/dbchecker_10.vcxproj.filters | 6 | ||||
-rw-r--r-- | plugins/DbChecker/res/version.rc | 41 | ||||
-rw-r--r-- | plugins/DbChecker/src/cleaning.cpp | 11 | ||||
-rw-r--r-- | plugins/DbChecker/src/dbchecker.h | 19 | ||||
-rw-r--r-- | plugins/DbChecker/src/fileaccess.cpp | 17 | ||||
-rw-r--r-- | plugins/DbChecker/src/main.cpp | 65 | ||||
-rw-r--r-- | plugins/DbChecker/src/openerror.cpp | 8 | ||||
-rw-r--r-- | plugins/DbChecker/src/progress.cpp | 8 | ||||
-rw-r--r-- | plugins/DbChecker/src/selectdb.cpp | 55 | ||||
-rw-r--r-- | plugins/DbChecker/src/version.h | 9 | ||||
-rw-r--r-- | plugins/DbChecker/src/wizard.cpp | 10 | ||||
-rw-r--r-- | plugins/DbChecker/src/worker.cpp | 12 |
14 files changed, 178 insertions, 111 deletions
diff --git a/include/m_db_int.h b/include/m_db_int.h index aadc882b84..9047736ea8 100644 --- a/include/m_db_int.h +++ b/include/m_db_int.h @@ -28,6 +28,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_core.h>
#endif
+///////////////////////////////////////////////////////////////////////////////
+// basic database interface
+
interface MIDatabase
{
STDMETHOD_(void,SetCacheSafetyMode)(BOOL) PURE;
@@ -67,17 +70,25 @@ interface MIDatabase };
///////////////////////////////////////////////////////////////////////////////
-// Each database plugin should register itself using this structure
+// basic database checker interface
struct DBCHeckCallback
{
int cbSize;
- MIDatabase* db;
DWORD spaceProcessed, spaceUsed;
void (*pfnAddLogMessage)(int type, const TCHAR* ptszFormat, ...);
};
+interface MIDatabaseChecker
+{
+ STDMETHOD_(BOOL,CheckDb)(DBCHeckCallback *callback, int phase, int firstTime) PURE;
+ STDMETHOD_(VOID,Destroy)() PURE;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// Each database plugin should register itself using this structure
+
struct DATABASELINK
{
int cbSize;
@@ -102,10 +113,10 @@ struct DATABASELINK etc.
Returns: 0 on success, non zero on failure
*/
- int (*grokHeader)(const TCHAR *profile, int * error);
+ int (*grokHeader)(const TCHAR *profile, int *error);
/*
- Affect: Tell the database to create all services/hooks that a 3.xx legecy database might support into link,
+ Affect: Tell the database to create all services/hooks that a 3.xx legacy database might support into link,
which is a PLUGINLINK structure
Returns: 0 on success, nonzero on failure
*/
@@ -119,11 +130,10 @@ struct DATABASELINK int (*Unload)(MIDatabase*);
/*
- Affect: performs one of the database check steps.
- Returns: If there're no more steps to execute, returns ERROR_NO_MORE_ITEMS, or ERROR_SUCCESS, or the error code.
- Warning: this code is never executed in the main thread.
+ Returns a pointer to the database checker or NULL if a database doesn't support checking
+ Note: Unload() might be called even if Load(void) was never called, wasLoaded is set to 1 if Load(void) was ever called.
*/
- int (*CheckDb)(DBCHeckCallback *callback, int phase, int firstTime);
+ MIDatabaseChecker* (*CheckDB) (const TCHAR *profile, int *error);
};
///////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/DbChecker/dbchecker_10.vcxproj b/plugins/DbChecker/dbchecker_10.vcxproj index e81afbb368..c1b2d4fbf9 100644 --- a/plugins/DbChecker/dbchecker_10.vcxproj +++ b/plugins/DbChecker/dbchecker_10.vcxproj @@ -188,7 +188,6 @@ <ClCompile Include="src\main.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
- <ClCompile Include="src\utf.cpp" />
<ClCompile Include="src\wizard.cpp" />
<ClCompile Include="src\worker.cpp" />
<ClCompile Include="src\cleaning.cpp" />
@@ -201,6 +200,7 @@ </ItemGroup>
<ItemGroup>
<ClInclude Include="src\dbchecker.h" />
+ <ClInclude Include="src\version.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\resource.rc" />
diff --git a/plugins/DbChecker/dbchecker_10.vcxproj.filters b/plugins/DbChecker/dbchecker_10.vcxproj.filters index 0bf3b22913..e421e1eff8 100644 --- a/plugins/DbChecker/dbchecker_10.vcxproj.filters +++ b/plugins/DbChecker/dbchecker_10.vcxproj.filters @@ -21,9 +21,6 @@ <ClCompile Include="src\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\utf.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\worker.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -56,6 +53,9 @@ <ClInclude Include="src\dbchecker.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="src\version.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\resource.rc">
diff --git a/plugins/DbChecker/res/version.rc b/plugins/DbChecker/res/version.rc index 93ddb70b68..c20e13c88f 100644 --- a/plugins/DbChecker/res/version.rc +++ b/plugins/DbChecker/res/version.rc @@ -4,56 +4,41 @@ #error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
-#include "..\src\resource.h"
+#include "afxres.h"
#include "..\src\version.h"
-#include "winres.h"
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page( 1252)
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#endif //_WIN32
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
VS_VERSION_INFO VERSIONINFO
FILEVERSION __FILEVERSION_STRING
PRODUCTVERSION __FILEVERSION_STRING
- FILEFLAGSMASK 0x3fL
+ FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
- FILEOS 0x40004L
- FILETYPE 0x2L
+ FILEOS 0x4L
+ FILETYPE 0x0L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
- BLOCK "040904b0"
+ BLOCK "000004b0"
BEGIN
VALUE "CompanyName", "Miranda NG project"
- VALUE "FileDescription", "Miranda NG Database Checker"
+ VALUE "FileDescription", __DESCRIPTION
VALUE "FileVersion", __FILEVERSION_STRING
- VALUE "InternalName", "dbchecker"
- VALUE "LegalCopyright", "Copyright (C) 2012, George Hazan"
- VALUE "LegalTrademarks", "Licensed under the Gnu General Public License V2 or any later version"
- VALUE "OriginalFilename", "dbchecker.dll"
- VALUE "ProductName", "Miranda NG Database Checker"
- VALUE "ProductVersion", __FILEVERSION_STRING
- END
+ VALUE "InternalName", __PLUGIN_NAME
+ VALUE "LegalCopyright", __COPYRIGHT
+ VALUE "OriginalFilename", __FILENAME
+ VALUE "ProductName", __PLUGIN_NAME
+ END
END
BLOCK "VarFileInfo"
BEGIN
- VALUE "Translation", 0x409, 1200
+ VALUE "Translation", 0x0, 1200
END
END
-
-#endif // AFX_RESOURCE_DLL
diff --git a/plugins/DbChecker/src/cleaning.cpp b/plugins/DbChecker/src/cleaning.cpp index 4ecd2772fb..bd8f296afb 100644 --- a/plugins/DbChecker/src/cleaning.cpp +++ b/plugins/DbChecker/src/cleaning.cpp @@ -49,16 +49,7 @@ INT_PTR CALLBACK CleaningDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM break;
case IDOK:
- if (!opts.hFile) {
- opts.hFile = CreateFile(opts.filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
- if (opts.hFile == INVALID_HANDLE_VALUE) {
- opts.hFile = NULL;
- opts.error = GetLastError();
- SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_OPENERROR, (LPARAM)OpenErrorDlgProc);
- break;
- }
- }
- SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_PROGRESS, (LPARAM)ProgressDlgProc);
+ OpenDatabase(hdlg, IDD_PROGRESS);
break;
}
break;
diff --git a/plugins/DbChecker/src/dbchecker.h b/plugins/DbChecker/src/dbchecker.h index 39d64cb089..d333f51b02 100644 --- a/plugins/DbChecker/src/dbchecker.h +++ b/plugins/DbChecker/src/dbchecker.h @@ -33,8 +33,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <commctrl.h>
#include <time.h>
+#include <m_system.h>
+#include <m_system_cpp.h>
+#include <newpluginapi.h>
#include <m_database.h>
#include <m_db_int.h>
+#include <m_langpack.h>
#include "resource.h"
@@ -45,15 +49,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define WZN_PAGECHANGING (WM_USER+1221)
#define WZN_CANCELCLICKED (WM_USER+1222)
-struct DbToolOptions {
+struct DbToolOptions
+{
TCHAR filename[MAX_PATH];
TCHAR workingFilename[MAX_PATH];
TCHAR outputFilename[MAX_PATH];
TCHAR backupFilename[MAX_PATH];
- HANDLE hFile;
+ DATABASELINK *dblink;
+ MIDatabaseChecker* dbChecker;
HANDLE hOutFile;
- HANDLE hMap;
- BYTE *pFile;
DWORD error;
int bCheckOnly, bBackup, bAggressive;
int bEraseHistory, bMarkRead, bConvertUtf;
@@ -63,6 +67,7 @@ extern HINSTANCE hInst; extern DbToolOptions opts;
extern HANDLE hEventRun, hEventAbort;
extern int errorCount;
+extern bool bServiceMode;
int DoMyControlProcessing(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam, INT_PTR *bReturn);
@@ -75,11 +80,7 @@ INT_PTR CALLBACK FinishedDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM INT_PTR CALLBACK WelcomeDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK OpenErrorDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam);
-struct DBSignature {
- char name[15];
- BYTE eof;
-};
-static struct DBSignature dbSignature = {"Miranda ICQ DB", 0x1A};
+void OpenDatabase(HWND hdlg, INT iNextPage);
#define SIZEOF(X) (sizeof(X)/sizeof(X[0]))
diff --git a/plugins/DbChecker/src/fileaccess.cpp b/plugins/DbChecker/src/fileaccess.cpp index f9b6e2d656..ef19a1244f 100644 --- a/plugins/DbChecker/src/fileaccess.cpp +++ b/plugins/DbChecker/src/fileaccess.cpp @@ -47,19 +47,10 @@ INT_PTR CALLBACK FileAccessDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARA break;
case IDOK:
- if (opts.bCheckOnly) {
- if (!opts.hFile) {
- opts.hFile = CreateFile(opts.filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
- if (opts.hFile == INVALID_HANDLE_VALUE) {
- opts.hFile = NULL;
- opts.error = GetLastError();
- SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_OPENERROR, (LPARAM)OpenErrorDlgProc);
- break;
- }
- }
- SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_PROGRESS, (LPARAM)ProgressDlgProc);
- }
- else SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_CLEANING, (LPARAM)CleaningDlgProc);
+ if (opts.bCheckOnly)
+ OpenDatabase(hdlg, IDD_PROGRESS);
+ else
+ SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_CLEANING, (LPARAM)CleaningDlgProc);
break;
case IDC_CHECKONLY:
diff --git a/plugins/DbChecker/src/main.cpp b/plugins/DbChecker/src/main.cpp index f59f66a13a..209bef8a70 100644 --- a/plugins/DbChecker/src/main.cpp +++ b/plugins/DbChecker/src/main.cpp @@ -18,9 +18,74 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "dbchecker.h"
+#include "version.h"
HINSTANCE hInst;
int hLangpack = 0;
+bool bServiceMode = false;
+
+static HANDLE hLaunchFunc;
DbToolOptions opts = {0};
+PLUGININFOEX pluginInfoEx =
+{
+ sizeof(pluginInfoEx),
+ __PLUGIN_NAME,
+ __VERSION_DWORD,
+ __DESCRIPTION,
+ __AUTHOR,
+ __AUTHOREMAIL,
+ __COPYRIGHT,
+ __AUTHORWEB,
+ UNICODE_AWARE,
+ // {A0138FC6-4C52-4501-AF93-7D3E20BCAE5B}
+ { 0xa0138fc6, 0x4c52, 0x4501, { 0xaf, 0x93, 0x7d, 0x3e, 0x20, 0xbc, 0xae, 0x5b}}
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
+{
+ hInst=hinstDLL;
+ return TRUE;
+}
+
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+{
+ return &pluginInfoEx;
+}
+
+// we implement service mode interface
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_SERVICEMODE, MIID_LAST};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static INT_PTR ServiceMode(WPARAM, LPARAM)
+{
+ bServiceMode = true;
+ return SERVICE_MONOPOLY; // unload db and open a wizard
+}
+
+static int OnModulesLoaded(WPARAM, LPARAM)
+{
+ if (bServiceMode)
+ DialogBox(hInst, MAKEINTRESOURCE(IDD_WIZARD), NULL, WizardDlgProc);
+ return 0;
+}
+
+extern "C" __declspec(dllexport) int Load(void)
+{
+ mir_getLP(&pluginInfoEx);
+
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+
+ hLaunchFunc = CreateServiceFunction(MS_SERVICEMODE_LAUNCH, ServiceMode);
+ return 0;
+}
+
+extern "C" __declspec(dllexport) int Unload(void)
+{
+ DestroyServiceFunction(hLaunchFunc);
+ return 0;
+}
diff --git a/plugins/DbChecker/src/openerror.cpp b/plugins/DbChecker/src/openerror.cpp index f86ba163cb..0ae07ed2c4 100644 --- a/plugins/DbChecker/src/openerror.cpp +++ b/plugins/DbChecker/src/openerror.cpp @@ -43,13 +43,7 @@ INT_PTR CALLBACK OpenErrorDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM break;
case IDOK:
- opts.hFile = CreateFile(opts.filename, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
- if (opts.hFile == INVALID_HANDLE_VALUE) {
- opts.hFile = NULL;
- opts.error = GetLastError();
- SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_OPENERROR, (LPARAM)OpenErrorDlgProc);
- }
- else SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_FILEACCESS, (LPARAM)FileAccessDlgProc);
+ OpenDatabase(hdlg, IDD_FILEACCESS);
break;
}
break;
diff --git a/plugins/DbChecker/src/progress.cpp b/plugins/DbChecker/src/progress.cpp index 5465fee8fa..4fe976f61f 100644 --- a/plugins/DbChecker/src/progress.cpp +++ b/plugins/DbChecker/src/progress.cpp @@ -55,14 +55,6 @@ void SetProgressBar(int perThou) void ProcessingDone(void)
{
- if (opts.pFile) {
- UnmapViewOfFile(opts.pFile);
- opts.pFile = NULL;
- }
- if (opts.hMap) {
- CloseHandle(opts.hMap);
- opts.hMap = NULL;
- }
SendMessage(hdlgProgress, WM_PROCESSINGDONE, 0, 0);
}
diff --git a/plugins/DbChecker/src/selectdb.cpp b/plugins/DbChecker/src/selectdb.cpp index 0b61d5c5b6..c1a6e75e90 100644 --- a/plugins/DbChecker/src/selectdb.cpp +++ b/plugins/DbChecker/src/selectdb.cpp @@ -18,6 +18,43 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "dbchecker.h"
+void OpenDatabase(HWND hdlg, INT iNextPage)
+{
+ TCHAR tszMsg[1024];
+
+ if (opts.dbChecker == NULL) {
+ DATABASELINK* dblink = FindDatabasePlugin(opts.filename);
+ if (dblink == NULL) {
+ mir_sntprintf(tszMsg, SIZEOF(tszMsg),
+ TranslateT("Database Checker cannot find a suitable database plugin to open '%s'."),
+ opts.filename);
+LBL_Error:
+ MessageBox(hdlg, tszMsg, TranslateT("Error"), MB_OK | MB_ICONERROR);
+ return;
+ }
+
+ if (dblink->CheckDB == NULL) {
+ mir_sntprintf(tszMsg, SIZEOF(tszMsg),
+ TranslateT("Database driver '%s' doesn't support checking."),
+ TranslateTS(dblink->szFullName));
+ goto LBL_Error;
+ }
+
+ int error = 0;
+ opts.dbChecker = opts.dblink->CheckDB(opts.filename, &error);
+ if (opts.dbChecker == NULL) {
+ opts.error = error;
+ SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_OPENERROR, (LPARAM)OpenErrorDlgProc);
+ return;
+ }
+ }
+
+ if (iNextPage == IDD_FILEACCESS)
+ SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_FILEACCESS, (LPARAM)FileAccessDlgProc);
+ else
+ SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_PROGRESS, (LPARAM)ProgressDlgProc);
+}
+
void GetProfileDirectory(TCHAR* szMirandaDir, TCHAR* szPath, int cbPath)
{
TCHAR szProfileDir[MAX_PATH], szExpandedProfileDir[MAX_PATH], szMirandaBootIni[MAX_PATH];
@@ -175,7 +212,7 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM FindAdd(hdlg, szMirandaProfiles, _T("[prf]\\"));
// search in current dir (as DBTOOL)
- FindAdd(hdlg, szMirandaPath, _T("[ . ]\\"));
+ FindAdd(hdlg, szMirandaPath, _T("[.]\\"));
// search in profile dir (using registry path + ini file)
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\miranda32.exe"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) {
@@ -194,9 +231,10 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM i = 0;
ListView_SetItemState(GetDlgItem(hdlg, IDC_DBLIST), i, LVIS_SELECTED, LVIS_SELECTED);
}
- if (opts.hFile != NULL && opts.hFile != INVALID_HANDLE_VALUE) {
- CloseHandle(opts.hFile);
- opts.hFile = NULL;
+
+ if (opts.dbChecker != NULL) {
+ opts.dbChecker->Destroy();
+ opts.dbChecker = NULL;
}
return TRUE;
@@ -251,16 +289,11 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM break;
case IDOK:
- opts.hFile = CreateFile(opts.filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
- if (opts.hFile == INVALID_HANDLE_VALUE) {
- opts.hFile = NULL;
- opts.error = GetLastError();
- SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_OPENERROR, (LPARAM)OpenErrorDlgProc);
- }
- else SendMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_FILEACCESS, (LPARAM)FileAccessDlgProc);
+ OpenDatabase(hdlg, IDD_FILEACCESS);
break;
}
break;
+
case WM_NOTIFY:
switch(((LPNMHDR)lParam)->idFrom) {
case IDC_DBLIST:
diff --git a/plugins/DbChecker/src/version.h b/plugins/DbChecker/src/version.h index 58f9cf348c..690140005a 100644 --- a/plugins/DbChecker/src/version.h +++ b/plugins/DbChecker/src/version.h @@ -3,3 +3,12 @@ #define __FILEVERSION_STRING MIRANDA_VERSION_FILEVERSION
#define __VERSION_STRING MIRANDA_VERSION_STRING
#define __VERSION_DWORD MIRANDA_VERSION_DWORD
+
+#define __PLUGIN_NAME "Database Checker"
+#define __INTERNAL_NAME "dbchecker"
+#define __FILENAME "dbchecker.dll"
+#define __DESCRIPTION "Miranda NG Database Checker"
+#define __AUTHOR "George Hazan"
+#define __AUTHOREMAIL "ghazan@miranda-ng.org"
+#define __AUTHORWEB "http://www.miranda-ng.org/"
+#define __COPYRIGHT "© 2012, George Hazan"
diff --git a/plugins/DbChecker/src/wizard.cpp b/plugins/DbChecker/src/wizard.cpp index dd10b614ac..835bb9d563 100644 --- a/plugins/DbChecker/src/wizard.cpp +++ b/plugins/DbChecker/src/wizard.cpp @@ -128,13 +128,19 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP break;
case WM_DESTROY:
- if (opts.hFile)
- CloseHandle(opts.hFile);
+ if (opts.dbChecker) {
+ opts.dbChecker->Destroy();
+ opts.dbChecker = NULL;
+ }
+
if (opts.hOutFile)
CloseHandle(opts.hOutFile);
+
DestroyWindow(hdlgPage);
if (hBoldFont != NULL) DeleteObject(hBoldFont);
if (hEmfHeaderLogo != NULL) DeleteEnhMetaFile(hEmfHeaderLogo);
+ if (bServiceMode)
+ PostQuitMessage(0);
break;
}
return FALSE;
diff --git a/plugins/DbChecker/src/worker.cpp b/plugins/DbChecker/src/worker.cpp index 834a40f308..9fa3e7aa2b 100644 --- a/plugins/DbChecker/src/worker.cpp +++ b/plugins/DbChecker/src/worker.cpp @@ -20,14 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "dbchecker.h"
void ProcessingDone(void);
-int WorkInitialChecks(int firstTime);
-int WorkModuleChain(int firstTime);
-int WorkUser(int firstTime);
-int WorkContactChain(int firstTime);
-int WorkAggressive(int firstTime);
-int WorkFinalTasks(int firstTime);
-
-DATABASELINK* dblink;
void __cdecl WorkerThread(void *unused)
{
@@ -35,14 +27,12 @@ void __cdecl WorkerThread(void *unused) time_t ts = time(NULL);
AddToStatus(STATUS_MESSAGE, TranslateT("Database worker thread activated"));
- SetFilePointer(opts.hFile, 0, NULL, FILE_BEGIN);
DWORD sp = 0;
firstTime = 0;
DBCHeckCallback callback;
callback.cbSize = sizeof(callback);
- callback.db = NULL;
callback.spaceUsed = 1;
callback.spaceProcessed = 0;
callback.pfnAddLogMessage = AddToStatus;
@@ -58,7 +48,7 @@ void __cdecl WorkerThread(void *unused) break;
}
- int ret = dblink->CheckDb(&callback, task, firstTime);
+ int ret = opts.dbChecker->CheckDb(&callback, task, firstTime);
firstTime = 0;
if (ret == ERROR_NO_MORE_ITEMS) {
AddToStatus(STATUS_MESSAGE, TranslateT("Elapsed time: %d sec"), time(NULL)-ts);
|