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

msi: Add the IWineMsiRemotePackage interface.

parent 1c14c180
......@@ -189,6 +189,7 @@ static const IClassFactoryVtbl MsiCF_Vtbl =
};
static IClassFactoryImpl MsiServer_CF = { &MsiCF_Vtbl, create_msiserver };
static IClassFactoryImpl WineMsiRemotePackage_CF = { &MsiCF_Vtbl, create_msi_remote_package };
/******************************************************************
* DllGetClassObject [MSI.@]
......@@ -211,6 +212,12 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
FIXME("create %s object\n", debugstr_guid( rclsid ));
}
if ( IsEqualCLSID (rclsid, &CLSID_IWineMsiRemotePackage) )
{
*ppv = (LPVOID) &WineMsiRemotePackage_CF;
return S_OK;
}
return CLASS_E_CLASSNOTAVAILABLE;
}
......
......@@ -512,6 +512,8 @@ DEFINE_GUID(CLSID_IMsiServerX3, 0x000C1094,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x0
DEFINE_GUID(CLSID_IMsiServerMessage, 0x000C101D,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
DEFINE_GUID(CLSID_IWineMsiRemotePackage,0x902b3592,0x9d08,0x4dfd,0xa5,0x93,0xd0,0x7c,0x52,0x54,0x64,0x21);
/* handle unicode/ascii output in the Msi* API functions */
typedef struct {
BOOL unicode;
......@@ -533,10 +535,12 @@ UINT msi_strcpy_to_awstring( LPCWSTR str, awstring *awbuf, DWORD *sz );
/* msi server interface */
extern ITypeLib *get_msi_typelib( LPWSTR *path );
extern HRESULT create_msi_remote_package( IUnknown *pOuter, LPVOID *ppObj );
/* handle functions */
extern void *msihandle2msiinfo(MSIHANDLE handle, UINT type);
extern MSIHANDLE alloc_msihandle( MSIOBJECTHDR * );
extern MSIHANDLE alloc_msi_remote_handle( IUnknown *unk );
extern void *alloc_msiobject(UINT type, UINT size, msihandledestructor destroy );
extern void msiobj_addref(MSIOBJECTHDR *);
extern int msiobj_release(MSIOBJECTHDR *);
......
......@@ -23,6 +23,23 @@ import "wtypes.idl";
import "objidl.idl";
import "oaidl.idl";
cpp_quote("#if 0")
typedef unsigned long MSIHANDLE;
cpp_quote("#endif")
[
uuid(902B3592-9D08-4dfd-A593-D07C52546421),
oleautomation,
object
]
interface IWineMsiRemotePackage : IUnknown
{
HRESULT SetMsiHandle( [in] MSIHANDLE handle );
HRESULT GetActiveDatabase( [out] MSIHANDLE *handle );
HRESULT GetProperty( [in] BSTR *property, [out] BSTR *value, [out] DWORD *size );
HRESULT SetProperty( [in] BSTR *property, [in] BSTR *value );
}
[ uuid(000C1092-0000-0000-C000-000000000046), version(1.0) ]
library WindowsInstaller
{
......
......@@ -20,6 +20,7 @@
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#define COBJMACROS
#include <stdarg.h>
#include "windef.h"
......@@ -44,6 +45,7 @@
#include "sddl.h"
#include "msipriv.h"
#include "msiserver.h"
WINE_DEFAULT_DEBUG_CHANNEL(msi);
......@@ -1393,3 +1395,110 @@ UINT WINAPI MsiGetPropertyW( MSIHANDLE hInstall, LPCWSTR szName,
return MSI_GetProperty( hInstall, szName, &val, pchValueBuf );
}
typedef struct _msi_remote_package_impl {
const IWineMsiRemotePackageVtbl *lpVtbl;
MSIHANDLE package;
LONG refs;
} msi_remote_package_impl;
static inline msi_remote_package_impl* mrp_from_IWineMsiRemotePackage( IWineMsiRemotePackage* iface )
{
return (msi_remote_package_impl*) iface;
}
static HRESULT WINAPI mrp_QueryInterface( IWineMsiRemotePackage *iface,
REFIID riid,LPVOID *ppobj)
{
if( IsEqualCLSID( riid, &IID_IUnknown ) ||
IsEqualCLSID( riid, &IID_IWineMsiRemotePackage ) )
{
IUnknown_AddRef( iface );
*ppobj = iface;
return S_OK;
}
return E_NOINTERFACE;
}
static ULONG WINAPI mrp_AddRef( IWineMsiRemotePackage *iface )
{
msi_remote_package_impl* This = mrp_from_IWineMsiRemotePackage( iface );
return InterlockedIncrement( &This->refs );
}
static ULONG WINAPI mrp_Release( IWineMsiRemotePackage *iface )
{
msi_remote_package_impl* This = mrp_from_IWineMsiRemotePackage( iface );
ULONG r;
r = InterlockedDecrement( &This->refs );
if (r == 0)
{
MsiCloseHandle( This->package );
msi_free( This );
}
return r;
}
static HRESULT WINAPI mrp_SetMsiHandle( IWineMsiRemotePackage *iface, MSIHANDLE handle )
{
msi_remote_package_impl* This = mrp_from_IWineMsiRemotePackage( iface );
This->package = handle;
return S_OK;
}
HRESULT WINAPI mrp_GetActiveDatabase( IWineMsiRemotePackage *iface, MSIHANDLE *handle )
{
msi_remote_package_impl* This = mrp_from_IWineMsiRemotePackage( iface );
*handle = MsiGetActiveDatabase(This->package);
return S_OK;
}
HRESULT WINAPI mrp_GetProperty( IWineMsiRemotePackage *iface, BSTR *property, BSTR *value, DWORD *size )
{
msi_remote_package_impl* This = mrp_from_IWineMsiRemotePackage( iface );
UINT r;
r = MsiGetPropertyW(This->package, (LPWSTR)property, (LPWSTR)value, size);
if (r != ERROR_SUCCESS)
return HRESULT_FROM_WIN32(r);
return S_OK;
}
HRESULT WINAPI mrp_SetProperty( IWineMsiRemotePackage *iface, BSTR *property, BSTR *value )
{
msi_remote_package_impl* This = mrp_from_IWineMsiRemotePackage( iface );
UINT r = MsiSetPropertyW(This->package, (LPWSTR)property, (LPWSTR)value);
return HRESULT_FROM_WIN32(r);
}
static const IWineMsiRemotePackageVtbl msi_remote_package_vtbl =
{
mrp_QueryInterface,
mrp_AddRef,
mrp_Release,
mrp_SetMsiHandle,
mrp_GetActiveDatabase,
mrp_GetProperty,
mrp_SetProperty,
};
HRESULT create_msi_remote_package( IUnknown *pOuter, LPVOID *ppObj )
{
msi_remote_package_impl* This;
This = msi_alloc( sizeof *This );
if (!This)
return E_OUTOFMEMORY;
This->lpVtbl = &msi_remote_package_vtbl;
This->package = 0;
This->refs = 1;
*ppObj = This;
return S_OK;
}
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