From 8d7132819228e6c21b8a190f09ce16d509abdabd Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Wed, 30 Jul 2014 17:20:55 +0200 Subject: [PATCH 1/3] Windows Overlay Icons --- .gitignore | 145 +++++++ .../OCShellExtensions/OCOverlays/DllMain.cpp | 156 +++++++ .../OCOverlays/OCOverlay.cpp | 143 +++++++ .../OCShellExtensions/OCOverlays/OCOverlay.h | 49 +++ .../OCShellExtensions/OCOverlays/OCOverlay.rc | Bin 0 -> 4244 bytes .../OCOverlays/OCOverlayFactory.cpp | 104 +++++ .../OCOverlays/OCOverlayFactory.h | 41 ++ .../OCOverlayRegistrationHandler.cpp | 149 +++++++ .../OCOverlays/OCOverlayRegistrationHandler.h | 31 ++ .../OCOverlays/OCOverlays.def | 6 + .../OCOverlays/OCOverlays.vcxproj | 195 +++++++++ .../OCOverlays/OverlayConstants.h | 32 ++ .../OCOverlays/OverlayConstants.h.original | 32 ++ .../OCOverlays/ico/Error.ico | Bin 0 -> 30166 bytes .../OCOverlays/ico/Error_Shared.ico | Bin 0 -> 30166 bytes .../OCShellExtensions/OCOverlays/ico/OK.ico | Bin 0 -> 30166 bytes .../OCOverlays/ico/OK_Shared.ico | Bin 0 -> 30166 bytes .../OCShellExtensions/OCOverlays/ico/Sync.ico | Bin 0 -> 30166 bytes .../OCOverlays/ico/Sync_Shared.ico | Bin 0 -> 30166 bytes .../OCOverlays/ico/Warning.ico | Bin 0 -> 30166 bytes .../OCOverlays/ico/Warning_Shared.ico | Bin 0 -> 30166 bytes .../OCShellExtensions/OCOverlays/resource.h | Bin 0 -> 1626 bytes .../OCShellExtensions/OCOverlays/stdafx.h | 30 ++ .../OCShellExtensions/OCShellExtensions.sln | 49 +++ .../OCUtil/CommunicationSocket.cpp | 127 ++++++ .../OCUtil/CommunicationSocket.h | 42 ++ .../OCShellExtensions/OCUtil/FileUtil.cpp | 84 ++++ .../OCShellExtensions/OCUtil/FileUtil.h | 40 ++ .../OCShellExtensions/OCUtil/OCMessage.cpp | 74 ++++ .../OCShellExtensions/OCUtil/OCMessage.h | 42 ++ .../OCShellExtensions/OCUtil/OCUtil.vcxproj | 157 +++++++ .../OCShellExtensions/OCUtil/ParserUtil.cpp | 389 ++++++++++++++++++ .../OCShellExtensions/OCUtil/RegistryUtil.cpp | 70 ++++ .../OCShellExtensions/OCUtil/RegistryUtil.h | 35 ++ .../OCUtil/RemotePathChecker.cpp | 112 +++++ .../OCUtil/RemotePathChecker.h | 41 ++ .../OCShellExtensions/OCUtil/StringUtil.cpp | 32 ++ .../OCShellExtensions/OCUtil/StringUtil.h | 27 ++ .../OCShellExtensions/OCUtil/UtilConstants.h | 30 ++ .../OCUtilTest/OCUtilTest.cpp | 37 ++ .../OCUtilTest/OCUtilTest.filters | 33 ++ .../OCUtilTest/OCUtilTest.vcxproj | 97 +++++ .../OCShellExtensions/OCUtilTest/ReadMe.txt | 40 ++ .../OCShellExtensions/OCUtilTest/stdafx.cpp | 8 + .../OCShellExtensions/OCUtilTest/stdafx.h | 15 + .../OCShellExtensions/OCUtilTest/targetver.h | 8 + 46 files changed, 2702 insertions(+) create mode 100644 shell_integration/windows/OCShellExtensions/OCOverlays/DllMain.cpp create mode 100644 shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.cpp create mode 100644 shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.h create mode 100644 shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.rc create mode 100644 shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayFactory.cpp create mode 100644 shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayFactory.h create mode 100644 shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayRegistrationHandler.cpp create mode 100644 shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayRegistrationHandler.h create mode 100644 shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlays.def create mode 100644 shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlays.vcxproj create mode 100644 shell_integration/windows/OCShellExtensions/OCOverlays/OverlayConstants.h create mode 100644 shell_integration/windows/OCShellExtensions/OCOverlays/OverlayConstants.h.original create mode 100644 shell_integration/windows/OCShellExtensions/OCOverlays/ico/Error.ico create mode 100644 shell_integration/windows/OCShellExtensions/OCOverlays/ico/Error_Shared.ico create mode 100644 shell_integration/windows/OCShellExtensions/OCOverlays/ico/OK.ico create mode 100644 shell_integration/windows/OCShellExtensions/OCOverlays/ico/OK_Shared.ico create mode 100644 shell_integration/windows/OCShellExtensions/OCOverlays/ico/Sync.ico create mode 100644 shell_integration/windows/OCShellExtensions/OCOverlays/ico/Sync_Shared.ico create mode 100644 shell_integration/windows/OCShellExtensions/OCOverlays/ico/Warning.ico create mode 100644 shell_integration/windows/OCShellExtensions/OCOverlays/ico/Warning_Shared.ico create mode 100644 shell_integration/windows/OCShellExtensions/OCOverlays/resource.h create mode 100644 shell_integration/windows/OCShellExtensions/OCOverlays/stdafx.h create mode 100644 shell_integration/windows/OCShellExtensions/OCShellExtensions.sln create mode 100644 shell_integration/windows/OCShellExtensions/OCUtil/CommunicationSocket.cpp create mode 100644 shell_integration/windows/OCShellExtensions/OCUtil/CommunicationSocket.h create mode 100644 shell_integration/windows/OCShellExtensions/OCUtil/FileUtil.cpp create mode 100644 shell_integration/windows/OCShellExtensions/OCUtil/FileUtil.h create mode 100644 shell_integration/windows/OCShellExtensions/OCUtil/OCMessage.cpp create mode 100644 shell_integration/windows/OCShellExtensions/OCUtil/OCMessage.h create mode 100644 shell_integration/windows/OCShellExtensions/OCUtil/OCUtil.vcxproj create mode 100644 shell_integration/windows/OCShellExtensions/OCUtil/ParserUtil.cpp create mode 100644 shell_integration/windows/OCShellExtensions/OCUtil/RegistryUtil.cpp create mode 100644 shell_integration/windows/OCShellExtensions/OCUtil/RegistryUtil.h create mode 100644 shell_integration/windows/OCShellExtensions/OCUtil/RemotePathChecker.cpp create mode 100644 shell_integration/windows/OCShellExtensions/OCUtil/RemotePathChecker.h create mode 100644 shell_integration/windows/OCShellExtensions/OCUtil/StringUtil.cpp create mode 100644 shell_integration/windows/OCShellExtensions/OCUtil/StringUtil.h create mode 100644 shell_integration/windows/OCShellExtensions/OCUtil/UtilConstants.h create mode 100644 shell_integration/windows/OCShellExtensions/OCUtilTest/OCUtilTest.cpp create mode 100644 shell_integration/windows/OCShellExtensions/OCUtilTest/OCUtilTest.filters create mode 100644 shell_integration/windows/OCShellExtensions/OCUtilTest/OCUtilTest.vcxproj create mode 100644 shell_integration/windows/OCShellExtensions/OCUtilTest/ReadMe.txt create mode 100644 shell_integration/windows/OCShellExtensions/OCUtilTest/stdafx.cpp create mode 100644 shell_integration/windows/OCShellExtensions/OCUtilTest/stdafx.h create mode 100644 shell_integration/windows/OCShellExtensions/OCUtilTest/targetver.h diff --git a/.gitignore b/.gitignore index eed2de186..e1cd73027 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,148 @@ build* cscope.* tags t1.cfg + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +build/ +bld/ +[Bb]in/ +[Oo]bj/ + +# Roslyn cache directories +*.ide/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +#NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# TFS 2012 Local Workspace +$tf/ + +# NCrunch +_NCrunch_* +.*crunch*.local.xml + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +## TODO: Comment the next line if you want to checkin your +## web deploy settings but do note that will include unencrypted +## passwords +*.pubxml + +# NuGet Packages +packages/* +*.nupkg +## TODO: If the tool you use requires repositories.config +## uncomment the next line +#!packages/repositories.config + +# Enable "build/" folder in the NuGet Packages folder since +# NuGet packages use it for MSBuild targets. +# This line needs to be after the ignore of the build folder +# (and the packages folder if the line above has been uncommented) +!packages/build/ + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Microsoft Fakes +FakesAssemblies/ diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/DllMain.cpp b/shell_integration/windows/OCShellExtensions/OCOverlays/DllMain.cpp new file mode 100644 index 000000000..84b128dd4 --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/DllMain.cpp @@ -0,0 +1,156 @@ +/** + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library 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 Lesser General Public License for more + * details. + */ + +#include "OCOverlayRegistrationHandler.h" +#include "OCOverlayFactory.h" +#include "stdafx.h" + +HINSTANCE instanceHandle = NULL; + +long dllReferenceCount = 0; + +BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved) +{ + switch (dwReason) + { + case DLL_PROCESS_ATTACH: + instanceHandle = hModule; + DisableThreadLibraryCalls(hModule); + break; + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + + return TRUE; +} + +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv) +{ + HRESULT hResult = CLASS_E_CLASSNOTAVAILABLE; + GUID guid; + + hResult = CLSIDFromString(OVERLAY_GUID, (LPCLSID)&guid); + + if (hResult != S_OK) { + return hResult; + } + + if (!IsEqualCLSID(guid, rclsid)) { + return hResult; + } + + hResult = E_OUTOFMEMORY; + + wchar_t szModule[MAX_PATH]; + + if (GetModuleFileName(instanceHandle, szModule, ARRAYSIZE(szModule)) == 0) { + hResult = HRESULT_FROM_WIN32(GetLastError()); + + return hResult; + } + + OCOverlayFactory* ocOverlayFactory = new OCOverlayFactory(szModule); + + if (ocOverlayFactory) { + hResult = ocOverlayFactory->QueryInterface(riid, ppv); + ocOverlayFactory->Release(); + } + return hResult; +} + +STDAPI DllCanUnloadNow(void) +{ + return dllReferenceCount > 0 ? S_FALSE : S_OK; + + return S_FALSE; +} + +HRESULT _stdcall DllRegisterServer(void) +{ + HRESULT hResult = S_OK; + + wchar_t szModule[MAX_PATH]; + + if (GetModuleFileName(instanceHandle, szModule, ARRAYSIZE(szModule)) == 0) + { + hResult = HRESULT_FROM_WIN32(GetLastError()); + + return hResult; + } + + GUID guid; + + hResult = CLSIDFromString(OVERLAY_GUID, (LPCLSID)&guid); + + if (hResult != S_OK) + { + return hResult; + } + + hResult = OCOverlayRegistrationHandler::RegisterCOMObject(szModule, guid); + + if(!SUCCEEDED(hResult)) + { + return hResult; + } + + hResult = OCOverlayRegistrationHandler::MakeRegistryEntries(guid, OVERLAY_NAME); + + if(!SUCCEEDED(hResult)) + { + return hResult; + } + + return hResult; +} + +STDAPI DllUnregisterServer(void) +{ + HRESULT hResult = S_OK; + + wchar_t szModule[MAX_PATH]; + + if (GetModuleFileNameW(instanceHandle, szModule, ARRAYSIZE(szModule)) == 0) + { + hResult = HRESULT_FROM_WIN32(GetLastError()); + return hResult; + } + + GUID guid; + + hResult = CLSIDFromString(OVERLAY_GUID, (LPCLSID)&guid); + + if (hResult != S_OK) + { + return hResult; + } + + hResult = OCOverlayRegistrationHandler::UnregisterCOMObject(guid); + + if(!SUCCEEDED(hResult)) + { + return hResult; + } + + hResult = OCOverlayRegistrationHandler::RemoveRegistryEntries(OVERLAY_NAME); + + if (!SUCCEEDED(hResult)) + { + return hResult; + } + + return hResult; +} diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.cpp b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.cpp new file mode 100644 index 000000000..2fc947121 --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.cpp @@ -0,0 +1,143 @@ +/** + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library 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 Lesser General Public License for more + * details. + */ + +#include "OCOverlay.h" + +#include "RegistryUtil.h" +#include "UtilConstants.h" +#include "RemotePathChecker.h" + +#include "resource.h" + +#include +#include +#include + +using namespace std; + +#pragma comment(lib, "shlwapi.lib") + +extern HINSTANCE instanceHandle; + +#define IDM_DISPLAY 0 +#define IDB_OK 101 + +OCOverlay::OCOverlay() + : _communicationSocket(0) + , _referenceCount(1) + , _checker(new RemotePathChecker(PORT)) + +{ +} + +OCOverlay::~OCOverlay(void) +{ +} + +IFACEMETHODIMP_(ULONG) OCOverlay::AddRef() +{ + return InterlockedIncrement(&_referenceCount); +} + +IFACEMETHODIMP OCOverlay::QueryInterface(REFIID riid, void **ppv) +{ + HRESULT hr = S_OK; + + if (IsEqualIID(IID_IUnknown, riid) || IsEqualIID(IID_IShellIconOverlayIdentifier, riid)) + { + *ppv = static_cast(this); + } + else + { + hr = E_NOINTERFACE; + *ppv = NULL; + } + + if (*ppv) + { + AddRef(); + } + + return hr; +} + +IFACEMETHODIMP_(ULONG) OCOverlay::Release() +{ + ULONG cRef = InterlockedDecrement(&_referenceCount); + if (0 == cRef) + { + delete this; + } + + return cRef; +} + +IFACEMETHODIMP OCOverlay::GetPriority(int *pPriority) +{ + pPriority = 0; + + return S_OK; +} + + IFACEMETHODIMP OCOverlay::IsMemberOf(PCWSTR pwszPath, DWORD dwAttrib) +{ + + //if(!_IsOverlaysEnabled()) + //{ + // return MAKE_HRESULT(S_FALSE, 0, 0); + //} + + bool isDir = dwAttrib & FILE_ATTRIBUTE_DIRECTORY; + + if (!_checker->IsMonitoredPath(pwszPath, isDir)) { + return MAKE_HRESULT(S_FALSE, 0, 0); + } + + return MAKE_HRESULT(S_OK, 0, 0); +} + +IFACEMETHODIMP OCOverlay::GetOverlayInfo(PWSTR pwszIconFile, int cchMax, int *pIndex, DWORD *pdwFlags) +{ + *pIndex = 0; + *pdwFlags = ISIOI_ICONFILE | ISIOI_ICONINDEX; + *pIndex = 2; + + if (GetModuleFileName(instanceHandle, pwszIconFile, cchMax) == 0) { + HRESULT hResult = HRESULT_FROM_WIN32(GetLastError()); + wcerr << L"IsOK? " << (hResult == S_OK) << L" with path " << pwszIconFile << L", index " << *pIndex << endl; + return hResult; + } + + return S_OK; +} + + +bool OCOverlay::_IsOverlaysEnabled() +{ + //int enable; + bool success = false; + + + + + //if(RegistryUtil::ReadRegistry(REGISTRY_ROOT_KEY, REGISTRY_ENABLE_OVERLAY, &enable)) + //{ + // if(enable) { + // success = true; + // } + //} + + return success; +} + diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.h b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.h new file mode 100644 index 000000000..498800a66 --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.h @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library 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 Lesser General Public License for more + * details. + */ + +#ifndef OCOVERLAY_H +#define OCOVERLAY_H + +#include "stdafx.h" + +#pragma once + +class RemotePathChecker; + +class OCOverlay : public IShellIconOverlayIdentifier + +{ +public: + OCOverlay(); + + IFACEMETHODIMP_(ULONG) AddRef(); + IFACEMETHODIMP GetOverlayInfo(PWSTR pwszIconFile, int cchMax, int *pIndex, DWORD *pdwFlags); + IFACEMETHODIMP GetPriority(int *pPriority); + IFACEMETHODIMP IsMemberOf(PCWSTR pwszPath, DWORD dwAttrib); + IFACEMETHODIMP QueryInterface(REFIID riid, void **ppv); + IFACEMETHODIMP_(ULONG) Release(); + +protected: + ~OCOverlay(void); + +private: + //bool _GenerateMessage(const wchar_t*, std::wstring*); + + bool _IsOverlaysEnabled(); + long _referenceCount; + CommunicationSocket* _communicationSocket; + RemotePathChecker* _checker; +}; + +#endif \ No newline at end of file diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.rc b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.rc new file mode 100644 index 0000000000000000000000000000000000000000..8d4d30b6d48b50535658f4c44ddc2e3a4a7bc80c GIT binary patch literal 4244 zcmds)+ip@p6o%KeiSIDNjg6-D@C2n)BvNXiEt-&!21J@r+OWZD(q~t{e`b%IHejI_ zXeOJPz4n@!fBsn~e*HYK19Ns_SJt+n-B`lYwGpxlWQmRK()zp|*$bMpulB_TJVWFo z`VO)oz2=P>wHZ6!wAz*3qO)&L?FqXa_&$$xz}G(79j}{Pn7?m5%Xw|h%zM4ApQp7C z?W5K0%+9T7WjnQ&)$AB)k#W^3_8Cc?-xDh!sW6WF3&ZZUh%WZdO7JqzaTk_u?3(kB zU`IThaq3U}mO1qi=M*2u$lvhH-^ltqxa8Kqr}Jj{-#x}6qF^0kxRNDxIrnC^5t)zc z?p7bsIc|4=|Mk6J_Bicx?tH*o^us!%;FXE(WmrKn=q$@EK>l&TNj|V^@t=zY*ab=S|vLb#CJDra=IcpMsnpkv*{S%bS5WU?H(L?vi`*_^J(-dPu zQ;f)pH;dL5?`XH8$}}1w)O+k5meMBM4E{)_&oKGw?9N9Y#iBm?ckq-DgQQX9_nWUB z#y(r!qH*b~162&l=EGEX#7yTIR<)tb<qpBi7Bj8SW z7ZT-B;R&-<$*7h|>___bnm*)4AujvMLGep=uBcO^o$|z6pY&y-qUw!_Wc4VQVsB#M z$DC5xe8}E9;Z17st1+mmX;9Tn_IVr(TDJ#-V!rbih!jaD7-mP?Akw<)`H2W;xg%OC9@Ejl7JcgqF`x`mu>JgynU+HQ3bS~ zmsuRM>^vThRqQO!8IM!NO~>!u8pm7_d*%Nw_x8V5Xxsf;Qw_8F-&*8xw{CeFjSw!k Q_W}7$Ie78ES$3`T8y~~`&j0`b literal 0 HcmV?d00001 diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayFactory.cpp b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayFactory.cpp new file mode 100644 index 000000000..f2d344c02 --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayFactory.cpp @@ -0,0 +1,104 @@ +/** + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library 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 Lesser General Public License for more + * details. + */ + +#include "OCOverlayFactory.h" +#include "OCOverlay.h" + +extern long dllReferenceCount; + +OCOverlayFactory::OCOverlayFactory(wchar_t* path) + : _referenceCount(1) +{ + InterlockedIncrement(&dllReferenceCount); +} + +OCOverlayFactory::~OCOverlayFactory() +{ + InterlockedDecrement(&dllReferenceCount); +} + +IFACEMETHODIMP OCOverlayFactory::QueryInterface(REFIID riid, void **ppv) +{ + HRESULT hResult = S_OK; + + if (IsEqualIID(IID_IUnknown, riid) || + IsEqualIID(IID_IClassFactory, riid)) + { + *ppv = static_cast(this); + AddRef(); + } + else + { + hResult = E_NOINTERFACE; + *ppv = NULL; + } + + return hResult; +} + +IFACEMETHODIMP_(ULONG) OCOverlayFactory::AddRef() +{ + return InterlockedIncrement(&_referenceCount); +} + +IFACEMETHODIMP_(ULONG) OCOverlayFactory::Release() +{ + ULONG cRef = InterlockedDecrement(&_referenceCount); + + if (0 == cRef) + { + delete this; + } + return cRef; +} + +IFACEMETHODIMP OCOverlayFactory::CreateInstance( + IUnknown *pUnkOuter, REFIID riid, void **ppv) +{ + HRESULT hResult = CLASS_E_NOAGGREGATION; + + if (pUnkOuter != NULL) + { + return hResult; + } + + hResult = E_OUTOFMEMORY; + + OCOverlay *lrOverlay = + new (std::nothrow) OCOverlay(); + + if (!lrOverlay) + { + return hResult; + } + + hResult = lrOverlay->QueryInterface(riid, ppv); + + lrOverlay->Release(); + + return hResult; +} + +IFACEMETHODIMP OCOverlayFactory::LockServer(BOOL fLock) +{ + if (fLock) + { + InterlockedIncrement(&dllReferenceCount); + } + else + { + InterlockedDecrement(&dllReferenceCount); + } + return S_OK; +} \ No newline at end of file diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayFactory.h b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayFactory.h new file mode 100644 index 000000000..6751e5b57 --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayFactory.h @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library 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 Lesser General Public License for more + * details. + */ + +#ifndef OCOVERLAYFACTORY_H +#define OCOVERLAYFACTORY_H + +#pragma once + +#include "stdafx.h" + +class OCOverlayFactory : public IClassFactory +{ +public: + OCOverlayFactory(wchar_t* path); + + IFACEMETHODIMP_(ULONG) AddRef(); + IFACEMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv); + IFACEMETHODIMP LockServer(BOOL fLock); + IFACEMETHODIMP QueryInterface(REFIID riid, void **ppv); + IFACEMETHODIMP_(ULONG) Release(); + +protected: + ~OCOverlayFactory(); + +private: + long _referenceCount; + wchar_t* _path; +}; + +#endif \ No newline at end of file diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayRegistrationHandler.cpp b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayRegistrationHandler.cpp new file mode 100644 index 000000000..3fc0729f1 --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayRegistrationHandler.cpp @@ -0,0 +1,149 @@ +/** + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library 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 Lesser General Public License for more + * details. + */ + +#include "OCOverlayRegistrationHandler.h" +#include "stdafx.h" + +#include +#include + +using namespace std; + +HRESULT OCOverlayRegistrationHandler::MakeRegistryEntries(const CLSID& clsid, PWSTR friendlyName) +{ + HRESULT hResult; + HKEY shellOverlayKey = NULL; + hResult = HRESULT_FROM_WIN32(RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGISTRY_OVERLAY_KEY, 0, KEY_WRITE, &shellOverlayKey)); + if (!SUCCEEDED(hResult)) { + hResult = RegCreateKey(HKEY_LOCAL_MACHINE, REGISTRY_OVERLAY_KEY, &shellOverlayKey); + if(!SUCCEEDED(hResult)) { + return hResult; + } + } + + HKEY syncExOverlayKey = NULL; + hResult = HRESULT_FROM_WIN32(RegCreateKeyEx(shellOverlayKey, friendlyName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &syncExOverlayKey, NULL)); + + if (!SUCCEEDED(hResult)) { + return hResult; + } + + wchar_t stringCLSID[MAX_PATH]; + StringFromGUID2(clsid, stringCLSID, ARRAYSIZE(stringCLSID)); + LPCTSTR value = stringCLSID; + hResult = RegSetValueEx(syncExOverlayKey, NULL, 0, REG_SZ, (LPBYTE)value, (DWORD)((wcslen(value)+1) * sizeof(TCHAR))); + if (!SUCCEEDED(hResult)) { + return hResult; + } + + return hResult; +} + +HRESULT OCOverlayRegistrationHandler::RemoveRegistryEntries(PWSTR friendlyName) +{ + HRESULT hResult; + HKEY shellOverlayKey = NULL; + hResult = HRESULT_FROM_WIN32(RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGISTRY_OVERLAY_KEY, 0, KEY_WRITE, &shellOverlayKey)); + + if (!SUCCEEDED(hResult)) { + return hResult; + } + + HKEY syncExOverlayKey = NULL; + hResult = HRESULT_FROM_WIN32(RegDeleteKeyEx(shellOverlayKey, friendlyName, DELETE, 0)); + if (!SUCCEEDED(hResult)) { + return hResult; + } + + return hResult; +} + +HRESULT OCOverlayRegistrationHandler::RegisterCOMObject(PCWSTR modulePath, const CLSID& clsid) +{ + if (modulePath == NULL) { + return E_FAIL; + } + + wchar_t stringCLSID[MAX_PATH]; + StringFromGUID2(clsid, stringCLSID, ARRAYSIZE(stringCLSID)); + HRESULT hResult; + HKEY hKey = NULL; + + hResult = HRESULT_FROM_WIN32(RegOpenKeyEx(HKEY_CLASSES_ROOT, REGISTRY_CLSID, 0, KEY_WRITE, &hKey)); + if (!SUCCEEDED(hResult)) { + return hResult; + } + + HKEY clsidKey = NULL; + hResult = HRESULT_FROM_WIN32(RegCreateKeyEx(hKey, stringCLSID, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &clsidKey, NULL)); + if(!SUCCEEDED(hResult)) { + return hResult; + } + + HKEY inprocessKey = NULL; + hResult = HRESULT_FROM_WIN32(RegCreateKeyEx(clsidKey, REGISTRY_IN_PROCESS, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &inprocessKey, NULL)); + if(!SUCCEEDED(hResult)) { + return hResult; + } + + DWORD cbData = lstrlen(modulePath) * sizeof(*modulePath); + hResult = HRESULT_FROM_WIN32(RegSetValue(inprocessKey, NULL, REG_SZ, modulePath, cbData)); + + if(!SUCCEEDED(hResult)) { + return hResult; + } + + hResult = HRESULT_FROM_WIN32(RegSetValueEx(inprocessKey, REGISTRY_THREADING, 0, REG_SZ, (LPBYTE)REGISTRY_APARTMENT, (DWORD)((wcslen(REGISTRY_APARTMENT)+1) * sizeof(TCHAR)))); + if(!SUCCEEDED(hResult)) { + return hResult; + } + + hResult = HRESULT_FROM_WIN32(RegSetValueEx(inprocessKey, REGISTRY_VERSION, 0, REG_SZ, (LPBYTE)REGISTRY_VERSION_NUMBER, (DWORD)(wcslen(REGISTRY_VERSION_NUMBER)+1) * sizeof(TCHAR))); + if(!SUCCEEDED(hResult)) { + return hResult; + } + + return S_OK; +} + +HRESULT OCOverlayRegistrationHandler::UnregisterCOMObject(const CLSID& clsid) +{ + wchar_t stringCLSID[MAX_PATH]; + + StringFromGUID2(clsid, stringCLSID, ARRAYSIZE(stringCLSID)); + HRESULT hResult; + HKEY hKey = NULL; + hResult = HRESULT_FROM_WIN32(RegOpenKeyEx(HKEY_CLASSES_ROOT, REGISTRY_CLSID, 0, DELETE, &hKey)); + if (!SUCCEEDED(hResult)) { + return hResult; + } + + HKEY clsidKey = NULL; + hResult = HRESULT_FROM_WIN32(RegOpenKeyEx(hKey, stringCLSID, 0, DELETE, &clsidKey)); + if(!SUCCEEDED(hResult)) { + return hResult; + } + + hResult = HRESULT_FROM_WIN32(RegDeleteKeyEx(clsidKey, REGISTRY_IN_PROCESS, DELETE, 0)); + if(!SUCCEEDED(hResult)) { + return hResult; + } + + hResult = HRESULT_FROM_WIN32(RegDeleteKeyEx(hKey, stringCLSID, DELETE, 0)); + if(!SUCCEEDED(hResult)) { + return hResult; + } + + return S_OK; +} \ No newline at end of file diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayRegistrationHandler.h b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayRegistrationHandler.h new file mode 100644 index 000000000..1fdef93a7 --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayRegistrationHandler.h @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library 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 Lesser General Public License for more + * details. + */ + +#ifndef OCOVERLAYREGISTRATIONHANDLER_H +#define OCOVERLAYREGISTRATIONHANDLER_H + +#pragma once + +#include "stdafx.h" + +class __declspec(dllexport) OCOverlayRegistrationHandler +{ + public: + static HRESULT MakeRegistryEntries(const CLSID& clsid, PWSTR fileType); + static HRESULT RegisterCOMObject(PCWSTR modulePath, const CLSID& clsid); + static HRESULT RemoveRegistryEntries(PWSTR friendlyName); + static HRESULT UnregisterCOMObject(const CLSID& clsid); +}; + +#endif \ No newline at end of file diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlays.def b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlays.def new file mode 100644 index 000000000..8cde2bd02 --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlays.def @@ -0,0 +1,6 @@ +LIBRARY +EXPORTS + DllGetClassObject PRIVATE + DllCanUnloadNow PRIVATE + DllRegisterServer PRIVATE + DllUnregisterServer PRIVATE \ No newline at end of file diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlays.vcxproj b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlays.vcxproj new file mode 100644 index 000000000..b9f352b22 --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlays.vcxproj @@ -0,0 +1,195 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {42EFEC79-5ACA-4F76-955F-15CE4340F6BC} + OCOverlays + + + + DynamicLibrary + true + Unicode + v120_xp + + + DynamicLibrary + true + Unicode + v120_xp + + + DynamicLibrary + false + true + Unicode + + + DynamicLibrary + false + true + Unicode + Windows7.1SDK + + + + + + + + + + + + + + + + + + + $(SolutionDir)$(Configuration)\$(Platform)\ + $(Configuration)\$(Platform)\ + $(ProjectName)_x86 + .dll + + + $(SolutionDir)$(Configuration)\$(Platform)\ + $(Configuration)\$(Platform)\ + $(ProjectName)_x64 + .dll + + + $(SolutionDir)$(Configuration)\$(Platform)\ + $(Configuration)\$(Platform)\ + $(ProjectName)_x86 + .dll + + + $(SolutionDir)$(Configuration)\$(Platform)\ + $(Configuration)\$(Platform)\ + $(ProjectName)_x64 + .dll + + + + Level3 + Disabled + ..\OCUtil;%(AdditionalIncludeDirectories) + false + + + true + ..\$(Configuration)\$(Platform); + OCUtil_x86.lib;%(AdditionalDependencies) + OCOverlays.def + + + + + Level3 + Disabled + ..\OCUtil;%(AdditionalIncludeDirectories) + false + + + true + ..\$(Configuration)\$(Platform); + OCUtil_x64.lib;%(AdditionalDependencies) + OCOverlays.def + + + + + Level3 + MaxSpeed + true + true + ..\OCUtil;%(AdditionalIncludeDirectories) + + + true + true + true + ..\$(Configuration)\$(Platform); + OCUtil_x86.lib;%(AdditionalDependencies) + OCOverlays.def + + + + + Level3 + MaxSpeed + true + true + ..\OCUtil;%(AdditionalIncludeDirectories) + + + true + true + true + ..\$(Configuration)\$(Platform); + OCUtil_x64.lib;%(AdditionalDependencies) + OCOverlays.def + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OverlayConstants.h b/shell_integration/windows/OCShellExtensions/OCOverlays/OverlayConstants.h new file mode 100644 index 000000000..9df0bc5d0 --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/OverlayConstants.h @@ -0,0 +1,32 @@ +/** +* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. +* +* This library is free software; you can redistribute it and/or modify it under +* the terms of the GNU Lesser General Public License as published by the Free +* Software Foundation; either version 2.1 of the License, or (at your option) +* any later version. +* +* This library 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 Lesser General Public License for more +* details. +*/ + +#define OVERLAY_ID 1 +#define OVERLAY_GUID L"{0960F09E-F328-48A3-B746-276B1E3C3722}" +#define OVERLAY_NAME L"OwnCloudStatusOverlay" + +#define REGISTRY_OVERLAY_KEY L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ShellIconOverlayIdentifiers" +#define REGISTRY_CLSID L"CLSID" +#define REGISTRY_IN_PROCESS L"InprocServer32" +#define REGISTRY_THREADING L"ThreadingModel" +#define REGISTRY_APARTMENT L"Apartment" +#define REGISTRY_VERSION L"Version" +#define REGISTRY_VERSION_NUMBER L"1.0" + +//Registry values for running +#define REGISTRY_ENABLE_OVERLAY L"EnableOverlay" + +#define GET_FILE_OVERLAY_ID L"getFileIconId" + +#define PORT 33001 \ No newline at end of file diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OverlayConstants.h.original b/shell_integration/windows/OCShellExtensions/OCOverlays/OverlayConstants.h.original new file mode 100644 index 000000000..e244e1515 --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/OverlayConstants.h.original @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library 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 Lesser General Public License for more + * details. + */ + +#define OVERLAY_ID [$overlay.id$] +#define OVERLAY_GUID L"[$overlay.guid$]" +#define OVERLAY_NAME L"[$overlay.name$]" + +#define REGISTRY_OVERLAY_KEY L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ShellIconOverlayIdentifiers" +#define REGISTRY_CLSID L"CLSID" +#define REGISTRY_IN_PROCESS L"InprocServer32" +#define REGISTRY_THREADING L"ThreadingModel" +#define REGISTRY_APARTMENT L"Apartment" +#define REGISTRY_VERSION L"Version" +#define REGISTRY_VERSION_NUMBER L"1.0" + +//Registry values for running +#define REGISTRY_ENABLE_OVERLAY L"EnableOverlay" + +#define GET_FILE_OVERLAY_ID L"getFileIconId" + +#define PORT 33001 diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/ico/Error.ico b/shell_integration/windows/OCShellExtensions/OCOverlays/ico/Error.ico new file mode 100644 index 0000000000000000000000000000000000000000..ebcaa7f98c4140b1afc71401e113e668e6cc7113 GIT binary patch literal 30166 zcmeHPdvH|M89!;r-c5G%pa}wz>?7nwf{=$AW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*g?~Tqu+AuP)rgh(JG5cXG=^}$k>|cLhqU8*9k2QN!RG;ACpmWR zAGntCG;P*T#*;j6`8taBAU^KroNFw39dE0a)8I3h<5e*!cvb%S=Pb@!#H-%J^>j!K zuQCrcYYXFFT`vRbr<`{!aq>J={YAqu9~-$u-;&#EdrzBdj!ok~DqgH(c1;tX8ILqA zR(?HRdr>DC5DW+g1OtKr!GK^uFd!HZ3 literal 0 HcmV?d00001 diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/ico/Error_Shared.ico b/shell_integration/windows/OCShellExtensions/OCOverlays/ico/Error_Shared.ico new file mode 100644 index 0000000000000000000000000000000000000000..02c963937b94281313b1e6d85db9ac0b0031f7ac GIT binary patch literal 30166 zcmeHPc~})kwr@=od9JvA*#s4X5Z7T6C&`Hi-~|AfPDARp1JWAOcEM)Tl{B*@P${LcMdU`gB*{g?mxnKl!@&iql

N;0ZdMSOCAwv|9e#*W*-($etu`k>foO*rA%w256loWRFA2Qj;$ zf&46X^zeSn?bY8_u9e&S1SaH7p0SG+AGyTVL>y%iTTieNQ&ZV<3sSx%28)UNdYU! z-O0jMyv9Cw=O3)H)Ye#6S9d?P9~7`PDfoAp%o1~)&G_G3wmQ6$4WF9A-hMyh?7@O; zwrJi=<={sXDo{7*Vmni|aSV7~ zUTUkXC@Xo2+G=ua^vFT}kt+uWY+m<2&!&8Oys~_`L$0cvd+OAw0IiLAU^37H41{^X zO)%dgWjGHTtSF4R&)u14INV?h3+A~P?ye}s#l;M>{V}g=|Bu>9ve+WpTS6^xAI$pw z49(RxaG6=44Q3^{n1%9ocpeJb!gDc5!lc~;>MC##Y=;Tk$?Zw6B^2)y>ZCo|E%XM5 zO8Qk@p}d`r-$6eB!S;$G?t@s6M^L2N+;v;s4!{j56fmG9J@yi>naO0Jrx?iJEantG z*Qj$2&M}qGx}Rfk9>RIX5Aws1@wo|87(U>1k-YEt{7&z2o452IA8i|WcWfo(L;eqL z%MXt#+ud}zF4mLW+|(G=-q!Y6dwct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ellExtensions/OCOverlays/ico/OK.ico new file mode 100644 index 0000000000000000000000000000000000000000..f285d9c757c45178a4bfa50025351366e0dc0580 GIT binary patch literal 30166 zcmeHP3viUx6}~A+b~j7N3rHi6L_uNN320+!cqF?CGzn4A@K8%hfT?bAI;dramMPUx z%M_;wl_?=EyGcldhJ=TNSFwOnEvR$_9~FxvG{y29OBuixiRAX2`~PS6|Mw9$>~1#0 z+{@g(_rI_6o$sD|`S%gR#fH$l5GCjIlN494!g zSFOLBvEO`4|2*np#zx|p5MdZ02NGt5aeV@3G0F9%3(^~>9m!~((U#s+_NsY($ta(8 z0Sc08ix+0L%;wYH{1qRy=f^y2M+MJlex%LpC`=E~MOU2OSoYT+9bUozeExmDp=}?( zbH^MpM%u=yi*yYGJY+OaKZSCK@0`c0PPFi+kE{{>`){1OB0v{i@qkyR?ncZQNA7-t z*L=E*4}*NlhRKiW8U}bsd|`ZUM)S;5GzN0fzhTNo2D}F7;!|vT!7@0ty6CyIn$q8= z)E3R^PG6tFWPxO$8w~W}us`^TzlJg%L=1YLK}_}>o@2Lh=E{MQyB~6(UyjQz#>jEO zI5<|Y0c6{tugm4)cKAm)a-ck@AwU-PLAiDq2ged)1l5@_lp`=hf9!{2C^`fwALXbR zM2h;~N+5kHy_GR!AIU&B8TcJoEAA<{*U+A`9P*z)40fN%0-08b_}+wJDZb!z5zK1} zzMWY6{ic+L()Us~Ja95~!-MblTVJ$2p(cNF7u`ayg8%zX>#WcB|HIUO(R+b5O>dfh zDY15J<+zC^rZX)$DMo^j1wUoa~)iTd7&j>0X9jB@^iH<$4idL-AkqBZT&pQeXNW${)Sk#{YTs9DnEH$J}=4Mc#4qD_-CFNB8?J@i3tAp)<@m zE-^Hzp57@94}MBxmmXNmvjGP_KYOf3@UY;W)jAH+Hw}DFLq-{YkcTDbL6ImCe_ospJUQatz2z>{NAVdXV)(9BNvbJ>|IX? z49N{8E>G{!bEajvW$8`RE@|az^RvJvf8lcQ;XCGXT%!q&!X=?g)s0{fAv(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R@5j7gnZ8)=%+S UU9cQZ(H8H&Ph6JVur}=ZKipkf4FCWD literal 0 HcmV?d00001 diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/ico/Warning.ico b/shell_integration/windows/OCShellExtensions/OCOverlays/ico/Warning.ico new file mode 100644 index 0000000000000000000000000000000000000000..b7fabc3bf67125141cd7705f139368abc88ea773 GIT binary patch literal 30166 zcmeHQ3s6-GMNmijiVzZomwN0 zh(r-$d{Dez5rbgV3WyM*1oa{j5Uz-T3KEf-QXL&L+DB|^(ro{K&)Iv=J@)_ybMC!P zX4l!f=drv0_ka8E-gEc-KN8|Yd`Uej`Jm}XoQJ*R0HA^2l+T0d*?DXZ>+QzDhMHP>^ z*3-TcRa~(=;rwO#RA(=J@4^60>KmjFTWtdo<_bVLdYX3RR6Djw?&+tmbzEfa@jQCp z(N&|jCIm1KVEt!0FVVW8>-P3j4>#uPX&+O4tQOm+bobNdYd2YY)F*Ox^w%I6woNR`2j0xK&+bA{5CF@IPA5vRvZ=w74?$MW`>!Uid*7PFyJ-@TEOaXO~JK> zuQ~6+@kPjb*O^#AHxDvCH(|=c2b>X->FrH3!nc<1i`-pvX3E~W{wbw3T@#BA95&?? z&mW&m{Pqf%&2OmRsTPmlczh1@L5Nd7Bb@(PgdOcKLXHy4ChY zSl;d>Mq&srC_SL&Jh69x{^W2Yo!NcKNj_qjyz5Z2k@BN<9kMBP$KyFo9rWhE@6g4- zgZf@{<*{qQD>jW{$@&pSmDcpCW&8%@VoGoCagiTa-+IS4E&mby5=O2WwY&PPTK+37 zT}*y<#|0PpQ>(2v0@6258o5{fcPDNxt5(Zj-qyq9zt`F4B0sXEs>8_VZBttAv(xID zK38IR`^*I;5{dpd>@TcDic%g|4?0$DecPx~RE}wh!H)%M|vPc<~Ai z-}<4IWM+O(SFdBKl#~=2mbYtv+=;e-aD5Zu_aQ%?(cbe_#Fp|Cp{om{$I|T>>f&#& z2TiLA7Ed<+_0u2hKYBH`uIZoAm7m;*EUxSb$+4^<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J%K4{-m;nDs6tyB582=EnMHB_X?cHy z-!!$s?`%IEoV~pTj;s9BHoQijO+nnK@BNxk5A@?iU3}$?#~5LW_e2s52nGZLf&syR zU_dY+7!V8y1_T3w0l|P^KrkQ}5DW+g1OxXy17G^!+X+H$!(VB^68>NSE3?R4RuU4U zD#2liMQYq@sqSws>n}@|Yn5>f%DBD+A1RcFpWnsuTlr~m>%tfYIrBIJx5RUBc}A6T zY=$xxMLL#aR#?28d*jpYSrw=FDo2bBkEddKfW>0G$Ne-Gl6}ZAPm1^>#F+{@rOIQ% zl{pF85*beU2rkH>VxqABAdQ5TF$!#Uu@x04?7*ys{ya3y9t zAfMq;=m416SipUrl5Jd9#Tda&NiQ$0M=IM_u8)j+;GHKac2vd=`Z~vuf*#P9!R(IS zogKf-y}~Y#e;!+jI@s4A<@$uz`P}gue&9}tTgKzUKeHb#{-tXK=F;ed8C=6@{=yh= zKIKx$KOS>ix35j|yus@RBh%jz@ftC zgr9#0xaa}gd&71(ekd7#43{&Kvz0}+z zZg$-Zb5@OAdG55HBFD<{aLfyK-J3SA#H>C>9W?cj^kMemWqVgc);vdyn2~2*YE~2% z1p|Ts!GK^uFd!HZ3ks%pw^Z$UzuYg3`-yQJ-(a`U4nM!k<^KT-E63ab literal 0 HcmV?d00001 diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/ico/Warning_Shared.ico b/shell_integration/windows/OCShellExtensions/OCOverlays/ico/Warning_Shared.ico new file mode 100644 index 0000000000000000000000000000000000000000..fc85d46d0acc51d848b5101e85a9a99afae16556 GIT binary patch literal 30166 zcmeHPeNa@_6@S`JOgq!oCaD>}3fhS=sI3jH)0oU?{;)OErqh~9CrLY##?&>o!Nw*t zjWbT5+WOHJzqKwB1O!Du6!{k7E(^PS$nL_jiwo=uYSxH?z!~z zI@8R(GuQL($Ghiue)qh$>)msZqzTdk(&Wh!%2?@*uS$|Zl7iX}?2C<+$8&JrqOS$F z&rg-4g$tGO$0TWUTyXpQzmlZ6v?f+uh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sm%YCJy7|_3oJ7KG{*NJ9RKJ3#bp$IN7+>VoHAcW zU!`{p75N>Cys`a}Z8S39QLv%yoNxXNaK5>uy`d5<|6%L0J z=5)GezQ58+>x1PhP^f~6s$stKeC1VQ*U%^HSV!ch<*BN%`kHE@88*_KSc}+93w8C( zF0WITr$-I-f=!9fc@Bt;iS)@@up6=;5qZW-ZB%H26=nDIPEG(~pe3;>xm{u@y#C(_ z<96ck49zNfFfU*s?C+JsiugsF>;$*QipX3yW7LukgsBqx6zWYUHADq z7J2hNA5z6QN62d>`zYnj>DRP4LRky+WqMxXn?{Ey(KI?iZ=O@uE6<5~dg5K5+?it= zO@>H^WAYvBCjPdPJi3+DO=4u5PgPcqYK2%_kK3McYxfM; r#oN$*zQATzWe>Vdtqk0g_9W`0{foG6{NBzrvQ72@({{9~w7vfUAqdh^ literal 0 HcmV?d00001 diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/stdafx.h b/shell_integration/windows/OCShellExtensions/OCOverlays/stdafx.h new file mode 100644 index 000000000..81121202b --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/stdafx.h @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library 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 Lesser General Public License for more + * details. + */ + +#define WIN32_LEAN_AND_MEAN + +#include "CommunicationSocket.h" +#include "RegistryUtil.h" +#include "OverlayConstants.h" +#include "FileUtil.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/shell_integration/windows/OCShellExtensions/OCShellExtensions.sln b/shell_integration/windows/OCShellExtensions/OCShellExtensions.sln new file mode 100644 index 000000000..979c155fa --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCShellExtensions.sln @@ -0,0 +1,49 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.30501.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OCUtil", "OCUtil\OCUtil.vcxproj", "{E4F63E19-808D-4234-8DF0-69C5F47C9CD3}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OCOverlays", "OCOverlays\OCOverlays.vcxproj", "{42EFEC79-5ACA-4F76-955F-15CE4340F6BC}" + ProjectSection(ProjectDependencies) = postProject + {E4F63E19-808D-4234-8DF0-69C5F47C9CD3} = {E4F63E19-808D-4234-8DF0-69C5F47C9CD3} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OCUtilTest", "ConsoleApplication1\ConsoleApplication1.vcxproj", "{A81E3DAE-8FE7-4BD0-82F9-939B2D59D033}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Debug|Win32.ActiveCfg = Debug|Win32 + {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Debug|Win32.Build.0 = Debug|Win32 + {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Debug|x64.ActiveCfg = Debug|x64 + {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Debug|x64.Build.0 = Debug|x64 + {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Release|Win32.ActiveCfg = Release|Win32 + {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Release|Win32.Build.0 = Release|Win32 + {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Release|x64.ActiveCfg = Release|x64 + {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Release|x64.Build.0 = Release|x64 + {42EFEC79-5ACA-4F76-955F-15CE4340F6BC}.Debug|Win32.ActiveCfg = Debug|Win32 + {42EFEC79-5ACA-4F76-955F-15CE4340F6BC}.Debug|Win32.Build.0 = Debug|Win32 + {42EFEC79-5ACA-4F76-955F-15CE4340F6BC}.Debug|x64.ActiveCfg = Debug|x64 + {42EFEC79-5ACA-4F76-955F-15CE4340F6BC}.Debug|x64.Build.0 = Debug|x64 + {42EFEC79-5ACA-4F76-955F-15CE4340F6BC}.Release|Win32.ActiveCfg = Release|Win32 + {42EFEC79-5ACA-4F76-955F-15CE4340F6BC}.Release|Win32.Build.0 = Release|Win32 + {42EFEC79-5ACA-4F76-955F-15CE4340F6BC}.Release|x64.ActiveCfg = Release|x64 + {42EFEC79-5ACA-4F76-955F-15CE4340F6BC}.Release|x64.Build.0 = Release|x64 + {A81E3DAE-8FE7-4BD0-82F9-939B2D59D033}.Debug|Win32.ActiveCfg = Debug|Win32 + {A81E3DAE-8FE7-4BD0-82F9-939B2D59D033}.Debug|Win32.Build.0 = Debug|Win32 + {A81E3DAE-8FE7-4BD0-82F9-939B2D59D033}.Debug|x64.ActiveCfg = Debug|Win32 + {A81E3DAE-8FE7-4BD0-82F9-939B2D59D033}.Release|Win32.ActiveCfg = Release|Win32 + {A81E3DAE-8FE7-4BD0-82F9-939B2D59D033}.Release|Win32.Build.0 = Release|Win32 + {A81E3DAE-8FE7-4BD0-82F9-939B2D59D033}.Release|x64.ActiveCfg = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/shell_integration/windows/OCShellExtensions/OCUtil/CommunicationSocket.cpp b/shell_integration/windows/OCShellExtensions/OCUtil/CommunicationSocket.cpp new file mode 100644 index 000000000..92f404848 --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCUtil/CommunicationSocket.cpp @@ -0,0 +1,127 @@ +/** + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library 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 Lesser General Public License for more + * details. + */ + +#include "CommunicationSocket.h" +#include "UtilConstants.h" +#include "StringUtil.h" + +#include +#include +#include +#include +#include + +#include + +#define BUFSIZE 1024 + +using namespace std; + +#define DEFAULT_BUFLEN 4096 + +CommunicationSocket::CommunicationSocket(int port) + : _port(port), _clientSocket(INVALID_SOCKET) +{ +} + +CommunicationSocket::~CommunicationSocket() +{ + Close(); +} + +bool CommunicationSocket::Close() +{ + WSACleanup(); + bool closed = (closesocket(_clientSocket) == 0); + shutdown(_clientSocket, SD_BOTH); + _clientSocket = INVALID_SOCKET; + return closed; +} + + +bool CommunicationSocket::Connect() +{ + WSADATA wsaData; + + HRESULT iResult = WSAStartup(MAKEWORD(2, 2), &wsaData); + + if (iResult != NO_ERROR) { + int error = WSAGetLastError(); + } + + + _clientSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + + if (_clientSocket == INVALID_SOCKET) { + //int error = WSAGetLastError(); + Close(); + return false; + } + + struct sockaddr_in clientService; + + clientService.sin_family = AF_INET; + clientService.sin_addr.s_addr = inet_addr(PLUG_IN_SOCKET_ADDRESS); + clientService.sin_port = htons(_port); + + iResult = connect(_clientSocket, (SOCKADDR*)&clientService, sizeof(clientService)); + + if (iResult == SOCKET_ERROR) { + //int error = WSAGetLastError(); + Close(); + return false; + } + return true; +} + +bool CommunicationSocket::SendMsg(const wchar_t* message) +{ + const char* utf8_msg = StringUtil::toUtf8(message); + size_t result = send(_clientSocket, utf8_msg, (int)strlen(utf8_msg), 0); + delete[] utf8_msg; + + if (result == SOCKET_ERROR) { + //int error = WSAGetLastError(); + closesocket(_clientSocket); + return false; + } + + return true; + +} + +bool CommunicationSocket::ReadLine(wstring* response) +{ + if (!response) { + return false; + } + + vector resp_utf8; + char buffer; + while (true) { + int bytesRead = recv(_clientSocket, &buffer, 1, 0); + if (bytesRead <= 0) { + response = 0; + return false; + } + + if (buffer == '\n') { + resp_utf8.push_back(0); + *response = StringUtil::toUtf16(&resp_utf8[0], resp_utf8.size()); + return true; + } else { + resp_utf8.push_back(buffer); + } + } +} diff --git a/shell_integration/windows/OCShellExtensions/OCUtil/CommunicationSocket.h b/shell_integration/windows/OCShellExtensions/OCUtil/CommunicationSocket.h new file mode 100644 index 000000000..7bbf1bf63 --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCUtil/CommunicationSocket.h @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library 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 Lesser General Public License for more + * details. + */ + +#ifndef COMMUNICATIONSOCKET_H +#define COMMUNICATIONSOCKET_H + +#pragma once + +#pragma warning (disable : 4251) + +#include +#include + +class __declspec(dllexport) CommunicationSocket +{ +public: + CommunicationSocket(int port); + ~CommunicationSocket(); + + bool Connect(); + bool Close(); + + bool SendMsg(const wchar_t*); + bool ReadLine(std::wstring*); + +private: + int _port; + SOCKET _clientSocket; +}; + +#endif \ No newline at end of file diff --git a/shell_integration/windows/OCShellExtensions/OCUtil/FileUtil.cpp b/shell_integration/windows/OCShellExtensions/OCUtil/FileUtil.cpp new file mode 100644 index 000000000..e0861682b --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCUtil/FileUtil.cpp @@ -0,0 +1,84 @@ +/** + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library 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 Lesser General Public License for more + * details. + */ + +#include "FileUtil.h" +#include "RegistryUtil.h" +#include "UtilConstants.h" + +using namespace std; + +bool FileUtil::IsChildFile(const wchar_t* rootFolder, vector* files) +{ + for(vector::iterator it = files->begin(); it != files->end(); it++) + { + wstring file = *it; + + size_t found = file.find(rootFolder); + + if(found != string::npos) + { + return true; + } + } + + return false; +} + +bool FileUtil::IsChildFile(const wchar_t* rootFolder, const wchar_t* file) +{ + wstring* f = new wstring(file); + + size_t found = f->find(rootFolder); + + if(found != string::npos) + { + return true; + } + + return false; +} + +bool FileUtil::IsChildFileOfRoot(std::vector* files) +{ + wstring* rootFolder = new wstring(); + bool needed = false; + + if(RegistryUtil::ReadRegistry(REGISTRY_ROOT_KEY, REGISTRY_FILTER_FOLDER, rootFolder)) + { + if(IsChildFile(rootFolder->c_str(), files)) + { + needed = true; + } + } + + delete rootFolder; + return needed; +} + +bool FileUtil::IsChildFileOfRoot(const wchar_t* filePath) +{ + wstring* rootFolder = new wstring(); + bool needed = false; + + if(RegistryUtil::ReadRegistry(REGISTRY_ROOT_KEY, REGISTRY_FILTER_FOLDER, rootFolder)) + { + if(FileUtil::IsChildFile(rootFolder->c_str(), filePath)) + { + needed = true; + } + } + + delete rootFolder; + return needed; +} \ No newline at end of file diff --git a/shell_integration/windows/OCShellExtensions/OCUtil/FileUtil.h b/shell_integration/windows/OCShellExtensions/OCUtil/FileUtil.h new file mode 100644 index 000000000..650bc471f --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCUtil/FileUtil.h @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library 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 Lesser General Public License for more + * details. + */ + +#ifndef FILEUTIL_H +#define FILEUTIL_H + +#pragma once + +#pragma warning (disable : 4251) + +#include +#include + +class __declspec(dllexport) FileUtil +{ +public: + FileUtil(); + + ~FileUtil(); + + static bool IsChildFile(const wchar_t*, std::vector*); + static bool IsChildFile(const wchar_t*, const wchar_t*); + static bool IsChildFileOfRoot(std::vector*); + static bool IsChildFileOfRoot(const wchar_t*); + +private: +}; + +#endif \ No newline at end of file diff --git a/shell_integration/windows/OCShellExtensions/OCUtil/OCMessage.cpp b/shell_integration/windows/OCShellExtensions/OCUtil/OCMessage.cpp new file mode 100644 index 000000000..b86005f71 --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCUtil/OCMessage.cpp @@ -0,0 +1,74 @@ +/** + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library 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 Lesser General Public License for more + * details. + */ + +#include "OCMessage.h" +#include "ParserUtil.h" +#include "UtilConstants.h" + +#include + +#include +#include + +using namespace std; + +OCMessage::OCMessage(void) +{ + _command = new wstring(); + _value = new wstring(); +} + +OCMessage::~OCMessage(void) +{ +} + +bool OCMessage::InitFromMessage(const wstring* message) +{ + if(message->length() == 0) + { + return false; + } + + if(!ParserUtil::GetItem(COMMAND, message, _command)) + { + return false; + } + + if(!ParserUtil::GetItem(VALUE, message, _value)) + { + return false; + } + + return true; +} + +std::wstring* OCMessage::GetCommand() +{ + return _command; +} + +std::wstring* OCMessage::GetValue() +{ + return _value; +} + +void OCMessage::SetCommand(std::wstring* command) +{ + _command = command; +} + +void OCMessage::SetValue(std::wstring* value) +{ + _value = value; +} diff --git a/shell_integration/windows/OCShellExtensions/OCUtil/OCMessage.h b/shell_integration/windows/OCShellExtensions/OCUtil/OCMessage.h new file mode 100644 index 000000000..131f3d714 --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCUtil/OCMessage.h @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library 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 Lesser General Public License for more + * details. + */ + +#ifndef OCMESSAGE_H +#define OCMESSAGE_H + +#include + +#pragma once + +class __declspec(dllexport) OCMessage +{ +public: + OCMessage(void); + ~OCMessage(void); + + bool InitFromMessage(const std::wstring*); + + std::wstring* GetCommand(); + std::wstring* GetValue(); + + void SetCommand(std::wstring*); + void SetValue(std::wstring*); + +private: + + std::wstring* _command; + std::wstring* _value; +}; + +#endif \ No newline at end of file diff --git a/shell_integration/windows/OCShellExtensions/OCUtil/OCUtil.vcxproj b/shell_integration/windows/OCShellExtensions/OCUtil/OCUtil.vcxproj new file mode 100644 index 000000000..fc3b1a31f --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCUtil/OCUtil.vcxproj @@ -0,0 +1,157 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {E4F63E19-808D-4234-8DF0-69C5F47C9CD3} + OCUtil + + + + DynamicLibrary + true + Unicode + v120_xp + + + DynamicLibrary + true + Unicode + v120_xp + + + DynamicLibrary + false + true + Unicode + + + DynamicLibrary + false + true + Unicode + Windows7.1SDK + + + + + + + + + + + + + + + + + + + .dll + $(SolutionDir)$(Configuration)\$(Platform)\ + $(Configuration)\$(Platform)\ + $(ProjectName)_x86 + + + .dll + $(SolutionDir)$(Configuration)\$(Platform)\ + $(Configuration)\$(Platform)\ + $(ProjectName)_x64 + + + $(ProjectName)_x64 + $(Configuration)\$(Platform)\ + $(SolutionDir)$(Configuration)\$(Platform)\ + + + .dll + $(ProjectName)_x86 + $(Configuration)\$(Platform)\ + $(SolutionDir)$(Configuration)\$(Platform)\ + + + + Level3 + Disabled + false + + + true + ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + Level3 + Disabled + + + true + ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + Level3 + MaxSpeed + true + true + + + true + true + true + ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + Level3 + MaxSpeed + true + true + + + true + true + true + ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/shell_integration/windows/OCShellExtensions/OCUtil/ParserUtil.cpp b/shell_integration/windows/OCShellExtensions/OCUtil/ParserUtil.cpp new file mode 100644 index 000000000..ba7d9f101 --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCUtil/ParserUtil.cpp @@ -0,0 +1,389 @@ +/** + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library 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 Lesser General Public License for more + * details. + */ + +#include "ParserUtil.h" +#include "UtilConstants.h" + +#include + +using namespace std; + +bool ParserUtil::GetItem(const wchar_t* item, const wstring* message, wstring* result) +{ + size_t start = message->find(item, 0); + + if(start == string::npos) + { + return false; + } + + size_t end = message->find(COLON, start); + + if(end == string::npos) + { + return false; + } + + //Move to next character after : + end += 1; + + wchar_t c = message->at(end); + + //Move to the next character, which is the start of the value + end += 1; + + if(c == '[') + { + return GetList(end - 1, message, result); + } + else + { + return GetValue(end, message, result); + } +} + +bool ParserUtil::GetList(size_t start, const wstring* message, wstring* result) +{ + size_t end = start + 1; + + int openBraceCount = 1; + + while(openBraceCount > 0) + { + size_t closeBraceLocation = message->find(CLOSE_BRACE, end); + size_t openBraceLocation = message->find(OPEN_BRACE, end); + + if(closeBraceLocation < openBraceLocation) + { + openBraceCount--; + end = closeBraceLocation + 1; + } + else if(openBraceLocation < closeBraceLocation) + { + openBraceCount++; + end = openBraceLocation + 1; + } + + } + + size_t length = end - start; + + return GetString(start, end, message, result); +} + +size_t ParserUtil::GetNextStringItemInList(const wstring* message, size_t start, wstring* result) +{ + size_t end = string::npos; + size_t commaLocation = message->find(COMMA, start); + + if(commaLocation == string::npos) + { + end = message->find(CLOSE_BRACE, start); + if(end == string::npos) + { + end = message->length(); + } + else + { + end = end - 1; + } + } + else + { + end = commaLocation - 1; + } + + if(!GetString(start + 2, end, message, result)) + { + return string::npos; + } + + return end + 2; +} + +size_t ParserUtil::GetNextOCItemInList(const wstring* message, size_t start, wstring* result) +{ + size_t end = message->find(OPEN_CURLY_BRACE, start) + 1; + + int openBraceCount = 1; + + while(openBraceCount > 0) + { + size_t closeBraceLocation = message->find(CLOSE_CURLY_BRACE, end); + size_t openBraceLocation = message->find(OPEN_CURLY_BRACE, end); + + if(closeBraceLocation < openBraceLocation) + { + openBraceCount--; + end = closeBraceLocation + 1; + } + else if(openBraceLocation < closeBraceLocation) + { + openBraceCount++; + end = openBraceLocation + 1; + } + } + + size_t length = end - start; + + if(!GetString(start, end, message, result)) + { + return string::npos; + } + + return end; +} + +bool ParserUtil::GetValue(size_t start, const wstring* message, wstring* result) +{ + if(message->at(start - 1) == '\"') + { + size_t end = message->find(QUOTE, start); + return GetString(start, end, message, result); + } + else + { + start = start - 1; + + size_t end = message->find(COMMA, start); + + result->append(message->substr(start, end-start)); + } + + return true; +} + +bool ParserUtil::GetString(size_t start, size_t end, const wstring* message, wstring* result) +{ + if(end == string::npos) + { + return false; + } + + size_t length = end - start; + + if(length > 0) + { + result->append(message->substr(start, length)); + } + else + { + result->append(L""); + } + + + return true; +} + +bool ParserUtil::IsList(wstring* message) +{ + wchar_t c = message->at(0); + + if(c == '[') + { + return true; + } + + return false; +} + +bool ParserUtil::ParseJsonList(wstring* message, vector* items) +{ + + size_t currentLocation = message->find(OPEN_BRACE, 0); + + while(currentLocation < message->size()) + { + wstring* item = new wstring(); + + currentLocation = ParserUtil::GetNextStringItemInList(message, currentLocation, item); + + if(currentLocation == string::npos) + { + return false; + } + + items->push_back(item); + } + + return true; +} + +bool ParserUtil::ParseOCList(wstring* message, vector* items) +{ + + size_t currentLocation = message->find(OPEN_CURLY_BRACE, 0); + + while(currentLocation < message->size()) + { + wstring* item = new wstring(); + + currentLocation = ParserUtil::GetNextOCItemInList(message, currentLocation, item); + + if(currentLocation == string::npos) + { + return false; + } + + items->push_back(item); + } + + return true; +} + +bool ParserUtil::ParseOCMessageList(wstring* message, vector* messages) +{ + vector* items = new vector(); + + if(!ParseOCList(message, items)) + { + return false; + } + + for(vector::iterator it = items->begin(); it != items->end(); it++) + { + wstring* temp = *it; + + OCMessage* message = new OCMessage(); + message->InitFromMessage(temp); + + messages->push_back(message); + } + + return true; +} + +bool ParserUtil::SerializeList(std::vector* list, std::wstring* result, bool escapeQuotes) +{ + if(result == 0) + { + return false; + } + + result->append(OPEN_BRACE); + + for(vector::iterator it = list->begin(); it != list->end(); it++) + { + wstring value = *it; + + if(escapeQuotes) + { + result->append(BACK_SLASH); + } + + result->append(QUOTE); + result->append(value.c_str()); + + if(escapeQuotes) + { + result->append(BACK_SLASH); + } + + result->append(QUOTE); + result->append(COMMA); + } + + //Erase last comma + result->erase(result->size() - 1, 1); + + result->append(CLOSE_BRACE); + + return true; +} + +bool ParserUtil::SerializeMessage(std::map* arguments, std::wstring* result, bool escapeQuotes) +{ + if(result == 0) + { + return false; + } + + result->append(OPEN_CURLY_BRACE); + + for(map::iterator it = arguments->begin(); it != arguments->end(); it++) + { + wstring key = *it->first; + wstring value = *it->second; + + if(escapeQuotes) + { + result->append(BACK_SLASH); + } + + result->append(QUOTE); + result->append(key.c_str()); + + if(escapeQuotes) + { + result->append(BACK_SLASH); + } + + result->append(QUOTE); + result->append(COLON); + result->append(value.c_str()); + result->append(COMMA); + } + + //Erase last comma + result->erase(result->size() - 1, 1); + + result->append(CLOSE_CURLY_BRACE); + + return true; +} + +bool ParserUtil::SerializeMessage(OCMessage* OCMessage, std::wstring* result) +{ + if(result == 0) + { + return false; + } + + result->append(OPEN_CURLY_BRACE); + + result->append(QUOTE); + result->append(COMMAND); + result->append(QUOTE); + + result->append(COLON); + + result->append(QUOTE); + result->append(OCMessage->GetCommand()->c_str()); + result->append(QUOTE); + + result->append(COMMA); + + result->append(QUOTE); + result->append(VALUE); + result->append(QUOTE); + + result->append(COLON); + + if(!IsList(OCMessage->GetValue())) + { + result->append(QUOTE); + } + + result->append(OCMessage->GetValue()->c_str()); + + if(!IsList(OCMessage->GetValue())) + { + result->append(QUOTE); + } + + result->append(CLOSE_CURLY_BRACE); + + return true; +} + diff --git a/shell_integration/windows/OCShellExtensions/OCUtil/RegistryUtil.cpp b/shell_integration/windows/OCShellExtensions/OCUtil/RegistryUtil.cpp new file mode 100644 index 000000000..5c41bf861 --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCUtil/RegistryUtil.cpp @@ -0,0 +1,70 @@ +/** + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library 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 Lesser General Public License for more + * details. + */ + +#include "RegistryUtil.h" + +#include + +using namespace std; + +#define SIZE 4096 + +bool RegistryUtil::ReadRegistry(const wchar_t* key, const wchar_t* name, int* result) +{ + wstring* strResult = new wstring(); + + if(!ReadRegistry(key, name, strResult)) + { + return false; + } + + *result = stoi( strResult->c_str() ); + + return true; +} + +bool RegistryUtil::ReadRegistry(const wchar_t* key, const wchar_t* name, wstring* result) +{ + HRESULT hResult; + + HKEY rootKey = NULL; + + hResult = HRESULT_FROM_WIN32(RegOpenKeyEx(HKEY_CURRENT_USER, (LPCWSTR)key, NULL, KEY_READ, &rootKey)); + + if(!SUCCEEDED(hResult)) + { + return false; + } + + wchar_t value[SIZE]; + DWORD value_length = SIZE; + + hResult = RegQueryValueEx(rootKey, (LPCWSTR)name, NULL, NULL, (LPBYTE)value, &value_length ); + + if(!SUCCEEDED(hResult)) + { + return false; + } + + result->append(value); + + HRESULT hResult2 = RegCloseKey(rootKey); + + if (!SUCCEEDED(hResult2)) + { + return false; + } + + return true; +} diff --git a/shell_integration/windows/OCShellExtensions/OCUtil/RegistryUtil.h b/shell_integration/windows/OCShellExtensions/OCUtil/RegistryUtil.h new file mode 100644 index 000000000..1928d64ce --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCUtil/RegistryUtil.h @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library 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 Lesser General Public License for more + * details. + */ + +#ifndef REGISTRYUTIL_H +#define REGISTRYUTIL_H + +#pragma once + +#pragma warning (disable : 4251) + +#include + +class __declspec(dllexport) RegistryUtil +{ +public: + RegistryUtil(); + + ~RegistryUtil(); + + static bool ReadRegistry(const wchar_t*, const wchar_t*, int*); + static bool ReadRegistry(const wchar_t*, const wchar_t*, std::wstring*); +}; + +#endif \ No newline at end of file diff --git a/shell_integration/windows/OCShellExtensions/OCUtil/RemotePathChecker.cpp b/shell_integration/windows/OCShellExtensions/OCUtil/RemotePathChecker.cpp new file mode 100644 index 000000000..2eec3c2ea --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCUtil/RemotePathChecker.cpp @@ -0,0 +1,112 @@ +/** +* Copyright (c) 2014 ownCloud, Inc. All rights reserved. +* +* This library is free software; you can redistribute it and/or modify it under +* the terms of the GNU Lesser General Public License as published by the Free +* Software Foundation; version 2.1 of the License +* +* This library 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 Lesser General Public License for more +* details. +*/ + +#include "CommunicationSocket.h" + +#include "RemotePathChecker.h" + +#include +#include +#include +#include +#include + +using namespace std; + +namespace { + template + bool begins_with(const TContainer& input, const TContainer& match) + { + return input.size() >= match.size() + && equal(match.begin(), match.end(), input.begin()); + } +} + +RemotePathChecker::RemotePathChecker(int port) + : _port(port) +{ +} + +bool RemotePathChecker::IsMonitoredPath(const wchar_t* filePath, bool isDir) +{ + wstring request; + wstring response; + bool needed = false; + + CommunicationSocket socket(_port); + socket.Connect(); + if (isDir) { + request = L"RETRIEVE_FOLDER_STATUS:"; + } else { + request = L"RETRIEVE_FILE_STATUS:"; + } + request += filePath; + request += L'\n'; + + if (!socket.SendMsg(request.c_str())) { + return false; + } + + while ((socket.ReadLine(&response))) { + // discard broadcast messages + if (begins_with(response, wstring(L"STATUS:"))) { + break; + } + } + + size_t statusBegin = response.find(L':', 0); + if (statusBegin == -1) + return false; + + size_t statusEnd = response.find(L':', statusBegin + 1); + if (statusEnd == -1) + return false; + + + wstring responseStatus = response.substr(statusBegin+1, statusEnd - statusBegin-1); + wstring responsePath = response.substr(statusEnd+1); + if (responsePath == filePath) { + int status = _StrToFileState(responseStatus); + if (status == StateNone) { + return false; + } + needed = true; + } + + return needed; +} + +int RemotePathChecker::_StrToFileState(const std::wstring &str) +{ + if (str == L"NOP" || str == L"NONE") { + return StateNone; + } else if (str == L"SYNC" || str == L"NEW") { + return StateSync; + } else if (str == L"SYNC+SWM" || str == L"NEW+SWM") { + return StateSyncSWM; + } else if (str == L"OK") { + return StateOk; + } else if (str == L"OK+SWM") { + return StateOkSWM; + } else if (str == L"IGNORE") { + return StateWarning; + } else if (str == L"IGNORE+SWM") { + return StateWarningSWM; + } else if (str == L"ERROR") { + return StateError; + } else if (str == L"ERROR+SWM") { + return StateErrorSWM; + } + + return StateNone; +} \ No newline at end of file diff --git a/shell_integration/windows/OCShellExtensions/OCUtil/RemotePathChecker.h b/shell_integration/windows/OCShellExtensions/OCUtil/RemotePathChecker.h new file mode 100644 index 000000000..5e58c6d64 --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCUtil/RemotePathChecker.h @@ -0,0 +1,41 @@ +/** +* Copyright (c) 2014 ownCloud, Inc. All rights reserved. +* +* This library is free software; you can redistribute it and/or modify it under +* the terms of the GNU Lesser General Public License as published by the Free +* Software Foundation; version 2.1 of the License +* +* This library 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 Lesser General Public License for more +* details. +*/ + +#ifndef PATHCHECKER_H +#define PATHCHECKER_H + +#include + +#pragma once + +class __declspec(dllexport) RemotePathChecker { +public: + enum FileState { + // Order synced with OCOverlay + StateError = 0, StateErrorSWM, + StateOk, StateOkSWM, + StateSync, StateSyncSWM, + StateWarning, StateWarningSWM, + StateNone + }; + RemotePathChecker(int port); + bool IsMonitoredPath(const wchar_t* filePath, bool isDir); + +private: + int _StrToFileState(const std::wstring &str); + + int _port; + +}; + +#endif \ No newline at end of file diff --git a/shell_integration/windows/OCShellExtensions/OCUtil/StringUtil.cpp b/shell_integration/windows/OCShellExtensions/OCUtil/StringUtil.cpp new file mode 100644 index 000000000..0c7af0b82 --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCUtil/StringUtil.cpp @@ -0,0 +1,32 @@ +/** +* Copyright (c) 2014 ownCloud, Inc. All rights reserved. +* +* This library is free software; you can redistribute it and/or modify it under +* the terms of the GNU Lesser General Public License as published by the Free +* Software Foundation; version 2.1 of the License +* +* This library 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 Lesser General Public License for more +* details. +*/ + +#include + +#include "StringUtil.h" + +char* StringUtil::toUtf8(const wchar_t *utf16, int len) +{ + int newlen = WideCharToMultiByte(CP_UTF8, 0, utf16, len, NULL, 0, NULL, NULL); + char* str = new char[newlen]; + WideCharToMultiByte(CP_UTF8, 0, utf16, -1, str, newlen, NULL, NULL); + return str; +} + +wchar_t* StringUtil::toUtf16(const char *utf8, int len) +{ + int newlen = MultiByteToWideChar(CP_UTF8, 0, utf8, len, NULL, 0); + wchar_t* wstr = new wchar_t[newlen]; + MultiByteToWideChar(CP_UTF8, 0, utf8, -1, wstr, newlen); + return wstr; +} diff --git a/shell_integration/windows/OCShellExtensions/OCUtil/StringUtil.h b/shell_integration/windows/OCShellExtensions/OCUtil/StringUtil.h new file mode 100644 index 000000000..d885a89f6 --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCUtil/StringUtil.h @@ -0,0 +1,27 @@ +/** +* Copyright (c) 2014 ownCloud, Inc. All rights reserved. +* +* This library is free software; you can redistribute it and/or modify it under +* the terms of the GNU Lesser General Public License as published by the Free +* Software Foundation; version 2.1 of the License +* +* This library 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 Lesser General Public License for more +* details. +*/ + +#ifndef STRINGUTIL_H +#define STRINGUTIL_H + +#pragma once + +#include + +class __declspec(dllexport) StringUtil { +public: + static char* toUtf8(const wchar_t* utf16, int len = -1); + static wchar_t* toUtf16(const char* utf8, int len = -1); +}; + +#endif // STRINGUTIL_H diff --git a/shell_integration/windows/OCShellExtensions/OCUtil/UtilConstants.h b/shell_integration/windows/OCShellExtensions/OCUtil/UtilConstants.h new file mode 100644 index 000000000..04ca7d3ba --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCUtil/UtilConstants.h @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library 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 Lesser General Public License for more + * details. + */ + +#define PLUG_IN_SOCKET_ADDRESS "127.0.0.1" + +#define BACK_SLASH L"\\" +#define CLOSE_BRACE L"]" +#define CLOSE_CURLY_BRACE L"}" +#define COLON L":" +#define COMMAND L"command" +#define COMMA L"," +#define OPEN_BRACE L"[" +#define OPEN_CURLY_BRACE L"{" +#define QUOTE L"\"" +#define VALUE L"value" + +#define REGISTRY_ROOT_KEY L"SOFTWARE\\ownCloud Inc\\ownCloud" +#define REGISTRY_ENABLE_OVERLAY L"EnableOverlay" +#define REGISTRY_FILTER_FOLDER L"FilterFolder" diff --git a/shell_integration/windows/OCShellExtensions/OCUtilTest/OCUtilTest.cpp b/shell_integration/windows/OCShellExtensions/OCUtilTest/OCUtilTest.cpp new file mode 100644 index 000000000..179f8334a --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCUtilTest/OCUtilTest.cpp @@ -0,0 +1,37 @@ +// ConsoleApplication1.cpp : Defines the entry point for the console application. +// + +#include "stdafx.h" + +#include +#include +#include + +#include "RemotePathChecker.h" +#include "StringUtil.h" + +using namespace std; + +int _tmain(int argc, _TCHAR* argv[]) +{ + RemotePathChecker checker(33001); + + vector paths; + + wstring test1(L"C:\\Users\\owncloud\\ownCloud\\wizard2.png"); + wstring test2(L"C:\\Users\\owncloud\\ownCloud\\wizard3.png"); + wstring test3(L"C:\\Users\\owncloud\\ownCloud\\HAMMANET.png"); + paths.push_back(test1); + paths.push_back(test2); + paths.push_back(test3); + +// wstring test3 = StringUtil::toUtf16(StringUtil::toUtf8(test1.c_str())); + + vector::iterator it; + for (it = paths.begin(); it != paths.end(); ++it) { + bool monitored = checker.IsMonitoredPath(it->c_str(), false); + wcout << *it << " " << monitored << " with value " << checker.GetPathType() << endl; + } + return 0; +} + diff --git a/shell_integration/windows/OCShellExtensions/OCUtilTest/OCUtilTest.filters b/shell_integration/windows/OCShellExtensions/OCUtilTest/OCUtilTest.filters new file mode 100644 index 000000000..2507d8e20 --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCUtilTest/OCUtilTest.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/shell_integration/windows/OCShellExtensions/OCUtilTest/OCUtilTest.vcxproj b/shell_integration/windows/OCShellExtensions/OCUtilTest/OCUtilTest.vcxproj new file mode 100644 index 000000000..e4c35a3b2 --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCUtilTest/OCUtilTest.vcxproj @@ -0,0 +1,97 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {A81E3DAE-8FE7-4BD0-82F9-939B2D59D033} + Win32Proj + OCUtilTest + OCUtilTest + + + + Application + true + v120 + Unicode + + + Application + false + v120 + true + Unicode + + + + + + + + + + + + + true + $(SolutionDir)$(Configuration)\$(Platform)\ + + + false + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + true + ..\OCUtil + + + Console + true + ..\$(Configuration)\$(Platform); + OCUtil_x86.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + + Create + Create + + + + + + \ No newline at end of file diff --git a/shell_integration/windows/OCShellExtensions/OCUtilTest/ReadMe.txt b/shell_integration/windows/OCShellExtensions/OCUtilTest/ReadMe.txt new file mode 100644 index 000000000..4cb8a2f4b --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCUtilTest/ReadMe.txt @@ -0,0 +1,40 @@ +======================================================================== + CONSOLE APPLICATION : ConsoleApplication1 Project Overview +======================================================================== + +AppWizard has created this ConsoleApplication1 application for you. + +This file contains a summary of what you will find in each of the files that +make up your ConsoleApplication1 application. + + +ConsoleApplication1.vcxproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +ConsoleApplication1.vcxproj.filters + This is the filters file for VC++ projects generated using an Application Wizard. + It contains information about the association between the files in your project + and the filters. This association is used in the IDE to show grouping of files with + similar extensions under a specific node (for e.g. ".cpp" files are associated with the + "Source Files" filter). + +ConsoleApplication1.cpp + This is the main application source file. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named ConsoleApplication1.pch and a precompiled types file named StdAfx.obj. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" comments to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff --git a/shell_integration/windows/OCShellExtensions/OCUtilTest/stdafx.cpp b/shell_integration/windows/OCShellExtensions/OCUtilTest/stdafx.cpp new file mode 100644 index 000000000..f1d63e0b4 --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCUtilTest/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// ConsoleApplication1.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/shell_integration/windows/OCShellExtensions/OCUtilTest/stdafx.h b/shell_integration/windows/OCShellExtensions/OCUtilTest/stdafx.h new file mode 100644 index 000000000..b005a839d --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCUtilTest/stdafx.h @@ -0,0 +1,15 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#include +#include + + + +// TODO: reference additional headers your program requires here diff --git a/shell_integration/windows/OCShellExtensions/OCUtilTest/targetver.h b/shell_integration/windows/OCShellExtensions/OCUtilTest/targetver.h new file mode 100644 index 000000000..87c0086de --- /dev/null +++ b/shell_integration/windows/OCShellExtensions/OCUtilTest/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include From 9a1781f613ba84e288d16b30dec0f0b0831e43b1 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Mon, 4 Aug 2014 15:40:08 +0200 Subject: [PATCH 2/3] Support for multiple icons --- .../OCShellExtensions/OCOverlays/DllMain.cpp | 192 +++++++++++------- .../OCOverlays/OCOverlay.cpp | 13 +- .../OCShellExtensions/OCOverlays/OCOverlay.h | 3 +- .../OCOverlays/OCOverlayFactory.cpp | 27 +-- .../OCOverlays/OCOverlayFactory.h | 11 +- .../OCOverlayRegistrationHandler.cpp | 4 +- .../OCOverlays/OCOverlayRegistrationHandler.h | 4 +- .../OCOverlays/OverlayConstants.h | 21 +- .../OCShellExtensions/OCOverlays/resource.h | Bin 1626 -> 1536 bytes .../OCShellExtensions/OCShellExtensions.sln | 26 +-- .../OCUtil/RemotePathChecker.cpp | 15 +- .../OCUtil/RemotePathChecker.h | 2 +- 12 files changed, 183 insertions(+), 135 deletions(-) diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/DllMain.cpp b/shell_integration/windows/OCShellExtensions/OCOverlays/DllMain.cpp index 84b128dd4..a124b9596 100644 --- a/shell_integration/windows/OCShellExtensions/OCOverlays/DllMain.cpp +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/DllMain.cpp @@ -37,38 +37,57 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved) return TRUE; } -STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv) +HRESULT CreateFactory(REFIID riid, void **ppv, int state) { - HRESULT hResult = CLASS_E_CLASSNOTAVAILABLE; - GUID guid; - - hResult = CLSIDFromString(OVERLAY_GUID, (LPCLSID)&guid); + HRESULT hResult = E_OUTOFMEMORY; - if (hResult != S_OK) { - return hResult; - } - - if (!IsEqualCLSID(guid, rclsid)) { - return hResult; - } - - hResult = E_OUTOFMEMORY; - - wchar_t szModule[MAX_PATH]; - - if (GetModuleFileName(instanceHandle, szModule, ARRAYSIZE(szModule)) == 0) { - hResult = HRESULT_FROM_WIN32(GetLastError()); - - return hResult; - } - - OCOverlayFactory* ocOverlayFactory = new OCOverlayFactory(szModule); + OCOverlayFactory* ocOverlayFactory = new OCOverlayFactory(state); if (ocOverlayFactory) { hResult = ocOverlayFactory->QueryInterface(riid, ppv); ocOverlayFactory->Release(); } - return hResult; + return hResult; +} + +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv) +{ + HRESULT hResult = CLASS_E_CLASSNOTAVAILABLE; + GUID guid; + + hResult = CLSIDFromString(OVERLAY_GUID_ERROR, (LPCLSID)&guid); + if (!SUCCEEDED(hResult)) { return hResult; } + if (IsEqualCLSID(guid, rclsid)) { return CreateFactory(riid, ppv, State_Error); } + + hResult = CLSIDFromString(OVERLAY_GUID_ERROR_SHARED, (LPCLSID)&guid); + if (!SUCCEEDED(hResult)) { return hResult; } + if (IsEqualCLSID(guid, rclsid)) { return CreateFactory(riid, ppv, State_ErrorShared); } + + hResult = CLSIDFromString(OVERLAY_GUID_OK, (LPCLSID)&guid); + if (!SUCCEEDED(hResult)) { return hResult; } + if (IsEqualCLSID(guid, rclsid)) { return CreateFactory(riid, ppv, State_OK); } + + hResult = CLSIDFromString(OVERLAY_GUID_OK_SHARED, (LPCLSID)&guid); + if (!SUCCEEDED(hResult)) { return hResult; } + if (IsEqualCLSID(guid, rclsid)) { return CreateFactory(riid, ppv, State_OKShared); } + + hResult = CLSIDFromString(OVERLAY_GUID_SYNC, (LPCLSID)&guid); + if (!SUCCEEDED(hResult)) { return hResult; } + if (IsEqualCLSID(guid, rclsid)) { return CreateFactory(riid, ppv, State_Sync); } + + hResult = CLSIDFromString(OVERLAY_GUID_SYNC_SHARED, (LPCLSID)&guid); + if (!SUCCEEDED(hResult)) { return hResult; } + if (IsEqualCLSID(guid, rclsid)) { return CreateFactory(riid, ppv, State_SyncShared); } + + hResult = CLSIDFromString(OVERLAY_GUID_WARNING, (LPCLSID)&guid); + if (!SUCCEEDED(hResult)) { return hResult; } + if (IsEqualCLSID(guid, rclsid)) { return CreateFactory(riid, ppv, State_Warning); } + + hResult = CLSIDFromString(OVERLAY_GUID_WARNING_SHARED, (LPCLSID)&guid); + if (!SUCCEEDED(hResult)) { return hResult; } + if (IsEqualCLSID(guid, rclsid)) { return CreateFactory(riid, ppv, State_WarningShared); } + + return CLASS_E_CLASSNOTAVAILABLE; } STDAPI DllCanUnloadNow(void) @@ -78,45 +97,81 @@ STDAPI DllCanUnloadNow(void) return S_FALSE; } +HRESULT RegisterCLSID(LPCOLESTR guidStr, PCWSTR overlayStr, PCWSTR szModule) +{ + HRESULT hResult = S_OK; + + GUID guid; + hResult = CLSIDFromString(guidStr, (LPCLSID)&guid); + + if (hResult != S_OK) { + return hResult; + } + + hResult = OCOverlayRegistrationHandler::RegisterCOMObject(szModule, guid); + + if (!SUCCEEDED(hResult)) { + return hResult; + } + + hResult = OCOverlayRegistrationHandler::MakeRegistryEntries(guid, overlayStr); + + return hResult; +} + HRESULT _stdcall DllRegisterServer(void) { HRESULT hResult = S_OK; wchar_t szModule[MAX_PATH]; - if (GetModuleFileName(instanceHandle, szModule, ARRAYSIZE(szModule)) == 0) - { + if (GetModuleFileName(instanceHandle, szModule, ARRAYSIZE(szModule)) == 0) { hResult = HRESULT_FROM_WIN32(GetLastError()); - return hResult; } - GUID guid; - - hResult = CLSIDFromString(OVERLAY_GUID, (LPCLSID)&guid); - - if (hResult != S_OK) - { - return hResult; - } - - hResult = OCOverlayRegistrationHandler::RegisterCOMObject(szModule, guid); - - if(!SUCCEEDED(hResult)) - { - return hResult; - } - - hResult = OCOverlayRegistrationHandler::MakeRegistryEntries(guid, OVERLAY_NAME); - - if(!SUCCEEDED(hResult)) - { - return hResult; - } + hResult = RegisterCLSID(OVERLAY_GUID_ERROR, OVERLAY_NAME_ERROR, szModule); + if (!SUCCEEDED(hResult)) { return hResult; } + hResult = RegisterCLSID(OVERLAY_GUID_ERROR_SHARED, OVERLAY_NAME_ERROR_SHARED, szModule); + if (!SUCCEEDED(hResult)) { return hResult; } + hResult = RegisterCLSID(OVERLAY_GUID_OK, OVERLAY_NAME_OK, szModule); + if (!SUCCEEDED(hResult)) { return hResult; } + hResult = RegisterCLSID(OVERLAY_GUID_OK_SHARED, OVERLAY_NAME_OK_SHARED, szModule); + if (!SUCCEEDED(hResult)) { return hResult; } + hResult = RegisterCLSID(OVERLAY_GUID_SYNC, OVERLAY_NAME_SYNC, szModule); + if (!SUCCEEDED(hResult)) { return hResult; } + hResult = RegisterCLSID(OVERLAY_GUID_SYNC_SHARED, OVERLAY_NAME_SYNC_SHARED,szModule); + if (!SUCCEEDED(hResult)) { return hResult; } + hResult = RegisterCLSID(OVERLAY_GUID_WARNING, OVERLAY_NAME_WARNING, szModule); + if (!SUCCEEDED(hResult)) { return hResult; } + hResult = RegisterCLSID(OVERLAY_GUID_WARNING_SHARED, OVERLAY_NAME_WARNING_SHARED, szModule); return hResult; } + +HRESULT UnregisterCLSID(LPCOLESTR guidStr, PCWSTR overlayStr) +{ + HRESULT hResult = S_OK; + GUID guid; + + hResult = CLSIDFromString(guidStr, (LPCLSID)&guid); + + if (hResult != S_OK) { + return hResult; + } + + hResult = OCOverlayRegistrationHandler::UnregisterCOMObject(guid); + + if (!SUCCEEDED(hResult)) { + return hResult; + } + + hResult = OCOverlayRegistrationHandler::RemoveRegistryEntries(overlayStr); + + return hResult; +} + STDAPI DllUnregisterServer(void) { HRESULT hResult = S_OK; @@ -128,29 +183,22 @@ STDAPI DllUnregisterServer(void) hResult = HRESULT_FROM_WIN32(GetLastError()); return hResult; } - - GUID guid; - - hResult = CLSIDFromString(OVERLAY_GUID, (LPCLSID)&guid); - if (hResult != S_OK) - { - return hResult; - } - - hResult = OCOverlayRegistrationHandler::UnregisterCOMObject(guid); - - if(!SUCCEEDED(hResult)) - { - return hResult; - } - - hResult = OCOverlayRegistrationHandler::RemoveRegistryEntries(OVERLAY_NAME); - - if (!SUCCEEDED(hResult)) - { - return hResult; - } + hResult = UnregisterCLSID(OVERLAY_GUID_ERROR, OVERLAY_NAME_ERROR); + if (!SUCCEEDED(hResult)) { return hResult; } + hResult = UnregisterCLSID(OVERLAY_GUID_ERROR_SHARED, OVERLAY_NAME_ERROR_SHARED); + if (!SUCCEEDED(hResult)) { return hResult; } + hResult = UnregisterCLSID(OVERLAY_GUID_OK, OVERLAY_NAME_OK); + if (!SUCCEEDED(hResult)) { return hResult; } + hResult = UnregisterCLSID(OVERLAY_GUID_OK_SHARED, OVERLAY_NAME_OK_SHARED); + if (!SUCCEEDED(hResult)) { return hResult; } + hResult = UnregisterCLSID(OVERLAY_GUID_SYNC, OVERLAY_NAME_SYNC); + if (!SUCCEEDED(hResult)) { return hResult; } + hResult = UnregisterCLSID(OVERLAY_GUID_SYNC_SHARED, OVERLAY_NAME_SYNC_SHARED); + if (!SUCCEEDED(hResult)) { return hResult; } + hResult = UnregisterCLSID(OVERLAY_GUID_WARNING, OVERLAY_NAME_WARNING); + if (!SUCCEEDED(hResult)) { return hResult; } + hResult = UnregisterCLSID(OVERLAY_GUID_WARNING_SHARED, OVERLAY_NAME_WARNING_SHARED); return hResult; } diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.cpp b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.cpp index 2fc947121..a8e3689e4 100644 --- a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.cpp +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.cpp @@ -33,10 +33,11 @@ extern HINSTANCE instanceHandle; #define IDM_DISPLAY 0 #define IDB_OK 101 -OCOverlay::OCOverlay() +OCOverlay::OCOverlay(int state) : _communicationSocket(0) , _referenceCount(1) , _checker(new RemotePathChecker(PORT)) + , _state(state) { } @@ -98,20 +99,18 @@ IFACEMETHODIMP OCOverlay::GetPriority(int *pPriority) // return MAKE_HRESULT(S_FALSE, 0, 0); //} - bool isDir = dwAttrib & FILE_ATTRIBUTE_DIRECTORY; - - if (!_checker->IsMonitoredPath(pwszPath, isDir)) { + int state = 0; + if (!_checker->IsMonitoredPath(pwszPath, &state)) { return MAKE_HRESULT(S_FALSE, 0, 0); } - - return MAKE_HRESULT(S_OK, 0, 0); + return MAKE_HRESULT(state == _state ? S_OK : S_FALSE, 0, 0); } IFACEMETHODIMP OCOverlay::GetOverlayInfo(PWSTR pwszIconFile, int cchMax, int *pIndex, DWORD *pdwFlags) { *pIndex = 0; *pdwFlags = ISIOI_ICONFILE | ISIOI_ICONINDEX; - *pIndex = 2; + *pIndex = _state; if (GetModuleFileName(instanceHandle, pwszIconFile, cchMax) == 0) { HRESULT hResult = HRESULT_FROM_WIN32(GetLastError()); diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.h b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.h index 498800a66..a84bc45b0 100644 --- a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.h +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.h @@ -25,7 +25,7 @@ class OCOverlay : public IShellIconOverlayIdentifier { public: - OCOverlay(); + OCOverlay(int state); IFACEMETHODIMP_(ULONG) AddRef(); IFACEMETHODIMP GetOverlayInfo(PWSTR pwszIconFile, int cchMax, int *pIndex, DWORD *pdwFlags); @@ -44,6 +44,7 @@ private: long _referenceCount; CommunicationSocket* _communicationSocket; RemotePathChecker* _checker; + int _state; }; #endif \ No newline at end of file diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayFactory.cpp b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayFactory.cpp index f2d344c02..963d7c6d2 100644 --- a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayFactory.cpp +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayFactory.cpp @@ -17,8 +17,8 @@ extern long dllReferenceCount; -OCOverlayFactory::OCOverlayFactory(wchar_t* path) - : _referenceCount(1) +OCOverlayFactory::OCOverlayFactory(int state) + : _referenceCount(1), _state(state) { InterlockedIncrement(&dllReferenceCount); } @@ -68,23 +68,13 @@ IFACEMETHODIMP OCOverlayFactory::CreateInstance( { HRESULT hResult = CLASS_E_NOAGGREGATION; - if (pUnkOuter != NULL) - { - return hResult; - } + if (pUnkOuter != NULL) { return hResult; } hResult = E_OUTOFMEMORY; - - OCOverlay *lrOverlay = - new (std::nothrow) OCOverlay(); - - if (!lrOverlay) - { - return hResult; - } + OCOverlay *lrOverlay = new (std::nothrow) OCOverlay(_state); + if (!lrOverlay) { return hResult; } hResult = lrOverlay->QueryInterface(riid, ppv); - lrOverlay->Release(); return hResult; @@ -92,12 +82,9 @@ IFACEMETHODIMP OCOverlayFactory::CreateInstance( IFACEMETHODIMP OCOverlayFactory::LockServer(BOOL fLock) { - if (fLock) - { + if (fLock) { InterlockedIncrement(&dllReferenceCount); - } - else - { + } else { InterlockedDecrement(&dllReferenceCount); } return S_OK; diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayFactory.h b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayFactory.h index 6751e5b57..9f3ece860 100644 --- a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayFactory.h +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayFactory.h @@ -19,10 +19,17 @@ #include "stdafx.h" +enum State { + State_Error = 0, State_ErrorShared, + State_OK, State_OKShared, + State_Sync, State_SyncShared, + State_Warning, State_WarningShared +}; + class OCOverlayFactory : public IClassFactory { public: - OCOverlayFactory(wchar_t* path); + OCOverlayFactory(int state); IFACEMETHODIMP_(ULONG) AddRef(); IFACEMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv); @@ -35,7 +42,7 @@ protected: private: long _referenceCount; - wchar_t* _path; + int _state; }; #endif \ No newline at end of file diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayRegistrationHandler.cpp b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayRegistrationHandler.cpp index 3fc0729f1..0271ee9c3 100644 --- a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayRegistrationHandler.cpp +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayRegistrationHandler.cpp @@ -20,7 +20,7 @@ using namespace std; -HRESULT OCOverlayRegistrationHandler::MakeRegistryEntries(const CLSID& clsid, PWSTR friendlyName) +HRESULT OCOverlayRegistrationHandler::MakeRegistryEntries(const CLSID& clsid, PCWSTR friendlyName) { HRESULT hResult; HKEY shellOverlayKey = NULL; @@ -50,7 +50,7 @@ HRESULT OCOverlayRegistrationHandler::MakeRegistryEntries(const CLSID& clsid, PW return hResult; } -HRESULT OCOverlayRegistrationHandler::RemoveRegistryEntries(PWSTR friendlyName) +HRESULT OCOverlayRegistrationHandler::RemoveRegistryEntries(PCWSTR friendlyName) { HRESULT hResult; HKEY shellOverlayKey = NULL; diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayRegistrationHandler.h b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayRegistrationHandler.h index 1fdef93a7..606b9e87b 100644 --- a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayRegistrationHandler.h +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlayRegistrationHandler.h @@ -22,9 +22,9 @@ class __declspec(dllexport) OCOverlayRegistrationHandler { public: - static HRESULT MakeRegistryEntries(const CLSID& clsid, PWSTR fileType); + static HRESULT MakeRegistryEntries(const CLSID& clsid, PCWSTR fileType); static HRESULT RegisterCOMObject(PCWSTR modulePath, const CLSID& clsid); - static HRESULT RemoveRegistryEntries(PWSTR friendlyName); + static HRESULT RemoveRegistryEntries(PCWSTR friendlyName); static HRESULT UnregisterCOMObject(const CLSID& clsid); }; diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OverlayConstants.h b/shell_integration/windows/OCShellExtensions/OCOverlays/OverlayConstants.h index 9df0bc5d0..d93ea98cb 100644 --- a/shell_integration/windows/OCShellExtensions/OCOverlays/OverlayConstants.h +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/OverlayConstants.h @@ -12,9 +12,24 @@ * details. */ -#define OVERLAY_ID 1 -#define OVERLAY_GUID L"{0960F09E-F328-48A3-B746-276B1E3C3722}" -#define OVERLAY_NAME L"OwnCloudStatusOverlay" + +#define OVERLAY_GUID_ERROR L"{0960F090-F328-48A3-B746-276B1E3C3722}" +#define OVERLAY_GUID_ERROR_SHARED L"{0960F091-F328-48A3-B746-276B1E3C3722}" +#define OVERLAY_GUID_OK L"{0960F092-F328-48A3-B746-276B1E3C3722}" +#define OVERLAY_GUID_OK_SHARED L"{0960F093-F328-48A3-B746-276B1E3C3722}" +#define OVERLAY_GUID_SYNC L"{0960F094-F328-48A3-B746-276B1E3C3722}" +#define OVERLAY_GUID_SYNC_SHARED L"{0960F095-F328-48A3-B746-276B1E3C3722}" +#define OVERLAY_GUID_WARNING L"{0960F096-F328-48A3-B746-276B1E3C3722}" +#define OVERLAY_GUID_WARNING_SHARED L"{0960F097-F328-48A3-B746-276B1E3C3722}" + +#define OVERLAY_NAME_ERROR L"OCError" +#define OVERLAY_NAME_ERROR_SHARED L"OCErrorShared" +#define OVERLAY_NAME_OK L"OCOK" +#define OVERLAY_NAME_OK_SHARED L"OCOKShared" +#define OVERLAY_NAME_SYNC L"OCSync" +#define OVERLAY_NAME_SYNC_SHARED L"OCSyncShared" +#define OVERLAY_NAME_WARNING L"OCWarning" +#define OVERLAY_NAME_WARNING_SHARED L"OCWarningShared" #define REGISTRY_OVERLAY_KEY L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ShellIconOverlayIdentifiers" #define REGISTRY_CLSID L"CLSID" diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/resource.h b/shell_integration/windows/OCShellExtensions/OCOverlays/resource.h index dbb1edc400068eaebe94d6372fd3ce339ec21c82..3a3dab3567e16fc80e2d0d5b6536f58c1ef5841e 100644 GIT binary patch delta 15 Wcmcb`)4;PKig^;V)aG-{Jxl;B*9AcU delta 30 mcmZqRxy7>~ig|Jxv(97zMgd0i$%>4clX;l=HkUB>FaZFCX$RT> diff --git a/shell_integration/windows/OCShellExtensions/OCShellExtensions.sln b/shell_integration/windows/OCShellExtensions/OCShellExtensions.sln index 979c155fa..1bfbbf3ed 100644 --- a/shell_integration/windows/OCShellExtensions/OCShellExtensions.sln +++ b/shell_integration/windows/OCShellExtensions/OCShellExtensions.sln @@ -3,14 +3,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 VisualStudioVersion = 12.0.30501.0 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OCUtil", "OCUtil\OCUtil.vcxproj", "{E4F63E19-808D-4234-8DF0-69C5F47C9CD3}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OCOverlays", "OCOverlays\OCOverlays.vcxproj", "{42EFEC79-5ACA-4F76-955F-15CE4340F6BC}" ProjectSection(ProjectDependencies) = postProject {E4F63E19-808D-4234-8DF0-69C5F47C9CD3} = {E4F63E19-808D-4234-8DF0-69C5F47C9CD3} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OCUtilTest", "ConsoleApplication1\ConsoleApplication1.vcxproj", "{A81E3DAE-8FE7-4BD0-82F9-939B2D59D033}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OCUtil", "OCUtil\OCUtil.vcxproj", "{E4F63E19-808D-4234-8DF0-69C5F47C9CD3}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -20,14 +18,6 @@ Global Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Debug|Win32.ActiveCfg = Debug|Win32 - {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Debug|Win32.Build.0 = Debug|Win32 - {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Debug|x64.ActiveCfg = Debug|x64 - {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Debug|x64.Build.0 = Debug|x64 - {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Release|Win32.ActiveCfg = Release|Win32 - {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Release|Win32.Build.0 = Release|Win32 - {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Release|x64.ActiveCfg = Release|x64 - {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Release|x64.Build.0 = Release|x64 {42EFEC79-5ACA-4F76-955F-15CE4340F6BC}.Debug|Win32.ActiveCfg = Debug|Win32 {42EFEC79-5ACA-4F76-955F-15CE4340F6BC}.Debug|Win32.Build.0 = Debug|Win32 {42EFEC79-5ACA-4F76-955F-15CE4340F6BC}.Debug|x64.ActiveCfg = Debug|x64 @@ -36,12 +26,14 @@ Global {42EFEC79-5ACA-4F76-955F-15CE4340F6BC}.Release|Win32.Build.0 = Release|Win32 {42EFEC79-5ACA-4F76-955F-15CE4340F6BC}.Release|x64.ActiveCfg = Release|x64 {42EFEC79-5ACA-4F76-955F-15CE4340F6BC}.Release|x64.Build.0 = Release|x64 - {A81E3DAE-8FE7-4BD0-82F9-939B2D59D033}.Debug|Win32.ActiveCfg = Debug|Win32 - {A81E3DAE-8FE7-4BD0-82F9-939B2D59D033}.Debug|Win32.Build.0 = Debug|Win32 - {A81E3DAE-8FE7-4BD0-82F9-939B2D59D033}.Debug|x64.ActiveCfg = Debug|Win32 - {A81E3DAE-8FE7-4BD0-82F9-939B2D59D033}.Release|Win32.ActiveCfg = Release|Win32 - {A81E3DAE-8FE7-4BD0-82F9-939B2D59D033}.Release|Win32.Build.0 = Release|Win32 - {A81E3DAE-8FE7-4BD0-82F9-939B2D59D033}.Release|x64.ActiveCfg = Release|Win32 + {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Debug|Win32.ActiveCfg = Debug|Win32 + {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Debug|Win32.Build.0 = Debug|Win32 + {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Debug|x64.ActiveCfg = Debug|x64 + {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Debug|x64.Build.0 = Debug|x64 + {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Release|Win32.ActiveCfg = Release|Win32 + {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Release|Win32.Build.0 = Release|Win32 + {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Release|x64.ActiveCfg = Release|x64 + {E4F63E19-808D-4234-8DF0-69C5F47C9CD3}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/shell_integration/windows/OCShellExtensions/OCUtil/RemotePathChecker.cpp b/shell_integration/windows/OCShellExtensions/OCUtil/RemotePathChecker.cpp index 2eec3c2ea..e2eba1d18 100644 --- a/shell_integration/windows/OCShellExtensions/OCUtil/RemotePathChecker.cpp +++ b/shell_integration/windows/OCShellExtensions/OCUtil/RemotePathChecker.cpp @@ -37,7 +37,7 @@ RemotePathChecker::RemotePathChecker(int port) { } -bool RemotePathChecker::IsMonitoredPath(const wchar_t* filePath, bool isDir) +bool RemotePathChecker::IsMonitoredPath(const wchar_t* filePath, int* state) { wstring request; wstring response; @@ -45,11 +45,7 @@ bool RemotePathChecker::IsMonitoredPath(const wchar_t* filePath, bool isDir) CommunicationSocket socket(_port); socket.Connect(); - if (isDir) { - request = L"RETRIEVE_FOLDER_STATUS:"; - } else { - request = L"RETRIEVE_FILE_STATUS:"; - } + request = L"RETRIEVE_FILE_STATUS:"; request += filePath; request += L'\n'; @@ -76,8 +72,11 @@ bool RemotePathChecker::IsMonitoredPath(const wchar_t* filePath, bool isDir) wstring responseStatus = response.substr(statusBegin+1, statusEnd - statusBegin-1); wstring responsePath = response.substr(statusEnd+1); if (responsePath == filePath) { - int status = _StrToFileState(responseStatus); - if (status == StateNone) { + if (!state) { + return false; + } + *state = _StrToFileState(responseStatus); + if (*state == StateNone) { return false; } needed = true; diff --git a/shell_integration/windows/OCShellExtensions/OCUtil/RemotePathChecker.h b/shell_integration/windows/OCShellExtensions/OCUtil/RemotePathChecker.h index 5e58c6d64..47b76f2a8 100644 --- a/shell_integration/windows/OCShellExtensions/OCUtil/RemotePathChecker.h +++ b/shell_integration/windows/OCShellExtensions/OCUtil/RemotePathChecker.h @@ -29,7 +29,7 @@ public: StateNone }; RemotePathChecker(int port); - bool IsMonitoredPath(const wchar_t* filePath, bool isDir); + bool IsMonitoredPath(const wchar_t* filePath, int* state); private: int _StrToFileState(const std::wstring &str); From c7ff1e9b3fc5d1d1ff186390ace1ffd0017109b1 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Tue, 5 Aug 2014 19:23:40 +0200 Subject: [PATCH 3/3] Windows Shell extension: Add watched directories --- .../OCOverlays/OCOverlay.cpp | 21 ++++++++-- .../OCShellExtensions/OCOverlays/OCOverlay.h | 2 + .../OCOverlays/OCOverlays.vcxproj | 2 + .../OCUtil/CommunicationSocket.cpp | 2 + .../OCShellExtensions/OCUtil/OCUtil.vcxproj | 2 + .../OCUtil/RemotePathChecker.cpp | 40 +++++++++++++------ .../OCUtil/RemotePathChecker.h | 3 +- .../OCShellExtensions/OCUtil/StringUtil.h | 8 ++++ 8 files changed, 64 insertions(+), 16 deletions(-) diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.cpp b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.cpp index a8e3689e4..20b809bdc 100644 --- a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.cpp +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.cpp @@ -15,6 +15,8 @@ #include "OCOverlay.h" #include "RegistryUtil.h" +#include "StringUtil.h" + #include "UtilConstants.h" #include "RemotePathChecker.h" @@ -40,6 +42,8 @@ OCOverlay::OCOverlay(int state) , _state(state) { + // FIXME: Use Registry instead + _watchedDirectories = _checker->WatchedDirectories(); } OCOverlay::~OCOverlay(void) @@ -99,6 +103,20 @@ IFACEMETHODIMP OCOverlay::GetPriority(int *pPriority) // return MAKE_HRESULT(S_FALSE, 0, 0); //} + wstring wpath(pwszPath); + wpath.append(L"\\"); + vector::iterator it; + bool watched = false; + for (it = _watchedDirectories.begin(); it != _watchedDirectories.end(); ++it) { + if (StringUtil::begins_with(wpath, *it)) { + watched = true; + } + } + + if (!watched) { + return MAKE_HRESULT(S_FALSE, 0, 0); + } + int state = 0; if (!_checker->IsMonitoredPath(pwszPath, &state)) { return MAKE_HRESULT(S_FALSE, 0, 0); @@ -127,9 +145,6 @@ bool OCOverlay::_IsOverlaysEnabled() //int enable; bool success = false; - - - //if(RegistryUtil::ReadRegistry(REGISTRY_ROOT_KEY, REGISTRY_ENABLE_OVERLAY, &enable)) //{ // if(enable) { diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.h b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.h index a84bc45b0..801b30332 100644 --- a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.h +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.h @@ -45,6 +45,8 @@ private: CommunicationSocket* _communicationSocket; RemotePathChecker* _checker; int _state; + + std::vector _watchedDirectories; }; #endif \ No newline at end of file diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlays.vcxproj b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlays.vcxproj index b9f352b22..d648d8bf6 100644 --- a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlays.vcxproj +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlays.vcxproj @@ -100,6 +100,7 @@ ..\$(Configuration)\$(Platform); OCUtil_x86.lib;%(AdditionalDependencies) OCOverlays.def + Windows @@ -114,6 +115,7 @@ ..\$(Configuration)\$(Platform); OCUtil_x64.lib;%(AdditionalDependencies) OCOverlays.def + Windows diff --git a/shell_integration/windows/OCShellExtensions/OCUtil/CommunicationSocket.cpp b/shell_integration/windows/OCShellExtensions/OCUtil/CommunicationSocket.cpp index 92f404848..a2f4a9413 100644 --- a/shell_integration/windows/OCShellExtensions/OCUtil/CommunicationSocket.cpp +++ b/shell_integration/windows/OCShellExtensions/OCUtil/CommunicationSocket.cpp @@ -76,6 +76,8 @@ bool CommunicationSocket::Connect() clientService.sin_port = htons(_port); iResult = connect(_clientSocket, (SOCKADDR*)&clientService, sizeof(clientService)); + DWORD timeout = 500; // ms + setsockopt(_clientSocket, SOL_SOCKET, SO_RCVTIMEO, (const char*) &timeout, sizeof(DWORD)); if (iResult == SOCKET_ERROR) { //int error = WSAGetLastError(); diff --git a/shell_integration/windows/OCShellExtensions/OCUtil/OCUtil.vcxproj b/shell_integration/windows/OCShellExtensions/OCUtil/OCUtil.vcxproj index fc3b1a31f..a29cc48c9 100644 --- a/shell_integration/windows/OCShellExtensions/OCUtil/OCUtil.vcxproj +++ b/shell_integration/windows/OCShellExtensions/OCUtil/OCUtil.vcxproj @@ -96,6 +96,7 @@ true ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + Windows @@ -106,6 +107,7 @@ true ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + Windows diff --git a/shell_integration/windows/OCShellExtensions/OCUtil/RemotePathChecker.cpp b/shell_integration/windows/OCShellExtensions/OCUtil/RemotePathChecker.cpp index e2eba1d18..a6d9cce28 100644 --- a/shell_integration/windows/OCShellExtensions/OCUtil/RemotePathChecker.cpp +++ b/shell_integration/windows/OCShellExtensions/OCUtil/RemotePathChecker.cpp @@ -14,29 +14,45 @@ #include "CommunicationSocket.h" #include "RemotePathChecker.h" +#include "StringUtil.h" #include #include #include #include -#include using namespace std; -namespace { - template - bool begins_with(const TContainer& input, const TContainer& match) - { - return input.size() >= match.size() - && equal(match.begin(), match.end(), input.begin()); - } -} - RemotePathChecker::RemotePathChecker(int port) : _port(port) { } +vector RemotePathChecker::WatchedDirectories() +{ + vector watchedDirectories; + wstring response; + bool needed = false; + + CommunicationSocket socket(_port); + socket.Connect(); + + while (socket.ReadLine(&response)) { + if (StringUtil::begins_with(response, wstring(L"REGISTER_PATH:"))) { + size_t pathBegin = response.find(L':', 0); + if (pathBegin == -1) { + continue; + } + + // chop trailing '\n' + wstring responsePath = response.substr(pathBegin + 1, response.length()-1); + watchedDirectories.push_back(responsePath); + } + } + + return watchedDirectories; +} + bool RemotePathChecker::IsMonitoredPath(const wchar_t* filePath, int* state) { wstring request; @@ -53,9 +69,9 @@ bool RemotePathChecker::IsMonitoredPath(const wchar_t* filePath, int* state) return false; } - while ((socket.ReadLine(&response))) { + while (socket.ReadLine(&response)) { // discard broadcast messages - if (begins_with(response, wstring(L"STATUS:"))) { + if (StringUtil::begins_with(response, wstring(L"STATUS:"))) { break; } } diff --git a/shell_integration/windows/OCShellExtensions/OCUtil/RemotePathChecker.h b/shell_integration/windows/OCShellExtensions/OCUtil/RemotePathChecker.h index 47b76f2a8..1fb1ef9f3 100644 --- a/shell_integration/windows/OCShellExtensions/OCUtil/RemotePathChecker.h +++ b/shell_integration/windows/OCShellExtensions/OCUtil/RemotePathChecker.h @@ -15,6 +15,7 @@ #define PATHCHECKER_H #include +#include #pragma once @@ -29,11 +30,11 @@ public: StateNone }; RemotePathChecker(int port); + std::vector WatchedDirectories(); bool IsMonitoredPath(const wchar_t* filePath, int* state); private: int _StrToFileState(const std::wstring &str); - int _port; }; diff --git a/shell_integration/windows/OCShellExtensions/OCUtil/StringUtil.h b/shell_integration/windows/OCShellExtensions/OCUtil/StringUtil.h index d885a89f6..cf6ec8606 100644 --- a/shell_integration/windows/OCShellExtensions/OCUtil/StringUtil.h +++ b/shell_integration/windows/OCShellExtensions/OCUtil/StringUtil.h @@ -22,6 +22,14 @@ class __declspec(dllexport) StringUtil { public: static char* toUtf8(const wchar_t* utf16, int len = -1); static wchar_t* toUtf16(const char* utf8, int len = -1); + + + template + static bool begins_with(const T& input, const T& match) + { + return input.size() >= match.size() + && equal(match.begin(), match.end(), input.begin()); + } }; #endif // STRINGUTIL_H