mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 03:54:02 +00:00
[WINESYNC] msi: Avoid using awstring in MsiGetSourcePathW().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 48aeef69fc99ff1460da934f4933f0499ff33b13 by Zebediah Figura <z.figura12@gmail.com>
This commit is contained in:
parent
2491afaa14
commit
6fc5d381f1
1 changed files with 32 additions and 59 deletions
|
@ -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(szFolder), szPathBuf, pcchPathBuf );
|
||||
TRACE("%s %p %p\n", debugstr_w(folder), buf, sz);
|
||||
|
||||
str.unicode = TRUE;
|
||||
str.str.w = szPathBuf;
|
||||
if (!folder)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
return MSI_GetSourcePath( hInstall, szFolder, &str, pcchPathBuf );
|
||||
package = msihandle2msiinfo(hinst, MSIHANDLETYPE_PACKAGE);
|
||||
if (!package)
|
||||
{
|
||||
WCHAR *path = NULL;
|
||||
MSIHANDLE remote;
|
||||
|
||||
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);
|
||||
|
||||
midl_user_free(path);
|
||||
return r;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
Loading…
Reference in a new issue