[ADVPACK]: Sync with Wine 1.5.19.
[reactos.git] / reactos / dll / win32 / advpack / files.c
index f6056f2..c34f6d5 100644 (file)
@@ -779,11 +779,39 @@ done:
 HRESULT WINAPI ExtractFilesW(LPCWSTR CabName, LPCWSTR ExpandDir, DWORD Flags,
                              LPCWSTR FileList, LPVOID LReserved, DWORD Reserved)
 {
 HRESULT WINAPI ExtractFilesW(LPCWSTR CabName, LPCWSTR ExpandDir, DWORD Flags,
                              LPCWSTR FileList, LPVOID LReserved, DWORD Reserved)
 {
+    char *cab_name = NULL, *expand_dir = NULL, *file_list = NULL;
+    HRESULT hres = S_OK;
 
 
-    FIXME("(%s, %s, %d, %s, %p, %d) stub!\n", debugstr_w(CabName), debugstr_w(ExpandDir),
+    TRACE("(%s, %s, %d, %s, %p, %d)\n", debugstr_w(CabName), debugstr_w(ExpandDir),
           Flags, debugstr_w(FileList), LReserved, Reserved);
 
           Flags, debugstr_w(FileList), LReserved, Reserved);
 
-    return E_FAIL;
+    if(CabName) {
+        cab_name = heap_strdupWtoA(CabName);
+        if(!cab_name)
+            return E_OUTOFMEMORY;
+    }
+
+    if(ExpandDir) {
+        expand_dir = heap_strdupWtoA(ExpandDir);
+        if(!expand_dir)
+            hres = E_OUTOFMEMORY;
+    }
+
+    if(SUCCEEDED(hres) && FileList) {
+        file_list = heap_strdupWtoA(FileList);
+        if(!file_list)
+            hres = E_OUTOFMEMORY;
+    }
+
+    /* cabinet.dll, which does the real job of extracting files, doesn't have UNICODE API,
+       so we need W->A conversion at some point anyway. */
+    if(SUCCEEDED(hres))
+        hres = ExtractFilesA(cab_name, expand_dir, Flags, file_list, LReserved, Reserved);
+
+    heap_free(cab_name);
+    heap_free(expand_dir);
+    heap_free(file_list);
+    return hres;
 }
 
 /***********************************************************************
 }
 
 /***********************************************************************