From 6d22ab59235627fb9fded5862ffcfd79b3821699 Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Tue, 19 Aug 2008 22:40:05 +0000 Subject: [PATCH] * The CLSID of a PropertySheet handler can either be present as subkey or as a default value. * Fixes WinRar file property sheet handler and etc... svn path=/trunk/; revision=35465 --- reactos/dll/win32/shell32/shellord.c | 60 +++++++++++++++------------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/reactos/dll/win32/shell32/shellord.c b/reactos/dll/win32/shell32/shellord.c index f3811d54c46..0fa51324751 100644 --- a/reactos/dll/win32/shell32/shellord.c +++ b/reactos/dll/win32/shell32/shellord.c @@ -1662,6 +1662,7 @@ HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY hKey, LPCWSTR pszSubKey, UINT max_ IShellPropSheetExt *pspsx; HKEY hkBase, hkPropSheetHandlers; PPSXA psxa = NULL; + HRESULT hr; TRACE("(%p,%s,%u)\n", hKey, debugstr_w(pszSubKey), max_iface); @@ -1699,38 +1700,41 @@ HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY hKey, LPCWSTR pszSubKey, UINT max_ lRet = ERROR_SUCCESS; break; } - - dwClsidSize = sizeof(szClsidHandler); - if (SHGetValueW(hkPropSheetHandlers, szHandler, NULL, NULL, szClsidHandler, &dwClsidSize) == ERROR_SUCCESS) + szHandler[(sizeof(szHandler) / sizeof(szHandler[0])) - 1] = 0; + hr = SHCLSIDFromStringW(szHandler, &clsid); + if (FAILED(hr)) { - /* Force a NULL-termination and convert the string */ - szClsidHandler[(sizeof(szClsidHandler) / sizeof(szClsidHandler[0])) - 1] = 0; - if (SUCCEEDED(SHCLSIDFromStringW(szClsidHandler, &clsid))) + dwClsidSize = sizeof(szClsidHandler); + if (SHGetValueW(hkPropSheetHandlers, szHandler, NULL, NULL, szClsidHandler, &dwClsidSize) == ERROR_SUCCESS) { - /* Attempt to get an IShellPropSheetExt and an IShellExtInit instance. - Only if both interfaces are supported it's a real shell extension. - Then call IShellExtInit's Initialize method. */ - if (SUCCEEDED(CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER/* | CLSCTX_NO_CODE_DOWNLOAD */, &IID_IShellPropSheetExt, (LPVOID *)&pspsx))) - { - if (SUCCEEDED(pspsx->lpVtbl->QueryInterface(pspsx, &IID_IShellExtInit, (PVOID *)&psxi))) - { - if (SUCCEEDED(psxi->lpVtbl->Initialize(psxi, NULL, pDataObj, hKey))) - { - /* Add the IShellPropSheetExt instance to the array */ - psxa->pspsx[psxa->uiCount++] = pspsx; - } - else - { - psxi->lpVtbl->Release(psxi); - pspsx->lpVtbl->Release(pspsx); - } - } - else - pspsx->lpVtbl->Release(pspsx); - } + szClsidHandler[(sizeof(szClsidHandler) / sizeof(szClsidHandler[0])) - 1] = 0; + hr = SHCLSIDFromStringW(szClsidHandler, &clsid); + } + } + if (SUCCEEDED(hr)) + { + /* Attempt to get an IShellPropSheetExt and an IShellExtInit instance. + Only if both interfaces are supported it's a real shell extension. + Then call IShellExtInit's Initialize method. */ + if (SUCCEEDED(CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER/* | CLSCTX_NO_CODE_DOWNLOAD */, &IID_IShellPropSheetExt, (LPVOID *)&pspsx))) + { + if (SUCCEEDED(pspsx->lpVtbl->QueryInterface(pspsx, &IID_IShellExtInit, (PVOID *)&psxi))) + { + if (SUCCEEDED(psxi->lpVtbl->Initialize(psxi, NULL, pDataObj, hKey))) + { + /* Add the IShellPropSheetExt instance to the array */ + psxa->pspsx[psxa->uiCount++] = pspsx; + } + else + { + psxi->lpVtbl->Release(psxi); + pspsx->lpVtbl->Release(pspsx); + } + } + else + pspsx->lpVtbl->Release(pspsx); } } - } while (psxa->uiCount != psxa->uiAllocated); } else