Author: gadamopoulos
Date: Sat Feb 21 14:36:22 2015
New Revision: 66388

URL: http://svn.reactos.org/svn/reactos?rev=66388&view=rev
Log:
[SHELL32]
- Fix crash during shell32:shlfileop test.
CORE-4476

Modified:
    trunk/reactos/dll/win32/shell32/shlfileop.cpp

Modified: trunk/reactos/dll/win32/shell32/shlfileop.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shlfileop.cpp?rev=66388&r1=66387&r2=66388&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shell32/shlfileop.cpp       [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shlfileop.cpp       [iso-8859-1] Sat Feb 21 
14:36:22 2015
@@ -1714,6 +1714,10 @@
     if (!lpFileOp)
         return ERROR_INVALID_PARAMETER;
 
+    ret = CoInitialize(NULL);
+    if (FAILED(ret))
+        return ret;
+
     check_flags(lpFileOp->fFlags);
 
     ZeroMemory(&flFrom, sizeof(FILE_LIST));
@@ -1732,7 +1736,13 @@
     op.bManyItems = (flFrom.dwNumFiles > 1);
 
     if (lpFileOp->wFunc != FO_RENAME && !(lpFileOp->fFlags & FOF_SILENT)) {
-        CoCreateInstance(CLSID_ProgressDialog, NULL, CLSCTX_INPROC_SERVER, 
IID_IProgressDialog, (void**) &op.progress);
+        ret = CoCreateInstance(CLSID_ProgressDialog, 
+                               NULL, 
+                               CLSCTX_INPROC_SERVER, 
+                               IID_PPV_ARG(IProgressDialog, &op.progress));
+        if (FAILED(ret))
+            goto cleanup;
+
         op.progress->StartProgressDialog(op.req->hwnd, NULL, PROGDLG_NORMAL & 
PROGDLG_AUTOTIME, NULL);
         _SetOperationTitle(&op);
         _FileOpCountManager(&op, &flFrom);
@@ -1762,6 +1772,7 @@
         op.progress->Release();
     }
 
+cleanup:
     destroy_file_list(&flFrom);
 
     if (lpFileOp->wFunc != FO_DELETE)
@@ -1769,6 +1780,8 @@
 
     if (ret == ERROR_CANCELLED)
         lpFileOp->fAnyOperationsAborted = TRUE;
+
+    CoUninitialize();
 
     return ret;
 }


Reply via email to