diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-10-22 11:46:58 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2012-12-06 20:25:47 +0100 |
commit | 722565ce6f7bb2361207c43769f27c76864fdae1 (patch) | |
tree | 2bfd0a686beac3d3fbb65b7ba86f5f1f16bb48f6 /libmsi | |
parent | 3dc2025a38b7fccd3cec8990bf46710009c9fa38 (diff) | |
download | msitools-722565ce6f7bb2361207c43769f27c76864fdae1.tar.gz msitools-722565ce6f7bb2361207c43769f27c76864fdae1.tar.xz msitools-722565ce6f7bb2361207c43769f27c76864fdae1.zip |
drop OLE Automation support
Diffstat (limited to 'libmsi')
-rw-r--r-- | libmsi/Makefile.am | 29 | ||||
-rw-r--r-- | libmsi/automation.c | 2462 | ||||
-rw-r--r-- | libmsi/cond-parser.y | 33 | ||||
-rw-r--r-- | libmsi/custom.c | 171 | ||||
-rw-r--r-- | libmsi/database.c | 156 | ||||
-rw-r--r-- | libmsi/dialog.c | 15 | ||||
-rw-r--r-- | libmsi/format.c | 35 | ||||
-rw-r--r-- | libmsi/handle.c | 89 | ||||
-rw-r--r-- | libmsi/install.c | 461 | ||||
-rw-r--r-- | libmsi/msi.c | 27 | ||||
-rw-r--r-- | libmsi/msi.rc | 3 | ||||
-rw-r--r-- | libmsi/msi_main.c | 118 | ||||
-rw-r--r-- | libmsi/msipriv.h | 5 | ||||
-rw-r--r-- | libmsi/msiquery.c | 90 | ||||
-rw-r--r-- | libmsi/msiserver.h | 126 | ||||
-rw-r--r-- | libmsi/msiserver.idl | 558 | ||||
-rw-r--r-- | libmsi/msiserver.rgs | 8 | ||||
-rw-r--r-- | libmsi/msiserver_dispids.h | 68 | ||||
-rw-r--r-- | libmsi/msiserver_i.c | 4 | ||||
-rw-r--r-- | libmsi/package.c | 429 | ||||
-rw-r--r-- | libmsi/script.c | 336 | ||||
-rw-r--r-- | libmsi/suminfo.c | 26 |
22 files changed, 188 insertions, 5061 deletions
diff --git a/libmsi/Makefile.am b/libmsi/Makefile.am index eb1c60c..2261c22 100644 --- a/libmsi/Makefile.am +++ b/libmsi/Makefile.am @@ -2,29 +2,26 @@ lib_LTLIBRARIES = libmsi.la AM_CPPFLAGS = -I$(srcdir) -I. -D__WINESRC__ -DUNICODE -D_UNICODE AM_YFLAGS = -d -BUILT_SOURCES = msiserver.h msiserver_i.c sql-parser.c sql-parser.h cond-parser.c cond-parser.h +BUILT_SOURCES = sql-parser.c sql-parser.h cond-parser.c cond-parser.h noinst_HEADERS = \ msi.h \ msipriv.h \ msiquery.h \ - msiserver_dispids.h \ msiserver.h \ query.h libmsi_la_SOURCES = action.c alter.c appsearch.c assembly.c \ - automation.c classes.c create.c custom.c database.c delete.c \ + classes.c create.c custom.c database.c delete.c \ dialog.c distinct.c drop.c events.c files.c font.c format.c \ handle.c insert.c install.c media.c msi.c msi_main.c msiquery.c \ package.c patch.c record.c registry.c script.c select.c source.c \ storages.c streams.c string.c suminfo.c table.c tokenize.c update.c \ upgrade.c where.c \ - cond-parser.y sql-parser.y \ - msiserver_i.c + msiserver_i.c \ + cond-parser.y sql-parser.y libmsi_la_DEPENDENCIES = \ - msiserver_r.res \ - msiserver_t.res \ msi.res libmsi_la_LIBADD = \ @@ -47,23 +44,7 @@ libmsi_la_LIBADD = \ -lcrypt32 \ -limagehlp -msi.res: msi.rc msiserver.rgs instabsent.bmp instadvert.bmp instlocal.bmp +msi.res: msi.rc instabsent.bmp instadvert.bmp instlocal.bmp %.res: %.rc $(RC) $(RCFLAGS) -o $@ $< -%.h: %.idl - $(WIDL) $(IDLFLAGS) -h -o $@ $< -%_c.c: %.idl - $(WIDL) $(IDLFLAGS) -c -o $@ $< -%_i.c: %.idl - $(WIDL) $(IDLFLAGS) -u -o $@ $< -%_p.c: %.idl - $(WIDL) $(IDLFLAGS) -p -o $@ $< -%_r.res: %.idl - $(WIDL) $(IDLFLAGS) -r -o $@ $< -%_s.c: %.idl - $(WIDL) $(IDLFLAGS) -s -o $@ $< -%.tlb: %.idl - $(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -o $@ $< -%_t.res: %.idl - $(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -o $@ $< diff --git a/libmsi/automation.c b/libmsi/automation.c deleted file mode 100644 index 60d96a5..0000000 --- a/libmsi/automation.c +++ /dev/null @@ -1,2462 +0,0 @@ -/* - * Implementation of OLE Automation for Microsoft Installer (msi.dll) - * - * Copyright 2007 Misha Koshelev - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#define COBJMACROS - -#include <stdarg.h> -#include "windef.h" -#include "winbase.h" -#include "winerror.h" -#include "wingdi.h" -#include "winuser.h" -#include "winreg.h" -#include "msidefs.h" -#include "msipriv.h" -#include "activscp.h" -#include "oleauto.h" -#include "shlwapi.h" -#include "wine/debug.h" -#include "wine/unicode.h" - -#include "msiserver.h" -#include "msiserver_dispids.h" - -WINE_DEFAULT_DEBUG_CHANNEL(msi); - -#define REG_INDEX_CLASSES_ROOT 0 -#define REG_INDEX_DYN_DATA 6 - -/* - * AutomationObject - "base" class for all automation objects. For each interface, we implement Invoke function - * called from AutomationObject::Invoke. - */ - -typedef struct AutomationObject AutomationObject; - -typedef HRESULT (*autoInvokeFunc)(AutomationObject* This, - DISPID dispIdMember, REFIID riid, LCID lcid, WORD flags, DISPPARAMS* pDispParams, - VARIANT* result, EXCEPINFO* ei, UINT* arg_err); - -typedef void (*autoFreeFunc)(AutomationObject* This); - -struct AutomationObject { - IDispatch IDispatch_iface; - IProvideMultipleClassInfo IProvideMultipleClassInfo_iface; - LONG ref; - - /* Clsid for this class and it's appropriate ITypeInfo object */ - LPCLSID clsid; - ITypeInfo *iTypeInfo; - - /* The MSI handle of the current object */ - MSIHANDLE msiHandle; - - /* A function that is called from AutomationObject::Invoke, specific to this type of object. */ - autoInvokeFunc funcInvoke; - /* A function that is called from AutomationObject::Release when the object is being freed to free any private - * data structures (or NULL) */ - autoFreeFunc funcFree; -}; - -typedef struct { - AutomationObject autoobj; - int count; - VARIANT *data; -} ListObject; - -static HRESULT create_database(MSIHANDLE, IDispatch**); -static HRESULT create_list_enumerator(ListObject*, void**); -static HRESULT create_summaryinfo(MSIHANDLE, IDispatch**); -static HRESULT create_view(MSIHANDLE, IDispatch**); - -/* ListEnumerator - IEnumVARIANT implementation for MSI automation lists */ -typedef struct { - IEnumVARIANT IEnumVARIANT_iface; - LONG ref; - - /* Current position and pointer to AutomationObject that stores actual data */ - ULONG pos; - ListObject *list; -} ListEnumerator; - -typedef struct { - AutomationObject autoobj; - IDispatch *installer; -} SessionObject; - -static inline AutomationObject *impl_from_IProvideMultipleClassInfo( IProvideMultipleClassInfo *iface ) -{ - return CONTAINING_RECORD(iface, AutomationObject, IProvideMultipleClassInfo_iface); -} - -static inline AutomationObject *impl_from_IDispatch( IDispatch *iface ) -{ - return CONTAINING_RECORD(iface, AutomationObject, IDispatch_iface); -} - -/* Load type info so we don't have to process GetIDsOfNames */ -HRESULT load_type_info(IDispatch *iface, ITypeInfo **pptinfo, REFIID clsid, LCID lcid) -{ - static const WCHAR msiserverW[] = {'m','s','i','s','e','r','v','e','r','.','t','l','b',0}; - ITypeInfo *ti = NULL; - ITypeLib *lib = NULL; - HRESULT hr; - - TRACE("(%p)->(%s, %d)\n", iface, debugstr_guid(clsid), lcid); - - /* Load registered type library */ - hr = LoadRegTypeLib(&LIBID_WindowsInstaller, 1, 0, lcid, &lib); - if (FAILED(hr)) { - hr = LoadTypeLib(msiserverW, &lib); - if (FAILED(hr)) { - ERR("Could not load msiserver.tlb\n"); - return hr; - } - } - - /* Get type information for object */ - hr = ITypeLib_GetTypeInfoOfGuid(lib, clsid, &ti); - ITypeLib_Release(lib); - if (FAILED(hr)) { - ERR("Could not load ITypeInfo for %s\n", debugstr_guid(clsid)); - return hr; - } - *pptinfo = ti; - return S_OK; -} - -/* AutomationObject methods */ -static HRESULT WINAPI AutomationObject_QueryInterface(IDispatch* iface, REFIID riid, void** ppvObject) -{ - AutomationObject *This = impl_from_IDispatch(iface); - - TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject); - - if (ppvObject == NULL) - return E_INVALIDARG; - - *ppvObject = 0; - - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IDispatch) || - IsEqualGUID(riid, This->clsid)) - *ppvObject = &This->IDispatch_iface; - else if (IsEqualGUID(riid, &IID_IProvideClassInfo) || - IsEqualGUID(riid, &IID_IProvideClassInfo2) || - IsEqualGUID(riid, &IID_IProvideMultipleClassInfo)) - *ppvObject = &This->IProvideMultipleClassInfo_iface; - else - { - TRACE("() : asking for unsupported interface %s\n", debugstr_guid(riid)); - return E_NOINTERFACE; - } - - IDispatch_AddRef(iface); - - return S_OK; -} - -static ULONG WINAPI AutomationObject_AddRef(IDispatch* iface) -{ - AutomationObject *This = impl_from_IDispatch(iface); - - TRACE("(%p/%p)\n", iface, This); - - return InterlockedIncrement(&This->ref); -} - -static ULONG WINAPI AutomationObject_Release(IDispatch* iface) -{ - AutomationObject *This = impl_from_IDispatch(iface); - ULONG ref = InterlockedDecrement(&This->ref); - - TRACE("(%p/%p)\n", iface, This); - - if (!ref) - { - if (This->funcFree) This->funcFree(This); - ITypeInfo_Release(This->iTypeInfo); - MsiCloseHandle(This->msiHandle); - msi_free(This); - } - - return ref; -} - -static HRESULT WINAPI AutomationObject_GetTypeInfoCount( - IDispatch* iface, - UINT* pctinfo) -{ - AutomationObject *This = impl_from_IDispatch(iface); - - TRACE("(%p/%p)->(%p)\n", iface, This, pctinfo); - *pctinfo = 1; - return S_OK; -} - -static HRESULT WINAPI AutomationObject_GetTypeInfo( - IDispatch* iface, - UINT iTInfo, - LCID lcid, - ITypeInfo** ppTInfo) -{ - AutomationObject *This = impl_from_IDispatch(iface); - TRACE("(%p/%p)->(%d,%d,%p)\n", iface, This, iTInfo, lcid, ppTInfo); - - ITypeInfo_AddRef(This->iTypeInfo); - *ppTInfo = This->iTypeInfo; - return S_OK; -} - -static HRESULT WINAPI AutomationObject_GetIDsOfNames( - IDispatch* iface, - REFIID riid, - LPOLESTR* rgszNames, - UINT cNames, - LCID lcid, - DISPID* rgDispId) -{ - AutomationObject *This = impl_from_IDispatch(iface); - HRESULT hr; - TRACE("(%p/%p)->(%p,%p,%d,%d,%p)\n", iface, This, riid, rgszNames, cNames, lcid, rgDispId); - - if (!IsEqualGUID(riid, &IID_NULL)) return E_INVALIDARG; - hr = ITypeInfo_GetIDsOfNames(This->iTypeInfo, rgszNames, cNames, rgDispId); - if (hr == DISP_E_UNKNOWNNAME) - { - UINT idx; - for (idx=0; idx<cNames; idx++) - { - if (rgDispId[idx] == DISPID_UNKNOWN) - FIXME("Unknown member %s, clsid %s\n", debugstr_w(rgszNames[idx]), debugstr_guid(This->clsid)); - } - } - return hr; -} - -/* Maximum number of allowed function parameters+1 */ -#define MAX_FUNC_PARAMS 20 - -/* Some error checking is done here to simplify individual object function invocation */ -static HRESULT WINAPI AutomationObject_Invoke( - IDispatch* iface, - DISPID dispIdMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - AutomationObject *This = impl_from_IDispatch(iface); - HRESULT hr; - unsigned int uArgErr; - VARIANT varResultDummy; - BSTR bstrName = NULL; - - TRACE("(%p/%p)->(%d,%p,%d,%d,%p,%p,%p,%p)\n", iface, This, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); - - if (!IsEqualIID(riid, &IID_NULL)) - { - ERR("riid was %s instead of IID_NULL\n", debugstr_guid(riid)); - return DISP_E_UNKNOWNNAME; - } - - if (wFlags & DISPATCH_PROPERTYGET && !pVarResult) - { - ERR("NULL pVarResult not allowed when DISPATCH_PROPERTYGET specified\n"); - return DISP_E_PARAMNOTOPTIONAL; - } - - /* This simplifies our individual object invocation functions */ - if (puArgErr == NULL) puArgErr = &uArgErr; - if (pVarResult == NULL) pVarResult = &varResultDummy; - - /* Assume return type is void unless determined otherwise */ - VariantInit(pVarResult); - - /* If we are tracing, we want to see the name of the member we are invoking */ - if (TRACE_ON(msi)) - { - ITypeInfo_GetDocumentation(This->iTypeInfo, dispIdMember, &bstrName, NULL, NULL, NULL); - TRACE("Method %d, %s\n", dispIdMember, debugstr_w(bstrName)); - } - - hr = This->funcInvoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr); - - if (hr == DISP_E_MEMBERNOTFOUND) { - if (bstrName == NULL) ITypeInfo_GetDocumentation(This->iTypeInfo, dispIdMember, &bstrName, NULL, NULL, NULL); - FIXME("Method %d, %s wflags %d not implemented, clsid %s\n", dispIdMember, debugstr_w(bstrName), wFlags, debugstr_guid(This->clsid)); - } - else if (pExcepInfo && - (hr == DISP_E_PARAMNOTFOUND || - hr == DISP_E_EXCEPTION)) { - static const WCHAR szComma[] = { ',',0 }; - static const WCHAR szExceptionSource[] = {'M','s','i',' ','A','P','I',' ','E','r','r','o','r',0}; - WCHAR szExceptionDescription[MAX_PATH]; - BSTR bstrParamNames[MAX_FUNC_PARAMS]; - unsigned namesNo, i; - BOOL bFirst = TRUE; - - if (FAILED(ITypeInfo_GetNames(This->iTypeInfo, dispIdMember, bstrParamNames, - MAX_FUNC_PARAMS, &namesNo))) - { - TRACE("Failed to retrieve names for dispIdMember %d\n", dispIdMember); - } - else - { - memset(szExceptionDescription, 0, sizeof(szExceptionDescription)); - for (i=0; i<namesNo; i++) - { - if (bFirst) bFirst = FALSE; - else { - lstrcpyW(&szExceptionDescription[lstrlenW(szExceptionDescription)], szComma); - } - lstrcpyW(&szExceptionDescription[lstrlenW(szExceptionDescription)], bstrParamNames[i]); - SysFreeString(bstrParamNames[i]); - } - - memset(pExcepInfo, 0, sizeof(EXCEPINFO)); - pExcepInfo->wCode = 1000; - pExcepInfo->bstrSource = SysAllocString(szExceptionSource); - pExcepInfo->bstrDescription = SysAllocString(szExceptionDescription); - hr = DISP_E_EXCEPTION; - } - } - - /* Make sure we free the return variant if it is our dummy variant */ - if (pVarResult == &varResultDummy) VariantClear(pVarResult); - - /* Free function name if we retrieved it */ - SysFreeString(bstrName); - - TRACE("Returning 0x%08x, %s\n", hr, SUCCEEDED(hr) ? "ok" : "not ok"); - - return hr; -} - -static const struct IDispatchVtbl AutomationObjectVtbl = -{ - AutomationObject_QueryInterface, - AutomationObject_AddRef, - AutomationObject_Release, - AutomationObject_GetTypeInfoCount, - AutomationObject_GetTypeInfo, - AutomationObject_GetIDsOfNames, - AutomationObject_Invoke -}; - -/* - * IProvideMultipleClassInfo methods - */ - -static HRESULT WINAPI ProvideMultipleClassInfo_QueryInterface( - IProvideMultipleClassInfo* iface, - REFIID riid, - VOID** ppvoid) -{ - AutomationObject *This = impl_from_IProvideMultipleClassInfo(iface); - return IDispatch_QueryInterface(&This->IDispatch_iface, riid, ppvoid); -} - -static ULONG WINAPI ProvideMultipleClassInfo_AddRef(IProvideMultipleClassInfo* iface) -{ - AutomationObject *This = impl_from_IProvideMultipleClassInfo(iface); - return IDispatch_AddRef(&This->IDispatch_iface); -} - -static ULONG WINAPI ProvideMultipleClassInfo_Release(IProvideMultipleClassInfo* iface) -{ - AutomationObject *This = impl_from_IProvideMultipleClassInfo(iface); - return IDispatch_Release(&This->IDispatch_iface); -} - -static HRESULT WINAPI ProvideMultipleClassInfo_GetClassInfo(IProvideMultipleClassInfo* iface, ITypeInfo** ppTI) -{ - AutomationObject *This = impl_from_IProvideMultipleClassInfo(iface); - TRACE("(%p/%p)->(%p)\n", iface, This, ppTI); - return load_type_info(&This->IDispatch_iface, ppTI, This->clsid, 0); -} - -static HRESULT WINAPI ProvideMultipleClassInfo_GetGUID(IProvideMultipleClassInfo* iface, DWORD dwGuidKind, GUID* pGUID) -{ - AutomationObject *This = impl_from_IProvideMultipleClassInfo(iface); - TRACE("(%p/%p)->(%d,%s)\n", iface, This, dwGuidKind, debugstr_guid(pGUID)); - - if (dwGuidKind != GUIDKIND_DEFAULT_SOURCE_DISP_IID) - return E_INVALIDARG; - else { - *pGUID = *This->clsid; - return S_OK; - } -} - -static HRESULT WINAPI ProvideMultipleClassInfo_GetMultiTypeInfoCount(IProvideMultipleClassInfo* iface, ULONG* pcti) -{ - AutomationObject *This = impl_from_IProvideMultipleClassInfo(iface); - - TRACE("(%p/%p)->(%p)\n", iface, This, pcti); - *pcti = 1; - return S_OK; -} - -static HRESULT WINAPI ProvideMultipleClassInfo_GetInfoOfIndex(IProvideMultipleClassInfo* iface, - ULONG iti, - DWORD dwFlags, - ITypeInfo** pptiCoClass, - DWORD* pdwTIFlags, - ULONG* pcdispidReserved, - IID* piidPrimary, - IID* piidSource) -{ - AutomationObject *This = impl_from_IProvideMultipleClassInfo(iface); - - TRACE("(%p/%p)->(%d,%d,%p,%p,%p,%p,%p)\n", iface, This, iti, dwFlags, pptiCoClass, pdwTIFlags, pcdispidReserved, piidPrimary, piidSource); - - if (iti != 0) - return E_INVALIDARG; - - if (dwFlags & MULTICLASSINFO_GETTYPEINFO) - load_type_info(&This->IDispatch_iface, pptiCoClass, This->clsid, 0); - - if (dwFlags & MULTICLASSINFO_GETNUMRESERVEDDISPIDS) - { - *pdwTIFlags = 0; - *pcdispidReserved = 0; - } - - if (dwFlags & MULTICLASSINFO_GETIIDPRIMARY){ - *piidPrimary = *This->clsid; - } - - if (dwFlags & MULTICLASSINFO_GETIIDSOURCE){ - *piidSource = *This->clsid; - } - - return S_OK; -} - -static const IProvideMultipleClassInfoVtbl ProvideMultipleClassInfoVtbl = -{ - ProvideMultipleClassInfo_QueryInterface, - ProvideMultipleClassInfo_AddRef, - ProvideMultipleClassInfo_Release, - ProvideMultipleClassInfo_GetClassInfo, - ProvideMultipleClassInfo_GetGUID, - ProvideMultipleClassInfo_GetMultiTypeInfoCount, - ProvideMultipleClassInfo_GetInfoOfIndex -}; - -static HRESULT init_automation_object(AutomationObject *This, MSIHANDLE msiHandle, REFIID clsid, - autoInvokeFunc invokeFunc, autoFreeFunc freeFunc) -{ - TRACE("(%p, %d, %s, %p, %p)\n", This, msiHandle, debugstr_guid(clsid), invokeFunc, freeFunc); - - This->IDispatch_iface.lpVtbl = &AutomationObjectVtbl; - This->IProvideMultipleClassInfo_iface.lpVtbl = &ProvideMultipleClassInfoVtbl; - This->ref = 1; - - This->msiHandle = msiHandle; - This->clsid = (LPCLSID)clsid; - This->funcInvoke = invokeFunc; - This->funcFree = freeFunc; - - /* Load our TypeInfo so we don't have to process GetIDsOfNames */ - This->iTypeInfo = NULL; - return load_type_info(&This->IDispatch_iface, &This->iTypeInfo, clsid, 0); -} - -/* - * ListEnumerator methods - */ - -static inline ListEnumerator *impl_from_IEnumVARIANT(IEnumVARIANT* iface) -{ - return CONTAINING_RECORD(iface, ListEnumerator, IEnumVARIANT_iface); -} - -static HRESULT WINAPI ListEnumerator_QueryInterface(IEnumVARIANT* iface, REFIID riid, - void** ppvObject) -{ - ListEnumerator *This = impl_from_IEnumVARIANT(iface); - - TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject); - - if (ppvObject == NULL) - return E_INVALIDARG; - - *ppvObject = 0; - - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IEnumVARIANT)) - { - *ppvObject = &This->IEnumVARIANT_iface; - } - else - { - TRACE("() : asking for unsupported interface %s\n",debugstr_guid(riid)); - return E_NOINTERFACE; - } - - IEnumVARIANT_AddRef(iface); - return S_OK; -} - -static ULONG WINAPI ListEnumerator_AddRef(IEnumVARIANT* iface) -{ - ListEnumerator *This = impl_from_IEnumVARIANT(iface); - - TRACE("(%p/%p)\n", iface, This); - - return InterlockedIncrement(&This->ref); -} - -static ULONG WINAPI ListEnumerator_Release(IEnumVARIANT* iface) -{ - ListEnumerator *This = impl_from_IEnumVARIANT(iface); - ULONG ref = InterlockedDecrement(&This->ref); - - TRACE("(%p/%p)\n", iface, This); - - if (!ref) - { - if (This->list) IDispatch_Release(&This->list->autoobj.IDispatch_iface); - msi_free(This); - } - - return ref; -} - -static HRESULT WINAPI ListEnumerator_Next(IEnumVARIANT* iface, ULONG celt, VARIANT* rgVar, - ULONG* fetched) -{ - ListEnumerator *This = impl_from_IEnumVARIANT(iface); - ULONG i, local; - - TRACE("(%p, %uld, %p, %p)\n", iface, celt, rgVar, fetched); - - if (fetched) *fetched = 0; - - if (!rgVar) - return S_FALSE; - - for (local = 0; local < celt; local++) - VariantInit(&rgVar[local]); - - for (i = This->pos, local = 0; i < This->list->count && local < celt; i++, local++) - VariantCopy(&rgVar[local], &This->list->data[i]); - - if (fetched) *fetched = local; - This->pos = i; - - return (local < celt) ? S_FALSE : S_OK; -} - -static HRESULT WINAPI ListEnumerator_Skip(IEnumVARIANT* iface, ULONG celt) -{ - ListEnumerator *This = impl_from_IEnumVARIANT(iface); - - TRACE("(%p,%uld)\n", iface, celt); - - This->pos += celt; - if (This->pos >= This->list->count) - { - This->pos = This->list->count; - return S_FALSE; - } - - return S_OK; -} - -static HRESULT WINAPI ListEnumerator_Reset(IEnumVARIANT* iface) -{ - ListEnumerator *This = impl_from_IEnumVARIANT(iface); - - TRACE("(%p)\n", iface); - - This->pos = 0; - return S_OK; -} - -static HRESULT WINAPI ListEnumerator_Clone(IEnumVARIANT* iface, IEnumVARIANT **ppEnum) -{ - ListEnumerator *This = impl_from_IEnumVARIANT(iface); - HRESULT hr; - - TRACE("(%p,%p)\n", iface, ppEnum); - - if (ppEnum == NULL) - return S_FALSE; - - *ppEnum = NULL; - hr = create_list_enumerator(This->list, (LPVOID *)ppEnum); - if (FAILED(hr)) - { - if (*ppEnum) IEnumVARIANT_Release(*ppEnum); - return hr; - } - - return S_OK; -} - -static const struct IEnumVARIANTVtbl ListEnumerator_Vtbl = -{ - ListEnumerator_QueryInterface, - ListEnumerator_AddRef, - ListEnumerator_Release, - ListEnumerator_Next, - ListEnumerator_Skip, - ListEnumerator_Reset, - ListEnumerator_Clone -}; - -/* Create a list enumerator, placing the result in the pointer ppObj. */ -static HRESULT create_list_enumerator(ListObject *list, void **ppObj) -{ - ListEnumerator *object; - - TRACE("(%p, %p)\n", list, ppObj); - - object = msi_alloc(sizeof(ListEnumerator)); - - /* Set all the VTable references */ - object->IEnumVARIANT_iface.lpVtbl = &ListEnumerator_Vtbl; - object->ref = 1; - - /* Store data that was passed */ - object->pos = 0; - object->list = list; - if (list) IDispatch_AddRef(&list->autoobj.IDispatch_iface); - - *ppObj = object; - return S_OK; -} - -/* - * Individual Object Invocation Functions - */ - -/* Helper function that copies a passed parameter instead of using VariantChangeType like the actual DispGetParam. - This function is only for VARIANT type parameters that have several types that cannot be properly discriminated - using DispGetParam/VariantChangeType. */ -static HRESULT DispGetParam_CopyOnly( - DISPPARAMS *pdispparams, /* [in] Parameter list */ - UINT *position, /* [in] Position of parameter to copy in pdispparams; on return will contain calculated position */ - VARIANT *pvarResult) /* [out] Destination for resulting variant */ -{ - /* position is counted backwards */ - UINT pos; - - TRACE("position=%d, cArgs=%d, cNamedArgs=%d\n", - *position, pdispparams->cArgs, pdispparams->cNamedArgs); - if (*position < pdispparams->cArgs) { - /* positional arg? */ - pos = pdispparams->cArgs - *position - 1; - } else { - /* FIXME: is this how to handle named args? */ - for (pos=0; pos<pdispparams->cNamedArgs; pos++) - if (pdispparams->rgdispidNamedArgs[pos] == *position) break; - - if (pos==pdispparams->cNamedArgs) - return DISP_E_PARAMNOTFOUND; - } - *position = pos; - return VariantCopyInd(pvarResult, - &pdispparams->rgvarg[pos]); -} - -static HRESULT SummaryInfoImpl_Invoke( - AutomationObject* This, - DISPID dispIdMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - UINT ret; - VARIANTARG varg0, varg1; - FILETIME ft, ftlocal; - SYSTEMTIME st; - HRESULT hr; - - VariantInit(&varg0); - VariantInit(&varg1); - - switch (dispIdMember) - { - case DISPID_SUMMARYINFO_PROPERTY: - if (wFlags & DISPATCH_PROPERTYGET) - { - UINT type; - INT value; - DWORD size = 0; - DATE date; - LPWSTR str; - - static WCHAR szEmpty[] = {0}; - - hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr); - if (FAILED(hr)) return hr; - ret = MsiSummaryInfoGetPropertyW(This->msiHandle, V_I4(&varg0), &type, &value, - &ft, szEmpty, &size); - if (ret != ERROR_SUCCESS && - ret != ERROR_MORE_DATA) - { - ERR("MsiSummaryInfoGetProperty returned %d\n", ret); - return DISP_E_EXCEPTION; - } - - switch (type) - { - case VT_EMPTY: - break; - - case VT_I2: - case VT_I4: - V_VT(pVarResult) = VT_I4; - V_I4(pVarResult) = value; - break; - - case VT_LPSTR: - if (!(str = msi_alloc(++size * sizeof(WCHAR)))) - ERR("Out of memory\n"); - else if ((ret = MsiSummaryInfoGetPropertyW(This->msiHandle, V_I4(&varg0), &type, NULL, - NULL, str, &size)) != ERROR_SUCCESS) - ERR("MsiSummaryInfoGetProperty returned %d\n", ret); - else - { - V_VT(pVarResult) = VT_BSTR; - V_BSTR(pVarResult) = SysAllocString(str); - } - msi_free(str); - break; - - case VT_FILETIME: - FileTimeToLocalFileTime(&ft, &ftlocal); - FileTimeToSystemTime(&ftlocal, &st); - SystemTimeToVariantTime(&st, &date); - - V_VT(pVarResult) = VT_DATE; - V_DATE(pVarResult) = date; - break; - - default: - ERR("Unhandled variant type %d\n", type); - } - } - else if (wFlags & DISPATCH_PROPERTYPUT) - { - UINT posValue = DISPID_PROPERTYPUT; - - hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr); - if (FAILED(hr)) return hr; - hr = DispGetParam_CopyOnly(pDispParams, &posValue, &varg1); - if (FAILED(hr)) - { - *puArgErr = posValue; - return hr; - } - - switch (V_VT(&varg1)) - { - case VT_I2: - case VT_I4: - ret = MsiSummaryInfoSetPropertyW(This->msiHandle, V_I4(&varg0), V_VT(&varg1), V_I4(&varg1), NULL, NULL); - break; - - case VT_DATE: - VariantTimeToSystemTime(V_DATE(&varg1), &st); - SystemTimeToFileTime(&st, &ftlocal); - LocalFileTimeToFileTime(&ftlocal, &ft); - ret = MsiSummaryInfoSetPropertyW(This->msiHandle, V_I4(&varg0), VT_FILETIME, 0, &ft, NULL); - break; - - case VT_BSTR: - ret = MsiSummaryInfoSetPropertyW(This->msiHandle, V_I4(&varg0), VT_LPSTR, 0, NULL, V_BSTR(&varg1)); - break; - - default: - FIXME("Unhandled variant type %d\n", V_VT(&varg1)); - VariantClear(&varg1); - return DISP_E_EXCEPTION; - } - - if (ret != ERROR_SUCCESS) - { - ERR("MsiSummaryInfoSetPropertyW returned %d\n", ret); - return DISP_E_EXCEPTION; - } - } - else return DISP_E_MEMBERNOTFOUND; - break; - - case DISPID_SUMMARYINFO_PROPERTYCOUNT: - if (wFlags & DISPATCH_PROPERTYGET) { - UINT count; - if ((ret = MsiSummaryInfoGetPropertyCount(This->msiHandle, &count)) != ERROR_SUCCESS) - ERR("MsiSummaryInfoGetPropertyCount returned %d\n", ret); - else - { - V_VT(pVarResult) = VT_I4; - V_I4(pVarResult) = count; - } - } - else return DISP_E_MEMBERNOTFOUND; - break; - - default: - return DISP_E_MEMBERNOTFOUND; - } - - VariantClear(&varg1); - VariantClear(&varg0); - - return S_OK; -} - -static HRESULT RecordImpl_Invoke( - AutomationObject* This, - DISPID dispIdMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - WCHAR *szString; - DWORD dwLen; - UINT ret; - VARIANTARG varg0, varg1; - HRESULT hr; - - VariantInit(&varg0); - VariantInit(&varg1); - - switch (dispIdMember) - { - case DISPID_RECORD_FIELDCOUNT: - if (wFlags & DISPATCH_PROPERTYGET) { - V_VT(pVarResult) = VT_I4; - V_I4(pVarResult) = MsiRecordGetFieldCount(This->msiHandle); - } - else return DISP_E_MEMBERNOTFOUND; - break; - - case DISPID_RECORD_STRINGDATA: - if (wFlags & DISPATCH_PROPERTYGET) { - hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr); - if (FAILED(hr)) return hr; - V_VT(pVarResult) = VT_BSTR; - V_BSTR(pVarResult) = NULL; - if ((ret = MsiRecordGetStringW(This->msiHandle, V_I4(&varg0), NULL, &dwLen)) == ERROR_SUCCESS) - { - if (!(szString = msi_alloc((++dwLen)*sizeof(WCHAR)))) - ERR("Out of memory\n"); - else if ((ret = MsiRecordGetStringW(This->msiHandle, V_I4(&varg0), szString, &dwLen)) == ERROR_SUCCESS) - V_BSTR(pVarResult) = SysAllocString(szString); - msi_free(szString); - } - if (ret != ERROR_SUCCESS) - ERR("MsiRecordGetString returned %d\n", ret); - } else if (wFlags & DISPATCH_PROPERTYPUT) { - hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr); - if (FAILED(hr)) return hr; - hr = DispGetParam(pDispParams, 1, VT_BSTR, &varg1, puArgErr); - if (FAILED(hr)) return hr; - if ((ret = MsiRecordSetStringW(This->msiHandle, V_I4(&varg0), V_BSTR(&varg1))) != ERROR_SUCCESS) - { - VariantClear(&varg1); - ERR("MsiRecordSetString returned %d\n", ret); - return DISP_E_EXCEPTION; - } - } - else return DISP_E_MEMBERNOTFOUND; - break; - - case DISPID_RECORD_INTEGERDATA: - if (wFlags & DISPATCH_PROPERTYGET) { - hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr); - if (FAILED(hr)) return hr; - V_VT(pVarResult) = VT_I4; - V_I4(pVarResult) = MsiRecordGetInteger(This->msiHandle, V_I4(&varg0)); - } else if (wFlags & DISPATCH_PROPERTYPUT) { - hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr); - if (FAILED(hr)) return hr; - hr = DispGetParam(pDispParams, 1, VT_I4, &varg1, puArgErr); - if (FAILED(hr)) return hr; - if ((ret = MsiRecordSetInteger(This->msiHandle, V_I4(&varg0), V_I4(&varg1))) != ERROR_SUCCESS) - { - ERR("MsiRecordSetInteger returned %d\n", ret); - return DISP_E_EXCEPTION; - } - } - else return DISP_E_MEMBERNOTFOUND; - break; - - default: - return DISP_E_MEMBERNOTFOUND; - } - - VariantClear(&varg1); - VariantClear(&varg0); - - return S_OK; -} - -static HRESULT create_record(MSIHANDLE msiHandle, IDispatch **disp) -{ - AutomationObject *record; - HRESULT hr; - - record = msi_alloc(sizeof(*record)); - if (!record) return E_OUTOFMEMORY; - - hr = init_automation_object(record, msiHandle, &DIID_Record, RecordImpl_Invoke, NULL); - if (hr != S_OK) - { - msi_free(record); - return hr; - } - - *disp = &record->IDispatch_iface; - - return hr; -} - -static HRESULT ListImpl_Invoke( - AutomationObject* This, - DISPID dispIdMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - ListObject *list = (ListObject*)This; - IUnknown *pUnk = NULL; - HRESULT hr; - - switch (dispIdMember) - { - case DISPID_LIST__NEWENUM: - if (wFlags & DISPATCH_METHOD) { - V_VT(pVarResult) = VT_UNKNOWN; - if (SUCCEEDED(hr = create_list_enumerator(list, (LPVOID *)&pUnk))) - V_UNKNOWN(pVarResult) = pUnk; - else - ERR("Failed to create IEnumVARIANT object, hresult 0x%08x\n", hr); - } - else return DISP_E_MEMBERNOTFOUND; - break; - - case DISPID_LIST_ITEM: - if (wFlags & DISPATCH_PROPERTYGET) { - VARIANTARG index; - - VariantInit(&index); - hr = DispGetParam(pDispParams, 0, VT_I4, &index, puArgErr); - if (FAILED(hr)) return hr; - if (V_I4(&index) < 0 || V_I4(&index) >= list->count) - return DISP_E_BADINDEX; - VariantCopy(pVarResult, &list->data[V_I4(&index)]); - } - else return DISP_E_MEMBERNOTFOUND; - break; - - case DISPID_LIST_COUNT: - if (wFlags & DISPATCH_PROPERTYGET) { - V_VT(pVarResult) = VT_I4; - V_I4(pVarResult) = list->count; - } - else return DISP_E_MEMBERNOTFOUND; - break; - - default: - return DISP_E_MEMBERNOTFOUND; - } - - return S_OK; -} - -static void ListImpl_Free(AutomationObject *This) -{ - ListObject *list = (ListObject*)This; - int i; - - for (i = 0; i < list->count; i++) - VariantClear(&list->data[i]); - msi_free(list->data); -} - -static HRESULT get_products_count(const WCHAR *product, int *len) -{ - int i = 0; - - while (1) - { - WCHAR dataW[GUID_SIZE]; - UINT ret; - - /* all or related only */ - if (product) - ret = MsiEnumRelatedProductsW(product, 0, i, dataW); - else - ret = MsiEnumProductsW(i, dataW); - - if (ret == ERROR_NO_MORE_ITEMS) break; - - if (ret != ERROR_SUCCESS) - return DISP_E_EXCEPTION; - - i++; - } - - *len = i; - - return S_OK; -} - -static HRESULT create_list(const WCHAR *product, IDispatch **dispatch) -{ - ListObject *list; - HRESULT hr; - int i; - - list = msi_alloc_zero(sizeof(ListObject)); - if (!list) return E_OUTOFMEMORY; - - hr = init_automation_object(&list->autoobj, 0, &DIID_StringList, ListImpl_Invoke, ListImpl_Free); - if (hr != S_OK) - { - msi_free(list); - return hr; - } - - *dispatch = &list->autoobj.IDispatch_iface; - - hr = get_products_count(product, &list->count); - if (hr != S_OK) - { - IDispatch_Release(*dispatch); - return hr; - } - - list->data = msi_alloc(list->count*sizeof(VARIANT)); - if (!list->data) - { - IDispatch_Release(*dispatch); - return E_OUTOFMEMORY; - } - - for (i = 0; i < list->count; i++) - { - WCHAR dataW[GUID_SIZE]; - UINT ret; - - /* all or related only */ - if (product) - ret = MsiEnumRelatedProductsW(product, 0, i, dataW); - else - ret = MsiEnumProductsW(i, dataW); - - if (ret == ERROR_NO_MORE_ITEMS) break; - - V_VT(&list->data[i]) = VT_BSTR; - V_BSTR(&list->data[i]) = SysAllocString(dataW); - } - - return S_OK; -} - -static HRESULT ViewImpl_Invoke( - AutomationObject* This, - DISPID dispIdMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - MSIHANDLE msiHandle; - UINT ret; - VARIANTARG varg0, varg1; - HRESULT hr; - - VariantInit(&varg0); - VariantInit(&varg1); - - switch (dispIdMember) - { - case DISPID_VIEW_EXECUTE: - if (wFlags & DISPATCH_METHOD) - { - hr = DispGetParam(pDispParams, 0, VT_DISPATCH, &varg0, puArgErr); - if (SUCCEEDED(hr) && V_DISPATCH(&varg0) != NULL) - MsiViewExecute(This->msiHandle, ((AutomationObject *)V_DISPATCH(&varg0))->msiHandle); - else - MsiViewExecute(This->msiHandle, 0); - } - else return DISP_E_MEMBERNOTFOUND; - break; - - case DISPID_VIEW_FETCH: - if (wFlags & DISPATCH_METHOD) - { - V_VT(pVarResult) = VT_DISPATCH; - if ((ret = MsiViewFetch(This->msiHandle, &msiHandle)) == ERROR_SUCCESS) - { - IDispatch *dispatch = NULL; - - if (SUCCEEDED(hr = create_record(msiHandle, &dispatch))) - V_DISPATCH(pVarResult) = dispatch; - else - ERR("Failed to create Record object, hresult 0x%08x\n", hr); - } - else if (ret == ERROR_NO_MORE_ITEMS) - V_DISPATCH(pVarResult) = NULL; - else - { - ERR("MsiViewFetch returned %d\n", ret); - return DISP_E_EXCEPTION; - } - } - else return DISP_E_MEMBERNOTFOUND; - break; - - case DISPID_VIEW_MODIFY: - if (wFlags & DISPATCH_METHOD) - { - hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr); - if (FAILED(hr)) return hr; - hr = DispGetParam(pDispParams, 1, VT_DISPATCH, &varg1, puArgErr); - if (FAILED(hr)) return hr; - if (!V_DISPATCH(&varg1)) return DISP_E_EXCEPTION; - if ((ret = MsiViewModify(This->msiHandle, V_I4(&varg0), ((AutomationObject *)V_DISPATCH(&varg1))->msiHandle)) != ERROR_SUCCESS) - { - VariantClear(&varg1); - ERR("MsiViewModify returned %d\n", ret); - return DISP_E_EXCEPTION; - } - } - else return DISP_E_MEMBERNOTFOUND; - break; - - case DISPID_VIEW_CLOSE: - if (wFlags & DISPATCH_METHOD) - { - MsiViewClose(This->msiHandle); - } - else return DISP_E_MEMBERNOTFOUND; - break; - - default: - return DISP_E_MEMBERNOTFOUND; - } - - VariantClear(&varg1); - VariantClear(&varg0); - - return S_OK; -} - -static HRESULT DatabaseImpl_LastErrorRecord(WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - if (!(wFlags & DISPATCH_METHOD)) - return DISP_E_MEMBERNOTFOUND; - - FIXME("\n"); - - VariantInit(pVarResult); - return S_OK; -} - -static HRESULT DatabaseImpl_Invoke( - AutomationObject* This, - DISPID dispIdMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - IDispatch *dispatch = NULL; - MSIHANDLE msiHandle; - UINT ret; - VARIANTARG varg0, varg1; - HRESULT hr; - - VariantInit(&varg0); - VariantInit(&varg1); - - switch (dispIdMember) - { - case DISPID_DATABASE_SUMMARYINFORMATION: - if (wFlags & DISPATCH_PROPERTYGET) - { - hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr); - if (FAILED(hr)) - V_I4(&varg0) = 0; - - V_VT(pVarResult) = VT_DISPATCH; - if ((ret = MsiGetSummaryInformationW(This->msiHandle, NULL, V_I4(&varg0), &msiHandle)) == ERROR_SUCCESS) - { - hr = create_summaryinfo(msiHandle, &dispatch); - if (SUCCEEDED(hr)) - V_DISPATCH(pVarResult) = dispatch; - else - ERR("Failed to create SummaryInfo object: 0x%08x\n", hr); - } - else - { - ERR("MsiGetSummaryInformation returned %d\n", ret); - return DISP_E_EXCEPTION; - } - } - else return DISP_E_MEMBERNOTFOUND; - break; - - case DISPID_DATABASE_OPENVIEW: - if (wFlags & DISPATCH_METHOD) - { - hr = DispGetParam(pDispParams, 0, VT_BSTR, &varg0, puArgErr); - if (FAILED(hr)) return hr; - V_VT(pVarResult) = VT_DISPATCH; - if ((ret = MsiDatabaseOpenViewW(This->msiHandle, V_BSTR(&varg0), &msiHandle)) == ERROR_SUCCESS) - { - if (SUCCEEDED(hr = create_view(msiHandle, &dispatch))) - V_DISPATCH(pVarResult) = dispatch; - else - ERR("Failed to create View object, hresult 0x%08x\n", hr); - } - else - { - VariantClear(&varg0); - ERR("MsiDatabaseOpenView returned %d\n", ret); - return DISP_E_EXCEPTION; - } - } - else return DISP_E_MEMBERNOTFOUND; - break; - - case DISPID_INSTALLER_LASTERRORRECORD: - return DatabaseImpl_LastErrorRecord(wFlags, pDispParams, - pVarResult, pExcepInfo, - puArgErr); - - default: - return DISP_E_MEMBERNOTFOUND; - } - - VariantClear(&varg1); - VariantClear(&varg0); - - return S_OK; -} - -static HRESULT SessionImpl_Invoke( - AutomationObject* This, - DISPID dispIdMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - SessionObject *session = (SessionObject*)This; - WCHAR *szString; - DWORD dwLen; - MSIHANDLE msiHandle; - LANGID langId; - UINT ret; - INSTALLSTATE iInstalled, iAction; - VARIANTARG varg0, varg1; - HRESULT hr; - - VariantInit(&varg0); - VariantInit(&varg1); - - switch (dispIdMember) - { - case DISPID_SESSION_INSTALLER: - if (wFlags & DISPATCH_PROPERTYGET) { - V_VT(pVarResult) = VT_DISPATCH; - IDispatch_AddRef(session->installer); - V_DISPATCH(pVarResult) = session->installer; - } - else return DISP_E_MEMBERNOTFOUND; - break; - - case DISPID_SESSION_PROPERTY: - if (wFlags & DISPATCH_PROPERTYGET) { - hr = DispGetParam(pDispParams, 0, VT_BSTR, &varg0, puArgErr); - if (FAILED(hr)) return hr; - V_VT(pVarResult) = VT_BSTR; - V_BSTR(pVarResult) = NULL; - if ((ret = MsiGetPropertyW(This->msiHandle, V_BSTR(&varg0), NULL, &dwLen)) == ERROR_SUCCESS) - { - if (!(szString = msi_alloc((++dwLen)*sizeof(WCHAR)))) - ERR("Out of memory\n"); - else if ((ret = MsiGetPropertyW(This->msiHandle, V_BSTR(&varg0), szString, &dwLen)) == ERROR_SUCCESS) - V_BSTR(pVarResult) = SysAllocString(szString); - msi_free(szString); - } - if (ret != ERROR_SUCCESS) - ERR("MsiGetProperty returned %d\n", ret); - } else if (wFlags & DISPATCH_PROPERTYPUT) { - hr = DispGetParam(pDispParams, 0, VT_BSTR, &varg0, puArgErr); - if (FAILED(hr)) return hr; - hr = DispGetParam(pDispParams, 1, VT_BSTR, &varg1, puArgErr); - if (FAILED(hr)) { - VariantClear(&varg0); - return hr; - } - if ((ret = MsiSetPropertyW(This->msiHandle, V_BSTR(&varg0), V_BSTR(&varg1))) != ERROR_SUCCESS) - { - VariantClear(&varg0); - VariantClear(&varg1); - ERR("MsiSetProperty returned %d\n", ret); - return DISP_E_EXCEPTION; - } - } - else return DISP_E_MEMBERNOTFOUND; - break; - - case DISPID_SESSION_LANGUAGE: - if (wFlags & DISPATCH_PROPERTYGET) { - langId = MsiGetLanguage(This->msiHandle); - V_VT(pVarResult) = VT_I4; - V_I4(pVarResult) = langId; - } - else return DISP_E_MEMBERNOTFOUND; - break; - - case DISPID_SESSION_MODE: - if (wFlags & DISPATCH_PROPERTYGET) { - hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr); - if (FAILED(hr)) return hr; - V_VT(pVarResult) = VT_BOOL; - V_BOOL(pVarResult) = MsiGetMode(This->msiHandle, V_I4(&varg0)); - } else if (wFlags & DISPATCH_PROPERTYPUT) { - hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr); - if (FAILED(hr)) return hr; - hr = DispGetParam(pDispParams, 1, VT_BOOL, &varg1, puArgErr); - if (FAILED(hr)) return hr; - if ((ret = MsiSetMode(This->msiHandle, V_I4(&varg0), V_BOOL(&varg1))) != ERROR_SUCCESS) - { - ERR("MsiSetMode returned %d\n", ret); - return DISP_E_EXCEPTION; - } - } - else return DISP_E_MEMBERNOTFOUND; - break; - - case DISPID_SESSION_DATABASE: - if (wFlags & DISPATCH_PROPERTYGET) { - V_VT(pVarResult) = VT_DISPATCH; - if ((msiHandle = MsiGetActiveDatabase(This->msiHandle))) - { - IDispatch *dispatch; - - if (SUCCEEDED(hr = create_database(msiHandle, &dispatch))) - V_DISPATCH(pVarResult) = dispatch; - else - ERR("Failed to create Database object, hresult 0x%08x\n", hr); - } - else - { - ERR("MsiGetActiveDatabase failed\n"); - return DISP_E_EXCEPTION; - } - } - else return DISP_E_MEMBERNOTFOUND; - break; - - case DISPID_SESSION_DOACTION: - if (wFlags & DISPATCH_METHOD) { - hr = DispGetParam(pDispParams, 0, VT_BSTR, &varg0, puArgErr); - if (FAILED(hr)) return hr; - ret = MsiDoActionW(This->msiHandle, V_BSTR(&varg0)); - V_VT(pVarResult) = VT_I4; - switch (ret) - { - case ERROR_FUNCTION_NOT_CALLED: - V_I4(pVarResult) = msiDoActionStatusNoAction; - break; - case ERROR_SUCCESS: - V_I4(pVarResult) = msiDoActionStatusSuccess; - break; - case ERROR_INSTALL_USEREXIT: - V_I4(pVarResult) = msiDoActionStatusUserExit; - break; - case ERROR_INSTALL_FAILURE: - V_I4(pVarResult) = msiDoActionStatusFailure; - break; - case ERROR_INSTALL_SUSPEND: - V_I4(pVarResult) = msiDoActionStatusSuspend; - break; - case ERROR_MORE_DATA: - V_I4(pVarResult) = msiDoActionStatusFinished; - break; - case ERROR_INVALID_HANDLE_STATE: - V_I4(pVarResult) = msiDoActionStatusWrongState; - break; - case ERROR_INVALID_DATA: - V_I4(pVarResult) = msiDoActionStatusBadActionData; - break; - default: - VariantClear(&varg0); - FIXME("MsiDoAction returned unhandled value %d\n", ret); - return DISP_E_EXCEPTION; - } - } - else return DISP_E_MEMBERNOTFOUND; - break; - - case DISPID_SESSION_EVALUATECONDITION: - if (wFlags & DISPATCH_METHOD) { - hr = DispGetParam(pDispParams, 0, VT_BSTR, &varg0, puArgErr); - if (FAILED(hr)) return hr; - V_VT(pVarResult) = VT_I4; - V_I4(pVarResult) = MsiEvaluateConditionW(This->msiHandle, V_BSTR(&varg0)); - } - else return DISP_E_MEMBERNOTFOUND; - break; - - case DISPID_SESSION_MESSAGE: - if(!(wFlags & DISPATCH_METHOD)) - return DISP_E_MEMBERNOTFOUND; - - hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr); - if (FAILED(hr)) return hr; - hr = DispGetParam(pDispParams, 1, VT_DISPATCH, &varg1, puArgErr); - if (FAILED(hr)) return hr; - - V_VT(pVarResult) = VT_I4; - V_I4(pVarResult) = - MsiProcessMessage(This->msiHandle, V_I4(&varg0), ((AutomationObject *)V_DISPATCH(&varg1))->msiHandle); - break; - - case DISPID_SESSION_SETINSTALLLEVEL: - if (wFlags & DISPATCH_METHOD) { - hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr); - if (FAILED(hr)) return hr; - if ((ret = MsiSetInstallLevel(This->msiHandle, V_I4(&varg0))) != ERROR_SUCCESS) - { - ERR("MsiSetInstallLevel returned %d\n", ret); - return DISP_E_EXCEPTION; - } - } - else return DISP_E_MEMBERNOTFOUND; - break; - - case DISPID_SESSION_FEATURECURRENTSTATE: - if (wFlags & DISPATCH_PROPERTYGET) { - hr = DispGetParam(pDispParams, 0, VT_BSTR, &varg0, puArgErr); - if (FAILED(hr)) return hr; - V_VT(pVarResult) = VT_I4; - if ((ret = MsiGetFeatureStateW(This->msiHandle, V_BSTR(&varg0), &iInstalled, &iAction)) == ERROR_SUCCESS) - V_I4(pVarResult) = iInstalled; - else - { - ERR("MsiGetFeatureState returned %d\n", ret); - V_I4(pVarResult) = msiInstallStateUnknown; - } - } - else return DISP_E_MEMBERNOTFOUND; - break; - - case DISPID_SESSION_FEATUREREQUESTSTATE: - if (wFlags & DISPATCH_PROPERTYGET) { - hr = DispGetParam(pDispParams, 0, VT_BSTR, &varg0, puArgErr); - if (FAILED(hr)) return hr; - V_VT(pVarResult) = VT_I4; - if ((ret = MsiGetFeatureStateW(This->msiHandle, V_BSTR(&varg0), &iInstalled, &iAction)) == ERROR_SUCCESS) - V_I4(pVarResult) = iAction; - else - { - ERR("MsiGetFeatureState returned %d\n", ret); - V_I4(pVarResult) = msiInstallStateUnknown; - } - } else if (wFlags & DISPATCH_PROPERTYPUT) { - hr = DispGetParam(pDispParams, 0, VT_BSTR, &varg0, puArgErr); - if (FAILED(hr)) return hr; - hr = DispGetParam(pDispParams, 1, VT_I4, &varg1, puArgErr); - if (FAILED(hr)) { - VariantClear(&varg0); - return hr; - } - if ((ret = MsiSetFeatureStateW(This->msiHandle, V_BSTR(&varg0), V_I4(&varg1))) != ERROR_SUCCESS) - { - VariantClear(&varg0); - ERR("MsiSetFeatureState returned %d\n", ret); - return DISP_E_EXCEPTION; - } - } - else return DISP_E_MEMBERNOTFOUND; - break; - - default: - return DISP_E_MEMBERNOTFOUND; - } - - VariantClear(&varg1); - VariantClear(&varg0); - - return S_OK; -} - -/* Fill the variant pointed to by pVarResult with the value & size returned by RegQueryValueEx as dictated by the - * registry value type. Used by Installer::RegistryValue. */ -static void variant_from_registry_value(VARIANT *pVarResult, DWORD dwType, LPBYTE lpData, DWORD dwSize) -{ - static const WCHAR szREG_BINARY[] = { '(','R','E','G','_','B','I','N','A','R','Y',')',0 }; - static const WCHAR szREG_[] = { '(','R','E','G','_',']',0 }; - WCHAR *szString = (WCHAR *)lpData; - LPWSTR szNewString = NULL; - DWORD dwNewSize = 0; - int idx; - - switch (dwType) - { - /* Registry strings may not be null terminated so we must use SysAllocStringByteLen/Len */ - case REG_MULTI_SZ: /* Multi SZ change internal null characters to newlines */ - idx = (dwSize/sizeof(WCHAR))-1; - while (idx >= 0 && !szString[idx]) idx--; - for (; idx >= 0; idx--) - if (!szString[idx]) szString[idx] = '\n'; - /* fall through */ - case REG_SZ: - V_VT(pVarResult) = VT_BSTR; - V_BSTR(pVarResult) = SysAllocStringByteLen((LPCSTR)szString, dwSize); - break; - - case REG_EXPAND_SZ: - if (!(dwNewSize = ExpandEnvironmentStringsW(szString, szNewString, dwNewSize))) - ERR("ExpandEnvironmentStrings returned error %d\n", GetLastError()); - else if (!(szNewString = msi_alloc(dwNewSize * sizeof(WCHAR)))) - ERR("Out of memory\n"); - else if (!(dwNewSize = ExpandEnvironmentStringsW(szString, szNewString, dwNewSize))) - ERR("ExpandEnvironmentStrings returned error %d\n", GetLastError()); - else - { - V_VT(pVarResult) = VT_BSTR; - V_BSTR(pVarResult) = SysAllocStringLen(szNewString, dwNewSize); - } - msi_free(szNewString); - break; - - case REG_DWORD: - V_VT(pVarResult) = VT_I4; - V_I4(pVarResult) = *((DWORD *)lpData); - break; - - case REG_QWORD: - V_VT(pVarResult) = VT_BSTR; - V_BSTR(pVarResult) = SysAllocString(szREG_); /* Weird string, don't know why native returns it */ - break; - - case REG_BINARY: - V_VT(pVarResult) = VT_BSTR; - V_BSTR(pVarResult) = SysAllocString(szREG_BINARY); - break; - - case REG_NONE: - V_VT(pVarResult) = VT_EMPTY; - break; - - default: - FIXME("Unhandled registry value type %d\n", dwType); - } -} - -static HRESULT InstallerImpl_CreateRecord(WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - HRESULT hr; - VARIANTARG varg0; - MSIHANDLE hrec; - IDispatch* dispatch; - - if (!(wFlags & DISPATCH_METHOD)) - return DISP_E_MEMBERNOTFOUND; - - VariantInit(&varg0); - hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr); - if (FAILED(hr)) - return hr; - - V_VT(pVarResult) = VT_DISPATCH; - - hrec = MsiCreateRecord(V_I4(&varg0)); - if (!hrec) - return DISP_E_EXCEPTION; - - hr = create_record(hrec, &dispatch); - if (SUCCEEDED(hr)) - V_DISPATCH(pVarResult) = dispatch; - - return hr; -} - -static HRESULT InstallerImpl_OpenPackage(AutomationObject* This, - WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - UINT ret; - HRESULT hr; - MSIHANDLE hpkg; - IDispatch* dispatch; - VARIANTARG varg0, varg1; - - if (!(wFlags & DISPATCH_METHOD)) - return DISP_E_MEMBERNOTFOUND; - - if (pDispParams->cArgs == 0) - return DISP_E_TYPEMISMATCH; - - if (V_VT(&pDispParams->rgvarg[pDispParams->cArgs - 1]) != VT_BSTR) - return DISP_E_TYPEMISMATCH; - - VariantInit(&varg0); - hr = DispGetParam(pDispParams, 0, VT_BSTR, &varg0, puArgErr); - if (FAILED(hr)) - return hr; - - VariantInit(&varg1); - if (pDispParams->cArgs == 2) - { - hr = DispGetParam(pDispParams, 1, VT_I4, &varg1, puArgErr); - if (FAILED(hr)) - goto done; - } - else - { - V_VT(&varg1) = VT_I4; - V_I4(&varg1) = 0; - } - - V_VT(pVarResult) = VT_DISPATCH; - - ret = MsiOpenPackageExW(V_BSTR(&varg0), V_I4(&varg1), &hpkg); - if (ret != ERROR_SUCCESS) - { - hr = DISP_E_EXCEPTION; - goto done; - } - - hr = create_session(hpkg, &This->IDispatch_iface, &dispatch); - if (SUCCEEDED(hr)) - V_DISPATCH(pVarResult) = dispatch; - -done: - VariantClear(&varg0); - VariantClear(&varg1); - return hr; -} - -static HRESULT InstallerImpl_OpenProduct(WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - HRESULT hr; - VARIANTARG varg0; - - if (!(wFlags & DISPATCH_METHOD)) - return DISP_E_MEMBERNOTFOUND; - - VariantInit(&varg0); - hr = DispGetParam(pDispParams, 0, VT_BSTR, &varg0, puArgErr); - if (FAILED(hr)) - return hr; - - FIXME("%s\n", debugstr_w(V_BSTR(&varg0))); - - VariantInit(pVarResult); - - VariantClear(&varg0); - return S_OK; -} - -static HRESULT InstallerImpl_OpenDatabase(WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - UINT ret; - HRESULT hr; - MSIHANDLE hdb; - IDispatch* dispatch; - VARIANTARG varg0, varg1; - - if (!(wFlags & DISPATCH_METHOD)) - return DISP_E_MEMBERNOTFOUND; - - VariantInit(&varg0); - hr = DispGetParam(pDispParams, 0, VT_BSTR, &varg0, puArgErr); - if (FAILED(hr)) - return hr; - - VariantInit(&varg1); - hr = DispGetParam(pDispParams, 1, VT_BSTR, &varg1, puArgErr); - if (FAILED(hr)) - goto done; - - V_VT(pVarResult) = VT_DISPATCH; - - ret = MsiOpenDatabaseW(V_BSTR(&varg0), V_BSTR(&varg1), &hdb); - if (ret != ERROR_SUCCESS) - { - hr = DISP_E_EXCEPTION; - goto done; - } - - hr = create_database(hdb, &dispatch); - if (SUCCEEDED(hr)) - V_DISPATCH(pVarResult) = dispatch; - -done: - VariantClear(&varg0); - VariantClear(&varg1); - return hr; -} - -static HRESULT InstallerImpl_SummaryInformation(WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - if (!(wFlags & DISPATCH_METHOD)) - return DISP_E_MEMBERNOTFOUND; - - FIXME("\n"); - - VariantInit(pVarResult); - return S_OK; -} - -static HRESULT InstallerImpl_UILevel(WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - HRESULT hr; - VARIANTARG varg0; - INSTALLUILEVEL ui; - - if (!(wFlags & DISPATCH_PROPERTYPUT) && !(wFlags & DISPATCH_PROPERTYGET)) - return DISP_E_MEMBERNOTFOUND; - - if (wFlags & DISPATCH_PROPERTYPUT) - { - VariantInit(&varg0); - hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr); - if (FAILED(hr)) - return hr; - - ui = MsiSetInternalUI(V_I4(&varg0), NULL); - if (ui == INSTALLUILEVEL_NOCHANGE) - return DISP_E_EXCEPTION; - } - else if (wFlags & DISPATCH_PROPERTYGET) - { - ui = MsiSetInternalUI(INSTALLUILEVEL_NOCHANGE, NULL); - if (ui == INSTALLUILEVEL_NOCHANGE) - return DISP_E_EXCEPTION; - - V_VT(pVarResult) = VT_I4; - V_I4(pVarResult) = ui; - } - - return S_OK; -} - -static HRESULT InstallerImpl_EnableLog(WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - if (!(wFlags & DISPATCH_METHOD)) - return DISP_E_MEMBERNOTFOUND; - - FIXME("\n"); - - VariantInit(pVarResult); - return S_OK; -} - -static HRESULT InstallerImpl_InstallProduct(WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - UINT ret; - HRESULT hr; - VARIANTARG varg0, varg1; - - if (!(wFlags & DISPATCH_METHOD)) - return DISP_E_MEMBERNOTFOUND; - - VariantInit(&varg0); - hr = DispGetParam(pDispParams, 0, VT_BSTR, &varg0, puArgErr); - if (FAILED(hr)) - return hr; - - VariantInit(&varg1); - hr = DispGetParam(pDispParams, 1, VT_BSTR, &varg1, puArgErr); - if (FAILED(hr)) - goto done; - - ret = MsiInstallProductW(V_BSTR(&varg0), V_BSTR(&varg1)); - if (ret != ERROR_SUCCESS) - { - hr = DISP_E_EXCEPTION; - goto done; - } - -done: - VariantClear(&varg0); - VariantClear(&varg1); - return hr; -} - -static HRESULT InstallerImpl_Version(WORD wFlags, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - HRESULT hr; - DLLVERSIONINFO verinfo; - WCHAR version[MAX_PATH]; - - static const WCHAR format[] = { - '%','d','.','%','d','.','%','d','.','%','d',0}; - - if (!(wFlags & DISPATCH_PROPERTYGET)) - return DISP_E_MEMBERNOTFOUND; - - verinfo.cbSize = sizeof(DLLVERSIONINFO); - hr = DllGetVersion(&verinfo); - if (FAILED(hr)) - return hr; - - sprintfW(version, format, verinfo.dwMajorVersion, verinfo.dwMinorVersion, - verinfo.dwBuildNumber, verinfo.dwPlatformID); - - V_VT(pVarResult) = VT_BSTR; - V_BSTR(pVarResult) = SysAllocString(version); - return S_OK; -} - -static HRESULT InstallerImpl_LastErrorRecord(WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - if (!(wFlags & DISPATCH_METHOD)) - return DISP_E_MEMBERNOTFOUND; - - FIXME("\n"); - - VariantInit(pVarResult); - return S_OK; -} - -static HRESULT InstallerImpl_RegistryValue(WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - UINT ret; - HKEY hkey = NULL; - HRESULT hr; - UINT posValue; - DWORD type, size; - LPWSTR szString = NULL; - VARIANTARG varg0, varg1, varg2; - - if (!(wFlags & DISPATCH_METHOD)) - return DISP_E_MEMBERNOTFOUND; - - VariantInit(&varg0); - hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr); - if (FAILED(hr)) - return hr; - - VariantInit(&varg1); - hr = DispGetParam(pDispParams, 1, VT_BSTR, &varg1, puArgErr); - if (FAILED(hr)) - goto done; - - /* Save valuePos so we can save puArgErr if we are unable to do our type - * conversions. - */ - posValue = 2; - VariantInit(&varg2); - hr = DispGetParam_CopyOnly(pDispParams, &posValue, &varg2); - if (FAILED(hr)) - goto done; - - if (V_I4(&varg0) >= REG_INDEX_CLASSES_ROOT && - V_I4(&varg0) <= REG_INDEX_DYN_DATA) - { - V_I4(&varg0) |= (UINT_PTR)HKEY_CLASSES_ROOT; - } - - ret = RegOpenKeyW((HKEY)(UINT_PTR)V_I4(&varg0), V_BSTR(&varg1), &hkey); - - /* Only VT_EMPTY case can do anything if the key doesn't exist. */ - if (ret != ERROR_SUCCESS && V_VT(&varg2) != VT_EMPTY) - { - hr = DISP_E_BADINDEX; - goto done; - } - - /* Third parameter can be VT_EMPTY, VT_I4, or VT_BSTR */ - switch (V_VT(&varg2)) - { - /* Return VT_BOOL clarifying whether registry key exists or not. */ - case VT_EMPTY: - V_VT(pVarResult) = VT_BOOL; - V_BOOL(pVarResult) = (ret == ERROR_SUCCESS); - break; - - /* Return the value of specified key if it exists. */ - case VT_BSTR: - ret = RegQueryValueExW(hkey, V_BSTR(&varg2), - NULL, NULL, NULL, &size); - if (ret != ERROR_SUCCESS) - { - hr = DISP_E_BADINDEX; - goto done; - } - - szString = msi_alloc(size); - if (!szString) - { - hr = E_OUTOFMEMORY; - goto done; - } - - ret = RegQueryValueExW(hkey, V_BSTR(&varg2), NULL, - &type, (LPBYTE)szString, &size); - if (ret != ERROR_SUCCESS) - { - msi_free(szString); - hr = DISP_E_BADINDEX; - goto done; - } - - variant_from_registry_value(pVarResult, type, - (LPBYTE)szString, size); - msi_free(szString); - break; - - /* Try to make it into VT_I4, can use VariantChangeType for this. */ - default: - hr = VariantChangeType(&varg2, &varg2, 0, VT_I4); - if (FAILED(hr)) - { - if (hr == DISP_E_TYPEMISMATCH) - *puArgErr = posValue; - - goto done; - } - - /* Retrieve class name or maximum value name or subkey name size. */ - if (!V_I4(&varg2)) - ret = RegQueryInfoKeyW(hkey, NULL, &size, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL); - else if (V_I4(&varg2) > 0) - ret = RegQueryInfoKeyW(hkey, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, &size, NULL, NULL, NULL); - else /* V_I4(&varg2) < 0 */ - ret = RegQueryInfoKeyW(hkey, NULL, NULL, NULL, NULL, &size, - NULL, NULL, NULL, NULL, NULL, NULL); - - if (ret != ERROR_SUCCESS) - goto done; - - szString = msi_alloc(++size * sizeof(WCHAR)); - if (!szString) - { - hr = E_OUTOFMEMORY; - goto done; - } - - if (!V_I4(&varg2)) - ret = RegQueryInfoKeyW(hkey, szString, &size,NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL); - else if (V_I4(&varg2) > 0) - ret = RegEnumValueW(hkey, V_I4(&varg2)-1, szString, - &size, 0, 0, NULL, NULL); - else /* V_I4(&varg2) < 0 */ - ret = RegEnumKeyW(hkey, -1 - V_I4(&varg2), szString, size); - - if (ret == ERROR_SUCCESS) - { - V_VT(pVarResult) = VT_BSTR; - V_BSTR(pVarResult) = SysAllocString(szString); - } - - msi_free(szString); - } - -done: - VariantClear(&varg0); - VariantClear(&varg1); - VariantClear(&varg2); - RegCloseKey(hkey); - return hr; -} - -static HRESULT InstallerImpl_Environment(WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - if (!(wFlags & DISPATCH_METHOD)) - return DISP_E_MEMBERNOTFOUND; - - FIXME("\n"); - - VariantInit(pVarResult); - return S_OK; -} - -static HRESULT InstallerImpl_FileAttributes(WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - if (!(wFlags & DISPATCH_METHOD)) - return DISP_E_MEMBERNOTFOUND; - - FIXME("\n"); - - VariantInit(pVarResult); - return S_OK; -} - -static HRESULT InstallerImpl_FileSize(WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - if (!(wFlags & DISPATCH_METHOD)) - return DISP_E_MEMBERNOTFOUND; - - FIXME("\n"); - - VariantInit(pVarResult); - return S_OK; -} - -static HRESULT InstallerImpl_FileVersion(WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - if (!(wFlags & DISPATCH_METHOD)) - return DISP_E_MEMBERNOTFOUND; - - FIXME("\n"); - - VariantInit(pVarResult); - return S_OK; -} - -static HRESULT InstallerImpl_ProductState(WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - HRESULT hr; - VARIANTARG varg0; - - if (!(wFlags & DISPATCH_PROPERTYGET)) - return DISP_E_MEMBERNOTFOUND; - - VariantInit(&varg0); - hr = DispGetParam(pDispParams, 0, VT_BSTR, &varg0, puArgErr); - if (FAILED(hr)) - return hr; - - V_VT(pVarResult) = VT_I4; - V_I4(pVarResult) = MsiQueryProductStateW(V_BSTR(&varg0)); - - VariantClear(&varg0); - return S_OK; -} - -static HRESULT InstallerImpl_ProductInfo(WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - UINT ret; - HRESULT hr; - DWORD size; - LPWSTR str = NULL; - VARIANTARG varg0, varg1; - - if (!(wFlags & DISPATCH_PROPERTYGET)) - return DISP_E_MEMBERNOTFOUND; - - VariantInit(&varg0); - hr = DispGetParam(pDispParams, 0, VT_BSTR, &varg0, puArgErr); - if (FAILED(hr)) - return hr; - - VariantInit(&varg1); - hr = DispGetParam(pDispParams, 1, VT_BSTR, &varg1, puArgErr); - if (FAILED(hr)) - goto done; - - V_VT(pVarResult) = VT_BSTR; - V_BSTR(pVarResult) = NULL; - - ret = MsiGetProductInfoW(V_BSTR(&varg0), V_BSTR(&varg1), NULL, &size); - if (ret != ERROR_SUCCESS) - { - hr = DISP_E_EXCEPTION; - goto done; - } - - str = msi_alloc(++size * sizeof(WCHAR)); - if (!str) - { - hr = E_OUTOFMEMORY; - goto done; - } - - ret = MsiGetProductInfoW(V_BSTR(&varg0), V_BSTR(&varg1), str, &size); - if (ret != ERROR_SUCCESS) - { - hr = DISP_E_EXCEPTION; - goto done; - } - - V_BSTR(pVarResult) = SysAllocString(str); - hr = S_OK; - -done: - msi_free(str); - VariantClear(&varg0); - VariantClear(&varg1); - return hr; -} - -static HRESULT InstallerImpl_Products(WORD flags, - DISPPARAMS* pDispParams, - VARIANT* result, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - IDispatch *dispatch; - HRESULT hr; - - if (!(flags & DISPATCH_PROPERTYGET)) - return DISP_E_MEMBERNOTFOUND; - - hr = create_list(NULL, &dispatch); - if (FAILED(hr)) - return hr; - - V_VT(result) = VT_DISPATCH; - V_DISPATCH(result) = dispatch; - - return hr; -} - -static HRESULT InstallerImpl_RelatedProducts(WORD flags, - DISPPARAMS* pDispParams, - VARIANT* result, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - IDispatch* dispatch; - VARIANTARG related; - HRESULT hr; - - if (!(flags & DISPATCH_PROPERTYGET)) - return DISP_E_MEMBERNOTFOUND; - - VariantInit(&related); - hr = DispGetParam(pDispParams, 0, VT_BSTR, &related, puArgErr); - if (FAILED(hr)) - return hr; - - hr = create_list(V_BSTR(&related), &dispatch); - VariantClear(&related); - - V_VT(result) = VT_DISPATCH; - V_DISPATCH(result) = dispatch; - - return hr; -} - -static HRESULT InstallerImpl_Invoke( - AutomationObject* This, - DISPID dispIdMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pVarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - switch (dispIdMember) - { - case DISPID_INSTALLER_CREATERECORD: - return InstallerImpl_CreateRecord(wFlags, pDispParams, - pVarResult, pExcepInfo, puArgErr); - - case DISPID_INSTALLER_OPENPACKAGE: - return InstallerImpl_OpenPackage(This, wFlags, pDispParams, - pVarResult, pExcepInfo, puArgErr); - - case DISPID_INSTALLER_OPENPRODUCT: - return InstallerImpl_OpenProduct(wFlags, pDispParams, - pVarResult, pExcepInfo, puArgErr); - - case DISPID_INSTALLER_OPENDATABASE: - return InstallerImpl_OpenDatabase(wFlags, pDispParams, - pVarResult, pExcepInfo, puArgErr); - - case DISPID_INSTALLER_SUMMARYINFORMATION: - return InstallerImpl_SummaryInformation(wFlags, pDispParams, - pVarResult, pExcepInfo, - puArgErr); - - case DISPID_INSTALLER_UILEVEL: - return InstallerImpl_UILevel(wFlags, pDispParams, - pVarResult, pExcepInfo, puArgErr); - - case DISPID_INSTALLER_ENABLELOG: - return InstallerImpl_EnableLog(wFlags, pDispParams, - pVarResult, pExcepInfo, puArgErr); - - case DISPID_INSTALLER_INSTALLPRODUCT: - return InstallerImpl_InstallProduct(wFlags, pDispParams, - pVarResult, pExcepInfo, - puArgErr); - - case DISPID_INSTALLER_VERSION: - return InstallerImpl_Version(wFlags, pVarResult, - pExcepInfo, puArgErr); - - case DISPID_INSTALLER_LASTERRORRECORD: - return InstallerImpl_LastErrorRecord(wFlags, pDispParams, - pVarResult, pExcepInfo, - puArgErr); - - case DISPID_INSTALLER_REGISTRYVALUE: - return InstallerImpl_RegistryValue(wFlags, pDispParams, - pVarResult, pExcepInfo, - puArgErr); - - case DISPID_INSTALLER_ENVIRONMENT: - return InstallerImpl_Environment(wFlags, pDispParams, - pVarResult, pExcepInfo, puArgErr); - - case DISPID_INSTALLER_FILEATTRIBUTES: - return InstallerImpl_FileAttributes(wFlags, pDispParams, - pVarResult, pExcepInfo, - puArgErr); - - case DISPID_INSTALLER_FILESIZE: - return InstallerImpl_FileSize(wFlags, pDispParams, - pVarResult, pExcepInfo, puArgErr); - - case DISPID_INSTALLER_FILEVERSION: - return InstallerImpl_FileVersion(wFlags, pDispParams, - pVarResult, pExcepInfo, puArgErr); - - case DISPID_INSTALLER_PRODUCTSTATE: - return InstallerImpl_ProductState(wFlags, pDispParams, - pVarResult, pExcepInfo, puArgErr); - - case DISPID_INSTALLER_PRODUCTINFO: - return InstallerImpl_ProductInfo(wFlags, pDispParams, - pVarResult, pExcepInfo, puArgErr); - - case DISPID_INSTALLER_PRODUCTS: - return InstallerImpl_Products(wFlags, pDispParams, - pVarResult, pExcepInfo, puArgErr); - - case DISPID_INSTALLER_RELATEDPRODUCTS: - return InstallerImpl_RelatedProducts(wFlags, pDispParams, - pVarResult, pExcepInfo, - puArgErr); - - default: - return DISP_E_MEMBERNOTFOUND; - } -} - -HRESULT create_msiserver(IUnknown *outer, void **ppObj) -{ - AutomationObject *installer; - HRESULT hr; - - TRACE("(%p %p)\n", outer, ppObj); - - if (outer) - return CLASS_E_NOAGGREGATION; - - installer = msi_alloc(sizeof(AutomationObject)); - if (!installer) return E_OUTOFMEMORY; - - hr = init_automation_object(installer, 0, &DIID_Installer, InstallerImpl_Invoke, NULL); - if (hr != S_OK) - { - msi_free(installer); - return hr; - } - - *ppObj = &installer->IDispatch_iface; - - return hr; -} - -HRESULT create_session(MSIHANDLE msiHandle, IDispatch *installer, IDispatch **disp) -{ - SessionObject *session; - HRESULT hr; - - session = msi_alloc(sizeof(SessionObject)); - if (!session) return E_OUTOFMEMORY; - - hr = init_automation_object(&session->autoobj, msiHandle, &DIID_Session, SessionImpl_Invoke, NULL); - if (hr != S_OK) - { - msi_free(session); - return hr; - } - - session->installer = installer; - *disp = &session->autoobj.IDispatch_iface; - - return hr; -} - -static HRESULT create_database(MSIHANDLE msiHandle, IDispatch **dispatch) -{ - AutomationObject *database; - HRESULT hr; - - TRACE("(%d %p)\n", msiHandle, dispatch); - - database = msi_alloc(sizeof(AutomationObject)); - if (!database) return E_OUTOFMEMORY; - - hr = init_automation_object(database, msiHandle, &DIID_Database, DatabaseImpl_Invoke, NULL); - if (hr != S_OK) - { - msi_free(database); - return hr; - } - - *dispatch = &database->IDispatch_iface; - - return hr; -} - -static HRESULT create_view(MSIHANDLE msiHandle, IDispatch **dispatch) -{ - AutomationObject *view; - HRESULT hr; - - TRACE("(%d %p)\n", msiHandle, dispatch); - - view = msi_alloc(sizeof(AutomationObject)); - if (!view) return E_OUTOFMEMORY; - - hr = init_automation_object(view, msiHandle, &DIID_View, ViewImpl_Invoke, NULL); - if (hr != S_OK) - { - msi_free(view); - return hr; - } - - *dispatch = &view->IDispatch_iface; - - return hr; -} - -static HRESULT create_summaryinfo(MSIHANDLE msiHandle, IDispatch **disp) -{ - AutomationObject *info; - HRESULT hr; - - info = msi_alloc(sizeof(*info)); - if (!info) return E_OUTOFMEMORY; - - hr = init_automation_object(info, msiHandle, &DIID_SummaryInfo, SummaryInfoImpl_Invoke, NULL); - if (hr != S_OK) - { - msi_free(info); - return hr; - } - - *disp = &info->IDispatch_iface; - - return hr; -} diff --git a/libmsi/cond-parser.y b/libmsi/cond-parser.y index 5d683f3..d6c39c7 100644 --- a/libmsi/cond-parser.y +++ b/libmsi/cond-parser.y @@ -848,38 +848,7 @@ MSICONDITION WINAPI MsiEvaluateConditionW( MSIHANDLE hInstall, LPCWSTR szConditi package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE); if( !package ) - { - HRESULT hr; - BSTR condition; - IWineMsiRemotePackage *remote_package; - - remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); - if (!remote_package) - return MSICONDITION_ERROR; - - condition = SysAllocString( szCondition ); - if (!condition) - { - IWineMsiRemotePackage_Release( remote_package ); - return ERROR_OUTOFMEMORY; - } - - hr = IWineMsiRemotePackage_EvaluateCondition( remote_package, condition ); - - SysFreeString( condition ); - IWineMsiRemotePackage_Release( remote_package ); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; - } - + return ERROR_INVALID_HANDLE; ret = MSI_EvaluateConditionW( package, szCondition ); msiobj_release( &package->hdr ); return ret; diff --git a/libmsi/custom.c b/libmsi/custom.c index f874e12..43c86f3 100644 --- a/libmsi/custom.c +++ b/libmsi/custom.c @@ -485,40 +485,6 @@ static void handle_msi_break( LPCWSTR target ) DebugBreak(); } -static UINT get_action_info( const GUID *guid, INT *type, MSIHANDLE *handle, - BSTR *dll, BSTR *funcname, - IWineMsiRemotePackage **package ) -{ - IClassFactory *cf = NULL; - IWineMsiRemoteCustomAction *rca = NULL; - HRESULT r; - - r = DllGetClassObject( &CLSID_WineMsiRemoteCustomAction, - &IID_IClassFactory, (LPVOID *)&cf ); - if (FAILED(r)) - { - ERR("failed to get IClassFactory interface\n"); - return ERROR_FUNCTION_FAILED; - } - - r = IClassFactory_CreateInstance( cf, NULL, &IID_IWineMsiRemoteCustomAction, (LPVOID *)&rca ); - if (FAILED(r)) - { - ERR("failed to get IWineMsiRemoteCustomAction interface\n"); - return ERROR_FUNCTION_FAILED; - } - - r = IWineMsiRemoteCustomAction_GetActionInfo( rca, guid, type, handle, dll, funcname, package ); - IWineMsiRemoteCustomAction_Release( rca ); - if (FAILED(r)) - { - ERR("GetActionInfo failed\n"); - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; -} - static inline UINT CUSTOMPROC_wrapper( MsiCustomActionEntryPoint proc, MSIHANDLE handle ) { return proc(handle); @@ -526,58 +492,7 @@ static inline UINT CUSTOMPROC_wrapper( MsiCustomActionEntryPoint proc, MSIHANDLE static DWORD ACTION_CallDllFunction( const GUID *guid ) { - MsiCustomActionEntryPoint fn; - MSIHANDLE hPackage, handle; - HANDLE hModule; - LPSTR proc; - UINT r = ERROR_FUNCTION_FAILED; - BSTR dll = NULL, function = NULL; - INT type; - IWineMsiRemotePackage *remote_package = NULL; - - TRACE("%s\n", debugstr_guid( guid )); - - r = get_action_info( guid, &type, &handle, &dll, &function, &remote_package ); - if (r != ERROR_SUCCESS) - return r; - - hModule = LoadLibraryW( dll ); - if (!hModule) - { - WARN( "failed to load dll %s (%u)\n", debugstr_w( dll ), GetLastError() ); - return ERROR_SUCCESS; - } - - proc = strdupWtoA( function ); - fn = (MsiCustomActionEntryPoint) GetProcAddress( hModule, proc ); - msi_free( proc ); - if (fn) - { - hPackage = alloc_msi_remote_handle( (IUnknown *)remote_package ); - if (hPackage) - { - IWineMsiRemotePackage_SetMsiHandle( remote_package, handle ); - TRACE("calling %s\n", debugstr_w( function ) ); - handle_msi_break( function ); - - r = CUSTOMPROC_wrapper( fn, hPackage ); - - MsiCloseHandle( hPackage ); - } - else - ERR("failed to create handle for %p\n", remote_package ); - } - else - ERR("GetProcAddress(%s) failed\n", debugstr_w( function ) ); - - FreeLibrary(hModule); - - IWineMsiRemotePackage_Release( remote_package ); - SysFreeString( dll ); - SysFreeString( function ); - MsiCloseHandle( handle ); - - return r; + return ERROR_FUNCTION_FAILED; } static DWORD WINAPI DllThread( LPVOID arg ) @@ -1394,87 +1309,3 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package) } LeaveCriticalSection( &msi_custom_action_cs ); } - -typedef struct _msi_custom_remote_impl { - IWineMsiRemoteCustomAction IWineMsiRemoteCustomAction_iface; - LONG refs; -} msi_custom_remote_impl; - -static inline msi_custom_remote_impl *impl_from_IWineMsiRemoteCustomAction( IWineMsiRemoteCustomAction *iface ) -{ - return CONTAINING_RECORD(iface, msi_custom_remote_impl, IWineMsiRemoteCustomAction_iface); -} - -static HRESULT WINAPI mcr_QueryInterface( IWineMsiRemoteCustomAction *iface, - REFIID riid,LPVOID *ppobj) -{ - if( IsEqualCLSID( riid, &IID_IUnknown ) || - IsEqualCLSID( riid, &IID_IWineMsiRemoteCustomAction ) ) - { - IWineMsiRemoteCustomAction_AddRef( iface ); - *ppobj = iface; - return S_OK; - } - - return E_NOINTERFACE; -} - -static ULONG WINAPI mcr_AddRef( IWineMsiRemoteCustomAction *iface ) -{ - msi_custom_remote_impl* This = impl_from_IWineMsiRemoteCustomAction( iface ); - - return InterlockedIncrement( &This->refs ); -} - -static ULONG WINAPI mcr_Release( IWineMsiRemoteCustomAction *iface ) -{ - msi_custom_remote_impl* This = impl_from_IWineMsiRemoteCustomAction( iface ); - ULONG r; - - r = InterlockedDecrement( &This->refs ); - if (r == 0) - msi_free( This ); - return r; -} - -static HRESULT WINAPI mcr_GetActionInfo( IWineMsiRemoteCustomAction *iface, LPCGUID custom_action_guid, - INT *type, MSIHANDLE *handle, BSTR *dll, BSTR *func, IWineMsiRemotePackage **remote_package ) -{ - msi_custom_action_info *info; - - info = find_action_by_guid( custom_action_guid ); - if (!info) - return E_FAIL; - - *type = info->type; - *handle = alloc_msihandle( &info->package->hdr ); - *dll = SysAllocString( info->source ); - *func = SysAllocString( info->target ); - - release_custom_action_data( info ); - return create_msi_remote_package( NULL, (LPVOID *)remote_package ); -} - -static const IWineMsiRemoteCustomActionVtbl msi_custom_remote_vtbl = -{ - mcr_QueryInterface, - mcr_AddRef, - mcr_Release, - mcr_GetActionInfo, -}; - -HRESULT create_msi_custom_remote( IUnknown *pOuter, LPVOID *ppObj ) -{ - msi_custom_remote_impl* This; - - This = msi_alloc( sizeof *This ); - if (!This) - return E_OUTOFMEMORY; - - This->IWineMsiRemoteCustomAction_iface.lpVtbl = &msi_custom_remote_vtbl; - This->refs = 1; - - *ppObj = This; - - return S_OK; -} diff --git a/libmsi/database.c b/libmsi/database.c index 9c0d346..d2ec11a 100644 --- a/libmsi/database.c +++ b/libmsi/database.c @@ -1028,19 +1028,7 @@ UINT WINAPI MsiDatabaseImportW(MSIHANDLE handle, LPCWSTR szFolder, LPCWSTR szFil db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE ); if( !db ) - { - IWineMsiRemoteDatabase *remote_database; - - remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( handle ); - if ( !remote_database ) - return ERROR_INVALID_HANDLE; - - IWineMsiRemoteDatabase_Release( remote_database ); - WARN("MsiDatabaseImport not allowed during a custom action!\n"); - - return ERROR_SUCCESS; - } - + return ERROR_INVALID_HANDLE; r = MSI_DatabaseImport( db, szFolder, szFilename ); msiobj_release( &db->hdr ); return r; @@ -1249,19 +1237,7 @@ UINT WINAPI MsiDatabaseExportW( MSIHANDLE handle, LPCWSTR szTable, db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE ); if( !db ) - { - IWineMsiRemoteDatabase *remote_database; - - remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( handle ); - if ( !remote_database ) - return ERROR_INVALID_HANDLE; - - IWineMsiRemoteDatabase_Release( remote_database ); - WARN("MsiDatabaseExport not allowed during a custom action!\n"); - - return ERROR_SUCCESS; - } - + return ERROR_INVALID_HANDLE; r = MSI_DatabaseExport( db, szTable, szFolder, szFilename ); msiobj_release( &db->hdr ); return r; @@ -2045,136 +2021,10 @@ MSIDBSTATE WINAPI MsiGetDatabaseState( MSIHANDLE handle ) db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE ); if( !db ) - { - IWineMsiRemoteDatabase *remote_database; - - remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( handle ); - if ( !remote_database ) - return MSIDBSTATE_ERROR; - - IWineMsiRemoteDatabase_Release( remote_database ); - WARN("MsiGetDatabaseState not allowed during a custom action!\n"); - - return MSIDBSTATE_READ; - } - + return ERROR_INVALID_HANDLE; if (db->mode != MSIDBOPEN_READONLY ) ret = MSIDBSTATE_WRITE; msiobj_release( &db->hdr ); return ret; } - -typedef struct _msi_remote_database_impl { - IWineMsiRemoteDatabase IWineMsiRemoteDatabase_iface; - MSIHANDLE database; - LONG refs; -} msi_remote_database_impl; - -static inline msi_remote_database_impl *impl_from_IWineMsiRemoteDatabase( IWineMsiRemoteDatabase *iface ) -{ - return CONTAINING_RECORD(iface, msi_remote_database_impl, IWineMsiRemoteDatabase_iface); -} - -static HRESULT WINAPI mrd_QueryInterface( IWineMsiRemoteDatabase *iface, - REFIID riid,LPVOID *ppobj) -{ - if( IsEqualCLSID( riid, &IID_IUnknown ) || - IsEqualCLSID( riid, &IID_IWineMsiRemoteDatabase ) ) - { - IWineMsiRemoteDatabase_AddRef( iface ); - *ppobj = iface; - return S_OK; - } - - return E_NOINTERFACE; -} - -static ULONG WINAPI mrd_AddRef( IWineMsiRemoteDatabase *iface ) -{ - msi_remote_database_impl* This = impl_from_IWineMsiRemoteDatabase( iface ); - - return InterlockedIncrement( &This->refs ); -} - -static ULONG WINAPI mrd_Release( IWineMsiRemoteDatabase *iface ) -{ - msi_remote_database_impl* This = impl_from_IWineMsiRemoteDatabase( iface ); - ULONG r; - - r = InterlockedDecrement( &This->refs ); - if (r == 0) - { - MsiCloseHandle( This->database ); - msi_free( This ); - } - return r; -} - -static HRESULT WINAPI mrd_IsTablePersistent( IWineMsiRemoteDatabase *iface, - LPCWSTR table, MSICONDITION *persistent ) -{ - msi_remote_database_impl *This = impl_from_IWineMsiRemoteDatabase( iface ); - *persistent = MsiDatabaseIsTablePersistentW(This->database, table); - return S_OK; -} - -static HRESULT WINAPI mrd_GetPrimaryKeys( IWineMsiRemoteDatabase *iface, - LPCWSTR table, MSIHANDLE *keys ) -{ - msi_remote_database_impl *This = impl_from_IWineMsiRemoteDatabase( iface ); - UINT r = MsiDatabaseGetPrimaryKeysW(This->database, table, keys); - return HRESULT_FROM_WIN32(r); -} - -static HRESULT WINAPI mrd_GetSummaryInformation( IWineMsiRemoteDatabase *iface, - UINT updatecount, MSIHANDLE *suminfo ) -{ - msi_remote_database_impl *This = impl_from_IWineMsiRemoteDatabase( iface ); - UINT r = MsiGetSummaryInformationW(This->database, NULL, updatecount, suminfo); - return HRESULT_FROM_WIN32(r); -} - -static HRESULT WINAPI mrd_OpenView( IWineMsiRemoteDatabase *iface, - LPCWSTR query, MSIHANDLE *view ) -{ - msi_remote_database_impl *This = impl_from_IWineMsiRemoteDatabase( iface ); - UINT r = MsiDatabaseOpenViewW(This->database, query, view); - return HRESULT_FROM_WIN32(r); -} - -static HRESULT WINAPI mrd_SetMsiHandle( IWineMsiRemoteDatabase *iface, MSIHANDLE handle ) -{ - msi_remote_database_impl* This = impl_from_IWineMsiRemoteDatabase( iface ); - This->database = handle; - return S_OK; -} - -static const IWineMsiRemoteDatabaseVtbl msi_remote_database_vtbl = -{ - mrd_QueryInterface, - mrd_AddRef, - mrd_Release, - mrd_IsTablePersistent, - mrd_GetPrimaryKeys, - mrd_GetSummaryInformation, - mrd_OpenView, - mrd_SetMsiHandle, -}; - -HRESULT create_msi_remote_database( IUnknown *pOuter, LPVOID *ppObj ) -{ - msi_remote_database_impl *This; - - This = msi_alloc( sizeof *This ); - if (!This) - return E_OUTOFMEMORY; - - This->IWineMsiRemoteDatabase_iface.lpVtbl = &msi_remote_database_vtbl; - This->database = 0; - This->refs = 1; - - *ppObj = This; - - return S_OK; -} diff --git a/libmsi/dialog.c b/libmsi/dialog.c index 66d8786..61acc0f 100644 --- a/libmsi/dialog.c +++ b/libmsi/dialog.c @@ -4062,20 +4062,7 @@ UINT WINAPI MsiEnableUIPreview( MSIHANDLE hdb, MSIHANDLE *phPreview ) db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE ); if (!db) - { - IWineMsiRemoteDatabase *remote_database; - - remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hdb ); - if (!remote_database) - return ERROR_INVALID_HANDLE; - - *phPreview = 0; - - IWineMsiRemoteDatabase_Release( remote_database ); - WARN("MsiEnableUIPreview not allowed during a custom action!\n"); - - return ERROR_FUNCTION_FAILED; - } + return ERROR_INVALID_HANDLE; preview = MSI_EnableUIPreview( db ); if (preview) { diff --git a/libmsi/format.c b/libmsi/format.c index 8188f13..c61fbd7 100644 --- a/libmsi/format.c +++ b/libmsi/format.c @@ -918,40 +918,7 @@ UINT WINAPI MsiFormatRecordW( MSIHANDLE hInstall, MSIHANDLE hRecord, package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); if (!package) - { - HRESULT hr; - IWineMsiRemotePackage *remote_package; - BSTR value = NULL; - awstring wstr; - - remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); - if (remote_package) - { - hr = IWineMsiRemotePackage_FormatRecord( remote_package, hRecord, - &value ); - 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; - } - } - + return ERROR_INVALID_HANDLE; record = msihandle2msiinfo( hRecord, MSIHANDLETYPE_RECORD ); if (!record) diff --git a/libmsi/handle.c b/libmsi/handle.c index 80c6873..381239f 100644 --- a/libmsi/handle.c +++ b/libmsi/handle.c @@ -55,11 +55,7 @@ static CRITICAL_SECTION MSI_object_cs = { &MSI_object_cs_debug, -1, 0, 0, 0, 0 } typedef struct msi_handle_info_t { - BOOL remote; - union { - MSIOBJECTHDR *obj; - IUnknown *unk; - } u; + MSIOBJECTHDR *obj; DWORD dwThreadId; } msi_handle_info; @@ -81,7 +77,7 @@ static MSIHANDLE alloc_handle_table_entry(void) /* find a slot */ for(i=0; i<msihandletable_size; i++) - if( !msihandletable[i].u.obj && !msihandletable[i].u.unk ) + if( !msihandletable[i].obj ) break; if( i==msihandletable_size ) { @@ -118,9 +114,8 @@ MSIHANDLE alloc_msihandle( MSIOBJECTHDR *obj ) { entry = &msihandletable[ ret - 1 ]; msiobj_addref( obj ); - entry->u.obj = obj; + entry->obj = obj; entry->dwThreadId = GetCurrentThreadId(); - entry->remote = FALSE; } LeaveCriticalSection( &MSI_handle_cs ); @@ -130,30 +125,6 @@ MSIHANDLE alloc_msihandle( MSIOBJECTHDR *obj ) return ret; } -MSIHANDLE alloc_msi_remote_handle( IUnknown *unk ) -{ - msi_handle_info *entry; - MSIHANDLE ret; - - EnterCriticalSection( &MSI_handle_cs ); - - ret = alloc_handle_table_entry(); - if (ret) - { - entry = &msihandletable[ ret - 1 ]; - IUnknown_AddRef( unk ); - entry->u.unk = unk; - entry->dwThreadId = GetCurrentThreadId(); - entry->remote = TRUE; - } - - LeaveCriticalSection( &MSI_handle_cs ); - - TRACE("%p -> %d\n", unk, ret); - - return ret; -} - void *msihandle2msiinfo(MSIHANDLE handle, UINT type) { MSIOBJECTHDR *ret = NULL; @@ -162,15 +133,13 @@ void *msihandle2msiinfo(MSIHANDLE handle, UINT type) handle--; if( handle >= msihandletable_size ) goto out; - if( msihandletable[handle].remote) - goto out; - if( !msihandletable[handle].u.obj ) + if( !msihandletable[handle].obj ) goto out; - if( msihandletable[handle].u.obj->magic != MSIHANDLE_MAGIC ) + if( msihandletable[handle].obj->magic != MSIHANDLE_MAGIC ) goto out; - if( type && (msihandletable[handle].u.obj->type != type) ) + if( type && (msihandletable[handle].obj->type != type) ) goto out; - ret = msihandletable[handle].u.obj; + ret = msihandletable[handle].obj; msiobj_addref( ret ); out: @@ -179,26 +148,6 @@ out: return ret; } -IUnknown *msi_get_remote( MSIHANDLE handle ) -{ - IUnknown *unk = NULL; - - EnterCriticalSection( &MSI_handle_cs ); - handle--; - if( handle>=msihandletable_size ) - goto out; - if( !msihandletable[handle].remote) - goto out; - unk = msihandletable[handle].u.unk; - if( unk ) - IUnknown_AddRef( unk ); - -out: - LeaveCriticalSection( &MSI_handle_cs ); - - return unk; -} - void *alloc_msiobject(UINT type, UINT size, msihandledestructor destroy ) { MSIOBJECTHDR *info; @@ -283,25 +232,17 @@ UINT WINAPI MsiCloseHandle(MSIHANDLE handle) if (handle >= msihandletable_size) goto out; - if (msihandletable[handle].remote) - { - IUnknown_Release( msihandletable[handle].u.unk ); - } - else - { - info = msihandletable[handle].u.obj; - if( !info ) - goto out; + info = msihandletable[handle].obj; + if( !info ) + goto out; - if( info->magic != MSIHANDLE_MAGIC ) - { - ERR("Invalid handle!\n"); - goto out; - } + if( info->magic != MSIHANDLE_MAGIC ) + { + ERR("Invalid handle!\n"); + goto out; } - msihandletable[handle].u.obj = NULL; - msihandletable[handle].remote = 0; + msihandletable[handle].obj = NULL; msihandletable[handle].dwThreadId = 0; ret = ERROR_SUCCESS; diff --git a/libmsi/install.c b/libmsi/install.c index a6c832a..0cf25a8 100644 --- a/libmsi/install.c +++ b/libmsi/install.c @@ -73,38 +73,7 @@ UINT WINAPI MsiDoActionW( MSIHANDLE hInstall, LPCWSTR szAction ) package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); if (!package) - { - HRESULT hr; - BSTR action; - IWineMsiRemotePackage *remote_package; - - remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); - if (!remote_package) - return ERROR_INVALID_HANDLE; - - action = SysAllocString( szAction ); - if (!action) - { - IWineMsiRemotePackage_Release( remote_package ); - return ERROR_OUTOFMEMORY; - } - - hr = IWineMsiRemotePackage_DoAction( remote_package, action ); - - SysFreeString( action ); - IWineMsiRemotePackage_Release( remote_package ); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; - } - + return ERROR_INVALID_HANDLE; ret = ACTION_PerformUIAction( package, szAction, SCRIPT_NONE ); msiobj_release( &package->hdr ); @@ -142,37 +111,7 @@ UINT WINAPI MsiSequenceW( MSIHANDLE hInstall, LPCWSTR szTable, INT iSequenceMode package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); if (!package) - { - HRESULT hr; - BSTR table; - IWineMsiRemotePackage *remote_package; - - remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); - if (!remote_package) - return ERROR_INVALID_HANDLE; - - table = SysAllocString( szTable ); - if (!table) - { - IWineMsiRemotePackage_Release( remote_package ); - return ERROR_OUTOFMEMORY; - } - - hr = IWineMsiRemotePackage_Sequence( remote_package, table, iSequenceMode ); - - SysFreeString( table ); - IWineMsiRemotePackage_Release( remote_package ); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; - } + return ERROR_INVALID_HANDLE; ret = MSI_Sequence( package, szTable ); msiobj_release( &package->hdr ); return ret; @@ -242,59 +181,7 @@ static UINT MSI_GetTargetPath( MSIHANDLE hInstall, LPCWSTR szFolder, package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); if (!package) - { - HRESULT hr; - IWineMsiRemotePackage *remote_package; - LPWSTR value = NULL; - BSTR folder; - DWORD len; - - remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); - if (!remote_package) - return ERROR_INVALID_HANDLE; - - folder = SysAllocString( szFolder ); - if (!folder) - { - IWineMsiRemotePackage_Release( remote_package ); - return ERROR_OUTOFMEMORY; - } - - len = 0; - hr = IWineMsiRemotePackage_GetTargetPath( remote_package, folder, 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, folder, value, &len ); - if (FAILED(hr)) - goto done; - - r = msi_strcpy_to_awstring( value, szPathBuf, pcchPathBuf ); - -done: - IWineMsiRemotePackage_Release( remote_package ); - SysFreeString( folder ); - msi_free( value ); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return r; - } - + return ERROR_INVALID_HANDLE; path = msi_get_target_folder( package, szFolder ); msiobj_release( &package->hdr ); @@ -412,59 +299,7 @@ static UINT MSI_GetSourcePath( MSIHANDLE hInstall, LPCWSTR szFolder, package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); if (!package) - { - HRESULT hr; - IWineMsiRemotePackage *remote_package; - LPWSTR value = NULL; - BSTR folder; - DWORD len; - - remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); - if (!remote_package) - return ERROR_INVALID_HANDLE; - - folder = SysAllocString( szFolder ); - if (!folder) - { - IWineMsiRemotePackage_Release( remote_package ); - return ERROR_OUTOFMEMORY; - } - - len = 0; - hr = IWineMsiRemotePackage_GetSourcePath( remote_package, folder, NULL, &len ); - if (FAILED(hr)) - goto done; - - len++; - value = msi_alloc(len * sizeof(WCHAR)); - if (!value) - { - r = ERROR_OUTOFMEMORY; - goto done; - } - - hr = IWineMsiRemotePackage_GetSourcePath( remote_package, folder, value, &len ); - if (FAILED(hr)) - goto done; - - r = msi_strcpy_to_awstring( value, szPathBuf, pcchPathBuf ); - -done: - IWineMsiRemotePackage_Release( remote_package ); - SysFreeString( folder ); - msi_free( value ); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return r; - } - + return ERROR_INVALID_HANDLE; if (szPathBuf->str.w && !pcchPathBuf ) { msiobj_release( &package->hdr ); @@ -618,42 +453,7 @@ UINT WINAPI MsiSetTargetPathW(MSIHANDLE hInstall, LPCWSTR szFolder, package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); if (!package) - { - HRESULT hr; - BSTR folder, path; - IWineMsiRemotePackage *remote_package; - - remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); - if (!remote_package) - return ERROR_INVALID_HANDLE; - - folder = SysAllocString( szFolder ); - path = SysAllocString( szFolderPath ); - if (!folder || !path) - { - SysFreeString(folder); - SysFreeString(path); - IWineMsiRemotePackage_Release( remote_package ); - return ERROR_OUTOFMEMORY; - } - - hr = IWineMsiRemotePackage_SetTargetPath( remote_package, folder, path ); - - SysFreeString(folder); - SysFreeString(path); - IWineMsiRemotePackage_Release( remote_package ); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; - } - + return ERROR_INVALID_HANDLE; ret = MSI_SetTargetPathW( package, szFolder, szFolderPath ); msiobj_release( &package->hdr ); return ret; @@ -701,23 +501,7 @@ BOOL WINAPI MsiGetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode) package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); if (!package) - { - BOOL ret; - HRESULT hr; - IWineMsiRemotePackage *remote_package; - - remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); - if (!remote_package) - return FALSE; - - hr = IWineMsiRemotePackage_GetMode(remote_package, iRunMode, &ret); - IWineMsiRemotePackage_Release(remote_package); - - if (hr == S_OK) - return ret; - - return FALSE; - } + return ERROR_INVALID_HANDLE; switch (iRunMode) { @@ -793,28 +577,7 @@ UINT WINAPI MsiSetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode, BOOL fState) package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); if (!package) - { - HRESULT hr; - IWineMsiRemotePackage *remote_package; - - remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); - if (!remote_package) - return FALSE; - - hr = IWineMsiRemotePackage_SetMode( remote_package, iRunMode, fState ); - IWineMsiRemotePackage_Release( remote_package ); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; - } - + return ERROR_INVALID_HANDLE; switch (iRunMode) { case MSIRUNMODE_REBOOTATEND: @@ -984,38 +747,7 @@ UINT WINAPI MsiSetFeatureStateW(MSIHANDLE hInstall, LPCWSTR szFeature, package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); if (!package) - { - HRESULT hr; - BSTR feature; - IWineMsiRemotePackage *remote_package; - - remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); - if (!remote_package) - return ERROR_INVALID_HANDLE; - - feature = SysAllocString(szFeature); - if (!feature) - { - IWineMsiRemotePackage_Release(remote_package); - return ERROR_OUTOFMEMORY; - } - - hr = IWineMsiRemotePackage_SetFeatureState(remote_package, feature, iState); - - SysFreeString(feature); - IWineMsiRemotePackage_Release(remote_package); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; - } - + return ERROR_INVALID_HANDLE; rc = MSI_SetFeatureStateW(package,szFeature,iState); msiobj_release( &package->hdr ); @@ -1135,39 +867,7 @@ UINT WINAPI MsiGetFeatureStateW(MSIHANDLE hInstall, LPCWSTR szFeature, package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); if (!package) - { - HRESULT hr; - BSTR feature; - IWineMsiRemotePackage *remote_package; - - remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); - if (!remote_package) - return ERROR_INVALID_HANDLE; - - feature = SysAllocString(szFeature); - if (!feature) - { - IWineMsiRemotePackage_Release(remote_package); - return ERROR_OUTOFMEMORY; - } - - hr = IWineMsiRemotePackage_GetFeatureState(remote_package, feature, - piInstalled, piAction); - - SysFreeString(feature); - IWineMsiRemotePackage_Release(remote_package); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; - } - + return ERROR_INVALID_HANDLE; ret = MSI_GetFeatureStateW(package, szFeature, piInstalled, piAction); msiobj_release( &package->hdr ); return ret; @@ -1267,39 +967,7 @@ UINT WINAPI MsiGetFeatureCostW(MSIHANDLE hInstall, LPCWSTR szFeature, package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); if (!package) - { - HRESULT hr; - BSTR feature; - IWineMsiRemotePackage *remote_package; - - remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); - if (!remote_package) - return ERROR_INVALID_HANDLE; - - feature = SysAllocString(szFeature); - if (!feature) - { - IWineMsiRemotePackage_Release(remote_package); - return ERROR_OUTOFMEMORY; - } - - hr = IWineMsiRemotePackage_GetFeatureCost(remote_package, feature, - iCostTree, iState, piCost); - - SysFreeString(feature); - IWineMsiRemotePackage_Release(remote_package); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; - } - + return ERROR_INVALID_HANDLE; feature = msi_get_loaded_feature(package, szFeature); if (feature) @@ -1525,38 +1193,7 @@ UINT WINAPI MsiSetComponentStateW(MSIHANDLE hInstall, LPCWSTR szComponent, package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); if (!package) - { - HRESULT hr; - BSTR component; - IWineMsiRemotePackage *remote_package; - - remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); - if (!remote_package) - return ERROR_INVALID_HANDLE; - - component = SysAllocString(szComponent); - if (!component) - { - IWineMsiRemotePackage_Release(remote_package); - return ERROR_OUTOFMEMORY; - } - - hr = IWineMsiRemotePackage_SetComponentState(remote_package, component, iState); - - SysFreeString(component); - IWineMsiRemotePackage_Release(remote_package); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; - } - + return ERROR_INVALID_HANDLE; ret = MSI_SetComponentStateW(package, szComponent, iState); msiobj_release(&package->hdr); return ret; @@ -1576,39 +1213,7 @@ UINT WINAPI MsiGetComponentStateW(MSIHANDLE hInstall, LPCWSTR szComponent, package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); if (!package) - { - HRESULT hr; - BSTR component; - IWineMsiRemotePackage *remote_package; - - remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); - if (!remote_package) - return ERROR_INVALID_HANDLE; - - component = SysAllocString(szComponent); - if (!component) - { - IWineMsiRemotePackage_Release(remote_package); - return ERROR_OUTOFMEMORY; - } - - hr = IWineMsiRemotePackage_GetComponentState(remote_package, component, - piInstalled, piAction); - - SysFreeString(component); - IWineMsiRemotePackage_Release(remote_package); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; - } - + return ERROR_INVALID_HANDLE; ret = MSI_GetComponentStateW( package, szComponent, piInstalled, piAction); msiobj_release( &package->hdr ); return ret; @@ -1624,23 +1229,7 @@ LANGID WINAPI MsiGetLanguage(MSIHANDLE hInstall) package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); if (!package) - { - HRESULT hr; - LANGID lang; - IWineMsiRemotePackage *remote_package; - - remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); - if (!remote_package) - return ERROR_INVALID_HANDLE; - - hr = IWineMsiRemotePackage_GetLanguage(remote_package, &lang); - - if (SUCCEEDED(hr)) - return lang; - - return 0; - } - + return ERROR_INVALID_HANDLE; langid = msi_get_property_int( package->db, szProductLanguage, 0 ); msiobj_release( &package->hdr ); return langid; @@ -1680,29 +1269,7 @@ UINT WINAPI MsiSetInstallLevel(MSIHANDLE hInstall, int iInstallLevel) package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); if (!package) - { - HRESULT hr; - IWineMsiRemotePackage *remote_package; - - remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); - if (!remote_package) - return ERROR_INVALID_HANDLE; - - hr = IWineMsiRemotePackage_SetInstallLevel(remote_package, iInstallLevel); - - IWineMsiRemotePackage_Release(remote_package); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; - } - + return ERROR_INVALID_HANDLE; r = MSI_SetInstallLevel( package, iInstallLevel ); msiobj_release( &package->hdr ); diff --git a/libmsi/msi.c b/libmsi/msi.c index bdfe41b..0d066ed 100644 --- a/libmsi/msi.c +++ b/libmsi/msi.c @@ -2006,30 +2006,9 @@ UINT WINAPI MsiEnumComponentCostsW( MSIHANDLE handle, LPCWSTR component, DWORD i state, drive, buflen, cost, temp); if (!drive || !buflen || !cost || !temp) return ERROR_INVALID_PARAMETER; - if (!(package = msihandle2msiinfo( handle, MSIHANDLETYPE_PACKAGE ))) - { - HRESULT hr; - IWineMsiRemotePackage *remote_package; - BSTR bname = NULL; - - if (!(remote_package = (IWineMsiRemotePackage *)msi_get_remote( handle ))) - return ERROR_INVALID_HANDLE; - - if (component && !(bname = SysAllocString( component ))) - { - IWineMsiRemotePackage_Release( remote_package ); - return ERROR_OUTOFMEMORY; - } - hr = IWineMsiRemotePackage_EnumComponentCosts( remote_package, bname, index, state, drive, buflen, cost, temp ); - IWineMsiRemotePackage_Release( remote_package ); - SysFreeString( bname ); - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) return HRESULT_CODE(hr); - return ERROR_FUNCTION_FAILED; - } - return ERROR_SUCCESS; - } + package = msihandle2msiinfo( handle, MSIHANDLETYPE_PACKAGE ); + if ( !package ) + return ERROR_INVALID_HANDLE; if (!msi_get_property_int( package->db, szCostingComplete, 0 )) { diff --git a/libmsi/msi.rc b/libmsi/msi.rc index 359ca35..67b679a 100644 --- a/libmsi/msi.rc +++ b/libmsi/msi.rc @@ -63,9 +63,6 @@ STRINGTABLE LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -/* @makedep: msiserver.rgs */ -1 WINE_REGISTRY msiserver.rgs - /* @makedep: instadvert.bmp */ 0x1001 BITMAP instadvert.bmp diff --git a/libmsi/msi_main.c b/libmsi/msi_main.c index de0534a..fb81546 100644 --- a/libmsi/msi_main.c +++ b/libmsi/msi_main.c @@ -84,124 +84,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) return TRUE; } -typedef struct tagIClassFactoryImpl { - IClassFactory IClassFactory_iface; - HRESULT (*create_object)( IUnknown*, LPVOID* ); -} IClassFactoryImpl; - -static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface) -{ - return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface); -} - -static HRESULT WINAPI MsiCF_QueryInterface(LPCLASSFACTORY iface, - REFIID riid,LPVOID *ppobj) -{ - IClassFactoryImpl *This = impl_from_IClassFactory(iface); - - TRACE("%p %s %p\n",This,debugstr_guid(riid),ppobj); - - if( IsEqualCLSID( riid, &IID_IUnknown ) || - IsEqualCLSID( riid, &IID_IClassFactory ) ) - { - IClassFactory_AddRef( iface ); - *ppobj = iface; - return S_OK; - } - return E_NOINTERFACE; -} - -static ULONG WINAPI MsiCF_AddRef(LPCLASSFACTORY iface) -{ - LockModule(); - return 2; -} - -static ULONG WINAPI MsiCF_Release(LPCLASSFACTORY iface) -{ - UnlockModule(); - return 1; -} - -static HRESULT WINAPI MsiCF_CreateInstance(LPCLASSFACTORY iface, - LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) -{ - IClassFactoryImpl *This = impl_from_IClassFactory(iface); - IUnknown *unk = NULL; - HRESULT r; - - TRACE("%p %p %s %p\n", This, pOuter, debugstr_guid(riid), ppobj); - - r = This->create_object( pOuter, (LPVOID*) &unk ); - if (SUCCEEDED(r)) - { - r = IUnknown_QueryInterface( unk, riid, ppobj ); - IUnknown_Release( unk ); - } - return r; -} - -static HRESULT WINAPI MsiCF_LockServer(LPCLASSFACTORY iface, BOOL dolock) -{ - TRACE("%p %d\n", iface, dolock); - - if (dolock) - LockModule(); - else - UnlockModule(); - - return S_OK; -} - -static const IClassFactoryVtbl MsiCF_Vtbl = -{ - MsiCF_QueryInterface, - MsiCF_AddRef, - MsiCF_Release, - MsiCF_CreateInstance, - MsiCF_LockServer -}; - -static IClassFactoryImpl MsiServer_CF = { { &MsiCF_Vtbl }, create_msiserver }; -static IClassFactoryImpl WineMsiCustomRemote_CF = { { &MsiCF_Vtbl }, create_msi_custom_remote }; -static IClassFactoryImpl WineMsiRemotePackage_CF = { { &MsiCF_Vtbl }, create_msi_remote_package }; - -/****************************************************************** - * DllGetClassObject [MSI.@] - */ -HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) -{ - TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); - - if ( IsEqualCLSID (rclsid, &CLSID_MsiInstaller) ) - { - *ppv = &MsiServer_CF; - return S_OK; - } - - if ( IsEqualCLSID (rclsid, &CLSID_WineMsiRemoteCustomAction) ) - { - *ppv = &WineMsiCustomRemote_CF; - return S_OK; - } - - if ( IsEqualCLSID (rclsid, &CLSID_WineMsiRemotePackage) ) - { - *ppv = &WineMsiRemotePackage_CF; - return S_OK; - } - - if( IsEqualCLSID (rclsid, &CLSID_MsiServerMessage) || - IsEqualCLSID (rclsid, &CLSID_MsiServer) || - IsEqualCLSID (rclsid, &CLSID_PSFactoryBuffer) || - IsEqualCLSID (rclsid, &CLSID_MsiServerX3) ) - { - FIXME("create %s object\n", debugstr_guid( rclsid )); - } - - return CLASS_E_CLASSNOTAVAILABLE; -} - /****************************************************************** * DllGetVersion [MSI.@] */ diff --git a/libmsi/msipriv.h b/libmsi/msipriv.h index 6baf940..51e12d8 100644 --- a/libmsi/msipriv.h +++ b/libmsi/msipriv.h @@ -1069,11 +1069,6 @@ extern VOID ControlEvent_CleanupSubscriptions(MSIPACKAGE *package) DECLSPEC_HIDD extern VOID ControlEvent_SubscribeToEvent(MSIPACKAGE *package, msi_dialog *dialog, LPCWSTR event, LPCWSTR control, LPCWSTR attribute) DECLSPEC_HIDDEN; -/* OLE automation */ -extern HRESULT create_msiserver(IUnknown *pOuter, LPVOID *ppObj) DECLSPEC_HIDDEN; -extern HRESULT create_session(MSIHANDLE msiHandle, IDispatch *pInstaller, IDispatch **pDispatch) DECLSPEC_HIDDEN; -extern HRESULT load_type_info(IDispatch *iface, ITypeInfo **pptinfo, REFIID clsid, LCID lcid) DECLSPEC_HIDDEN; - /* Scripting */ extern DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR function, LPCWSTR action) DECLSPEC_HIDDEN; diff --git a/libmsi/msiquery.c b/libmsi/msiquery.c index 433b3c7..f624d5e 100644 --- a/libmsi/msiquery.c +++ b/libmsi/msiquery.c @@ -249,27 +249,7 @@ UINT WINAPI MsiDatabaseOpenViewW(MSIHANDLE hdb, db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE ); if( !db ) - { - HRESULT hr; - IWineMsiRemoteDatabase *remote_database; - - remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hdb ); - if ( !remote_database ) - return ERROR_INVALID_HANDLE; - - hr = IWineMsiRemoteDatabase_OpenView( remote_database, szQuery, phView ); - IWineMsiRemoteDatabase_Release( remote_database ); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; - } + return ERROR_INVALID_HANDLE; ret = MSI_DatabaseOpenViewW( db, szQuery, &query ); if( ret == ERROR_SUCCESS ) @@ -758,19 +738,7 @@ UINT WINAPI MsiDatabaseApplyTransformW( MSIHANDLE hdb, db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE ); if( !db ) - { - IWineMsiRemoteDatabase *remote_database; - - remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hdb ); - if ( !remote_database ) - return ERROR_INVALID_HANDLE; - - IWineMsiRemoteDatabase_Release( remote_database ); - WARN("MsiDatabaseApplyTransform not allowed during a custom action!\n"); - - return ERROR_SUCCESS; - } - + return ERROR_INVALID_HANDLE; r = MSI_DatabaseApplyTransformW( db, szTransformFile, iErrorCond ); msiobj_release( &db->hdr ); return r; @@ -820,18 +788,7 @@ UINT WINAPI MsiDatabaseCommit( MSIHANDLE hdb ) db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE ); if( !db ) - { - IWineMsiRemoteDatabase *remote_database; - - remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hdb ); - if ( !remote_database ) - return ERROR_INVALID_HANDLE; - - IWineMsiRemoteDatabase_Release( remote_database ); - WARN("not allowed during a custom action!\n"); - - return ERROR_SUCCESS; - } + return ERROR_INVALID_HANDLE; if (db->mode == MSIDBOPEN_READONLY) { @@ -941,27 +898,7 @@ UINT WINAPI MsiDatabaseGetPrimaryKeysW( MSIHANDLE hdb, db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE ); if( !db ) - { - HRESULT hr; - IWineMsiRemoteDatabase *remote_database; - - remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hdb ); - if ( !remote_database ) - return ERROR_INVALID_HANDLE; - - hr = IWineMsiRemoteDatabase_GetPrimaryKeys( remote_database, table, phRec ); - IWineMsiRemoteDatabase_Release( remote_database ); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; - } + return ERROR_INVALID_HANDLE; r = MSI_DatabaseGetPrimaryKeys( db, table, &rec ); if( r == ERROR_SUCCESS ) @@ -1026,24 +963,7 @@ MSICONDITION WINAPI MsiDatabaseIsTablePersistentW( db = msihandle2msiinfo( hDatabase, MSIHANDLETYPE_DATABASE ); if( !db ) - { - HRESULT hr; - MSICONDITION condition; - IWineMsiRemoteDatabase *remote_database; - - remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hDatabase ); - if ( !remote_database ) - return MSICONDITION_ERROR; - - hr = IWineMsiRemoteDatabase_IsTablePersistent( remote_database, - szTableName, &condition ); - IWineMsiRemoteDatabase_Release( remote_database ); - - if (FAILED(hr)) - return MSICONDITION_ERROR; - - return condition; - } + return MSICONDITION_ERROR; r = MSI_DatabaseIsTablePersistent( db, szTableName ); diff --git a/libmsi/msiserver.h b/libmsi/msiserver.h new file mode 100644 index 0000000..48bd2a0 --- /dev/null +++ b/libmsi/msiserver.h @@ -0,0 +1,126 @@ +/*** Autogenerated by WIDL 1.5.14 from ../../libmsi/msiserver.idl - Do not edit ***/ + +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +#include <rpc.h> +#include <rpcndr.h> + +#ifndef COM_NO_WINDOWS_H +#include <windows.h> +#include <ole2.h> +#endif + +#ifndef __msiserver_h__ +#define __msiserver_h__ + +/* Headers for imported files */ + +#include <unknwn.h> +#include <wtypes.h> +#include <objidl.h> +#include <oaidl.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/***************************************************************************** + * MsiServer coclass + */ + +DEFINE_GUID(CLSID_MsiServer, 0x000c101c, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46); + +#ifdef __cplusplus +class DECLSPEC_UUID("000c101c-0000-0000-c000-000000000046") MsiServer; +#ifdef __CRT_UUID_DECL +__CRT_UUID_DECL(MsiServer, 0x000c101c, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46) +#endif +#endif + +/***************************************************************************** + * MsiServerMessage coclass + */ + +DEFINE_GUID(CLSID_MsiServerMessage, 0x000c101d, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46); + +#ifdef __cplusplus +class DECLSPEC_UUID("000c101d-0000-0000-c000-000000000046") MsiServerMessage; +#ifdef __CRT_UUID_DECL +__CRT_UUID_DECL(MsiServerMessage, 0x000c101d, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46) +#endif +#endif + +/***************************************************************************** + * PSFactoryBuffer coclass + */ + +DEFINE_GUID(CLSID_PSFactoryBuffer, 0x000c103e, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46); + +#ifdef __cplusplus +class DECLSPEC_UUID("000c103e-0000-0000-c000-000000000046") PSFactoryBuffer; +#ifdef __CRT_UUID_DECL +__CRT_UUID_DECL(PSFactoryBuffer, 0x000c103e, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46) +#endif +#endif + +/***************************************************************************** + * MsiTransform coclass + */ + +DEFINE_GUID(CLSID_MsiTransform, 0x000c1082, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46); + +#ifdef __cplusplus +class DECLSPEC_UUID("000c1082-0000-0000-c000-000000000046") MsiTransform; +#ifdef __CRT_UUID_DECL +__CRT_UUID_DECL(MsiTransform, 0x000c1082, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46) +#endif +#endif + +/***************************************************************************** + * MsiDatabase coclass + */ + +DEFINE_GUID(CLSID_MsiDatabase, 0x000c1084, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46); + +#ifdef __cplusplus +class DECLSPEC_UUID("000c1084-0000-0000-c000-000000000046") MsiDatabase; +#ifdef __CRT_UUID_DECL +__CRT_UUID_DECL(MsiDatabase, 0x000c1084, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46) +#endif +#endif + +/***************************************************************************** + * MsiPatch coclass + */ + +DEFINE_GUID(CLSID_MsiPatch, 0x000c1086, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46); + +#ifdef __cplusplus +class DECLSPEC_UUID("000c1086-0000-0000-c000-000000000046") MsiPatch; +#ifdef __CRT_UUID_DECL +__CRT_UUID_DECL(MsiPatch, 0x000c1086, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46) +#endif +#endif + +DEFINE_GUID(DIID_Session, 0x000c109e, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46); + +/***************************************************************************** + * MsiInstaller coclass + */ + +DEFINE_GUID(CLSID_MsiInstaller, 0x000c1090, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46); + +#ifdef __cplusplus +class DECLSPEC_UUID("000c1090-0000-0000-c000-000000000046") MsiInstaller; +#ifdef __CRT_UUID_DECL +__CRT_UUID_DECL(MsiInstaller, 0x000c1090, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46) +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __msiserver_h__ */ diff --git a/libmsi/msiserver.idl b/libmsi/msiserver.idl deleted file mode 100644 index 669d7f2..0000000 --- a/libmsi/msiserver.idl +++ /dev/null @@ -1,558 +0,0 @@ -/* - * Copyright (C) 2007 Mike McCormack - * Copyright (C) 2007 Misha Koshelev - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "msiserver_dispids.h" -import "unknwn.idl"; -import "wtypes.idl"; -import "objidl.idl"; -import "oaidl.idl"; - -cpp_quote("#if 0") -typedef unsigned long MSIHANDLE; -typedef int INSTALLMESSAGE; -typedef int MSICONDITION; -typedef int MSIRUNMODE; -typedef int INSTALLSTATE; -cpp_quote("#endif") - -[ - uuid(7BDE2046-D03B-4ffc-B84C-A098F38CFF0B), - oleautomation, - object -] -interface IWineMsiRemoteDatabase : IUnknown -{ - HRESULT IsTablePersistent( [in] LPCWSTR table, [out] MSICONDITION *persistent ); - HRESULT GetPrimaryKeys( [in] LPCWSTR table, [out] MSIHANDLE *keys ); - HRESULT GetSummaryInformation( [in] UINT updatecount, [out] MSIHANDLE *suminfo ); - HRESULT OpenView( [in] LPCWSTR query, [out] MSIHANDLE *view ); - HRESULT SetMsiHandle( [in] MSIHANDLE handle ); -} - -[ - 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, size_is(*size)] BSTR value, [in, out] DWORD *size ); - HRESULT SetProperty( [in] BSTR property, [in] BSTR value ); - 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, size_is(*size)] BSTR value, [in, out] DWORD *size ); - HRESULT SetTargetPath( [in] BSTR folder, [in] BSTR value ); - HRESULT GetSourcePath( [in] BSTR folder, [out, size_is(*size)] BSTR value, [in, out] DWORD *size ); - HRESULT GetMode( [in] MSIRUNMODE mode, [out] BOOL *ret ); - HRESULT SetMode( [in] MSIRUNMODE mode, [in] BOOL state ); - HRESULT GetFeatureState( [in] BSTR feature, [out] INSTALLSTATE *installed, [out] INSTALLSTATE *action ); - HRESULT SetFeatureState( [in] BSTR feature, [in] INSTALLSTATE state ); - HRESULT GetComponentState( [in] BSTR component, [out] INSTALLSTATE *installed, [out] INSTALLSTATE *action ); - 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 ); - HRESULT EvaluateCondition( [in] BSTR condition ); - HRESULT GetFeatureCost( [in] BSTR feature, [in] INT cost_tree, [in] INSTALLSTATE state, [out] INT *cost ); - HRESULT EnumComponentCosts( [in] BSTR component, [in] DWORD index, [in] INSTALLSTATE state, - [out, size_is(*buflen)] BSTR drive, [in, out] DWORD *buflen, [out] INT *cost, [out] INT *temp ); -} - -[ - uuid(56D58B64-8780-4c22-A8BC-8B0B29E4A9F8), - oleautomation, - object -] -interface IWineMsiRemoteCustomAction : IUnknown -{ - HRESULT GetActionInfo( [in] LPCGUID guid, [out] INT *type, [out] MSIHANDLE *handle, [out] BSTR *dllname, - [out] BSTR *function, [out] IWineMsiRemotePackage **package ); -} - -[ - uuid(000c101c-0000-0000-c000-000000000046), - oleautomation, - object -] -interface IMsiServer : IUnknown -{ - /* FIXME: methods */ -} - -[ - uuid(000c101d-0000-0000-c000-000000000046), - oleautomation, - object -] -interface IMsiMessage : IUnknown -{ - /* FIXME: methods */ -} - -[ - uuid(000c1025-0000-0000-c000-000000000046), - oleautomation, - object -] -interface IMsiCustomAction : IUnknown -{ - /* FIXME: methods */ -} - -[ - uuid(000c1033-0000-0000-c000-000000000046), - oleautomation, - object -] -interface IMsiRemoteAPI : IUnknown -{ - /* FIXME: methods */ -} - -[ - helpstring("Msi install server"), - progid("IMsiServer"), - uuid(000c101c-0000-0000-c000-000000000046) -] -coclass MsiServer { interface IMsiServer; } - -[ - helpstring("Microsoft Windows Installer Message RPC"), - progid("WindowsInstaller.Message"), - uuid(000c101d-0000-0000-c000-000000000046) -] -coclass MsiServerMessage { interface IMsiMessage; } - -[ - threading(both), - uuid(000c103e-0000-0000-c000-000000000046) -] -coclass PSFactoryBuffer { interface IPSFactoryBuffer; } - -[ - uuid(000c1082-0000-0000-c000-000000000046) -] -coclass MsiTransform { } - -[ - uuid(000c1084-0000-0000-c000-000000000046) -] -coclass MsiDatabase { } - -[ - uuid(000c1086-0000-0000-c000-000000000046) -] -coclass MsiPatch { } - -[ - threading(apartment), - uuid(000c1094-0000-0000-c000-000000000046) -] -/* FIXME: unidentified class */ -coclass MsiServerX3 { interface IMsiServer; } - -[ - uuid(ba26e6fa-4f27-4f56-953a-3f90272018aa) -] -coclass WineMsiRemoteCustomAction { interface WineMsiRemoteCustomAction; } - -[ - uuid(902b3592-9d08-4dfd-a593-d07c52546421) -] -coclass WineMsiRemotePackage { interface WineMsiRemotePackage; } - - -[ uuid(000C1092-0000-0000-C000-000000000046), version(1.0) ] -library WindowsInstaller -{ - dispinterface Installer; - dispinterface Record; - dispinterface Session; - dispinterface Database; - dispinterface SummaryInfo; - dispinterface View; - dispinterface UIPreview; - dispinterface FeatureInfo; - dispinterface RecordList; - dispinterface StringList; - dispinterface Product; - dispinterface Patch; - - typedef enum { - msiInstallStateNotUsed = -7, - msiInstallStateBadConfig = -6, - msiInstallStateIncomplete = -5, - msiInstallStateSourceAbsent = -4, - msiInstallStateInvalidArg = -2, - msiInstallStateUnknown = -1, - msiInstallStateBroken = 0, - msiInstallStateAdvertised = 1, - msiInstallStateRemoved = 1, - msiInstallStateAbsent = 2, - msiInstallStateLocal = 3, - msiInstallStateSource = 4, - msiInstallStateDefault = 5 - } MsiInstallState; - - typedef enum { - msiOpenDatabaseModeReadOnly = 0, - msiOpenDatabaseModeTransact = 1, - msiOpenDatabaseModeDirect = 2, - msiOpenDatabaseModeCreate = 3, - msiOpenDatabaseModeCreateDirect = 4, - msiOpenDatabaseModePatchFile = 32 - } MsiOpenDatabaseMode; - - typedef enum { - msiUILevelNoChange = 0, - msiUILevelDefault = 1, - msiUILevelNone = 2, - msiUILevelBasic = 3, - msiUILevelReduced = 4, - msiUILevelFull = 5, - msiUILevelHideCancel = 32, - msiUILevelProgressOnly = 64, - msiUILevelEndDialog = 128, - msiUILevelSourceResOnly = 256 - } MsiUILevel; - - [ uuid(000C1090-0000-0000-C000-000000000046) ] - dispinterface Installer - { - properties: - [id(DISPID_INSTALLER_UILEVEL)] - MsiUILevel UILevel; - methods: - [id(DISPID_INSTALLER_CREATERECORD)] - Record *CreateRecord([in] long Count); - [id(DISPID_INSTALLER_OPENPACKAGE)] - Session* OpenPackage( - [in] VARIANT PackagePath, - [in, optional, defaultvalue(0)] long Options); - [id(DISPID_INSTALLER_OPENPRODUCT)] - Session* OpenProduct( - [in] BSTR ProductCode); - [id(DISPID_INSTALLER_SUMMARYINFORMATION)] - SummaryInfo* SummaryInformation( - [in] BSTR PackagePath, - [in, optional, defaultvalue(0)] long UpdateCount); - [id(DISPID_INSTALLER_OPENDATABASE)] - Database *OpenDatabase( - [in] BSTR DatabasePath, - [in] VARIANT OpenMode); - [id(DISPID_INSTALLER_ENABLELOG)] - void EnableLog( - [in] BSTR LogMode, - [in] BSTR LogFile); - [id(DISPID_INSTALLER_INSTALLPRODUCT)] - void InstallProduct( - [in] BSTR PackagePath, - [in, optional, defaultvalue("0")] BSTR PropertyValues); - [id(DISPID_INSTALLER_VERSION)] - BSTR Version(); - [id(DISPID_INSTALLER_LASTERRORRECORD)] - Record* LastErrorRecord(); - [id(DISPID_INSTALLER_REGISTRYVALUE), propget] - BSTR RegistryValue( - [in] VARIANT Root, - [in] BSTR Key, - [in, optional] VARIANT Value); - [id(DISPID_INSTALLER_ENVIRONMENT), propget] - BSTR Environment([in] BSTR Variable); - [id(DISPID_INSTALLER_ENVIRONMENT), propput] - void Environment( - [in] BSTR Variable, - [in] BSTR rhs); - [id(DISPID_INSTALLER_FILEATTRIBUTES)] - long FileAttributes([in] BSTR FilePath); - [id(DISPID_INSTALLER_FILESIZE)] - long FileSize([in] BSTR FilePath); - [id(DISPID_INSTALLER_FILEVERSION)] - BSTR FileVersion( - [in] BSTR FilePath, - [in, optional] VARIANT Language); - [id(DISPID_INSTALLER_PRODUCTSTATE), propget] - MsiInstallState ProductState( - [in] BSTR Product); - [id(DISPID_INSTALLER_PRODUCTINFO), propget] - BSTR ProductInfo( - [in] BSTR Product, - [in] BSTR Attribute); - [id(DISPID_INSTALLER_PRODUCTS), propget] - StringList *Products(); - [id(DISPID_INSTALLER_RELATEDPRODUCTS), propget] - StringList *RelatedProducts( - [in] BSTR UpgradeCode); - } - - [ uuid(000C1093-0000-0000-C000-000000000046) ] - dispinterface Record - { - properties: - methods: - [id(DISPID_RECORD_STRINGDATA), propget] - BSTR StringData([in] long Field); - [id(DISPID_RECORD_STRINGDATA), propput] - void StringData( - [in] long Field, - [in] BSTR rhs); - [id(DISPID_RECORD_INTEGERDATA), propget] - long IntegerData([in] long Field); - [id(DISPID_RECORD_INTEGERDATA), propput] - void IntegerData( - [in] long Field, - [in] long rhs); - [id(DISPID_RECORD_FIELDCOUNT), propget] - long FieldCount(); - } - - [ uuid(000C1095-0000-0000-C000-000000000046) ] - dispinterface StringList - { - properties: - methods: - [id(DISPID_LIST__NEWENUM)] - IUnknown _NewEnum(); - [id(DISPID_LIST_ITEM), propget] - BSTR Item(long Index); - [id(DISPID_LIST_COUNT), propget] - long Count(); - } - - [ uuid(000C1096-0000-0000-C000-000000000046) ] - dispinterface RecordList - { - properties: - methods: - } - - [ uuid(000C109A-0000-0000-C000-000000000046) ] - dispinterface UIPreview - { - properties: - methods: - } - - [ uuid(000C109B-0000-0000-C000-000000000046) ] - dispinterface SummaryInfo - { - properties: - methods: - [id(DISPID_SUMMARYINFO_PROPERTY), propget] - VARIANT Property([in] long Pid); - [id(DISPID_SUMMARYINFO_PROPERTY), propput] - void Property( - [in] long Pid, - [in] VARIANT rhs); - [id(DISPID_SUMMARYINFO_PROPERTYCOUNT), propget] - long PropertyCount(); - } - - typedef enum { - msiViewModifySeek = -1, - msiViewModifyRefresh = 0, - msiViewModifyInsert = 1, - msiViewModifyUpdate = 2, - msiViewModifyAssign = 3, - msiViewModifyReplace = 4, - msiViewModifyMerge = 5, - msiViewModifyDelete = 6, - msiViewModifyInsertTemporary = 7, - msiViewModifyValidate = 8, - msiViewModifyValidateNew = 9, - msiViewModifyValidateField = 10, - msiViewModifyValidateDelete = 11, - } _MsiViewModify; /* Added underscore to avoid conflict with function name */ - - [ uuid(000C109C-0000-0000-C000-000000000046) ] - dispinterface View - { - properties: - methods: - [id(DISPID_VIEW_EXECUTE)] - void Execute([in, optional, defaultvalue(0)] Record *Params); - [id(DISPID_VIEW_FETCH)] - Record* Fetch(); - [id(DISPID_VIEW_MODIFY)] - void Modify( - [in] _MsiViewModify Mode, - Record *Record); - [id(DISPID_VIEW_CLOSE)] - void Close(); - } - - [ uuid(000C109D-0000-0000-C000-000000000046) ] - dispinterface Database - { - properties: - methods: - [id(DISPID_DATABASE_OPENVIEW)] - View* OpenView([in] BSTR Sql); - [id(DISPID_DATABASE_SUMMARYINFORMATION), propget] - SummaryInfo *SummaryInformation([in, optional, defaultvalue(0)] long UpdateCount); - } - - typedef enum { - msiDoActionStatusNoAction = 0, - msiDoActionStatusSuccess = 1, - msiDoActionStatusUserExit = 2, - msiDoActionStatusFailure = 3, - msiDoActionStatusSuspend = 4, - msiDoActionStatusFinished = 5, - msiDoActionStatusWrongState = 6, - msiDoActionStatusBadActionData = 7 - } MsiDoActionStatus; - - typedef enum { - msiRunModeAdmin = 0, - msiRunModeAdvertise = 1, - msiRunModeMaintenance = 2, - msiRunModeRollbackEnabled = 3, - msiRunModeLogEnabled = 4, - msiRunModeOperations = 5, - msiRunModeRebootAtEnd = 6, - msiRunModeRebootNow = 7, - msiRunModeCabinet = 8, - msiRunModeSourceShortNames = 9, - msiRunModeTargetShortNames = 10, - msiRunModeWindows9x = 12, - msiRunModeZawEnabled = 13, - msiRunModeScheduled = 16, - msiRunModeRollback = 17, - msiRunModeCommit = 18 - } MsiRunMode; - - typedef enum { - msiEvaluateConditionFalse = 0, - msiEvaluateConditionTrue = 1, - msiEvaluateConditionNone = 2, - msiEvaluateConditionError = 3 - } _MsiEvaluateCondition; /* Added underscore to avoid conflict with function name */ - - typedef enum { - msiMessageStatusError = -1, - msiMessageStatusNone = 0, - msiMessageStatusOk = 1, - msiMessageStatusCancel = 2, - msiMessageStatusAbort = 3, - msiMessageStatusRetry = 4, - msiMessageStatusIgnore = 5, - msiMessageStatusYes = 6, - msiMessageStatusNo = 7 - } MsiMessageStatus; - - typedef enum { - msiMessageTypeFatalExit = 0, - msiMessageTypeError = 0x01000000, - msiMessageTypeWarning = 0x02000000, - msiMessageTypeUser = 0x03000000, - msiMessageTypeInfo = 0x04000000, - msiMessageTypeFilesInUse = 0x05000000, - msiMessageTypeResolveSource = 0x06000000, - msiMessageTypeOutOfDiskSpace = 0x07000000, - msiMessageTypeActionStart = 0x08000000, - msiMessageTypeActionData = 0x09000000, - msiMessageTypeProgress = 0x0a000000, - msiMessageTypeCommonData = 0x0b000000, - msiMessageTypeOk = 0, - msiMessageTypeOkCancel = 1, - msiMessageTypeAbortRetryIgnore = 2, - msiMessageTypeYesNoCancel = 3, - msiMessageTypeYesNo = 4, - msiMessageTypeRetryCancel = 5, - msiMessageTypeDefault1 = 0, - msiMessageTypeDefault2 = 256, - msiMessageTypeDefault3 = 512 - } MsiMessageType; - - [ uuid(000C109E-0000-0000-C000-000000000046) ] - dispinterface Session - { - properties: - methods: - [id(DISPID_SESSION_INSTALLER), propget] - Installer *Installer(); - [id(DISPID_SESSION_PROPERTY), propget] - BSTR Property([in] BSTR Name); - [id(DISPID_SESSION_PROPERTY), propput] - void Property( - [in] BSTR Name, - [in] BSTR rhs); - [id(DISPID_SESSION_LANGUAGE), propget] - long Language(); - [id(DISPID_SESSION_MODE), propget] - VARIANT_BOOL Mode([in] MsiRunMode Flag); - [id(DISPID_SESSION_MODE), propput] - void Mode( - [in] MsiRunMode Flag, - [in] VARIANT_BOOL rhs); - [id(DISPID_SESSION_DATABASE), propget] - Database* Database(); - [id(DISPID_SESSION_DOACTION)] - MsiDoActionStatus DoAction([in] BSTR Action); - [id(DISPID_SESSION_EVALUATECONDITION)] - _MsiEvaluateCondition EvaluateCondition([in] BSTR Expression); - [id(DISPID_SESSION_MESSAGE)] - MsiMessageStatus Message( - [in] MsiMessageType Kind, - [in] Record *Record); - [id(DISPID_SESSION_FEATURECURRENTSTATE), propget] - MsiInstallState FeatureCurrentState([in] BSTR Feature); - [id(DISPID_SESSION_FEATUREREQUESTSTATE), propget] - MsiInstallState FeatureRequestState([in] BSTR Feature); - [id(DISPID_SESSION_FEATUREREQUESTSTATE), propput] - void FeatureRequestState( - [in] BSTR Feature, - [in] MsiInstallState rhs); - [id(DISPID_SESSION_SETINSTALLLEVEL)] - void SetInstallLevel([in] long Level); - } - - [ uuid(000C109F-0000-0000-C000-000000000046) ] - dispinterface FeatureInfo - { - properties: - methods: - } - - [ uuid(000C10A0-0000-0000-C000-000000000046) ] - dispinterface Product - { - properties: - methods: - } - - [ uuid(000C10A1-0000-0000-C000-000000000046) ] - dispinterface Patch - { - properties: - methods: - } - - [ - helpstring("Microsoft Windows Installer"), - threading(apartment), - progid("WindowsInstaller.Installer"), - uuid(000c1090-0000-0000-c000-000000000046) - ] - coclass MsiInstaller { interface Installer; } -} diff --git a/libmsi/msiserver.rgs b/libmsi/msiserver.rgs deleted file mode 100644 index 9f408db..0000000 --- a/libmsi/msiserver.rgs +++ /dev/null @@ -1,8 +0,0 @@ -HKCR -{ - NoRemove CLSID - { - '{000C101D-0000-0000-C000-000000000046}' { DllVersion = s '3.1.4000' } - '{000C1090-0000-0000-C000-000000000046}' { InProcHandler32 = s 'ole32.dll' } - } -} diff --git a/libmsi/msiserver_dispids.h b/libmsi/msiserver_dispids.h deleted file mode 100644 index d98d784..0000000 --- a/libmsi/msiserver_dispids.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2007 Misha Koshelev - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#define DISPID_INSTALLER_CREATERECORD 1 -#define DISPID_INSTALLER_OPENPACKAGE 2 -#define DISPID_INSTALLER_OPENPRODUCT 3 -#define DISPID_INSTALLER_OPENDATABASE 4 -#define DISPID_INSTALLER_SUMMARYINFORMATION 5 -#define DISPID_INSTALLER_UILEVEL 6 -#define DISPID_INSTALLER_ENABLELOG 7 -#define DISPID_INSTALLER_INSTALLPRODUCT 8 -#define DISPID_INSTALLER_VERSION 9 -#define DISPID_INSTALLER_LASTERRORRECORD 10 -#define DISPID_INSTALLER_REGISTRYVALUE 11 -#define DISPID_INSTALLER_ENVIRONMENT 12 -#define DISPID_INSTALLER_FILEATTRIBUTES 13 -#define DISPID_INSTALLER_FILESIZE 15 -#define DISPID_INSTALLER_FILEVERSION 16 -#define DISPID_INSTALLER_PRODUCTSTATE 17 -#define DISPID_INSTALLER_PRODUCTINFO 18 -#define DISPID_INSTALLER_PRODUCTS 35 -#define DISPID_INSTALLER_RELATEDPRODUCTS 40 - -#define DISPID_RECORD_FIELDCOUNT 0 -#define DISPID_RECORD_STRINGDATA 1 -#define DISPID_RECORD_INTEGERDATA 2 - -#define DISPID_LIST__NEWENUM -4 -#define DISPID_LIST_ITEM 0 -#define DISPID_LIST_COUNT 1 - -#define DISPID_VIEW_EXECUTE 1 -#define DISPID_VIEW_FETCH 2 -#define DISPID_VIEW_MODIFY 3 -#define DISPID_VIEW_CLOSE 4 - -#define DISPID_DATABASE_SUMMARYINFORMATION 2 -#define DISPID_DATABASE_OPENVIEW 3 - -#define DISPID_SESSION_INSTALLER 1 -#define DISPID_SESSION_PROPERTY 2 -#define DISPID_SESSION_LANGUAGE 3 -#define DISPID_SESSION_MODE 4 -#define DISPID_SESSION_DATABASE 5 -#define DISPID_SESSION_DOACTION 8 -#define DISPID_SESSION_EVALUATECONDITION 10 -#define DISPID_SESSION_MESSAGE 12 -#define DISPID_SESSION_FEATURECURRENTSTATE 13 -#define DISPID_SESSION_FEATUREREQUESTSTATE 14 -#define DISPID_SESSION_SETINSTALLLEVEL 19 - -#define DISPID_SUMMARYINFO_PROPERTY 1 -#define DISPID_SUMMARYINFO_PROPERTYCOUNT 2 diff --git a/libmsi/msiserver_i.c b/libmsi/msiserver_i.c new file mode 100644 index 0000000..7128c5f --- /dev/null +++ b/libmsi/msiserver_i.c @@ -0,0 +1,4 @@ +#include <rpc.h> +#include <rpcndr.h> +#include <initguid.h> +#include "msiserver.h" diff --git a/libmsi/package.c b/libmsi/package.c index ba433e5..62cccc0 100644 --- a/libmsi/package.c +++ b/libmsi/package.c @@ -1530,18 +1530,7 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage) handle = atoiW(&szPackage[1]); db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE ); if( !db ) - { - IWineMsiRemoteDatabase *remote_database; - - remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( handle ); - if ( !remote_database ) - return ERROR_INVALID_HANDLE; - - IWineMsiRemoteDatabase_Release( remote_database ); - WARN("MsiOpenPackage not allowed during a custom action!\n"); - - return ERROR_FUNCTION_FAILED; - } + return ERROR_INVALID_HANDLE; } else { @@ -1720,7 +1709,6 @@ MSIHANDLE WINAPI MsiGetActiveDatabase(MSIHANDLE hInstall) MSIPACKAGE *package; MSIHANDLE handle = 0; IUnknown *remote_unk; - IWineMsiRemotePackage *remote_package; TRACE("(%d)\n",hInstall); @@ -1730,20 +1718,6 @@ MSIHANDLE WINAPI MsiGetActiveDatabase(MSIHANDLE hInstall) handle = alloc_msihandle( &package->db->hdr ); msiobj_release( &package->hdr ); } - else if ((remote_unk = msi_get_remote(hInstall))) - { - if (IUnknown_QueryInterface(remote_unk, &IID_IWineMsiRemotePackage, - (LPVOID *)&remote_package) == S_OK) - { - IWineMsiRemotePackage_GetActiveDatabase(remote_package, &handle); - IWineMsiRemotePackage_Release(remote_package); - } - else - { - WARN("remote handle %d is not a package\n", hInstall); - } - IUnknown_Release(remote_unk); - } return handle; } @@ -1939,29 +1913,7 @@ INT WINAPI MsiProcessMessage( MSIHANDLE hInstall, INSTALLMESSAGE eMessageType, package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); if( !package ) - { - HRESULT hr; - IWineMsiRemotePackage *remote_package; - - remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); - if (!remote_package) - return ERROR_INVALID_HANDLE; - - hr = IWineMsiRemotePackage_ProcessMessage( remote_package, eMessageType, hRecord ); - - IWineMsiRemotePackage_Release( remote_package ); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; - } - + return ERROR_INVALID_HANDLE; record = msihandle2msiinfo( hRecord, MSIHANDLETYPE_RECORD ); if( !record ) goto out; @@ -2088,42 +2040,7 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE); if( !package ) - { - HRESULT hr; - BSTR name = NULL, value = NULL; - IWineMsiRemotePackage *remote_package; - - remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); - if (!remote_package) - return ERROR_INVALID_HANDLE; - - name = SysAllocString( szName ); - value = SysAllocString( szValue ); - if ((!name && szName) || (!value && szValue)) - { - SysFreeString( name ); - SysFreeString( value ); - IWineMsiRemotePackage_Release( remote_package ); - return ERROR_OUTOFMEMORY; - } - - hr = IWineMsiRemotePackage_SetProperty( remote_package, name, value ); - - SysFreeString( name ); - SysFreeString( value ); - IWineMsiRemotePackage_Release( remote_package ); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; - } - + return ERROR_INVALID_HANDLE; ret = msi_set_property( package->db, szName, szValue ); if (ret == ERROR_SUCCESS && !strcmpW( szName, szSourceDir )) msi_reset_folders( package, TRUE ); @@ -2242,63 +2159,7 @@ static UINT MSI_GetProperty( MSIHANDLE handle, LPCWSTR name, package = msihandle2msiinfo( handle, MSIHANDLETYPE_PACKAGE ); if (!package) - { - HRESULT hr; - IWineMsiRemotePackage *remote_package; - LPWSTR value = NULL; - BSTR bname; - DWORD len; - - remote_package = (IWineMsiRemotePackage *)msi_get_remote( handle ); - if (!remote_package) - return ERROR_INVALID_HANDLE; - - bname = SysAllocString( name ); - if (!bname) - { - IWineMsiRemotePackage_Release( remote_package ); - return ERROR_OUTOFMEMORY; - } - - len = 0; - hr = IWineMsiRemotePackage_GetProperty( remote_package, bname, NULL, &len ); - if (FAILED(hr)) - goto done; - - len++; - value = msi_alloc(len * sizeof(WCHAR)); - if (!value) - { - r = ERROR_OUTOFMEMORY; - goto done; - } - - hr = IWineMsiRemotePackage_GetProperty( remote_package, bname, value, &len ); - if (FAILED(hr)) - goto done; - - r = msi_strcpy_to_awstring( value, szValueBuf, pchValueBuf ); - - /* Bug required by Adobe installers */ - if (!szValueBuf->unicode && !szValueBuf->str.a) - *pchValueBuf *= sizeof(WCHAR); - -done: - IWineMsiRemotePackage_Release(remote_package); - SysFreeString(bname); - msi_free(value); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return r; - } - + return ERROR_INVALID_HANDLE; row = msi_get_property_row( package->db, name ); if (row) val = MSI_RecordGetString( row, 1 ); @@ -2345,288 +2206,6 @@ UINT WINAPI MsiGetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, return MSI_GetProperty( hInstall, szName, &val, pchValueBuf ); } -typedef struct _msi_remote_package_impl { - IWineMsiRemotePackage IWineMsiRemotePackage_iface; - MSIHANDLE package; - LONG refs; -} msi_remote_package_impl; - -static inline msi_remote_package_impl *impl_from_IWineMsiRemotePackage( IWineMsiRemotePackage *iface ) -{ - return CONTAINING_RECORD(iface, msi_remote_package_impl, IWineMsiRemotePackage_iface); -} - -static HRESULT WINAPI mrp_QueryInterface( IWineMsiRemotePackage *iface, - REFIID riid,LPVOID *ppobj) -{ - if( IsEqualCLSID( riid, &IID_IUnknown ) || - IsEqualCLSID( riid, &IID_IWineMsiRemotePackage ) ) - { - IWineMsiRemotePackage_AddRef( iface ); - *ppobj = iface; - return S_OK; - } - - return E_NOINTERFACE; -} - -static ULONG WINAPI mrp_AddRef( IWineMsiRemotePackage *iface ) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - - return InterlockedIncrement( &This->refs ); -} - -static ULONG WINAPI mrp_Release( IWineMsiRemotePackage *iface ) -{ - msi_remote_package_impl* This = impl_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 = impl_from_IWineMsiRemotePackage( iface ); - This->package = handle; - return S_OK; -} - -static HRESULT WINAPI mrp_GetActiveDatabase( IWineMsiRemotePackage *iface, MSIHANDLE *handle ) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - IWineMsiRemoteDatabase *rdb = NULL; - HRESULT hr; - MSIHANDLE hdb; - - hr = create_msi_remote_database( NULL, (LPVOID *)&rdb ); - if (FAILED(hr) || !rdb) - { - ERR("Failed to create remote database\n"); - return hr; - } - - hdb = MsiGetActiveDatabase(This->package); - - hr = IWineMsiRemoteDatabase_SetMsiHandle( rdb, hdb ); - if (FAILED(hr)) - { - ERR("Failed to set the database handle\n"); - return hr; - } - - *handle = alloc_msi_remote_handle( (IUnknown *)rdb ); - return S_OK; -} - -static HRESULT WINAPI mrp_GetProperty( IWineMsiRemotePackage *iface, BSTR property, BSTR value, DWORD *size ) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiGetPropertyW(This->package, property, value, size); - if (r != ERROR_SUCCESS) return HRESULT_FROM_WIN32(r); - return S_OK; -} - -static HRESULT WINAPI mrp_SetProperty( IWineMsiRemotePackage *iface, BSTR property, BSTR value ) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiSetPropertyW(This->package, property, value); - return HRESULT_FROM_WIN32(r); -} - -static HRESULT WINAPI mrp_ProcessMessage( IWineMsiRemotePackage *iface, INSTALLMESSAGE message, MSIHANDLE record ) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiProcessMessage(This->package, message, record); - return HRESULT_FROM_WIN32(r); -} - -static HRESULT WINAPI mrp_DoAction( IWineMsiRemotePackage *iface, BSTR action ) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiDoActionW(This->package, action); - return HRESULT_FROM_WIN32(r); -} - -static HRESULT WINAPI mrp_Sequence( IWineMsiRemotePackage *iface, BSTR table, int sequence ) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiSequenceW(This->package, table, sequence); - return HRESULT_FROM_WIN32(r); -} - -static HRESULT WINAPI mrp_GetTargetPath( IWineMsiRemotePackage *iface, BSTR folder, BSTR value, DWORD *size ) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiGetTargetPathW(This->package, folder, value, size); - return HRESULT_FROM_WIN32(r); -} - -static HRESULT WINAPI mrp_SetTargetPath( IWineMsiRemotePackage *iface, BSTR folder, BSTR value) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiSetTargetPathW(This->package, folder, value); - return HRESULT_FROM_WIN32(r); -} - -static HRESULT WINAPI mrp_GetSourcePath( IWineMsiRemotePackage *iface, BSTR folder, BSTR value, DWORD *size ) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiGetSourcePathW(This->package, folder, value, size); - return HRESULT_FROM_WIN32(r); -} - -static HRESULT WINAPI mrp_GetMode( IWineMsiRemotePackage *iface, MSIRUNMODE mode, BOOL *ret ) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - *ret = MsiGetMode(This->package, mode); - return S_OK; -} - -static HRESULT WINAPI mrp_SetMode( IWineMsiRemotePackage *iface, MSIRUNMODE mode, BOOL state ) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiSetMode(This->package, mode, state); - return HRESULT_FROM_WIN32(r); -} - -static HRESULT WINAPI mrp_GetFeatureState( IWineMsiRemotePackage *iface, BSTR feature, - INSTALLSTATE *installed, INSTALLSTATE *action ) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiGetFeatureStateW(This->package, feature, installed, action); - return HRESULT_FROM_WIN32(r); -} - -static HRESULT WINAPI mrp_SetFeatureState( IWineMsiRemotePackage *iface, BSTR feature, INSTALLSTATE state ) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiSetFeatureStateW(This->package, feature, state); - return HRESULT_FROM_WIN32(r); -} - -static HRESULT WINAPI mrp_GetComponentState( IWineMsiRemotePackage *iface, BSTR component, - INSTALLSTATE *installed, INSTALLSTATE *action ) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiGetComponentStateW(This->package, component, installed, action); - return HRESULT_FROM_WIN32(r); -} - -static HRESULT WINAPI mrp_SetComponentState( IWineMsiRemotePackage *iface, BSTR component, INSTALLSTATE state ) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiSetComponentStateW(This->package, component, state); - return HRESULT_FROM_WIN32(r); -} - -static HRESULT WINAPI mrp_GetLanguage( IWineMsiRemotePackage *iface, LANGID *language ) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - *language = MsiGetLanguage(This->package); - return S_OK; -} - -static HRESULT WINAPI mrp_SetInstallLevel( IWineMsiRemotePackage *iface, int level ) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiSetInstallLevel(This->package, level); - return HRESULT_FROM_WIN32(r); -} - -static HRESULT WINAPI mrp_FormatRecord( IWineMsiRemotePackage *iface, MSIHANDLE record, - BSTR *value) -{ - DWORD size = 0; - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiFormatRecordW(This->package, record, NULL, &size); - if (r == ERROR_SUCCESS) - { - *value = SysAllocStringLen(NULL, size); - if (!*value) - return E_OUTOFMEMORY; - size++; - r = MsiFormatRecordW(This->package, record, *value, &size); - } - return HRESULT_FROM_WIN32(r); -} - -static HRESULT WINAPI mrp_EvaluateCondition( IWineMsiRemotePackage *iface, BSTR condition ) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiEvaluateConditionW(This->package, condition); - return HRESULT_FROM_WIN32(r); -} - -static HRESULT WINAPI mrp_GetFeatureCost( IWineMsiRemotePackage *iface, BSTR feature, - INT cost_tree, INSTALLSTATE state, INT *cost ) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiGetFeatureCostW(This->package, feature, cost_tree, state, cost); - return HRESULT_FROM_WIN32(r); -} - -static HRESULT WINAPI mrp_EnumComponentCosts( IWineMsiRemotePackage *iface, BSTR component, - DWORD index, INSTALLSTATE state, BSTR drive, - DWORD *buflen, INT *cost, INT *temp ) -{ - msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); - UINT r = MsiEnumComponentCostsW(This->package, component, index, state, drive, buflen, cost, temp); - 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, - mrp_ProcessMessage, - mrp_DoAction, - mrp_Sequence, - mrp_GetTargetPath, - mrp_SetTargetPath, - mrp_GetSourcePath, - mrp_GetMode, - mrp_SetMode, - mrp_GetFeatureState, - mrp_SetFeatureState, - mrp_GetComponentState, - mrp_SetComponentState, - mrp_GetLanguage, - mrp_SetInstallLevel, - mrp_FormatRecord, - mrp_EvaluateCondition, - mrp_GetFeatureCost, - mrp_EnumComponentCosts -}; - -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->IWineMsiRemotePackage_iface.lpVtbl = &msi_remote_package_vtbl; - This->package = 0; - This->refs = 1; - - *ppObj = This; - - return S_OK; -} - UINT msi_package_add_info(MSIPACKAGE *package, DWORD context, DWORD options, LPCWSTR property, LPWSTR value) { diff --git a/libmsi/script.c b/libmsi/script.c index 3001000..f15185a 100644 --- a/libmsi/script.c +++ b/libmsi/script.c @@ -37,344 +37,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi); -#ifdef _WIN64 - -#define IActiveScriptParse_Release IActiveScriptParse64_Release -#define IActiveScriptParse_InitNew IActiveScriptParse64_InitNew -#define IActiveScriptParse_ParseScriptText IActiveScriptParse64_ParseScriptText - -#else - -#define IActiveScriptParse_Release IActiveScriptParse32_Release -#define IActiveScriptParse_InitNew IActiveScriptParse32_InitNew -#define IActiveScriptParse_ParseScriptText IActiveScriptParse32_ParseScriptText - -#endif - -static const WCHAR szJScript[] = { 'J','S','c','r','i','p','t',0}; -static const WCHAR szVBScript[] = { 'V','B','S','c','r','i','p','t',0}; -static const WCHAR szSession[] = {'S','e','s','s','i','o','n',0}; - -/* - * MsiActiveScriptSite - Our IActiveScriptSite implementation. - */ - -typedef struct { - IActiveScriptSite lpVtbl; - IDispatch *pInstaller; - IDispatch *pSession; - LONG ref; -} MsiActiveScriptSite; - -static const struct IActiveScriptSiteVtbl ASS_Vtbl; - -static HRESULT create_ActiveScriptSite(IUnknown *pUnkOuter, LPVOID *ppObj) -{ - MsiActiveScriptSite* object; - - TRACE("(%p,%p)\n", pUnkOuter, ppObj); - - if( pUnkOuter ) - return CLASS_E_NOAGGREGATION; - - object = msi_alloc_zero( sizeof(MsiActiveScriptSite) ); - - object->lpVtbl.lpVtbl = &ASS_Vtbl; - object->ref = 1; - object->pInstaller = NULL; - object->pSession = NULL; - - *ppObj = object; - - return S_OK; -} - /* * Call a script. */ DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR function, LPCWSTR action) { - HRESULT hr; - IActiveScript *pActiveScript = NULL; - IActiveScriptParse *pActiveScriptParse = NULL; - MsiActiveScriptSite *pActiveScriptSite = NULL; - IDispatch *pDispatch = NULL; - DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0}; - DISPID dispid; - CLSID clsid; - VARIANT var; - DWORD ret = ERROR_INSTALL_FAILURE; - - CoInitialize(NULL); - - /* Create MsiActiveScriptSite object */ - hr = create_ActiveScriptSite(NULL, (void **)&pActiveScriptSite); - if (hr != S_OK) goto done; - - /* Create an installer object */ - hr = create_msiserver(NULL, (LPVOID *)&pActiveScriptSite->pInstaller); - if (hr != S_OK) goto done; - - /* Create a session object */ - hr = create_session(hPackage, pActiveScriptSite->pInstaller, &pActiveScriptSite->pSession); - if (hr != S_OK) goto done; - - /* Create the scripting engine */ - if ((type & 7) == msidbCustomActionTypeJScript) - hr = CLSIDFromProgID(szJScript, &clsid); - else if ((type & 7) == msidbCustomActionTypeVBScript) - hr = CLSIDFromProgID(szVBScript, &clsid); - else { - ERR("Unknown script type %d\n", type); - goto done; - } - if (FAILED(hr)) { - ERR("Could not find CLSID for Windows Script\n"); - goto done; - } - hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IActiveScript, (void **)&pActiveScript); - if (FAILED(hr)) { - ERR("Could not instantiate class for Windows Script\n"); - goto done; - } - - hr = IActiveScript_QueryInterface(pActiveScript, &IID_IActiveScriptParse, (void **)&pActiveScriptParse); - if (FAILED(hr)) goto done; - - hr = IActiveScript_SetScriptSite(pActiveScript, (IActiveScriptSite *)pActiveScriptSite); - if (FAILED(hr)) goto done; - - hr = IActiveScriptParse_InitNew(pActiveScriptParse); - if (FAILED(hr)) goto done; - - hr = IActiveScript_AddNamedItem(pActiveScript, szSession, SCRIPTITEM_GLOBALMEMBERS|SCRIPTITEM_ISVISIBLE); - if (FAILED(hr)) goto done; - - hr = IActiveScriptParse_ParseScriptText(pActiveScriptParse, script, NULL, NULL, NULL, 0, 0, 0L, NULL, NULL); - if (FAILED(hr)) goto done; - - hr = IActiveScript_SetScriptState(pActiveScript, SCRIPTSTATE_CONNECTED); - if (FAILED(hr)) goto done; - - /* Call a function if necessary through the IDispatch interface */ - if (function != NULL && strlenW(function) > 0) { - TRACE("Calling function %s\n", debugstr_w(function)); - - hr = IActiveScript_GetScriptDispatch(pActiveScript, NULL, &pDispatch); - if (FAILED(hr)) goto done; - - hr = IDispatch_GetIDsOfNames(pDispatch, &IID_NULL, (WCHAR **)&function, 1,LOCALE_USER_DEFAULT, &dispid); - if (FAILED(hr)) goto done; - - hr = IDispatch_Invoke(pDispatch, dispid, &IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &dispparamsNoArgs, &var, NULL, NULL); - if (FAILED(hr)) goto done; - - /* Check return value, if it's not IDOK we failed */ - hr = VariantChangeType(&var, &var, 0, VT_I4); - if (FAILED(hr)) goto done; - - if (V_I4(&var) == IDOK) - ret = ERROR_SUCCESS; - else ret = ERROR_INSTALL_FAILURE; - - VariantClear(&var); - } else { - /* If no function to be called, MSI behavior is to succeed */ - ret = ERROR_SUCCESS; - } - -done: - - if (pDispatch) IDispatch_Release(pDispatch); - if (pActiveScript) IActiveScript_Release(pActiveScript); - if (pActiveScriptParse) IActiveScriptParse_Release(pActiveScriptParse); - if (pActiveScriptSite) - { - if (pActiveScriptSite->pSession) IDispatch_Release(pActiveScriptSite->pSession); - if (pActiveScriptSite->pInstaller) IDispatch_Release(pActiveScriptSite->pInstaller); - IActiveScriptSite_Release((IActiveScriptSite *)pActiveScriptSite); - } - CoUninitialize(); /* must call even if CoInitialize failed */ - return ret; -} - -/* - * MsiActiveScriptSite - */ - -/*** IUnknown methods ***/ -static HRESULT WINAPI MsiActiveScriptSite_QueryInterface(IActiveScriptSite* iface, REFIID riid, void** ppvObject) -{ - MsiActiveScriptSite *This = (MsiActiveScriptSite *)iface; - - TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject); - - if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IActiveScriptSite)) - { - IActiveScriptSite_AddRef(iface); - *ppvObject = This; - return S_OK; - } - - TRACE("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject); - - return E_NOINTERFACE; -} - -static ULONG WINAPI MsiActiveScriptSite_AddRef(IActiveScriptSite* iface) -{ - MsiActiveScriptSite *This = (MsiActiveScriptSite *)iface; - - TRACE("(%p/%p)\n", iface, This); - - return InterlockedIncrement(&This->ref); -} - -static ULONG WINAPI MsiActiveScriptSite_Release(IActiveScriptSite* iface) -{ - MsiActiveScriptSite *This = (MsiActiveScriptSite *)iface; - ULONG ref = InterlockedDecrement(&This->ref); - - TRACE("(%p/%p)\n", iface, This); - - if (!ref) - msi_free(This); - - return ref; -} - -/*** IActiveScriptSite methods **/ -static HRESULT WINAPI MsiActiveScriptSite_GetLCID(IActiveScriptSite* iface, LCID* plcid) -{ - MsiActiveScriptSite *This = (MsiActiveScriptSite *)iface; - TRACE("(%p/%p)->(%p)\n", This, iface, plcid); - return E_NOTIMPL; /* Script will use system-defined locale */ -} - -static HRESULT WINAPI MsiActiveScriptSite_GetItemInfo(IActiveScriptSite* iface, LPCOLESTR pstrName, DWORD dwReturnMask, IUnknown** ppiunkItem, ITypeInfo** ppti) -{ - MsiActiveScriptSite *This = (MsiActiveScriptSite *)iface; - TRACE("(%p/%p)->(%p,%d,%p,%p)\n", This, iface, pstrName, dwReturnMask, ppiunkItem, ppti); - - /* Determine the kind of pointer that is requested, and make sure placeholder is valid */ - if (dwReturnMask & SCRIPTINFO_ITYPEINFO) { - if (!ppti) return E_INVALIDARG; - *ppti = NULL; - } - if (dwReturnMask & SCRIPTINFO_IUNKNOWN) { - if (!ppiunkItem) return E_INVALIDARG; - *ppiunkItem = NULL; - } - - /* Are we looking for the session object? */ - if (!strcmpW(szSession, pstrName)) { - if (dwReturnMask & SCRIPTINFO_ITYPEINFO) - return load_type_info(This->pSession, ppti, &DIID_Session, 0); - else if (dwReturnMask & SCRIPTINFO_IUNKNOWN) { - IDispatch_QueryInterface(This->pSession, &IID_IUnknown, (void **)ppiunkItem); - return S_OK; - } - } - - return TYPE_E_ELEMENTNOTFOUND; -} - -static HRESULT WINAPI MsiActiveScriptSite_GetDocVersionString(IActiveScriptSite* iface, BSTR* pbstrVersion) -{ - MsiActiveScriptSite *This = (MsiActiveScriptSite *)iface; - TRACE("(%p/%p)->(%p)\n", This, iface, pbstrVersion); - return E_NOTIMPL; -} - -static HRESULT WINAPI MsiActiveScriptSite_OnScriptTerminate(IActiveScriptSite* iface, const VARIANT* pvarResult, const EXCEPINFO* pexcepinfo) -{ - MsiActiveScriptSite *This = (MsiActiveScriptSite *)iface; - TRACE("(%p/%p)->(%p,%p)\n", This, iface, pvarResult, pexcepinfo); - return S_OK; + return ERROR_INSTALL_FAILURE; } - -static HRESULT WINAPI MsiActiveScriptSite_OnStateChange(IActiveScriptSite* iface, SCRIPTSTATE ssScriptState) -{ - switch (ssScriptState) { - case SCRIPTSTATE_UNINITIALIZED: - TRACE("State: Uninitialized.\n"); - break; - - case SCRIPTSTATE_INITIALIZED: - TRACE("State: Initialized.\n"); - break; - - case SCRIPTSTATE_STARTED: - TRACE("State: Started.\n"); - break; - - case SCRIPTSTATE_CONNECTED: - TRACE("State: Connected.\n"); - break; - - case SCRIPTSTATE_DISCONNECTED: - TRACE("State: Disconnected.\n"); - break; - - case SCRIPTSTATE_CLOSED: - TRACE("State: Closed.\n"); - break; - - default: - ERR("Unknown State: %d\n", ssScriptState); - break; - } - - return S_OK; -} - -static HRESULT WINAPI MsiActiveScriptSite_OnScriptError(IActiveScriptSite* iface, IActiveScriptError* pscripterror) -{ - MsiActiveScriptSite *This = (MsiActiveScriptSite *)iface; - EXCEPINFO exception; - HRESULT hr; - - TRACE("(%p/%p)->(%p)\n", This, iface, pscripterror); - - memset(&exception, 0, sizeof(EXCEPINFO)); - hr = IActiveScriptError_GetExceptionInfo(pscripterror, &exception); - if (SUCCEEDED(hr)) - { - ERR("script error: %s\n", debugstr_w(exception.bstrDescription)); - SysFreeString(exception.bstrSource); - SysFreeString(exception.bstrDescription); - SysFreeString(exception.bstrHelpFile); - } - - return S_OK; -} - -static HRESULT WINAPI MsiActiveScriptSite_OnEnterScript(IActiveScriptSite* iface) -{ - MsiActiveScriptSite *This = (MsiActiveScriptSite *)iface; - TRACE("(%p/%p)\n", This, iface); - return S_OK; -} - -static HRESULT WINAPI MsiActiveScriptSite_OnLeaveScript(IActiveScriptSite* iface) -{ - MsiActiveScriptSite *This = (MsiActiveScriptSite *)iface; - TRACE("(%p/%p)\n", This, iface); - return S_OK; -} - -static const struct IActiveScriptSiteVtbl ASS_Vtbl = -{ - MsiActiveScriptSite_QueryInterface, - MsiActiveScriptSite_AddRef, - MsiActiveScriptSite_Release, - MsiActiveScriptSite_GetLCID, - MsiActiveScriptSite_GetItemInfo, - MsiActiveScriptSite_GetDocVersionString, - MsiActiveScriptSite_OnScriptTerminate, - MsiActiveScriptSite_OnStateChange, - MsiActiveScriptSite_OnScriptError, - MsiActiveScriptSite_OnEnterScript, - MsiActiveScriptSite_OnLeaveScript -}; diff --git a/libmsi/suminfo.c b/libmsi/suminfo.c index 67fe558..7eb46ec 100644 --- a/libmsi/suminfo.c +++ b/libmsi/suminfo.c @@ -40,6 +40,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi); +const CLSID FMTID_SummaryInformation = + { 0xf29f85e0, 0x4ff9, 0x1068, {0xab, 0x91, 0x08, 0x00, 0x2b, 0x27, 0xb3, 0xd9}}; + #include "pshpack1.h" typedef struct { @@ -481,28 +484,7 @@ UINT WINAPI MsiGetSummaryInformationW( MSIHANDLE hDatabase, { db = msihandle2msiinfo( hDatabase, MSIHANDLETYPE_DATABASE ); if( !db ) - { - HRESULT hr; - IWineMsiRemoteDatabase *remote_database; - - remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hDatabase ); - if ( !remote_database ) - return ERROR_INVALID_HANDLE; - - hr = IWineMsiRemoteDatabase_GetSummaryInformation( remote_database, - uiUpdateCount, pHandle ); - IWineMsiRemoteDatabase_Release( remote_database ); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; - } + return ERROR_INVALID_HANDLE; } si = MSI_GetSummaryInformationW( db->storage, uiUpdateCount ); |