diff --git a/dlls/msi/install.c b/dlls/msi/install.c index e06399c857..730c30a1c9 100644 --- a/dlls/msi/install.c +++ b/dlls/msi/install.c @@ -200,14 +200,58 @@ static UINT WINAPI MSI_GetTargetPath( MSIHANDLE hInstall, LPCWSTR szFolder, { MSIPACKAGE *package; LPWSTR path; - UINT r; + UINT r = ERROR_FUNCTION_FAILED; if (!szFolder) return ERROR_INVALID_PARAMETER; package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); if (!package) - return ERROR_INVALID_HANDLE; + { + HRESULT hr; + IWineMsiRemotePackage *remote_package; + LPWSTR value = NULL; + DWORD len; + + remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); + if (!remote_package) + return ERROR_INVALID_HANDLE; + + len = 0; + hr = IWineMsiRemotePackage_GetTargetPath( remote_package, (BSTR *)szFolder, + NULL, &len ); + if (FAILED(hr)) + goto done; + + len++; + value = msi_alloc(len * sizeof(WCHAR)); + if (!value) + { + r = ERROR_OUTOFMEMORY; + goto done; + } + + hr = IWineMsiRemotePackage_GetTargetPath( remote_package, (BSTR *)szFolder, + (BSTR *)value, &len); + if (FAILED(hr)) + goto done; + + r = msi_strcpy_to_awstring( value, szPathBuf, pcchPathBuf ); + +done: + IWineMsiRemotePackage_Release( remote_package ); + msi_free( value ); + + if (FAILED(hr)) + { + if (HRESULT_FACILITY(hr) == FACILITY_WIN32) + return HRESULT_CODE(hr); + + return ERROR_FUNCTION_FAILED; + } + + return r; + } path = resolve_folder( package, szFolder, FALSE, FALSE, TRUE, NULL ); msiobj_release( &package->hdr ); diff --git a/dlls/msi/msiserver.idl b/dlls/msi/msiserver.idl index 521b4ca457..708c9ca7b1 100644 --- a/dlls/msi/msiserver.idl +++ b/dlls/msi/msiserver.idl @@ -42,6 +42,7 @@ interface IWineMsiRemotePackage : IUnknown HRESULT ProcessMessage( [in] INSTALLMESSAGE message, [in] MSIHANDLE record ); HRESULT DoAction( [in] BSTR *action ); HRESULT Sequence( [in] BSTR *table, [in] int sequence ); + HRESULT GetTargetPath( [in] BSTR *folder, [out] BSTR *value, [out] DWORD *size ); } [ diff --git a/dlls/msi/package.c b/dlls/msi/package.c index b453ae53e6..8dd40ce4f8 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -1590,6 +1590,13 @@ HRESULT WINAPI mrp_Sequence( IWineMsiRemotePackage *iface, BSTR *table, int sequ return HRESULT_FROM_WIN32(r); } +HRESULT WINAPI mrp_GetTargetPath( IWineMsiRemotePackage *iface, BSTR *folder, BSTR *value, DWORD *size ) +{ + msi_remote_package_impl* This = mrp_from_IWineMsiRemotePackage( iface ); + UINT r = MsiGetTargetPathW(This->package, (LPWSTR)folder, (LPWSTR)value, size); + return HRESULT_FROM_WIN32(r); +} + static const IWineMsiRemotePackageVtbl msi_remote_package_vtbl = { mrp_QueryInterface, @@ -1602,6 +1609,7 @@ static const IWineMsiRemotePackageVtbl msi_remote_package_vtbl = mrp_ProcessMessage, mrp_DoAction, mrp_Sequence, + mrp_GetTargetPath, }; HRESULT create_msi_remote_package( IUnknown *pOuter, LPVOID *ppObj )