[Pkg-owncloud-commits] [owncloud-client] 206/470: [Win-shellex] Make sure to unregister obsolete CLSIDs #4595

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu May 12 16:25:03 UTC 2016


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 5989a07339b30946b96cdad02a1bf223e06f5694
Author: Jocelyn Turcotte <jturcotte at woboq.com>
Date:   Thu Mar 24 16:24:11 2016 +0100

    [Win-shellex] Make sure to unregister obsolete CLSIDs #4595
    
    If the user tries to install an older version of a branded client
    with shell extensions, and also install the 2.1 ownCloud client
    side-by-side, both shell extensions DLLs will be registered and might
    lead to both DLLs versions being loaded by exlorer, causing a system
    crash.
    
    Since we don't support both branded and non-branded shell extensions
    to work at the same time, at least make sure to unregister any legacy
    CLSID that could cause explorer to load the previous version DLL.
---
 binary                                             |   2 +-
 shell_integration/windows/OCOverlays/DllMain.cpp   |  56 ++++++++++++---------
 shell_integration/windows/OCOverlays/OCOverlay.rc  | Bin 5672 -> 6112 bytes
 .../windows/OCOverlays/OverlayConstants.h          |   6 +++
 4 files changed, 38 insertions(+), 26 deletions(-)

diff --git a/binary b/binary
index 71633ed..2e28918 160000
--- a/binary
+++ b/binary
@@ -1 +1 @@
-Subproject commit 71633edc9a3cff33a0f13acfe3c1e1fee1db925e
+Subproject commit 2e289185b8dfca845728baded466c9737717292a
diff --git a/shell_integration/windows/OCOverlays/DllMain.cpp b/shell_integration/windows/OCOverlays/DllMain.cpp
index 9c96f97..6e6b092 100644
--- a/shell_integration/windows/OCOverlays/DllMain.cpp
+++ b/shell_integration/windows/OCOverlays/DllMain.cpp
@@ -108,31 +108,6 @@ HRESULT RegisterCLSID(LPCOLESTR guidStr, PCWSTR overlayStr, PCWSTR szModule)
 	return hResult;
 }
 
-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;
-	}
-
-	hResult = RegisterCLSID(OVERLAY_GUID_ERROR, OVERLAY_NAME_ERROR, 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_WARNING, OVERLAY_NAME_WARNING, szModule);
-
-    return hResult;
-}
-
-
 HRESULT UnregisterCLSID(LPCOLESTR guidStr, PCWSTR overlayStr)
 {
 	HRESULT hResult = S_OK;
@@ -155,6 +130,37 @@ HRESULT UnregisterCLSID(LPCOLESTR guidStr, PCWSTR overlayStr)
 	return hResult;
 }
 
+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;
+	}
+
+	// Unregister any obsolete CLSID when we register here
+	// Those CLSID were removed in 2.1, but we need to make sure to prevent any previous version
+	// of the extension on the system from loading at the same time as a new version to avoid crashing explorer.
+	UnregisterCLSID(OVERLAY_GUID_ERROR_SHARED, OVERLAY_NAME_ERROR_SHARED);
+	UnregisterCLSID(OVERLAY_GUID_SYNC_SHARED, OVERLAY_NAME_SYNC_SHARED);
+	UnregisterCLSID(OVERLAY_GUID_WARNING_SHARED, OVERLAY_NAME_WARNING_SHARED);
+
+	hResult = RegisterCLSID(OVERLAY_GUID_ERROR, OVERLAY_NAME_ERROR, 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_WARNING, OVERLAY_NAME_WARNING, szModule);
+
+	return hResult;
+}
+
 STDAPI DllUnregisterServer(void)
 {
     HRESULT hResult = S_OK;
diff --git a/shell_integration/windows/OCOverlays/OCOverlay.rc b/shell_integration/windows/OCOverlays/OCOverlay.rc
index 71d453f..0be9b49 100644
Binary files a/shell_integration/windows/OCOverlays/OCOverlay.rc and b/shell_integration/windows/OCOverlays/OCOverlay.rc differ
diff --git a/shell_integration/windows/OCOverlays/OverlayConstants.h b/shell_integration/windows/OCOverlays/OverlayConstants.h
index 4e38984..5adf0a5 100644
--- a/shell_integration/windows/OCOverlays/OverlayConstants.h
+++ b/shell_integration/windows/OCOverlays/OverlayConstants.h
@@ -14,19 +14,25 @@
 
 
 #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_GENERIC_NAME        L"OC Overlay Handler"
 
 // two spaces to put us ahead of the competition :/
 #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"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list