[CABINET] Sync with Wine Staging 3.3. CORE-14434
[reactos.git] / dll / win32 / cabinet / cabinet_main.c
index 1f0daf8..8af0fb1 100644 (file)
@@ -251,11 +251,9 @@ static INT_PTR CDECL fdi_notify_extract(FDINOTIFICATIONTYPE fdint, PFDINOTIFICAT
                 }
 
                 hFile = CreateFileA(szFullPath, GENERIC_READ | GENERIC_WRITE, 0, NULL,
-                                    CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
+                                    CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
 
-                if (hFile == INVALID_HANDLE_VALUE)
-                    hFile = 0;
-                else if (node)
+                if (hFile != INVALID_HANDLE_VALUE && node)
                     node->DoExtract = FALSE;
             }
 
@@ -333,7 +331,7 @@ HRESULT WINAPI Extract(SESSION *dest, LPCSTR szCabName)
     HFDI hfdi;
     char *str, *end, *path = NULL, *name = NULL;
 
-    TRACE("(%p, %s)\n", dest, szCabName);
+    TRACE("(%p, %s)\n", dest, debugstr_a(szCabName));
 
     hfdi = FDICreate(mem_alloc,
                      mem_free,
@@ -365,6 +363,7 @@ HRESULT WINAPI Extract(SESSION *dest, LPCSTR szCabName)
 
     if ((end = strrchr(str, '\\')))
     {
+        path = str;
         end++;
         name = HeapAlloc( GetProcessHeap(), 0, strlen(end) + 1 );
         if (!name)
@@ -374,7 +373,6 @@ HRESULT WINAPI Extract(SESSION *dest, LPCSTR szCabName)
         }
         strcpy( name, end );
         *end = 0;
-        path = str;
     }
     else
     {