From 264e076f02faca0cfd59e5b0929d74ca621119cb Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Fri, 23 Aug 2013 11:14:31 +0000 Subject: fixed marking db "in use" when db is running git-svn-id: http://svn.miranda-ng.org/main/trunk@5790 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Db3x_mmap/src/dbintf.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'plugins/Db3x_mmap/src/dbintf.cpp') diff --git a/plugins/Db3x_mmap/src/dbintf.cpp b/plugins/Db3x_mmap/src/dbintf.cpp index 59640865e7..0888e8c7f9 100644 --- a/plugins/Db3x_mmap/src/dbintf.cpp +++ b/plugins/Db3x_mmap/src/dbintf.cpp @@ -35,11 +35,12 @@ static int OfsCompare(const ModuleName *mn1, const ModuleName *mn2 ) return ( mn1->ofs - mn2->ofs ); } -static int stringCompare2(const char* p1, const char* p2) -{ return strcmp(p1, p2); +static int stringCompare2(const char *p1, const char *p2) +{ + return strcmp(p1, p2); } -CDb3Base::CDb3Base(const TCHAR* tszFileName) : +CDb3Base::CDb3Base(const TCHAR *tszFileName) : m_hDbFile(INVALID_HANDLE_VALUE), m_safetyMode(true), m_bReadOnly(true), @@ -98,7 +99,10 @@ int CDb3Base::Load(bool bSkipInit) log0("DB logging running"); DWORD dummy = 0; - m_hDbFile = CreateFile(m_tszProfileName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, 0, NULL); + if (bSkipInit) + m_hDbFile = CreateFile(m_tszProfileName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); + else + m_hDbFile = CreateFile(m_tszProfileName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, 0, NULL); if ( m_hDbFile == INVALID_HANDLE_VALUE ) return EGROKPRF_CANTREAD; -- cgit v1.2.3