https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6fc5d381f1857562d631b…
commit 6fc5d381f1857562d631b2b39789a970b829c5f3
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sat Mar 12 15:12:19 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 MsiGetSourcePathW().
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 48aeef69fc99ff1460da934f4933f0499ff33b13 by Zebediah Figura
<z.figura12(a)gmail.com>
---
dll/win32/msi/install.c | 91 +++++++++++++++++--------------------------------
1 file changed, 32 insertions(+), 59 deletions(-)
diff --git a/dll/win32/msi/install.c b/dll/win32/msi/install.c
index e0b61e04833..80e535304ff 100644
--- a/dll/win32/msi/install.c
+++ b/dll/win32/msi/install.c
@@ -366,58 +366,6 @@ WCHAR *msi_resolve_source_folder( MSIPACKAGE *package, const WCHAR
*name, MSIFOL
return path;
}
-/***********************************************************************
- * MSI_GetSourcePath (internal)
- */
-static UINT MSI_GetSourcePath( MSIHANDLE hInstall, LPCWSTR szFolder,
- awstring *szPathBuf, LPDWORD pcchPathBuf )
-{
- MSIPACKAGE *package;
- LPWSTR path;
- UINT r = ERROR_FUNCTION_FAILED;
-
- TRACE("%s %p %p\n", debugstr_w(szFolder), szPathBuf, pcchPathBuf );
-
- 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_GetSourcePath(remote, szFolder, &value);
- if (r != ERROR_SUCCESS)
- return r;
-
- r = msi_strcpy_to_awstring(value, -1, szPathBuf, pcchPathBuf);
-
- midl_user_free(value);
- return r;
- }
-
- if (szPathBuf->str.w && !pcchPathBuf )
- {
- msiobj_release( &package->hdr );
- return ERROR_INVALID_PARAMETER;
- }
-
- path = msi_resolve_source_folder( package, szFolder, NULL );
- msiobj_release( &package->hdr );
-
- TRACE("path = %s\n", debugstr_w(path));
- if (!path)
- return ERROR_DIRECTORY;
-
- r = msi_strcpy_to_awstring( path, -1, szPathBuf, pcchPathBuf );
- msi_free( path );
- return r;
-}
-
/***********************************************************************
* MsiGetSourcePathA (MSI.@)
*/
@@ -471,17 +419,42 @@ UINT WINAPI MsiGetSourcePathA(MSIHANDLE hinst, const char *folder,
char *buf, DW
/***********************************************************************
* MsiGetSourcePathW (MSI.@)
*/
-UINT WINAPI MsiGetSourcePathW( MSIHANDLE hInstall, LPCWSTR szFolder,
- LPWSTR szPathBuf, LPDWORD pcchPathBuf )
+UINT WINAPI MsiGetSourcePathW(MSIHANDLE hinst, const WCHAR *folder, WCHAR *buf, DWORD
*sz)
{
- awstring str;
+ MSIPACKAGE *package;
+ const WCHAR *path;
+ UINT r;
+
+ TRACE("%s %p %p\n", debugstr_w(folder), buf, sz);
+
+ if (!folder)
+ return ERROR_INVALID_PARAMETER;
+
+ package = msihandle2msiinfo(hinst, MSIHANDLETYPE_PACKAGE);
+ if (!package)
+ {
+ WCHAR *path = NULL;
+ MSIHANDLE remote;
- TRACE("%s %p %p\n", debugstr_w(szFolder), szPathBuf, pcchPathBuf );
+ if (!(remote = msi_get_remote(hinst)))
+ return ERROR_INVALID_HANDLE;
+
+ r = remote_GetSourcePath(remote, folder, &path);
+ if (!r)
+ r = msi_strncpyW(path, -1, buf, sz);
- str.unicode = TRUE;
- str.str.w = szPathBuf;
+ midl_user_free(path);
+ return r;
+ }
- return MSI_GetSourcePath( hInstall, szFolder, &str, pcchPathBuf );
+ path = msi_resolve_source_folder(package, folder, NULL);
+ if (path)
+ r = msi_strncpyW(path, -1, buf, sz);
+ else
+ r = ERROR_DIRECTORY;
+
+ msiobj_release(&package->hdr);
+ return r;
}
/***********************************************************************