[ADVPACK]: Sync with Wine 1.5.19.
authorAmine Khaldi <amine.khaldi@reactos.org>
Mon, 10 Dec 2012 14:28:25 +0000 (14:28 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Mon, 10 Dec 2012 14:28:25 +0000 (14:28 +0000)
svn path=/trunk/; revision=57861

reactos/dll/win32/advpack/CMakeLists.txt
reactos/dll/win32/advpack/advpack_private.h
reactos/dll/win32/advpack/files.c
reactos/media/doc/README.WINE

index a11becd..9650fc6 100644 (file)
@@ -3,7 +3,7 @@ add_definitions(-D__WINESRC__)
 
 include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
 
-spec2def(advpack.dll advpack.spec)
+spec2def(advpack.dll advpack.spec ADD_IMPORTLIB)
 
 list(APPEND SOURCE
     advpack.c
index cbbbf48..5d74897 100644 (file)
@@ -27,4 +27,28 @@ void set_ldids(HINF hInf, LPCWSTR pszInstallSection, LPCWSTR pszWorkingDir) DECL
 
 HRESULT launch_exe(LPCWSTR cmd, LPCWSTR dir, HANDLE *phEXE) DECLSPEC_HIDDEN;
 
+static inline void *heap_alloc(size_t len)
+{
+    return HeapAlloc(GetProcessHeap(), 0, len);
+}
+
+static inline BOOL heap_free(void *mem)
+{
+    return HeapFree(GetProcessHeap(), 0, mem);
+}
+
+static inline char *heap_strdupWtoA(const WCHAR *str)
+{
+    char *ret = NULL;
+
+    if(str) {
+        size_t size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
+        ret = heap_alloc(size);
+        if(ret)
+            WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
+    }
+
+    return ret;
+}
+
 #endif /* __ADVPACK_PRIVATE_H */
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)
 {
+    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);
 
-    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;
 }
 
 /***********************************************************************
index 102df89..41b81b6 100644 (file)
@@ -39,7 +39,7 @@ reactos/dll/directx/qedit         # Autosync
 reactos/dll/directx/quartz        # Autosync
 reactos/dll/win32/activeds        # Synced to Wine-1.1.43?
 reactos/dll/win32/actxprxy        # Synced to Wine-1.3.29?
-reactos/dll/win32/advpack         # Synced to Wine-1.5.4
+reactos/dll/win32/advpack         # Synced to Wine-1.5.19
 reactos/dll/win32/atl             # Synced to Wine-1.3.37
 reactos/dll/win32/avifil32        # Synced to Wine-1.3.37
 reactos/dll/win32/bcrypt          # Synced to Wine-1.5.4