summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-12-01 21:51:12 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-12-01 21:51:12 +0000
commitbe0ea932723003e4319500883aa7ef2abba38c4b (patch)
treec0eee66c79f8aaf0e3b97f0ec803828b1e0afd68
parentf0dd963ab37b2ff412b4b1e0b9459d61d42ab9d4 (diff)
first lines of password UI code
git-svn-id: http://svn.miranda-ng.org/main/trunk@7028 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Db3x_mmap/db3x_mmap_10.vcxproj1
-rw-r--r--plugins/Db3x_mmap/db3x_mmap_10.vcxproj.filters3
-rw-r--r--plugins/Db3x_mmap/db3x_mmap_11.vcxproj1
-rw-r--r--plugins/Db3x_mmap/db3x_mmap_11.vcxproj.filters3
-rw-r--r--plugins/Db3x_mmap/db3x_mmap_12.vcxproj1
-rw-r--r--plugins/Db3x_mmap/db3x_mmap_12.vcxproj.filters3
-rw-r--r--plugins/Db3x_mmap/res/db3x_mmap.rc25
-rw-r--r--plugins/Db3x_mmap/res/logo.icobin0 -> 5430 bytes
-rw-r--r--plugins/Db3x_mmap/src/commonheaders.h3
-rw-r--r--plugins/Db3x_mmap/src/dbcrypt.cpp31
-rw-r--r--plugins/Db3x_mmap/src/dbintf.h5
-rw-r--r--plugins/Db3x_mmap/src/dbsettings.cpp4
-rw-r--r--plugins/Db3x_mmap/src/resource.h13
-rw-r--r--plugins/Db3x_mmap/src/ui.cpp170
14 files changed, 242 insertions, 21 deletions
diff --git a/plugins/Db3x_mmap/db3x_mmap_10.vcxproj b/plugins/Db3x_mmap/db3x_mmap_10.vcxproj
index e7d51c37b5..bbe32cb4b8 100644
--- a/plugins/Db3x_mmap/db3x_mmap_10.vcxproj
+++ b/plugins/Db3x_mmap/db3x_mmap_10.vcxproj
@@ -232,6 +232,7 @@
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="src\init.cpp" />
+ <ClCompile Include="src\ui.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\commonheaders.h" />
diff --git a/plugins/Db3x_mmap/db3x_mmap_10.vcxproj.filters b/plugins/Db3x_mmap/db3x_mmap_10.vcxproj.filters
index d4e3c10739..dde8eca53c 100644
--- a/plugins/Db3x_mmap/db3x_mmap_10.vcxproj.filters
+++ b/plugins/Db3x_mmap/db3x_mmap_10.vcxproj.filters
@@ -81,6 +81,9 @@
<ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\ui.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\commonheaders.h">
diff --git a/plugins/Db3x_mmap/db3x_mmap_11.vcxproj b/plugins/Db3x_mmap/db3x_mmap_11.vcxproj
index f2ba160fb7..270c7f54f4 100644
--- a/plugins/Db3x_mmap/db3x_mmap_11.vcxproj
+++ b/plugins/Db3x_mmap/db3x_mmap_11.vcxproj
@@ -235,6 +235,7 @@
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="src\init.cpp" />
+ <ClCompile Include="src\ui.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\commonheaders.h" />
diff --git a/plugins/Db3x_mmap/db3x_mmap_11.vcxproj.filters b/plugins/Db3x_mmap/db3x_mmap_11.vcxproj.filters
index d4e3c10739..dde8eca53c 100644
--- a/plugins/Db3x_mmap/db3x_mmap_11.vcxproj.filters
+++ b/plugins/Db3x_mmap/db3x_mmap_11.vcxproj.filters
@@ -81,6 +81,9 @@
<ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\ui.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\commonheaders.h">
diff --git a/plugins/Db3x_mmap/db3x_mmap_12.vcxproj b/plugins/Db3x_mmap/db3x_mmap_12.vcxproj
index 99cd776dd2..ebce8e1d03 100644
--- a/plugins/Db3x_mmap/db3x_mmap_12.vcxproj
+++ b/plugins/Db3x_mmap/db3x_mmap_12.vcxproj
@@ -235,6 +235,7 @@
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="src\init.cpp" />
+ <ClCompile Include="src\ui.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\commonheaders.h" />
diff --git a/plugins/Db3x_mmap/db3x_mmap_12.vcxproj.filters b/plugins/Db3x_mmap/db3x_mmap_12.vcxproj.filters
index a9d064b34d..40ffb74580 100644
--- a/plugins/Db3x_mmap/db3x_mmap_12.vcxproj.filters
+++ b/plugins/Db3x_mmap/db3x_mmap_12.vcxproj.filters
@@ -81,6 +81,9 @@
<ClCompile Include="src\dbcrypt.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\ui.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\commonheaders.h">
diff --git a/plugins/Db3x_mmap/res/db3x_mmap.rc b/plugins/Db3x_mmap/res/db3x_mmap.rc
index 33077b4e94..8829d34dbc 100644
--- a/plugins/Db3x_mmap/res/db3x_mmap.rc
+++ b/plugins/Db3x_mmap/res/db3x_mmap.rc
@@ -37,13 +37,13 @@ BEGIN
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDFRAME,0,55,190,1
END
-IDD_CHANGEPASS DIALOGEX 0, 0, 190, 102
+IDD_NEWPASS DIALOGEX 0, 0, 190, 102
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_TOPMOST | WS_EX_TOOLWINDOW
-CAPTION "Enter password"
+CAPTION "New password"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- CONTROL "",IDC_HEADERBAR,"MHeaderbarCtrl",0x0,0,0,190,26
+ CONTROL "Please enter your new password",IDC_HEADERBAR,"MHeaderbarCtrl",0x0,0,0,190,26
CTEXT "EN",IDC_LANG,158,34,13,13,SS_CENTERIMAGE | NOT WS_GROUP
EDITTEXT IDC_USERPASS1,21,34,128,14,ES_PASSWORD | ES_AUTOHSCROLL
EDITTEXT IDC_USERPASS2,21,54,128,14,ES_PASSWORD | ES_AUTOHSCROLL
@@ -52,6 +52,24 @@ BEGIN
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDFRAME,0,77,190,1
END
+IDD_CHANGEPASS DIALOGEX 0, 0, 190, 148
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
+EXSTYLE WS_EX_TOOLWINDOW
+CAPTION "Enter password"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ CONTROL "Change password",IDC_HEADERBAR,"MHeaderbarCtrl",0x0,0,0,190,26
+ CTEXT "EN",IDC_LANG,158,42,13,13,SS_CENTERIMAGE | NOT WS_GROUP
+ EDITTEXT IDC_OLDPASS,21,42,128,14,ES_PASSWORD | ES_AUTOHSCROLL
+ EDITTEXT IDC_USERPASS1, 21, 77, 128, 14, ES_PASSWORD | ES_AUTOHSCROLL
+ EDITTEXT IDC_USERPASS2, 21, 98, 128, 14, ES_PASSWORD | ES_AUTOHSCROLL
+ DEFPUSHBUTTON "Change",IDOK,11,127,50,14
+ PUSHBUTTON "Remove",IDREMOVE,69,127,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,126,127,50,14
+ LTEXT "New password", IDC_STATIC, 11, 66, 163, 10, 0, WS_EX_TRANSPARENT
+ CONTROL "",IDC_STATIC,"Static",SS_ETCHEDFRAME,0,119,190,1
+ LTEXT "Old password", IDC_STATIC, 11, 31, 140, 10, 0, WS_EX_TRANSPARENT
+END
/////////////////////////////////////////////////////////////////////////////
//
@@ -60,6 +78,7 @@ END
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
+IDI_LOGO ICON "logo.ico"
IDI_ICONPASS ICON "pass.ico"
/////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/Db3x_mmap/res/logo.ico b/plugins/Db3x_mmap/res/logo.ico
new file mode 100644
index 0000000000..7602e30cbe
--- /dev/null
+++ b/plugins/Db3x_mmap/res/logo.ico
Binary files differ
diff --git a/plugins/Db3x_mmap/src/commonheaders.h b/plugins/Db3x_mmap/src/commonheaders.h
index bb31a01615..f8978defe4 100644
--- a/plugins/Db3x_mmap/src/commonheaders.h
+++ b/plugins/Db3x_mmap/src/commonheaders.h
@@ -34,6 +34,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <m_system_cpp.h>
#include <m_database.h>
#include <m_langpack.h>
+#include <m_clist.h>
+#include <m_icolib.h>
#include <m_crypto.h>
#include "database.h"
@@ -41,6 +43,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "resource.h"
#include "version.h"
+extern HINSTANCE g_hInst;
extern LIST<CDb3Mmap> g_Dbs;
extern DBSignature dbSignature, dbSignatureIM, dbSignatureSA;
diff --git a/plugins/Db3x_mmap/src/dbcrypt.cpp b/plugins/Db3x_mmap/src/dbcrypt.cpp
index 79a3744462..4cd24f2ee9 100644
--- a/plugins/Db3x_mmap/src/dbcrypt.cpp
+++ b/plugins/Db3x_mmap/src/dbcrypt.cpp
@@ -149,26 +149,15 @@ LBL_CreateProvider:
if ((m_crypto = pProvider->pFactory()) == NULL)
return 3;
- size_t iKeyLength = m_crypto->getKeyLength();
-
dbv.type = DBVT_BLOB;
dbcgs.szSetting = "StoredKey";
if (GetContactSetting(NULL, &dbcgs)) {
LBL_SetNewKey:
m_crypto->generateKey(); // unencrypted key
-
- BYTE *pKey = (BYTE*)_alloca(iKeyLength);
- m_crypto->getKey(pKey, iKeyLength);
-
- DBCONTACTWRITESETTING dbcws = { "CryptoEngine", "StoredKey" };
- dbcws.value.type = DBVT_BLOB;
- dbcws.value.cpbVal = (WORD)iKeyLength;
- dbcws.value.pbVal = pKey;
- WriteContactSetting(NULL, &dbcws);
-
- memset(pKey, 0, iKeyLength);
+ StoreKey();
}
else {
+ size_t iKeyLength = m_crypto->getKeyLength();
if (dbv.cpbVal != (WORD)iKeyLength)
goto LBL_SetNewKey;
@@ -186,5 +175,21 @@ LBL_SetNewKey:
DBWrite(0, &dbSignature, sizeof(dbSignature));
}
+ InitDialogs();
return 0;
}
+
+void CDb3Mmap::StoreKey()
+{
+ size_t iKeyLength = m_crypto->getKeyLength();
+ BYTE *pKey = (BYTE*)_alloca(iKeyLength);
+ m_crypto->getKey(pKey, iKeyLength);
+
+ DBCONTACTWRITESETTING dbcws = { "CryptoEngine", "StoredKey" };
+ dbcws.value.type = DBVT_BLOB;
+ dbcws.value.cpbVal = (WORD)iKeyLength;
+ dbcws.value.pbVal = pKey;
+ WriteContactSetting(NULL, &dbcws);
+
+ SecureZeroMemory(pKey, iKeyLength);
+}
diff --git a/plugins/Db3x_mmap/src/dbintf.h b/plugins/Db3x_mmap/src/dbintf.h
index 7f0455c6f9..d0919c28c8 100644
--- a/plugins/Db3x_mmap/src/dbintf.h
+++ b/plugins/Db3x_mmap/src/dbintf.h
@@ -152,6 +152,7 @@ struct CDb3Base : public MIDatabase, public MIDatabaseChecker, public MZeroedObj
void DatabaseCorruption(TCHAR *text);
__forceinline HANDLE getFile() const { return m_hDbFile; }
+ __forceinline bool isEncrypted() const { return m_bEncrypted; }
public:
STDMETHODIMP_(void) SetCacheSafetyMode(BOOL);
@@ -297,6 +298,8 @@ struct CDb3Mmap : public CDb3Base
CDb3Mmap(const TCHAR* ptszFileName);
~CDb3Mmap();
+ void StoreKey(void);
+
protected:
virtual DWORD GetSettingsGroupOfsByModuleNameOfs(DBContact *dbc,DWORD ofsContact,DWORD ofsModuleName);
virtual void DBMoveChunk(DWORD ofsDest, DWORD ofsSource, int bytes);
@@ -312,6 +315,8 @@ protected:
void Map();
void ReMap(DWORD needed);
+
+ void InitDialogs();
};
typedef int (CDb3Base::*CheckWorker)(int);
diff --git a/plugins/Db3x_mmap/src/dbsettings.cpp b/plugins/Db3x_mmap/src/dbsettings.cpp
index cd5a246264..bd5915cbb1 100644
--- a/plugins/Db3x_mmap/src/dbsettings.cpp
+++ b/plugins/Db3x_mmap/src/dbsettings.cpp
@@ -83,7 +83,7 @@ int CDb3Base::GetContactSettingWorker(HANDLE hContact, DBCONTACTGETSETTING *dbcg
DBVARIANT *pCachedValue = m_cache->GetCachedValuePtr(hContact, szCachedSettingName, 0);
if (pCachedValue != NULL) {
if (pCachedValue->type == DBVT_ASCIIZ || pCachedValue->type == DBVT_UTF8) {
- bool bIsEncrypted = m_bEncrypted || isEncrypted(dbcgs->szModule, dbcgs->szSetting);
+ bool bIsEncrypted = m_bEncrypted || ::isEncrypted(dbcgs->szModule, dbcgs->szSetting);
int cbOrigLen = dbcgs->pValue->cchVal;
char *cbOrigPtr = dbcgs->pValue->pszVal;
memcpy(dbcgs->pValue, pCachedValue, sizeof(DBVARIANT));
@@ -412,7 +412,7 @@ STDMETHODIMP_(BOOL) CDb3Base::WriteContactSetting(HANDLE hContact, DBCONTACTWRIT
case DBVT_ASCIIZ: case DBVT_UTF8:
if (tmp.value.pszVal == NULL) return 1;
tmp.value.cchVal = (WORD)strlen(tmp.value.pszVal);
- bIsEncrypted = m_bEncrypted || isEncrypted(dbcws->szModule, dbcws->szSetting);
+ bIsEncrypted = m_bEncrypted || ::isEncrypted(dbcws->szModule, dbcws->szSetting);
if (bIsEncrypted) {
size_t len;
BYTE *pResult = m_crypto->encodeString(tmp.value.pszVal, &len);
diff --git a/plugins/Db3x_mmap/src/resource.h b/plugins/Db3x_mmap/src/resource.h
index f321454cd5..071a0af2e6 100644
--- a/plugins/Db3x_mmap/src/resource.h
+++ b/plugins/Db3x_mmap/src/resource.h
@@ -2,17 +2,24 @@
// Microsoft Visual C++ generated include file.
// Used by D:\Myranda\plugins\Db3x_mmap\res\db3x_mmap.rc
//
+
+#define IDREMOVE 3
+
#define IDI_ICONPASS 100
-#define IDD_LOGIN 101
-#define IDD_CHANGEPASS 102
+#define IDI_LOGO 101
+#define IDD_LOGIN 102
+#define IDD_NEWPASS 103
+#define IDD_CHANGEPASS 104
+
#define IDC_HEADERBAR 1001
#define IDC_LANG 1002
#define IDC_USERPASS 1003
#define IDC_USERPASS1 1004
#define IDC_USERPASS2 1005
+#define IDC_OLDPASS 1006
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103
diff --git a/plugins/Db3x_mmap/src/ui.cpp b/plugins/Db3x_mmap/src/ui.cpp
new file mode 100644
index 0000000000..2ae486219a
--- /dev/null
+++ b/plugins/Db3x_mmap/src/ui.cpp
@@ -0,0 +1,170 @@
+/*
+
+Miranda NG: the free IM client for Microsoft* Windows*
+
+Copyright 2012-13 Miranda NG project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "commonheaders.h"
+
+#define MS_DB_CHANGEPASSWORD "DB/ChangePassword"
+
+static IconItem iconList[] =
+{
+ { LPGEN("Logo"), "logo", IDI_LOGO },
+ { LPGEN("Password"), "password", IDI_ICONPASS }
+};
+
+static HGENMENU hSetPwdMenu;
+
+static int oldLangID;
+void LanguageChanged(HWND hDlg)
+{
+ UINT LangID = (UINT)GetKeyboardLayout(0);
+ char Lang[3] = { 0 };
+ if (LangID != oldLangID) {
+ oldLangID = LangID;
+ GetLocaleInfoA(MAKELCID((LangID & 0xffffffff), SORT_DEFAULT), LOCALE_SABBREVLANGNAME, Lang, 2);
+ Lang[0] = toupper(Lang[0]);
+ Lang[1] = tolower(Lang[1]);
+ SetDlgItemTextA(hDlg, IDC_LANG, Lang);
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+struct DlgChangePassParam
+{
+ CDb3Mmap *db;
+ TCHAR newPass[100];
+};
+
+static INT_PTR CALLBACK sttChangePassword(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ DlgChangePassParam *param = (DlgChangePassParam*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+
+ switch (uMsg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ SendMessage(GetDlgItem(hwndDlg, IDC_HEADERBAR), WM_SETICON, ICON_SMALL, (LPARAM)Skin_GetIconByHandle(iconList[0].hIcolib));
+
+ param = (DlgChangePassParam*)lParam;
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
+
+ oldLangID = 0;
+ SetTimer(hwndDlg, 1, 200, NULL);
+ LanguageChanged(hwndDlg);
+ return TRUE;
+
+ case WM_CTLCOLORSTATIC:
+ if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_LANG)) {
+ SetTextColor((HDC)wParam, GetSysColor(COLOR_HIGHLIGHTTEXT));
+ SetBkMode((HDC)wParam, TRANSPARENT);
+ return (BOOL)GetSysColorBrush(COLOR_HIGHLIGHT);
+ }
+ return FALSE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDCANCEL:
+ EndDialog(hwndDlg, IDCANCEL);
+ break;
+
+ case IDOK:
+ GetDlgItemText(hwndDlg, IDC_USERPASS1, param->newPass, SIZEOF(param->newPass));
+ if (_tcslen(param->newPass) < 3) {
+ SetDlgItemText(hwndDlg, IDC_HEADERBAR, TranslateT("Password is too short!"));
+LBL_Error:
+ SendDlgItemMessage(hwndDlg, IDC_HEADERBAR, WM_NCPAINT, 0, 0);
+ SetDlgItemTextA(hwndDlg, IDC_USERPASS1, "");
+ SetDlgItemTextA(hwndDlg, IDC_USERPASS2, "");
+ break;
+ }
+
+ TCHAR buf2[100];
+ GetDlgItemText(hwndDlg, IDC_USERPASS2, buf2, SIZEOF(buf2));
+ if (_tcscmp(param->newPass, buf2)) {
+ SetWindowText(GetDlgItem(hwndDlg, IDC_HEADERBAR), TranslateT("Passwords do not match!"));
+ goto LBL_Error;
+ }
+
+ if (param->db->isEncrypted()) {
+ GetDlgItemText(hwndDlg, IDC_OLDPASS, buf2, SIZEOF(buf2));
+ ptrA oldPass(mir_utf8encodeT(buf2));
+ if (!param->db->m_crypto->checkPassword(oldPass)) {
+ SetWindowText(GetDlgItem(hwndDlg, IDC_HEADERBAR), TranslateT("Wrong old password entered!"));
+ goto LBL_Error;
+ }
+ }
+ EndDialog(hwndDlg, IDOK);
+ }
+ break;
+
+ case WM_TIMER:
+ LanguageChanged(hwndDlg);
+ return FALSE;
+
+ case WM_DESTROY:
+ KillTimer(hwndDlg, 1);
+ Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0));
+ }
+
+ return FALSE;
+}
+
+static INT_PTR ChangePassword(void* obj, LPARAM, LPARAM)
+{
+ CDb3Mmap *db = (CDb3Mmap*)obj;
+ DlgChangePassParam param = { db };
+ if (IDOK == DialogBoxParam(g_hInst, MAKEINTRESOURCE(db->isEncrypted() ? IDD_CHANGEPASS : IDD_NEWPASS), 0, sttChangePassword, (LPARAM)&param)) {
+ ptrA newPass(mir_utf8encodeT(param.newPass));
+ db->m_crypto->setPassword(newPass);
+ // db->StoreKey();
+ }
+
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static int OnModulesLoaded(PVOID obj, WPARAM, LPARAM)
+{
+ CDb3Mmap *db = (CDb3Mmap*)obj;
+
+ Icon_Register(g_hInst, LPGEN("Database"), iconList, SIZEOF(iconList), "mmap");
+
+ // main menu item
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.flags = CMIM_ALL | CMIF_TCHAR;
+ mi.icolibItem = iconList[1].hIcolib;
+ mi.ptszName = (db->isEncrypted()) ? LPGENT("Change password") : LPGENT("Set password");
+ mi.ptszPopupName = LPGENT("Database");
+ mi.pszService = MS_DB_CHANGEPASSWORD;
+ mi.position = 500000000;
+ hSetPwdMenu = Menu_AddMainMenuItem(&mi);
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+void CDb3Mmap::InitDialogs()
+{
+ CreateServiceFunctionObj(MS_DB_CHANGEPASSWORD, ChangePassword, this);
+ HookEventObj(ME_SYSTEM_MODULESLOADED, OnModulesLoaded, this);
+}