https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c33915e4098d1dfb0b5e4…
commit c33915e4098d1dfb0b5e4a6ed7dfcc8471e75c76
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sat Mar 12 15:12:18 2022 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sun Mar 20 19:27:46 2022 +0100
[WINESYNC] msi: Handle the remote case directly in MsiGetTargetPathA().
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id c9fc3510218f3426b9b448b4569ff4fd275044f8 by Zebediah Figura
<z.figura12(a)gmail.com>
---
dll/win32/msi/install.c | 48 ++++++++++++++++++++++++---------
modules/rostests/winetests/msi/custom.c | 8 +++---
2 files changed, 40 insertions(+), 16 deletions(-)
diff --git a/dll/win32/msi/install.c b/dll/win32/msi/install.c
index 7271763f428..e87534d8bec 100644
--- a/dll/win32/msi/install.c
+++ b/dll/win32/msi/install.c
@@ -271,26 +271,50 @@ static UINT MSI_GetTargetPath( MSIHANDLE hInstall, LPCWSTR
szFolder,
/***********************************************************************
* MsiGetTargetPathA (MSI.@)
*/
-UINT WINAPI MsiGetTargetPathA( MSIHANDLE hInstall, LPCSTR szFolder,
- LPSTR szPathBuf, LPDWORD pcchPathBuf )
+UINT WINAPI MsiGetTargetPathA(MSIHANDLE hinst, const char *folder, char *buf, DWORD *sz)
{
- LPWSTR szwFolder;
- awstring path;
+ 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);
- szwFolder = strdupAtoW(szFolder);
- if (szFolder && !szwFolder)
- return ERROR_FUNCTION_FAILED;
+ 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;
- path.unicode = FALSE;
- path.str.a = szPathBuf;
+ if (!(remote = msi_get_remote(hinst)))
+ {
+ heap_free(folderW);
+ return ERROR_INVALID_HANDLE;
+ }
- r = MSI_GetTargetPath( hInstall, szwFolder, &path, pcchPathBuf );
+ r = remote_GetTargetPath(remote, folderW, &path);
+ if (!r)
+ r = msi_strncpyWtoA(path, -1, buf, sz, TRUE);
- msi_free( szwFolder );
+ midl_user_free(path);
+ heap_free(folderW);
+ return r;
+ }
+ path = msi_get_target_folder(package, folderW);
+ 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/modules/rostests/winetests/msi/custom.c
b/modules/rostests/winetests/msi/custom.c
index d240964aae7..4e42eed64b9 100644
--- a/modules/rostests/winetests/msi/custom.c
+++ b/modules/rostests/winetests/msi/custom.c
@@ -485,28 +485,28 @@ static void test_targetpath(MSIHANDLE hinst)
sz = 0;
r = MsiGetTargetPathA(hinst, "TARGETDIR", NULL, &sz);
ok(hinst, !r, "got %u\n", r);
- todo_wine_ok(hinst, sz == 6, "got size %u\n", sz);
+ ok(hinst, sz == 6, "got size %u\n", sz);
sz = 0;
strcpy(buffer,"q");
r = MsiGetTargetPathA(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 == 6, "got size %u\n", sz);
+ ok(hinst, sz == 6, "got size %u\n", sz);
sz = 1;
strcpy(buffer,"x");
r = MsiGetTargetPathA(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 == 6, "got size %u\n", sz);
+ ok(hinst, sz == 6, "got size %u\n", sz);
sz = 3;
strcpy(buffer,"x");
r = MsiGetTargetPathA(hinst, "TARGETDIR", buffer, &sz);
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
ok(hinst, !strcmp(buffer, "C:"), "got \"%s\"\n",
buffer);
- todo_wine_ok(hinst, sz == 6, "got size %u\n", sz);
+ ok(hinst, sz == 6, "got size %u\n", sz);
sz = 4;
strcpy(buffer,"x");