1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#include "stdafx.h"
CMPlugin g_plugin;
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_DATABASE, MIID_LAST };
/////////////////////////////////////////////////////////////////////////////////////////
static PLUGININFOEX pluginInfoEx =
{
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
__DESCRIPTION,
__AUTHOR,
__COPYRIGHT,
__AUTHORWEB,
UNICODE_AWARE | STATIC_PLUGIN,
// {DA223468-5F8E-4513-88B0-E52CE8A8B33B}
{ 0xda223468, 0x5f8e, 0x4513, { 0x88, 0xb0, 0xe5, 0x2c, 0xe8, 0xa8, 0xb3, 0x3b } }
};
CMPlugin::CMPlugin() :
PLUGIN<CMPlugin>(nullptr, pluginInfoEx)
{
}
/////////////////////////////////////////////////////////////////////////////////////////
// returns 0 if the profile is created, EMKPRF*
static int makeDatabase(const wchar_t *profile)
{
std::unique_ptr<CDbxSQLite> db(new CDbxSQLite(profile, false, false));
return db->Create();
}
// returns 0 if the given profile has a valid header
static int grokHeader(const wchar_t *profile)
{
std::unique_ptr<CDbxSQLite> db(new CDbxSQLite(profile, true, true));
return db->Check();
}
// returns 0 if all the APIs are injected otherwise, 1
static MDatabaseCommon* loadDatabase(const wchar_t *profile, BOOL bReadOnly)
{
std::unique_ptr<CDbxSQLite> db(new CDbxSQLite(profile, bReadOnly, false));
if (db->Load() != ERROR_SUCCESS)
return nullptr;
return db.release();
}
static DATABASELINK dblink =
{
MDB_CAPS_CREATE | MDB_CAPS_COMPACT,
"dbx_sqlite",
L"SQLite database driver",
makeDatabase,
grokHeader,
loadDatabase ,
};
STDMETHODIMP_(DATABASELINK *) CDbxSQLite::GetDriver()
{
return &dblink;
}
int CMPlugin::Load()
{
RegisterDatabasePlugin(&dblink);
return 0;
}
|