msi [2/5]: Handle remote calls to MsiFormatRecordW
James Hawkins
truiken at gmail.com
Thu Jul 5 19:48:43 CDT 2007
Hi,
Changelog:
* 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(-)
--
James Hawkins
-------------- next part --------------
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 @@ #include "winbase.h"
#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
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
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 : IUnkno
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( IWin
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 m
mrp_SetComponentState,
mrp_GetLanguage,
mrp_SetInstallLevel,
+ mrp_FormatRecord,
};
HRESULT create_msi_remote_package( IUnknown *pOuter, LPVOID *ppObj )
--
1.4.1
More information about the wine-patches
mailing list