https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2f2e68eb50b9a9087687f…
commit 2f2e68eb50b9a9087687f26789e20d62d886740e
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: Avoid using awstring in MsiGetTargetPathW().
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 ce3fc1af555106bcc614a1b9259172357035517f by Zebediah Figura
<z.figura12(a)gmail.com>
---
dll/win32/msi/install.c | 80 ++++++++++++++++++++-----------------------------
1 file changed, 32 insertions(+), 48 deletions(-)
diff --git a/dll/win32/msi/install.c b/dll/win32/msi/install.c
index e87534d8bec..4d8fecfe256 100644
--- a/dll/win32/msi/install.c
+++ b/dll/win32/msi/install.c
@@ -227,47 +227,6 @@ const WCHAR *msi_get_target_folder( MSIPACKAGE *package, const WCHAR
*name )
return folder->ResolvedTarget;
}
-/***********************************************************************
- * MsiGetTargetPath (internal)
- */
-static UINT MSI_GetTargetPath( MSIHANDLE hInstall, LPCWSTR szFolder,
- awstring *szPathBuf, LPDWORD pcchPathBuf )
-{
- MSIPACKAGE *package;
- const WCHAR *path;
- UINT r = ERROR_FUNCTION_FAILED;
-
- if (!szFolder)
- return ERROR_INVALID_PARAMETER;
-
- package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
- if (!package)
- {
- LPWSTR value = NULL;
- MSIHANDLE remote;
-
- if (!(remote = msi_get_remote(hInstall)))
- return ERROR_INVALID_HANDLE;
-
- r = remote_GetTargetPath(remote, szFolder, &value);
- if (r != ERROR_SUCCESS)
- return r;
-
- r = msi_strcpy_to_awstring(value, -1, szPathBuf, pcchPathBuf);
-
- midl_user_free(value);
- return r;
- }
-
- path = msi_get_target_folder( package, szFolder );
- msiobj_release( &package->hdr );
-
- if (!path)
- return ERROR_DIRECTORY;
-
- return msi_strcpy_to_awstring( path, -1, szPathBuf, pcchPathBuf );
-}
-
/***********************************************************************
* MsiGetTargetPathA (MSI.@)
*/
@@ -321,17 +280,42 @@ UINT WINAPI MsiGetTargetPathA(MSIHANDLE hinst, const char *folder,
char *buf, DW
/***********************************************************************
* MsiGetTargetPathW (MSI.@)
*/
-UINT WINAPI MsiGetTargetPathW( MSIHANDLE hInstall, LPCWSTR szFolder,
- LPWSTR szPathBuf, LPDWORD pcchPathBuf )
+UINT WINAPI MsiGetTargetPathW(MSIHANDLE hinst, const WCHAR *folder, WCHAR *buf, DWORD
*sz)
{
- awstring path;
+ MSIPACKAGE *package;
+ const WCHAR *path;
+ UINT r;
- TRACE("%s %p %p\n", debugstr_w(szFolder), szPathBuf, pcchPathBuf);
+ TRACE("%s %p %p\n", debugstr_w(folder), buf, sz);
- path.unicode = TRUE;
- path.str.w = szPathBuf;
+ if (!folder)
+ return ERROR_INVALID_PARAMETER;
+
+ package = msihandle2msiinfo(hinst, MSIHANDLETYPE_PACKAGE);
+ if (!package)
+ {
+ WCHAR *path = NULL;
+ MSIHANDLE remote;
- return MSI_GetTargetPath( hInstall, szFolder, &path, pcchPathBuf );
+ if (!(remote = msi_get_remote(hinst)))
+ return ERROR_INVALID_HANDLE;
+
+ r = remote_GetTargetPath(remote, folder, &path);
+ if (!r)
+ r = msi_strncpyW(path, -1, buf, sz);
+
+ midl_user_free(path);
+ return r;
+ }
+
+ path = msi_get_target_folder(package, folder);
+ if (path)
+ r = msi_strncpyW(path, -1, buf, sz);
+ else
+ r = ERROR_DIRECTORY;
+
+ msiobj_release(&package->hdr);
+ return r;
}
static WCHAR *get_source_root( MSIPACKAGE *package )