Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/install.c | 80 ++++++++++++++++++++++-------------------------------- 1 file changed, 32 insertions(+), 48 deletions(-)
diff --git a/dlls/msi/install.c b/dlls/msi/install.c index 93f9cce..31352c6 100644 --- a/dlls/msi/install.c +++ b/dlls/msi/install.c @@ -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;
- return MSI_GetTargetPath( hInstall, szFolder, &path, 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_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 )