Commit cba1b1e1 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Handle remote calls to MsiFormatRecordW.

parent 29ce520d
......@@ -33,8 +33,12 @@ http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/msifo
#include "winerror.h"
#include "wine/debug.h"
#include "msi.h"
#include "msipriv.h"
#include "winnls.h"
#include "objbase.h"
#include "oleauto.h"
#include "msipriv.h"
#include "msiserver.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(msi);
......@@ -713,6 +717,57 @@ UINT WINAPI MsiFormatRecordW( MSIHANDLE hInstall, MSIHANDLE hRecord,
TRACE("%ld %ld %p %p\n", hInstall, hRecord, szResult, sz);
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
if (!package)
{
HRESULT hr;
IWineMsiRemotePackage *remote_package;
BSTR value = NULL;
DWORD len;
awstring wstr;
remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall );
if (remote_package)
{
len = 0;
hr = IWineMsiRemotePackage_FormatRecord( remote_package, hRecord,
NULL, &len );
if (FAILED(hr))
goto done;
len++;
value = SysAllocStringLen( NULL, len );
if (!value)
{
r = ERROR_OUTOFMEMORY;
goto done;
}
hr = IWineMsiRemotePackage_FormatRecord( remote_package, hRecord,
value, &len );
if (FAILED(hr))
goto done;
wstr.unicode = TRUE;
wstr.str.w = szResult;
r = msi_strcpy_to_awstring( value, &wstr, sz );
done:
IWineMsiRemotePackage_Release( remote_package );
SysFreeString( value );
if (FAILED(hr))
{
if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
return HRESULT_CODE(hr);
return ERROR_FUNCTION_FAILED;
}
return r;
}
}
record = msihandle2msiinfo( hRecord, MSIHANDLETYPE_RECORD );
if (!record)
......@@ -726,8 +781,6 @@ UINT WINAPI MsiFormatRecordW( MSIHANDLE hInstall, MSIHANDLE hRecord,
return ERROR_SUCCESS;
}
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
r = MSI_FormatRecordW( package, record, szResult, sz );
msiobj_release( &record->hdr );
if (package)
......
......@@ -55,6 +55,7 @@ interface IWineMsiRemotePackage : IUnknown
HRESULT SetComponentState( [in] BSTR component, [in] INSTALLSTATE state );
HRESULT GetLanguage( [out] LANGID *language );
HRESULT SetInstallLevel( [in] int level );
HRESULT FormatRecord( [in] MSIHANDLE record, [out] BSTR value, [out] DWORD *size );
}
[
......
......@@ -1684,6 +1684,14 @@ HRESULT WINAPI mrp_SetInstallLevel( IWineMsiRemotePackage *iface, int level )
return HRESULT_FROM_WIN32(r);
}
HRESULT WINAPI mrp_FormatRecord( IWineMsiRemotePackage *iface, MSIHANDLE record,
BSTR value, DWORD *size )
{
msi_remote_package_impl* This = mrp_from_IWineMsiRemotePackage( iface );
UINT r = MsiFormatRecordW(This->package, record, (LPWSTR)value, size);
return HRESULT_FROM_WIN32(r);
}
static const IWineMsiRemotePackageVtbl msi_remote_package_vtbl =
{
mrp_QueryInterface,
......@@ -1706,6 +1714,7 @@ static const IWineMsiRemotePackageVtbl msi_remote_package_vtbl =
mrp_SetComponentState,
mrp_GetLanguage,
mrp_SetInstallLevel,
mrp_FormatRecord,
};
HRESULT create_msi_remote_package( IUnknown *pOuter, LPVOID *ppObj )
......
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