Index: src/ch/MainWnd.cpp =================================================================== diff -u -N -r306fbe693c70290af9de9a5779084a697de22d75 -r09cedb80782a75d4b4896a1f3d2dd535688bf840 --- src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision 306fbe693c70290af9de9a5779084a697de22d75) +++ src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision 09cedb80782a75d4b4896a1f3d2dd535688bf840) @@ -41,7 +41,6 @@ #include "FeedbackHandlerFactory.h" #include "../libchcore/TTask.h" #include "TTaskManagerWrapper.h" -#include "shortcuts.h" #include "CfgProperties.h" #include "resource.h" Index: src/ch/TWindowMessageFilterHelper.cpp =================================================================== diff -u -N --- src/ch/TWindowMessageFilterHelper.cpp (revision 0) +++ src/ch/TWindowMessageFilterHelper.cpp (revision 09cedb80782a75d4b4896a1f3d2dd535688bf840) @@ -0,0 +1,46 @@ +// ============================================================================ +// Copyright (C) 2001-2016 by Jozef Starosczyk +// ixen@copyhandler.com +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU Library General Public License +// (version 2) as published by the Free Software Foundation; +// +// This program 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 Library General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// ============================================================================ +#include "stdafx.h" +#include "TWindowMessageFilterHelper.h" +#include "WindowsVersion.h" + +typedef WINUSERAPI BOOL(WINAPI *ChangeWindowMessageFilterProc)(UINT message, DWORD dwFlag); + +bool TWindowMessageHelper::AllowToReceiveCopyDataMessages() +{ + if(WindowsVersion::IsWindowsXP()) + return true; + + HMODULE hMod = LoadLibrary(L"User32.dll"); + if(!hMod) + return false; + + ChangeWindowMessageFilterProc ChangeWindowMessageFilter = (ChangeWindowMessageFilterProc)GetProcAddress(hMod, "ChangeWindowMessageFilter"); + if(!ChangeWindowMessageFilter) + { + FreeLibrary(hMod); + return false; + } + + BOOL bResult = ChangeWindowMessageFilter(WM_COPYDATA, /*MSGFLT_ADD*/1); + + FreeLibrary(hMod); + + return bResult != false; +} Index: src/ch/TWindowMessageFilterHelper.h =================================================================== diff -u -N --- src/ch/TWindowMessageFilterHelper.h (revision 0) +++ src/ch/TWindowMessageFilterHelper.h (revision 09cedb80782a75d4b4896a1f3d2dd535688bf840) @@ -0,0 +1,28 @@ +// ============================================================================ +// Copyright (C) 2001-2016 by Jozef Starosczyk +// ixen@copyhandler.com +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU Library General Public License +// (version 2) as published by the Free Software Foundation; +// +// This program 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 Library General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// ============================================================================ +#ifndef __TWINDOWMESSAGEFILTERHELPER_H__ +#define __TWINDOWMESSAGEFILTERHELPER_H__ + +class TWindowMessageHelper +{ +public: + static bool AllowToReceiveCopyDataMessages(); +}; + +#endif Index: src/ch/ch.cpp =================================================================== diff -u -N -r306fbe693c70290af9de9a5779084a697de22d75 -r09cedb80782a75d4b4896a1f3d2dd535688bf840 --- src/ch/ch.cpp (.../ch.cpp) (revision 306fbe693c70290af9de9a5779084a697de22d75) +++ src/ch/ch.cpp (.../ch.cpp) (revision 09cedb80782a75d4b4896a1f3d2dd535688bf840) @@ -44,6 +44,7 @@ #include "resource.h" #include "../liblogger/TLogger.h" #include "../liblogger/TAsyncMultiLogger.h" +#include "TWindowMessageFilterHelper.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -487,6 +488,11 @@ LOG_ERROR(m_spLog) << L"Failed to initialize shell extension configuration. Shell extension will be inactive. Error: " << e.what(); } + // ================================= User Interface Privilege Isolation ================= + LOG_INFO(m_spLog) << _T("Enabling communication between non-admin explorer and admin Copy Handler"); + if(!TWindowMessageHelper::AllowToReceiveCopyDataMessages()) + LOG_WARNING(m_spLog) << _T("Failed to enable communication between non-admin explorer and admin Copy Handler"); + // ================================= Main window ======================================== LOG_INFO(m_spLog) << _T("Creating main application window"); // create main window Index: src/ch/ch.vc140.vcxproj =================================================================== diff -u -N -r306fbe693c70290af9de9a5779084a697de22d75 -r09cedb80782a75d4b4896a1f3d2dd535688bf840 --- src/ch/ch.vc140.vcxproj (.../ch.vc140.vcxproj) (revision 306fbe693c70290af9de9a5779084a697de22d75) +++ src/ch/ch.vc140.vcxproj (.../ch.vc140.vcxproj) (revision 09cedb80782a75d4b4896a1f3d2dd535688bf840) @@ -540,6 +540,7 @@ + @@ -791,6 +792,7 @@ + Index: src/ch/ch.vc140.vcxproj.filters =================================================================== diff -u -N -r306fbe693c70290af9de9a5779084a697de22d75 -r09cedb80782a75d4b4896a1f3d2dd535688bf840 --- src/ch/ch.vc140.vcxproj.filters (.../ch.vc140.vcxproj.filters) (revision 306fbe693c70290af9de9a5779084a697de22d75) +++ src/ch/ch.vc140.vcxproj.filters (.../ch.vc140.vcxproj.filters) (revision 09cedb80782a75d4b4896a1f3d2dd535688bf840) @@ -248,6 +248,9 @@ Source Files\Tools + + Source Files\Tools + @@ -424,6 +427,9 @@ Source Files\Tools + + Source Files\Tools +