From 9cf1444eb7888f2d942d220f938aa893396a8a1b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 18 Apr 2018 20:51:18 +0300 Subject: g_hInstance incapulated into PLUGIN<>, no need in the separate variable --- include/m_plugin.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/m_plugin.h b/include/m_plugin.h index ae56eeb49a..340b3100fe 100644 --- a/include/m_plugin.h +++ b/include/m_plugin.h @@ -4,8 +4,6 @@ #include #include -extern HINSTANCE g_hInstance; - class MIR_APP_EXPORT CMPluginBase { void tryOpenLog(); @@ -15,7 +13,7 @@ protected: HANDLE m_hLogger = nullptr; HINSTANCE m_hInst; - CMPluginBase(HINSTANCE, const char *moduleName); + CMPluginBase(const char *moduleName); ~CMPluginBase(); // pass one of PROTOTYPE_* constants as type @@ -30,6 +28,7 @@ public: void debugLogW(LPCWSTR wszFormat, ...); __forceinline HINSTANCE getInst() const { return m_hInst; } + __forceinline void setInst(HINSTANCE hInst) { m_hInst = hInst; } __forceinline INT_PTR delSetting(const char *name) { @@ -172,13 +171,13 @@ template class PLUGIN : public CMPluginBase public: static BOOL WINAPI RawDllMain(HINSTANCE hInstance, DWORD, LPVOID) { - g_hInstance = hInstance; + g_plugin.setInst(hInstance); return TRUE; } protected: PLUGIN(const char *moduleName) - : CSuper(g_hInstance, moduleName) + : CSuper(moduleName) {} __forceinline HANDLE CreatePluginEvent(const char *name) -- cgit v1.2.3