[CABINET] Sync with Wine Staging 3.3. CORE-14434
[reactos.git] / dll / win32 / cabinet / cabinet_main.c
index e759f8b..8af0fb1 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "cabinet.h"
+#include "config.h"
+
+#include <assert.h>
+#include <stdarg.h>
+#include <string.h>
 
+#include "windef.h"
+#include "winbase.h"
+#include "winerror.h"
 #define NO_SHLWAPI_REG
-#include <shlwapi.h>
+#include "shlwapi.h"
 #undef NO_SHLWAPI_REG
 
+#include "cabinet.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(cabinet);
+
+
 /***********************************************************************
  * DllGetVersion (CABINET.2)
  *
@@ -237,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;
             }
 
@@ -319,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,