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/Dbx_mmap_SA/src/dbintf_sa.cpp | |
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/Dbx_mmap_SA/src/dbintf_sa.cpp')
-rw-r--r-- | plugins/Dbx_mmap_SA/src/dbintf_sa.cpp | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/plugins/Dbx_mmap_SA/src/dbintf_sa.cpp b/plugins/Dbx_mmap_SA/src/dbintf_sa.cpp index 05db621e7a..9bbf76da2d 100644 --- a/plugins/Dbx_mmap_SA/src/dbintf_sa.cpp +++ b/plugins/Dbx_mmap_SA/src/dbintf_sa.cpp @@ -68,12 +68,12 @@ int CDdxMmapSA::CheckDbHeaders() else {
m_bEncoding = false;
if ( memcmp(m_dbHeader.signature,&dbSignature,sizeof(m_dbHeader.signature)))
- return 1;
+ return EGROKPRF_UNKHEADER;
if ( LOWORD(m_dbHeader.version) != 0x0700)
- return 2;
+ return EGROKPRF_VERNEWER;
}
if (m_dbHeader.ofsUser == 0)
- return 3;
+ return EGROKPRF_DAMAGED;
return 0;
}
@@ -232,3 +232,27 @@ void CDdxMmapSA::DecodeContactEvents(HANDLE hContact) hEvent = FindNextEvent(hEvent);
}
}
+
+int CDdxMmapSA::WorkInitialCheckHeaders(void)
+{
+ if (m_bEncoding) {
+ cb->pfnAddLogMessage(STATUS_SUCCESS,TranslateT("Database is Secured MMAP database"));
+
+ TCHAR* p = _tcsrchr(m_tszProfileName, '\\');
+ if (!p)
+ return ERROR_BAD_FORMAT;
+
+ g_Db = this;
+ if (!CheckPassword( LOWORD(m_dbHeader.version), p+1)) {
+ cb->pfnAddLogMessage(STATUS_FATAL,TranslateT("You are not authorized for access to Database"));
+ return ERROR_BAD_FORMAT;
+ }
+
+ cb->pfnAddLogMessage(STATUS_SUCCESS,TranslateT("Secured MMAP: authorization successful"));
+ }
+
+ if ( LOWORD(m_dbHeader.version) != 0x0700 && !m_bEncoding) {
+ cb->pfnAddLogMessage(STATUS_FATAL,TranslateT("Database is marked as belonging to an unknown version of Miranda"));
+ return ERROR_BAD_FORMAT;
+ }
+}
|