summaryrefslogtreecommitdiff
path: root/plugins/CloudFile/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-04-18 18:14:33 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-04-18 18:14:33 +0300
commitb172c4bbc75cdad0e8ccd22292aa671ba43cac45 (patch)
tree4677a04a47f3987c88f3fb44c6b70d2642b1f8a3 /plugins/CloudFile/src
parent524d1c7186eca3f0a4da08548eeb919785227101 (diff)
PLUGIN<> to half-automatically calculate the dll's g_hInstance and pass it inside
Diffstat (limited to 'plugins/CloudFile/src')
-rw-r--r--plugins/CloudFile/src/Services/dropbox_service.cpp6
-rw-r--r--plugins/CloudFile/src/Services/google_service.cpp2
-rw-r--r--plugins/CloudFile/src/Services/microsoft_service.cpp2
-rw-r--r--plugins/CloudFile/src/Services/yandex_service.cpp2
-rw-r--r--plugins/CloudFile/src/icons.cpp2
-rw-r--r--plugins/CloudFile/src/main.cpp8
-rw-r--r--plugins/CloudFile/src/oauth.cpp2
-rw-r--r--plugins/CloudFile/src/options.cpp2
-rw-r--r--plugins/CloudFile/src/stdafx.h2
9 files changed, 12 insertions, 16 deletions
diff --git a/plugins/CloudFile/src/Services/dropbox_service.cpp b/plugins/CloudFile/src/Services/dropbox_service.cpp
index 34e779df1c..1dacf3112e 100644
--- a/plugins/CloudFile/src/Services/dropbox_service.cpp
+++ b/plugins/CloudFile/src/Services/dropbox_service.cpp
@@ -308,12 +308,14 @@ UINT CDropboxService::Upload(FileTransferParam *ftp)
/////////////////////////////////////////////////////////////////////////////////////////
-struct CMPluginDropbox : public CMPluginBase
+struct CMPluginDropbox : public PLUGIN<CMPluginDropbox>
{
CMPluginDropbox() :
- CMPluginBase(MODULE "/Dropbox")
+ PLUGIN<CMPluginDropbox>(MODULE "/Dropbox")
{
RegisterProtocol(PROTOTYPE_PROTOCOL, (pfnInitProto)CDropboxService::Init, (pfnUninitProto)CDropboxService::UnInit);
}
}
g_pluginDropbox;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPluginDropbox::RawDllMain;
diff --git a/plugins/CloudFile/src/Services/google_service.cpp b/plugins/CloudFile/src/Services/google_service.cpp
index c7c24333ac..665f5bc511 100644
--- a/plugins/CloudFile/src/Services/google_service.cpp
+++ b/plugins/CloudFile/src/Services/google_service.cpp
@@ -295,7 +295,7 @@ UINT CGDriveService::Upload(FileTransferParam *ftp)
struct CMPluginGoogle : public CMPluginBase
{
CMPluginGoogle() :
- CMPluginBase(MODULE "/GDrive")
+ CMPluginBase(g_hInstance, MODULE "/GDrive")
{
RegisterProtocol(PROTOTYPE_PROTOCOL, (pfnInitProto)CGDriveService::Init, (pfnUninitProto)CGDriveService::UnInit);
}
diff --git a/plugins/CloudFile/src/Services/microsoft_service.cpp b/plugins/CloudFile/src/Services/microsoft_service.cpp
index 05c4c5ca81..656ccbdd4b 100644
--- a/plugins/CloudFile/src/Services/microsoft_service.cpp
+++ b/plugins/CloudFile/src/Services/microsoft_service.cpp
@@ -280,7 +280,7 @@ UINT COneDriveService::Upload(FileTransferParam *ftp)
struct CMPluginOnedrive : public CMPluginBase
{
CMPluginOnedrive() :
- CMPluginBase(MODULE "/OneDrive")
+ CMPluginBase(g_hInstance, MODULE "/OneDrive")
{
RegisterProtocol(PROTOTYPE_PROTOCOL, (pfnInitProto)COneDriveService::Init, (pfnUninitProto)COneDriveService::UnInit);
}
diff --git a/plugins/CloudFile/src/Services/yandex_service.cpp b/plugins/CloudFile/src/Services/yandex_service.cpp
index c3e32aa8c8..3212814db5 100644
--- a/plugins/CloudFile/src/Services/yandex_service.cpp
+++ b/plugins/CloudFile/src/Services/yandex_service.cpp
@@ -290,7 +290,7 @@ UINT CYandexService::Upload(FileTransferParam *ftp)
struct CMPluginYandex : public CMPluginBase
{
CMPluginYandex() :
- CMPluginBase(MODULE "/YandexDisk")
+ CMPluginBase(g_hInstance, MODULE "/YandexDisk")
{
RegisterProtocol(PROTOTYPE_PROTOCOL, (pfnInitProto)CYandexService::Init, (pfnUninitProto)CYandexService::UnInit);
}
diff --git a/plugins/CloudFile/src/icons.cpp b/plugins/CloudFile/src/icons.cpp
index ed496f2430..bb9dd9096c 100644
--- a/plugins/CloudFile/src/icons.cpp
+++ b/plugins/CloudFile/src/icons.cpp
@@ -11,7 +11,7 @@ static IconItem iconList[] =
void InitializeIcons()
{
- Icon_Register(hInstance, "Protocols/" MODULE, iconList, _countof(iconList), MODULE);
+ Icon_Register(g_hInstance, "Protocols/" MODULE, iconList, _countof(iconList), MODULE);
}
HANDLE GetIconHandle(int iconId)
diff --git a/plugins/CloudFile/src/main.cpp b/plugins/CloudFile/src/main.cpp
index 91d8a82f7c..e9c8a6fdd2 100644
--- a/plugins/CloudFile/src/main.cpp
+++ b/plugins/CloudFile/src/main.cpp
@@ -1,7 +1,7 @@
#include "stdafx.h"
int hLangpack;
-HINSTANCE hInstance;
+HINSTANCE g_hInstance;
PLUGININFOEX pluginInfo =
{
@@ -17,12 +17,6 @@ PLUGININFOEX pluginInfo =
{ 0xe876fe63, 0x701, 0x4cda, { 0xbe, 0xd5, 0x7c, 0x73, 0xa3, 0x79, 0xc1, 0xd1 }}
};
-DWORD WINAPI DllMain(HINSTANCE hInst, DWORD, LPVOID)
-{
- hInstance = hInst;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
diff --git a/plugins/CloudFile/src/oauth.cpp b/plugins/CloudFile/src/oauth.cpp
index 9d8e40cf73..0e0503f639 100644
--- a/plugins/CloudFile/src/oauth.cpp
+++ b/plugins/CloudFile/src/oauth.cpp
@@ -1,7 +1,7 @@
#include "stdafx.h"
COAuthDlg::COAuthDlg(CCloudService *service, const char *authUrl, pThreadFuncOwner requestAccessTokenThread)
- : CDlgBase(hInstance, IDD_OAUTH), m_service(service),
+ : CDlgBase(g_hInstance, IDD_OAUTH), m_service(service),
m_requestAccessTokenThread(requestAccessTokenThread),
m_authorize(this, IDC_OAUTH_AUTHORIZE, authUrl),
m_code(this, IDC_OAUTH_CODE), m_ok(this, IDOK)
diff --git a/plugins/CloudFile/src/options.cpp b/plugins/CloudFile/src/options.cpp
index 32eb485a31..09fb7df117 100644
--- a/plugins/CloudFile/src/options.cpp
+++ b/plugins/CloudFile/src/options.cpp
@@ -1,7 +1,7 @@
#include "stdafx.h"
COptionsMainDlg::COptionsMainDlg()
- : CPluginDlgBase(hInstance, IDD_OPTIONS_MAIN, MODULE),
+ : CPluginDlgBase(g_hInstance, IDD_OPTIONS_MAIN, MODULE),
m_defaultService(this, IDC_DEFAULTSERVICE),
m_doNothingOnConflict(this, IDC_DONOTHINGONCONFLICT),
m_renameOnConflict(this, IDC_RENAMEONCONFLICT),
diff --git a/plugins/CloudFile/src/stdafx.h b/plugins/CloudFile/src/stdafx.h
index 9e91769740..85ce23b8d7 100644
--- a/plugins/CloudFile/src/stdafx.h
+++ b/plugins/CloudFile/src/stdafx.h
@@ -41,7 +41,7 @@ class CCloudService;
#include "options.h"
-extern HINSTANCE hInstance;
+extern HINSTANCE g_hInstance;
extern HNETLIBUSER hNetlibConnection;
class Exception