Zebediah Figura : msi: Handle the remote case directly in MsiGetSourcePathA().

Alexandre Julliard julliard at winehq.org
Thu May 17 19:10:58 CDT 2018


Module: wine
Branch: master
Commit: 43ce218a48f5b3420f48379e911e974b8bb9ef88
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=43ce218a48f5b3420f48379e911e974b8bb9ef88

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Thu May 17 10:48:18 2018 -0500

msi: Handle the remote case directly in MsiGetSourcePathA().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msi/install.c      | 48 ++++++++++++++++++++++++++++++++++++++----------
 dlls/msi/tests/custom.c |  8 ++++----
 2 files changed, 42 insertions(+), 14 deletions(-)

diff --git a/dlls/msi/install.c b/dlls/msi/install.c
index 31352c6..d62fe26 100644
--- a/dlls/msi/install.c
+++ b/dlls/msi/install.c
@@ -421,22 +421,50 @@ static UINT MSI_GetSourcePath( MSIHANDLE hInstall, LPCWSTR szFolder,
 /***********************************************************************
  * MsiGetSourcePathA     (MSI.@)
  */
-UINT WINAPI MsiGetSourcePathA( MSIHANDLE hInstall, LPCSTR szFolder, 
-                               LPSTR szPathBuf, LPDWORD pcchPathBuf )
+UINT WINAPI MsiGetSourcePathA(MSIHANDLE hinst, const char *folder, char *buf, DWORD *sz)
 {
-    LPWSTR folder;
-    awstring str;
+    MSIPACKAGE *package;
+    const WCHAR *path;
+    WCHAR *folderW;
     UINT r;
 
-    TRACE("%s %p %p\n", debugstr_a(szFolder), szPathBuf, pcchPathBuf);
+    TRACE("%s %p %p\n", debugstr_a(folder), buf, sz);
+
+    if (!folder)
+        return ERROR_INVALID_PARAMETER;
+
+    if (!(folderW = strdupAtoW(folder)))
+        return ERROR_OUTOFMEMORY;
+
+    package = msihandle2msiinfo(hinst, MSIHANDLETYPE_PACKAGE);
+    if (!package)
+    {
+        WCHAR *path = NULL;
+        MSIHANDLE remote;
+
+        if (!(remote = msi_get_remote(hinst)))
+        {
+            heap_free(folderW);
+            return ERROR_INVALID_HANDLE;
+        }
 
-    str.unicode = FALSE;
-    str.str.a = szPathBuf;
+        r = remote_GetSourcePath(remote, folderW, &path);
+        if (!r)
+            r = msi_strncpyWtoA(path, -1, buf, sz, TRUE);
+
+        midl_user_free(path);
+        heap_free(folderW);
+        return r;
+    }
 
-    folder = strdupAtoW( szFolder );
-    r = MSI_GetSourcePath( hInstall, folder, &str, pcchPathBuf );
-    msi_free( folder );
+    path = msi_resolve_source_folder(package, folderW, NULL);
+    if (path)
+        r = msi_strncpyWtoA(path, -1, buf, sz, FALSE);
+    else
+        r = ERROR_DIRECTORY;
 
+    heap_free(folderW);
+    msiobj_release(&package->hdr);
     return r;
 }
 
diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c
index 4e42eed..ff1be9b 100644
--- a/dlls/msi/tests/custom.c
+++ b/dlls/msi/tests/custom.c
@@ -584,28 +584,28 @@ static void test_targetpath(MSIHANDLE hinst)
     sz = 0;
     r = MsiGetSourcePathA(hinst, "TARGETDIR", NULL, &sz);
     ok(hinst, !r, "got %u\n", r);
-    todo_wine_ok(hinst, sz == srcsz * 2, "got size %u\n", sz);
+    ok(hinst, sz == srcsz * 2, "got size %u\n", sz);
 
     sz = 0;
     strcpy(buffer,"q");
     r = MsiGetSourcePathA(hinst, "TARGETDIR", buffer, &sz);
     ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
     ok(hinst, !strcmp(buffer, "q"), "got \"%s\"\n", buffer);
-    todo_wine_ok(hinst, sz == srcsz * 2, "got size %u\n", sz);
+    ok(hinst, sz == srcsz * 2, "got size %u\n", sz);
 
     sz = 1;
     strcpy(buffer,"x");
     r = MsiGetSourcePathA(hinst, "TARGETDIR", buffer, &sz);
     ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
     ok(hinst, !buffer[0], "got \"%s\"\n", buffer);
-    todo_wine_ok(hinst, sz == srcsz * 2, "got size %u\n", sz);
+    ok(hinst, sz == srcsz * 2, "got size %u\n", sz);
 
     sz = srcsz;
     strcpy(buffer,"x");
     r = MsiGetSourcePathA(hinst, "TARGETDIR", buffer, &sz);
     ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
     ok(hinst, strlen(buffer) == srcsz - 1, "wrong buffer length %d\n", strlen(buffer));
-    todo_wine_ok(hinst, sz == srcsz * 2, "got size %u\n", sz);
+    ok(hinst, sz == srcsz * 2, "got size %u\n", sz);
 
     sz = srcsz + 1;
     strcpy(buffer,"x");




More information about the wine-cvs mailing list