[ros-diffs] [janderwald] 35465: * 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...

janderwald at svn.reactos.org janderwald at svn.reactos.org
Wed Aug 20 00:40:05 CEST 2008


Author: janderwald
Date: Tue Aug 19 17:40:05 2008
New Revision: 35465

URL: http://svn.reactos.org/svn/reactos?rev=35465&view=rev
Log:
* 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...

Modified:
    trunk/reactos/dll/win32/shell32/shellord.c

Modified: trunk/reactos/dll/win32/shell32/shellord.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellord.c?rev=35465&r1=35464&r2=35465&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shell32/shellord.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shellord.c [iso-8859-1] Tue Aug 19 17:40:05 2008
@@ -1662,6 +1662,7 @@
     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 @@
                         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)))
+                        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(pspsx->lpVtbl->QueryInterface(pspsx, &IID_IShellExtInit, (PVOID *)&psxi)))
+                            if (SUCCEEDED(psxi->lpVtbl->Initialize(psxi, NULL, pDataObj, hKey)))
                             {
-                                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);
-                                }
+                                /* 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



More information about the Ros-diffs mailing list