From ce236a1ca3574f230c150dff3a5bdd447e868ea5 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 24 Aug 2013 07:36:34 +0000 Subject: - correct COM expors - various fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@5804 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/ShellExt/src/ShellExt.def | 7 +++++++ plugins/ShellExt/src/Version.h | 3 --- plugins/ShellExt/src/main.cpp | 7 ++++--- plugins/ShellExt/src/options.cpp | 2 +- plugins/ShellExt/src/shlcom.cpp | 7 ++++--- 5 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 plugins/ShellExt/src/ShellExt.def (limited to 'plugins/ShellExt/src') diff --git a/plugins/ShellExt/src/ShellExt.def b/plugins/ShellExt/src/ShellExt.def new file mode 100644 index 0000000000..e867b9b540 --- /dev/null +++ b/plugins/ShellExt/src/ShellExt.def @@ -0,0 +1,7 @@ +LIBRARY ShlExt + +EXPORTS +DllCanUnloadNow PRIVATE +DllGetClassObject PRIVATE +DllRegisterServer PRIVATE +DllUnregisterServer PRIVATE diff --git a/plugins/ShellExt/src/Version.h b/plugins/ShellExt/src/Version.h index 89aa117923..c2f1323bba 100644 --- a/plugins/ShellExt/src/Version.h +++ b/plugins/ShellExt/src/Version.h @@ -6,9 +6,6 @@ #define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM #define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM -#define __STRINGIFY(x) #x -#define __VERSION_STRING __STRINGIFY(__FILEVERSION_STRING_DOTS) - #define __PLUGIN_NAME "ShlExt" #define __FILENAME "ShlExt.dll" #define __DESCRIPTION "Windows Explorer extension for Miranda NG." diff --git a/plugins/ShellExt/src/main.cpp b/plugins/ShellExt/src/main.cpp index 1791fc99f8..2dea9412ed 100644 --- a/plugins/ShellExt/src/main.cpp +++ b/plugins/ShellExt/src/main.cpp @@ -48,15 +48,16 @@ private: HKEY m_key; }; -char str1[] = "shlext " __VERSION_STRING " - shell context menu support for Miranda NG"; +char str1[100]; char str2[] = "{72013A26-A94C-11d6-8540-A5E62932711D}"; char str3[] = "miranda.shlext"; char str4[] = "Apartment"; TCHAR key1[] = _T("miranda.shlext\\{72013A26-A94C-11d6-8540-A5E62932711D}\\InprocServer32"); -HRESULT __stdcall DllRegisterServer() +STDAPI DllRegisterServer() { + sprintf_s(str1, sizeof(str1), "shlext %d.%d.%d.%d - shell context menu support for Miranda NG", __FILEVERSION_STRING); if ( RegSetValueA(HKEY_CLASSES_ROOT, "miranda.shlext", REG_SZ, str1, sizeof(str1))) return E_FAIL; if ( RegSetValueA(HKEY_CLASSES_ROOT, "miranda.shlext\\CLSID", REG_SZ, str2, sizeof(str2))) @@ -91,7 +92,7 @@ HRESULT __stdcall DllRegisterServer() return S_OK; } -HRESULT __stdcall DllUnregisterServer() +STDAPI DllUnregisterServer() { return RemoveCOMRegistryEntries(); } diff --git a/plugins/ShellExt/src/options.cpp b/plugins/ShellExt/src/options.cpp index 05f71ab039..1e92422fcb 100644 --- a/plugins/ShellExt/src/options.cpp +++ b/plugins/ShellExt/src/options.cpp @@ -25,7 +25,7 @@ static TCHAR* COM_OKSTR[2] = { LPGENT("Successfully created shell registration.") }; static TCHAR* COM_APPROVEDSTR[2] = { LPGENT("Not Approved"), LPGENT("Approved") }; -static LRESULT CALLBACK OptDialogProc(HWND hwndDlg, UINT wMsg, WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK OptDialogProc(HWND hwndDlg, UINT wMsg, WPARAM wParam, LPARAM lParam) { int comReg, iCheck; TCHAR szBuf[MAX_PATH]; diff --git a/plugins/ShellExt/src/shlcom.cpp b/plugins/ShellExt/src/shlcom.cpp index fbbf299894..11c6616116 100644 --- a/plugins/ShellExt/src/shlcom.cpp +++ b/plugins/ShellExt/src/shlcom.cpp @@ -1508,11 +1508,12 @@ void InvokeThreadServer() const IID CLSID_ISHLCOM = { 0x72013A26, 0xA94C, 0x11d6, {0x85, 0x40, 0xA5, 0xE6, 0x29, 0x32, 0x71, 0x1D }}; -HRESULT DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) { + MessageBoxA(0, "Ding!", "Dong", MB_OK); + if (rclsid == CLSID_ISHLCOM && riid == IID_IClassFactory && FindWindowA(MIRANDANAME, NULL) != 0) { *ppv = new TClassFactoryRec(); - MessageBoxA(0, "Ding!", "Dong", MB_OK); return S_OK; } @@ -1520,7 +1521,7 @@ HRESULT DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) return CLASS_E_CLASSNOTAVAILABLE; } -HRESULT DllCanUnloadNow() +STDAPI DllCanUnloadNow() { if (dllobject.FactoryCount == 0 && dllobject.ObjectCount == 0) return S_OK; -- cgit v1.2.3