diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 86282414..c8bc7d87 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -28,5 +28,4 @@ add_subdirectory(synergy) if (WIN32) add_subdirectory(synwinhk) - add_subdirectory(synwinxt) endif() diff --git a/src/lib/platform/MSWindowsScreen.cpp b/src/lib/platform/MSWindowsScreen.cpp index 9d0081bb..821fa5ca 100644 --- a/src/lib/platform/MSWindowsScreen.cpp +++ b/src/lib/platform/MSWindowsScreen.cpp @@ -131,7 +131,6 @@ CMSWindowsScreen::CMSWindowsScreen( if (m_isPrimary && !m_noHooks) { m_hook.loadLibrary(); } - m_shellEx.loadLibrary(); m_screensaver = new CMSWindowsScreenSaver(); m_desks = new CMSWindowsDesks( @@ -1885,13 +1884,6 @@ CMSWindowsScreen::getDraggingFilename() return m_draggingFilename; } -void -CMSWindowsScreen::clearDraggingFilename() -{ - LOG((CLOG_DEBUG1 "clearing stored dragging file name")); - m_shellEx.clearDraggingFilename(); -} - const CString& CMSWindowsScreen::getDropTarget() const { diff --git a/src/lib/platform/MSWindowsScreen.h b/src/lib/platform/MSWindowsScreen.h index d3543a6c..05368dc3 100644 --- a/src/lib/platform/MSWindowsScreen.h +++ b/src/lib/platform/MSWindowsScreen.h @@ -18,7 +18,6 @@ #pragma once -#include "platform/MSWindowsShellEx.h" #include "platform/MSWindowsHook.h" #include "synergy/PlatformScreen.h" #include "synwinhk/synwinhk.h" @@ -118,7 +117,6 @@ public: virtual bool isPrimary() const; virtual void fakeDraggingFiles(CString str); virtual CString& getDraggingFilename(); - virtual void clearDraggingFilename(); virtual const CString& getDropTarget() const; @@ -322,7 +320,6 @@ private: MOUSEKEYS m_oldMouseKeys; CMSWindowsHook m_hook; - CMSWindowsShellEx m_shellEx; static CMSWindowsScreen* s_screen; diff --git a/src/lib/platform/MSWindowsShellEx.cpp b/src/lib/platform/MSWindowsShellEx.cpp deleted file mode 100644 index ce526468..00000000 --- a/src/lib/platform/MSWindowsShellEx.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * synergy -- mouse and keyboard sharing utility - * Copyright (C) 2014 Bolton Software Ltd. - * - * This package is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * found in the file COPYING that should have accompanied this file. - * - * This package is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "platform/MSWindowsShellEx.h" - -#include "synergy/XScreen.h" -#include "base/Log.h" - -static const char* g_name = "synwinxt"; - -CMSWindowsShellEx::CMSWindowsShellEx() : - m_getDraggingFilenameFunc(NULL), - m_clearDraggingFilenameFunc(NULL), - m_instance(NULL) -{ -} - -CMSWindowsShellEx::~CMSWindowsShellEx() -{ - if (m_instance != NULL) { - FreeLibrary(m_instance); - } -} - -void -CMSWindowsShellEx::loadLibrary() -{ - OSVERSIONINFO osvi; - ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&osvi); - - if (osvi.dwMajorVersion < 6) { - LOG((CLOG_INFO "skipping shell extension library load, %s.dll not supported before vista", g_name)); - return; - } - - // load library - m_instance = LoadLibrary(g_name); - if (m_instance == NULL) { - LOG((CLOG_ERR "failed to load shell extension library, %s.dll is missing or invalid", g_name)); - throw XScreenOpenFailure(); - } - - // look up functions - m_getDraggingFilenameFunc = (GetDraggingFilenameFunc)GetProcAddress(m_instance, "getDraggingFilename"); - m_clearDraggingFilenameFunc = (ClearDraggingFilenameFunc)GetProcAddress(m_instance, "clearDraggingFilename"); - - if (m_getDraggingFilenameFunc == NULL || - m_clearDraggingFilenameFunc == NULL) { - LOG((CLOG_ERR "failed to load shell extension function, %s.dll could be out of date", g_name)); - throw XScreenOpenFailure(); - } -} - -HINSTANCE -CMSWindowsShellEx::getInstance() const -{ - return m_instance; -} - -void -CMSWindowsShellEx::getDraggingFilename(char* filename) const -{ - if (m_getDraggingFilenameFunc == NULL) { - return; - } - m_getDraggingFilenameFunc(filename); -} - -void -CMSWindowsShellEx::clearDraggingFilename() -{ - if (m_getDraggingFilenameFunc == NULL) { - return; - } - m_clearDraggingFilenameFunc(); -} diff --git a/src/lib/platform/MSWindowsShellEx.h b/src/lib/platform/MSWindowsShellEx.h deleted file mode 100644 index be1dd592..00000000 --- a/src/lib/platform/MSWindowsShellEx.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * synergy -- mouse and keyboard sharing utility - * Copyright (C) 2014 Bolton Software Ltd. - * - * This package is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * found in the file COPYING that should have accompanied this file. - * - * This package is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -#include "synwinxt/synwinxt.h" - -#define WIN32_LEAN_AND_MEAN -#include - -//! Loads and provides functions for the Windows shell extension -class CMSWindowsShellEx -{ -public: - CMSWindowsShellEx(); - virtual ~CMSWindowsShellEx(); - - void loadLibrary(); - HINSTANCE getInstance() const; - void getDraggingFilename(char* filename) const; - void clearDraggingFilename(); - -private: - HINSTANCE m_instance; - GetDraggingFilenameFunc - m_getDraggingFilenameFunc; - ClearDraggingFilenameFunc - m_clearDraggingFilenameFunc; -}; diff --git a/src/lib/synwinxt/CMakeLists.txt b/src/lib/synwinxt/CMakeLists.txt deleted file mode 100644 index b94f28e1..00000000 --- a/src/lib/synwinxt/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -# synergy -- mouse and keyboard sharing utility -# Copyright (C) 2013 Bolton Software Ltd. -# -# This package is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# found in the file COPYING that should have accompanied this file. -# -# This package is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -file(GLOB headers "*.h") -file(GLOB sources "*.cpp" "*.def") - -if (SYNERGY_ADD_HEADERS) - list(APPEND sources ${headers}) -endif() - -include_directories( - ../ -) - -add_library(synwinxt SHARED ${sources}) -target_link_libraries(synwinxt - arch base common ${libs}) - -# copy the dlls (and supporting files) from the lib dir to -# the bin dir, so that synergyc and synergys can easily find them. -# we should leave the other libraries compiling to the lib dir, -# so that the bin dir remains tidy. the path is relative to the -# build dir (in this case, that's: build\src\lib\platform). -add_custom_command( - TARGET synwinxt - POST_BUILD - COMMAND xcopy /Y /Q - ..\\..\\..\\..\\lib\\${CMAKE_CFG_INTDIR}\\synwinxt.* - ..\\..\\..\\..\\bin\\${CMAKE_CFG_INTDIR}\\ -) diff --git a/src/lib/synwinxt/ClassFactory.cpp b/src/lib/synwinxt/ClassFactory.cpp deleted file mode 100644 index ca704411..00000000 --- a/src/lib/synwinxt/ClassFactory.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* - * synergy -- mouse and keyboard sharing utility - * Copyright (C) 2013 Bolton Software Ltd. - * - * This package is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * found in the file COPYING that should have accompanied this file. - * - * This package is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "synwinxt/ClassFactory.h" -#include "synwinxt/DataHandlerExtension.h" - -#include - -extern LONG g_refCount; -extern void log(const char *str, ...); - -CClassFactory::CClassFactory() : - m_refCount(1) -{ - log("> CClassFactory::ctor, g_refCount=%d", g_refCount); - InterlockedIncrement(&g_refCount); - log("< CClassFactory::ctor, g_refCount=%d", g_refCount); -} - -CClassFactory::~CClassFactory() -{ - log("> CClassFactory::dtor, g_refCount=%d", g_refCount); - InterlockedDecrement(&g_refCount); - log("< CClassFactory::dtor, g_refCount=%d", g_refCount); -} - -HRESULT STDMETHODCALLTYPE -CClassFactory::QueryInterface(REFIID riid, void **ppvObject) -{ - log("> CClassFactory::QueryInterface"); - static const QITAB qit[] = - { - QITABENT(CClassFactory, IClassFactory), - { 0 }, - }; - HRESULT hr = QISearch(this, qit, riid, ppvObject); - - log("< CClassFactory::QueryInterface, hr=%d", hr); - return hr; -} - -ULONG STDMETHODCALLTYPE -CClassFactory::AddRef() -{ - log("> CClassFactory::AddRef, m_refCount=%d", m_refCount); - LONG r = InterlockedIncrement(&m_refCount); - log("< CClassFactory::AddRef, r=%d, m_refCount=%d", r, m_refCount); - return r; -} - -ULONG STDMETHODCALLTYPE -CClassFactory::Release() -{ - log("> CClassFactory::Release, m_refCount=%d", m_refCount); - LONG r = InterlockedDecrement(&m_refCount); - if (r == 0) { - delete this; - } - - log("< CClassFactory::Release, r=%d", r); - return r; -} - -HRESULT STDMETHODCALLTYPE -CClassFactory::CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppvObject) -{ - log("> CClassFactory::CreateInstance"); - if (pUnkOuter != NULL) { - return CLASS_E_NOAGGREGATION; - } - - CDataHandlerExtension* pExtension = new CDataHandlerExtension(); - HRESULT hr = pExtension->QueryInterface(riid, ppvObject); - if (FAILED(hr)) { - delete pExtension; - } - - log("< CClassFactory::CreateInstance, hr=%d", hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE -CClassFactory::LockServer(BOOL fLock) -{ - log("> CClassFactory::LockServer, g_refCount=%d", g_refCount); - if (fLock) { - InterlockedIncrement(&g_refCount); - } - else { - InterlockedDecrement(&g_refCount); - } - log("< CClassFactory::LockServer, g_refCount=%d", g_refCount); - return S_OK; -} diff --git a/src/lib/synwinxt/ClassFactory.h b/src/lib/synwinxt/ClassFactory.h deleted file mode 100644 index 4f33cd3a..00000000 --- a/src/lib/synwinxt/ClassFactory.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * synergy -- mouse and keyboard sharing utility - * Copyright (C) 2013 Bolton Software Ltd. - * - * This package is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * found in the file COPYING that should have accompanied this file. - * - * This package is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -#include - -class CClassFactory : public ::IClassFactory -{ -public: - CClassFactory(); - ~CClassFactory(); - - // IUnknown overrides - HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject); - ULONG STDMETHODCALLTYPE AddRef(); - ULONG STDMETHODCALLTYPE Release(); - - // IClassFactory overrides - HRESULT STDMETHODCALLTYPE CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppvObject); - HRESULT STDMETHODCALLTYPE LockServer(BOOL fLock); - -private: - LONG m_refCount; -}; diff --git a/src/lib/synwinxt/DataHandlerExtension.cpp b/src/lib/synwinxt/DataHandlerExtension.cpp deleted file mode 100644 index a06e1046..00000000 --- a/src/lib/synwinxt/DataHandlerExtension.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * synergy -- mouse and keyboard sharing utility - * Copyright (C) 2013 Bolton Software Ltd. - * - * This package is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * found in the file COPYING that should have accompanied this file. - * - * This package is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "DataHandlerExtension.h" - -#include -#include -#include - -extern LONG g_refCount; -extern GUID g_CLSID; -extern void setDraggingFilename(const char* str); -extern void log(const char* str, ...); - -CDataHandlerExtension::CDataHandlerExtension() : - m_refCount(1) -{ - log("> CDataHandlerExtension::ctor, g_refCount=%d", g_refCount); - InterlockedIncrement(&g_refCount); - log("< CDataHandlerExtension::ctor, g_refCount=%d", g_refCount); -} - -CDataHandlerExtension::~CDataHandlerExtension() -{ - log("> CDataHandlerExtension::dtor, g_refCount=%d", g_refCount); - InterlockedDecrement(&g_refCount); - log("< CDataHandlerExtension::dtor, g_refCount=%d", g_refCount); -} - -HRESULT STDMETHODCALLTYPE -CDataHandlerExtension::QueryInterface(REFIID riid, void **ppvObject) -{ - log("> CDataHandlerExtension::QueryInterface"); - static const QITAB qit[] = - { - QITABENT(CDataHandlerExtension, IPersistFile), - QITABENT(CDataHandlerExtension, IDataObject), - { 0 }, - }; - HRESULT hr = QISearch(this, qit, riid, ppvObject); - - if (FAILED(hr)) { - log("< CDataHandlerExtension::QueryInterface, hr=FAILED"); - } - else { - log("< CDataHandlerExtension::QueryInterface, hr=%d", hr); - } - return hr; -} - -ULONG STDMETHODCALLTYPE -CDataHandlerExtension::AddRef() -{ - log("> CDataHandlerExtension::AddRef, m_refCount=%d", m_refCount); - LONG r = InterlockedIncrement(&m_refCount); - log("< CDataHandlerExtension::AddRef, r=%d, m_refCount=%d", r, m_refCount); - return r; -} - -ULONG STDMETHODCALLTYPE -CDataHandlerExtension::Release() -{ - log("> CDataHandlerExtension::Release, m_refCount=%d", m_refCount); - LONG r = InterlockedDecrement(&m_refCount); - if (r == 0) { - delete this; - } - log("< CDataHandlerExtension::Release, r=%d", r); - return r; -} - -HRESULT STDMETHODCALLTYPE -CDataHandlerExtension::Load(__RPC__in LPCOLESTR pszFileName, DWORD dwMode) -{ - log("> CDataHandlerExtension::Load"); - std::string fileName = _bstr_t(pszFileName); - setDraggingFilename(fileName.c_str()); - log("< CDataHandlerExtension::Load"); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE -CDataHandlerExtension::GetClassID(__RPC__out CLSID *pClassID) -{ - log("> CDataHandlerExtension::GetClassID"); - *pClassID = g_CLSID; - log("< CDataHandlerExtension::GetClassID"); - return S_OK; -} diff --git a/src/lib/synwinxt/DataHandlerExtension.h b/src/lib/synwinxt/DataHandlerExtension.h deleted file mode 100644 index 0e470ec8..00000000 --- a/src/lib/synwinxt/DataHandlerExtension.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * synergy -- mouse and keyboard sharing utility - * Copyright (C) 2013 Bolton Software Ltd. - * - * This package is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * found in the file COPYING that should have accompanied this file. - * - * This package is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -#include - -class CDataHandlerExtension : public IDataObject, public IPersistFile -{ -public: - CDataHandlerExtension(); - ~CDataHandlerExtension(); - - // IUnknown overrides - HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject); - ULONG STDMETHODCALLTYPE AddRef(); - ULONG STDMETHODCALLTYPE Release(); - - // IDataObject overrides - HRESULT STDMETHODCALLTYPE GetData(FORMATETC *pformatetcIn, STGMEDIUM *pmedium) { return E_NOTIMPL; } - HRESULT STDMETHODCALLTYPE GetDataHere(FORMATETC *pformatetc, STGMEDIUM *pmedium) { return E_NOTIMPL; } - HRESULT STDMETHODCALLTYPE QueryGetData(__RPC__in_opt FORMATETC *pformatetc) { return E_NOTIMPL; } - HRESULT STDMETHODCALLTYPE GetCanonicalFormatEtc(__RPC__in_opt FORMATETC *pformatectIn, __RPC__out FORMATETC *pformatetcOut) { return E_NOTIMPL; } - HRESULT STDMETHODCALLTYPE SetData(FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease) { return E_NOTIMPL; } - HRESULT STDMETHODCALLTYPE EnumFormatEtc(DWORD dwDirection, __RPC__deref_out_opt IEnumFORMATETC **ppenumFormatEtc) { return E_NOTIMPL; } - HRESULT STDMETHODCALLTYPE DAdvise(__RPC__in FORMATETC *pformatetc, DWORD advf, __RPC__in_opt IAdviseSink *pAdvSink, __RPC__out DWORD *pdwConnection) { return E_NOTIMPL; } - HRESULT STDMETHODCALLTYPE DUnadvise(DWORD dwConnection) { return E_NOTIMPL; } - HRESULT STDMETHODCALLTYPE EnumDAdvise(__RPC__deref_out_opt IEnumSTATDATA **ppenumAdvise) { return E_NOTIMPL; } - - // IPersistFile overrides - HRESULT STDMETHODCALLTYPE IsDirty() { return E_NOTIMPL; }; - HRESULT STDMETHODCALLTYPE Load(__RPC__in LPCOLESTR pszFileName, DWORD dwMode); - HRESULT STDMETHODCALLTYPE Save(__RPC__in_opt LPCOLESTR pszFileName, BOOL fRemember) { return E_NOTIMPL; } - HRESULT STDMETHODCALLTYPE SaveCompleted(__RPC__in_opt LPCOLESTR pszFileName) { return E_NOTIMPL; } - HRESULT STDMETHODCALLTYPE GetCurFile(__RPC__deref_out_opt LPOLESTR *ppszFileName) { return E_NOTIMPL; } - - // IPersist overrides - HRESULT STDMETHODCALLTYPE GetClassID(__RPC__out CLSID *pClassID); - -private: - LONG m_refCount; -}; diff --git a/src/lib/synwinxt/synwinxt.cpp b/src/lib/synwinxt/synwinxt.cpp deleted file mode 100644 index bac61a1b..00000000 --- a/src/lib/synwinxt/synwinxt.cpp +++ /dev/null @@ -1,331 +0,0 @@ -/* - * synergy -- mouse and keyboard sharing utility - * Copyright (C) 2013 Bolton Software Ltd. - * - * This package is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * found in the file COPYING that should have accompanied this file. - * - * This package is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "synwinxt/synwinxt.h" -#include "synwinxt/ClassFactory.h" -#include "arch/win32/ArchMiscWindows.h" - -#include -#include -#include - -#pragma comment(lib, "Shlwapi.lib") - -#if defined(_MSC_VER) -#pragma comment(linker, "-section:sharedData,rws") -#pragma data_seg("sharedData") -#endif - -static BYTE g_draggingFilename[MAX_PATH] = { 0 }; - -#if defined(_MSC_VER) -#pragma data_seg() -#endif - -// {1BE208B1-BC21-4E39-8BB6-A5DC3F51479E} -GUID g_CLSID = {0x1be208b1, 0xbc21, 0x4e39, {0x8b, 0xb6, 0xa5, 0xdc, 0x3f, 0x51, 0x47, 0x9e}}; -LONG g_refCount = 0; -HINSTANCE g_instance = NULL; - -HRESULT registerInprocServer(CHAR* module, const CLSID& clsid, CHAR* threadModel); -HRESULT registerShellExtDataHandler(CHAR* fileType, const CLSID& clsid); -HRESULT unregisterShellExtDataHandler(CHAR* fileType, const CLSID& clsid); -HRESULT unregisterInprocServer(const CLSID& clsid); - -void -log(const char* str, ...) -{ - char buf[2048]; - - va_list ptr; - va_start(ptr, str); - vsprintf_s(buf, str, ptr); - - std::stringstream ss; - ss << "synwinxt-" << VERSION << ": " << buf << std::endl; - OutputDebugStringA(ss.str().c_str()); -} - -BOOL APIENTRY -DllMain(HMODULE module, DWORD reason, LPVOID reserved) -{ - log("> DllMain, reason=%d", reason); - - switch (reason) { - case DLL_PROCESS_ATTACH: - g_instance = module; - DisableThreadLibraryCalls(module); - break; - - case DLL_THREAD_ATTACH: - break; - case DLL_THREAD_DETACH: - break; - case DLL_PROCESS_DETACH: - break; - } - - log("< DllMain"); - return TRUE; -} - -//#pragma comment(linker, "/export:DllGetClassObject,PRIVATE") -STDAPI -DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppvObj) -{ - log("> DllGetClassObject"); - - HRESULT hr = E_OUTOFMEMORY; - *ppvObj = NULL; - - CClassFactory *classFactory = new CClassFactory(); - if (classFactory != NULL) { - hr = classFactory->QueryInterface(riid, ppvObj); - classFactory->Release(); - } - - log("< DllGetClassObject, hr=%d", hr); - return hr; -} - -//#pragma comment(linker, "/export:DllCanUnloadNow,PRIVATE") -STDAPI -DllCanUnloadNow() -{ - log("> DllCanUnloadNow, g_refCount=%d", g_refCount); - int r = g_refCount > 0 ? S_FALSE : S_OK; - log("< DllCanUnloadNow, g_refCount=%d, r=%d", g_refCount, r); - return r; -} - -//#pragma comment(linker, "/export:DllRegisterServer,PRIVATE") -STDAPI -DllRegisterServer() -{ - log("> DllRegisterServer"); - - /*HRESULT hr; - - CHAR module[MAX_PATH]; - if (GetModuleFileName(g_instance, module, ARRAYSIZE(module)) == 0) { - hr = HRESULT_FROM_WIN32(GetLastError()); - log("< DllRegisterServer, hr=%d", hr); - return hr; - } - - hr = registerInprocServer( - module, - g_CLSID, - "Apartment"); - - if (SUCCEEDED(hr)) { - hr = registerShellExtDataHandler( - "*", - g_CLSID); - } - - log("< DllRegisterServer, hr=%d", hr); - */ - - log("< DllRegisterServer"); - return S_OK; -} - -//#pragma comment(linker, "/export:DllUnregisterServer,PRIVATE") -STDAPI -DllUnregisterServer() -{ - log("> DllUnregisterServer"); - /* - HRESULT hr = S_OK; - - CHAR module[MAX_PATH]; - if (GetModuleFileName(g_instance, module, ARRAYSIZE(module)) == 0) { - hr = HRESULT_FROM_WIN32(GetLastError()); - log("< DllRegisterServer, hr=%d", hr); - return hr; - } - - hr = unregisterInprocServer(g_CLSID); - if (SUCCEEDED(hr)) { - hr = unregisterShellExtDataHandler("*", g_CLSID); - } - - log("< DllUnregisterServer, hr=%d", hr);*/ - - log("< DllUnregisterServer"); - return S_OK; -} -/* -HRESULT -registerInprocServer(CHAR* module, const CLSID& clsid, CHAR* threadModel) -{ - log("> registerInprocServer"); - - if (module == NULL || threadModel == NULL) { - return E_INVALIDARG; - } - - HRESULT hr; - - WCHAR CLASSID[MAX_PATH]; - CHAR szCLSID[MAX_PATH]; - StringFromGUID2(clsid, CLASSID, ARRAYSIZE(CLASSID)); - WideCharToMultiByte(CP_ACP, 0, CLASSID, -1, szCLSID, MAX_PATH, NULL, NULL); - - CHAR subkey[MAX_PATH]; - - // create the HKCR\CLSID\{}\InprocServer32 key. - hr = StringCchPrintf(subkey, ARRAYSIZE(subkey), "CLSID\\%s\\InprocServer32", szCLSID); - - if (SUCCEEDED(hr)) { - // set the default value of the InprocServer32 key to the - // path of the COM module. - HKEY key = CArchMiscWindows::addKey(HKEY_CLASSES_ROOT, subkey); - CArchMiscWindows::setValue(key, NULL, module); - - if (SUCCEEDED(hr)) { - // set the threading model of the component. - CArchMiscWindows::setValue(key, "ThreadingModel", threadModel); - } - } - - log("< registerInprocServer, hr=%d", hr); - return hr; -} - -HRESULT -unregisterInprocServer(const CLSID& clsid) -{ - log("> unregisterInprocServer"); - - HRESULT hr = S_OK; - - WCHAR CLASSID[MAX_PATH]; - CHAR szCLSID[MAX_PATH]; - StringFromGUID2(clsid, CLASSID, ARRAYSIZE(CLASSID)); - WideCharToMultiByte(CP_ACP, 0, CLASSID, -1, szCLSID, MAX_PATH, NULL, NULL); - - CHAR subkey[MAX_PATH]; - - // delete the HKCR\CLSID\{} key. - hr = StringCchPrintf(subkey, ARRAYSIZE(subkey), "CLSID\\%s", szCLSID); - if (SUCCEEDED(hr)) { - hr = HRESULT_FROM_WIN32(RegDeleteTree(HKEY_CLASSES_ROOT, subkey)); - } - - if (FAILED(hr)) { - log("< unregisterInprocServer, hr=FAILED"); - } - else { - log("< unregisterInprocServer, hr=%d", hr); - } - return hr; -} - -HRESULT -registerShellExtDataHandler(CHAR* fileType, const CLSID& clsid) -{ - log("> registerShellExtDataHandler"); - - if (fileType == NULL) { - return E_INVALIDARG; - } - - HRESULT hr; - - WCHAR szCLSID[MAX_PATH]; - CHAR CLASSID[MAX_PATH]; - StringFromGUID2(clsid, szCLSID, ARRAYSIZE(szCLSID)); - WideCharToMultiByte(CP_ACP, 0, szCLSID, -1, CLASSID, MAX_PATH, NULL, NULL); - - CHAR subkey[MAX_PATH]; - - // create the key HKCR\\shellex\DataHandler - hr = StringCchPrintf(subkey, ARRAYSIZE(subkey), "%s\\shellex\\DataHandler", fileType); - if (SUCCEEDED(hr)) { - // set the default value of the key. - HKEY key = CArchMiscWindows::addKey(HKEY_CLASSES_ROOT, subkey); - CArchMiscWindows::setValue(key, NULL, CLASSID); - } - - log("< registerShellExtDataHandler, hr=%d", hr); - return hr; -} - -HRESULT -unregisterShellExtDataHandler(CHAR* fileType, const CLSID& clsid) -{ - log("> unregisterShellExtDataHandler"); - - if (fileType == NULL) { - return E_INVALIDARG; - } - - HRESULT hr; - - WCHAR CLASSID[MAX_PATH]; - CHAR szCLSID[MAX_PATH]; - StringFromGUID2(clsid, CLASSID, ARRAYSIZE(CLASSID)); - WideCharToMultiByte(CP_ACP, 0, CLASSID, -1, szCLSID, MAX_PATH, NULL, NULL); - - CHAR subkey[MAX_PATH]; - - // remove the HKCR\\shellex\DataHandler key. - hr = StringCchPrintf(subkey, ARRAYSIZE(subkey), "%s\\shellex\\DataHandler", fileType); - if (SUCCEEDED(hr)) { - hr = HRESULT_FROM_WIN32(RegDeleteTree(HKEY_CLASSES_ROOT, subkey)); - } - - log("< unregisterShellExtDataHandler, hr=%d", hr); - return hr; -} -*/ -std::string -getFileExt(const char* filenameCStr) -{ - std::string filename = filenameCStr; - size_t findExt = filename.find_last_of(".", filename.size()); - if (findExt != std::string::npos) { - return filename.substr(findExt + 1, filename.size() - findExt - 1); - } - return ""; -} - -void -setDraggingFilename(const char* filename) -{ - log("> setDraggingFilename, filename='%s'", filename); - memcpy(g_draggingFilename, filename, MAX_PATH); - log("< setDraggingFilename, g_draggingFilename='%s'", g_draggingFilename); -} - -void -clearDraggingFilename() -{ - log("> clearDraggingFilename"); - g_draggingFilename[0] = NULL; - log("< clearDraggingFilename, g_draggingFilename='%s'", g_draggingFilename); -} - -void -getDraggingFilename(char* filename) -{ - log("> getDraggingFilename"); - memcpy(filename, g_draggingFilename, MAX_PATH); - log("< getDraggingFilename, filename='%s'", filename); -} diff --git a/src/lib/synwinxt/synwinxt.def b/src/lib/synwinxt/synwinxt.def deleted file mode 100644 index 9e44a04d..00000000 --- a/src/lib/synwinxt/synwinxt.def +++ /dev/null @@ -1,8 +0,0 @@ -LIBRARY "synwinxt" -EXPORTS - DllGetClassObject PRIVATE - DllCanUnloadNow PRIVATE - DllRegisterServer PRIVATE - DllUnregisterServer PRIVATE - getDraggingFilename - clearDraggingFilename diff --git a/src/lib/synwinxt/synwinxt.h b/src/lib/synwinxt/synwinxt.h deleted file mode 100644 index 89a21e6a..00000000 --- a/src/lib/synwinxt/synwinxt.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * synergy -- mouse and keyboard sharing utility - * Copyright (C) 2013 Bolton Software Ltd. - * - * This package is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * found in the file COPYING that should have accompanied this file. - * - * This package is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -#if defined(synwinxt_EXPORTS) -#define CSYNERGYSHELLEXE_API __declspec(dllexport) -#else -#define CSYNERGYSHELLEXE_API __declspec(dllimport) -#endif - -typedef void (*GetDraggingFilenameFunc)(char*); -typedef void (*ClearDraggingFilenameFunc)(); - -CSYNERGYSHELLEXE_API void getDraggingFilename(char* filename); -CSYNERGYSHELLEXE_API void clearDraggingFilename();