msi: Return void from init_automation_object.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2020-05-06 14:03:04 +02:00 committed by Alexandre Julliard
parent 463482a829
commit 1726b7f46c
1 changed files with 14 additions and 58 deletions

View File

@ -543,18 +543,15 @@ static const IProvideMultipleClassInfoVtbl ProvideMultipleClassInfoVtbl =
ProvideMultipleClassInfo_GetInfoOfIndex ProvideMultipleClassInfo_GetInfoOfIndex
}; };
static HRESULT init_automation_object(AutomationObject *This, MSIHANDLE msiHandle, tid_t tid) static void init_automation_object(AutomationObject *This, MSIHANDLE msiHandle, tid_t tid)
{ {
TRACE("(%p, %d, %s)\n", This, msiHandle, debugstr_guid(get_riid_from_tid(tid))); TRACE("(%p, %d, %s)\n", This, msiHandle, debugstr_guid(get_riid_from_tid(tid)));
This->IDispatch_iface.lpVtbl = &AutomationObjectVtbl; This->IDispatch_iface.lpVtbl = &AutomationObjectVtbl;
This->IProvideMultipleClassInfo_iface.lpVtbl = &ProvideMultipleClassInfoVtbl; This->IProvideMultipleClassInfo_iface.lpVtbl = &ProvideMultipleClassInfoVtbl;
This->ref = 1; This->ref = 1;
This->msiHandle = msiHandle; This->msiHandle = msiHandle;
This->tid = tid; This->tid = tid;
return S_OK;
} }
/* /*
@ -1002,21 +999,15 @@ static HRESULT record_invoke(
static HRESULT create_record(MSIHANDLE msiHandle, IDispatch **disp) static HRESULT create_record(MSIHANDLE msiHandle, IDispatch **disp)
{ {
AutomationObject *record; AutomationObject *record;
HRESULT hr;
record = msi_alloc(sizeof(*record)); record = msi_alloc(sizeof(*record));
if (!record) return E_OUTOFMEMORY; if (!record) return E_OUTOFMEMORY;
hr = init_automation_object(record, msiHandle, Record_tid); init_automation_object(record, msiHandle, Record_tid);
if (hr != S_OK)
{
msi_free(record);
return hr;
}
*disp = &record->IDispatch_iface; *disp = &record->IDispatch_iface;
return hr; return S_OK;
} }
static HRESULT list_invoke( static HRESULT list_invoke(
@ -1123,12 +1114,7 @@ static HRESULT create_list(const WCHAR *product, IDispatch **dispatch)
list = msi_alloc_zero(sizeof(ListObject)); list = msi_alloc_zero(sizeof(ListObject));
if (!list) return E_OUTOFMEMORY; if (!list) return E_OUTOFMEMORY;
hr = init_automation_object(&list->autoobj, 0, StringList_tid); init_automation_object(&list->autoobj, 0, StringList_tid);
if (hr != S_OK)
{
msi_free(list);
return hr;
}
*dispatch = &list->autoobj.IDispatch_iface; *dispatch = &list->autoobj.IDispatch_iface;
@ -2442,7 +2428,6 @@ static HRESULT installer_invoke(
HRESULT create_msiserver(IUnknown *outer, void **ppObj) HRESULT create_msiserver(IUnknown *outer, void **ppObj)
{ {
AutomationObject *installer; AutomationObject *installer;
HRESULT hr;
TRACE("(%p %p)\n", outer, ppObj); TRACE("(%p %p)\n", outer, ppObj);
@ -2452,99 +2437,70 @@ HRESULT create_msiserver(IUnknown *outer, void **ppObj)
installer = msi_alloc(sizeof(AutomationObject)); installer = msi_alloc(sizeof(AutomationObject));
if (!installer) return E_OUTOFMEMORY; if (!installer) return E_OUTOFMEMORY;
hr = init_automation_object(installer, 0, Installer_tid); init_automation_object(installer, 0, Installer_tid);
if (hr != S_OK)
{
msi_free(installer);
return hr;
}
*ppObj = &installer->IDispatch_iface; *ppObj = &installer->IDispatch_iface;
return hr; return S_OK;
} }
HRESULT create_session(MSIHANDLE msiHandle, IDispatch *installer, IDispatch **disp) HRESULT create_session(MSIHANDLE msiHandle, IDispatch *installer, IDispatch **disp)
{ {
SessionObject *session; SessionObject *session;
HRESULT hr;
session = msi_alloc(sizeof(SessionObject)); session = msi_alloc(sizeof(SessionObject));
if (!session) return E_OUTOFMEMORY; if (!session) return E_OUTOFMEMORY;
hr = init_automation_object(&session->autoobj, msiHandle, Session_tid); init_automation_object(&session->autoobj, msiHandle, Session_tid);
if (hr != S_OK)
{
msi_free(session);
return hr;
}
session->installer = installer; session->installer = installer;
*disp = &session->autoobj.IDispatch_iface; *disp = &session->autoobj.IDispatch_iface;
return hr; return S_OK;
} }
static HRESULT create_database(MSIHANDLE msiHandle, IDispatch **dispatch) static HRESULT create_database(MSIHANDLE msiHandle, IDispatch **dispatch)
{ {
AutomationObject *database; AutomationObject *database;
HRESULT hr;
TRACE("(%d %p)\n", msiHandle, dispatch); TRACE("(%d %p)\n", msiHandle, dispatch);
database = msi_alloc(sizeof(AutomationObject)); database = msi_alloc(sizeof(AutomationObject));
if (!database) return E_OUTOFMEMORY; if (!database) return E_OUTOFMEMORY;
hr = init_automation_object(database, msiHandle, Database_tid); init_automation_object(database, msiHandle, Database_tid);
if (hr != S_OK)
{
msi_free(database);
return hr;
}
*dispatch = &database->IDispatch_iface; *dispatch = &database->IDispatch_iface;
return hr; return S_OK;
} }
static HRESULT create_view(MSIHANDLE msiHandle, IDispatch **dispatch) static HRESULT create_view(MSIHANDLE msiHandle, IDispatch **dispatch)
{ {
AutomationObject *view; AutomationObject *view;
HRESULT hr;
TRACE("(%d %p)\n", msiHandle, dispatch); TRACE("(%d %p)\n", msiHandle, dispatch);
view = msi_alloc(sizeof(AutomationObject)); view = msi_alloc(sizeof(AutomationObject));
if (!view) return E_OUTOFMEMORY; if (!view) return E_OUTOFMEMORY;
hr = init_automation_object(view, msiHandle, View_tid); init_automation_object(view, msiHandle, View_tid);
if (hr != S_OK)
{
msi_free(view);
return hr;
}
*dispatch = &view->IDispatch_iface; *dispatch = &view->IDispatch_iface;
return hr; return S_OK;
} }
static HRESULT create_summaryinfo(MSIHANDLE msiHandle, IDispatch **disp) static HRESULT create_summaryinfo(MSIHANDLE msiHandle, IDispatch **disp)
{ {
AutomationObject *info; AutomationObject *info;
HRESULT hr;
info = msi_alloc(sizeof(*info)); info = msi_alloc(sizeof(*info));
if (!info) return E_OUTOFMEMORY; if (!info) return E_OUTOFMEMORY;
hr = init_automation_object(info, msiHandle, SummaryInfo_tid); init_automation_object(info, msiHandle, SummaryInfo_tid);
if (hr != S_OK)
{
msi_free(info);
return hr;
}
*disp = &info->IDispatch_iface; *disp = &info->IDispatch_iface;
return hr; return S_OK;
} }