Commit ce3fc1af authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

msi: Avoid using awstring in MsiGetTargetPathW().

parent c9fc3510
......@@ -228,47 +228,6 @@ const WCHAR *msi_get_target_folder( MSIPACKAGE *package, const WCHAR *name )
}
/***********************************************************************
* 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.@)
*/
UINT WINAPI MsiGetTargetPathA(MSIHANDLE hinst, const char *folder, char *buf, DWORD *sz)
......@@ -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 )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment