James Hawkins : msi: Handle remote calls to MsiFormatRecordW.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Jul 6 12:59:04 CDT 2007
Module: wine
Branch: master
Commit: cba1b1e1f480cecc6e3bca4fe2978efb2585a800
URL: http://source.winehq.org/git/wine.git/?a=commit;h=cba1b1e1f480cecc6e3bca4fe2978efb2585a800
Author: James Hawkins <truiken at gmail.com>
Date: Thu Jul 5 17:48:43 2007 -0700
msi: Handle remote calls to MsiFormatRecordW.
---
dlls/msi/format.c | 59 +++++++++++++++++++++++++++++++++++++++++++++--
dlls/msi/msiserver.idl | 1 +
dlls/msi/package.c | 9 +++++++
3 files changed, 66 insertions(+), 3 deletions(-)
diff --git a/dlls/msi/format.c b/dlls/msi/format.c
index 4b5edc4..147ae56 100644
--- a/dlls/msi/format.c
+++ b/dlls/msi/format.c
@@ -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)
diff --git a/dlls/msi/msiserver.idl b/dlls/msi/msiserver.idl
index b8db7dc..e293b10 100644
--- a/dlls/msi/msiserver.idl
+++ b/dlls/msi/msiserver.idl
@@ -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 );
}
[
diff --git a/dlls/msi/package.c b/dlls/msi/package.c
index 0bf3460..f68be84 100644
--- a/dlls/msi/package.c
+++ b/dlls/msi/package.c
@@ -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 )
More information about the wine-cvs
mailing list