Commit 3b0179cb authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

msi: Remove unnecessary casts and argument from script site creation helper.

parent 194c30d1
...@@ -59,8 +59,8 @@ static const WCHAR szSession[] = {'S','e','s','s','i','o','n',0}; ...@@ -59,8 +59,8 @@ static const WCHAR szSession[] = {'S','e','s','s','i','o','n',0};
*/ */
typedef struct { typedef struct {
IActiveScriptSite IActiveScriptSite_iface; IActiveScriptSite IActiveScriptSite_iface;
IDispatch *pInstaller; IDispatch *installer;
IDispatch *pSession; IDispatch *session;
LONG ref; LONG ref;
} MsiActiveScriptSite; } MsiActiveScriptSite;
...@@ -144,7 +144,7 @@ static HRESULT WINAPI MsiActiveScriptSite_GetItemInfo(IActiveScriptSite* iface, ...@@ -144,7 +144,7 @@ static HRESULT WINAPI MsiActiveScriptSite_GetItemInfo(IActiveScriptSite* iface,
return hr; return hr;
} }
else if (dwReturnMask & SCRIPTINFO_IUNKNOWN) { else if (dwReturnMask & SCRIPTINFO_IUNKNOWN) {
IDispatch_QueryInterface(This->pSession, &IID_IUnknown, (void **)ppiunkItem); IDispatch_QueryInterface(This->session, &IID_IUnknown, (void **)ppiunkItem);
return S_OK; return S_OK;
} }
} }
...@@ -251,23 +251,24 @@ static const struct IActiveScriptSiteVtbl activescriptsitevtbl = ...@@ -251,23 +251,24 @@ static const struct IActiveScriptSiteVtbl activescriptsitevtbl =
MsiActiveScriptSite_OnLeaveScript MsiActiveScriptSite_OnLeaveScript
}; };
static HRESULT create_ActiveScriptSite(IUnknown *outer, void **obj) static HRESULT create_activescriptsite(MsiActiveScriptSite **obj)
{ {
MsiActiveScriptSite* object; MsiActiveScriptSite* object;
TRACE("(%p,%p)\n", outer, obj); TRACE("(%p)\n", obj);
if( outer ) *obj = NULL;
return CLASS_E_NOAGGREGATION;
object = msi_alloc( sizeof(MsiActiveScriptSite) ); object = msi_alloc( sizeof(MsiActiveScriptSite) );
if (!object)
return E_OUTOFMEMORY;
object->IActiveScriptSite_iface.lpVtbl = &activescriptsitevtbl; object->IActiveScriptSite_iface.lpVtbl = &activescriptsitevtbl;
object->ref = 1; object->ref = 1;
object->pInstaller = NULL; object->installer = NULL;
object->pSession = NULL; object->session = NULL;
*obj = &object->IActiveScriptSite_iface; *obj = object;
return S_OK; return S_OK;
} }
...@@ -280,7 +281,7 @@ DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR function ...@@ -280,7 +281,7 @@ DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR function
HRESULT hr; HRESULT hr;
IActiveScript *pActiveScript = NULL; IActiveScript *pActiveScript = NULL;
IActiveScriptParse *pActiveScriptParse = NULL; IActiveScriptParse *pActiveScriptParse = NULL;
MsiActiveScriptSite *pActiveScriptSite = NULL; MsiActiveScriptSite *scriptsite;
IDispatch *pDispatch = NULL; IDispatch *pDispatch = NULL;
DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0}; DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
DISPID dispid; DISPID dispid;
...@@ -291,15 +292,15 @@ DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR function ...@@ -291,15 +292,15 @@ DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR function
CoInitialize(NULL); CoInitialize(NULL);
/* Create MsiActiveScriptSite object */ /* Create MsiActiveScriptSite object */
hr = create_ActiveScriptSite(NULL, (void **)&pActiveScriptSite); hr = create_activescriptsite(&scriptsite);
if (hr != S_OK) goto done; if (hr != S_OK) goto done;
/* Create an installer object */ /* Create an installer object */
hr = create_msiserver(NULL, (LPVOID *)&pActiveScriptSite->pInstaller); hr = create_msiserver(NULL, (void**)&scriptsite->installer);
if (hr != S_OK) goto done; if (hr != S_OK) goto done;
/* Create a session object */ /* Create a session object */
hr = create_session(hPackage, pActiveScriptSite->pInstaller, &pActiveScriptSite->pSession); hr = create_session(hPackage, scriptsite->installer, &scriptsite->session);
if (hr != S_OK) goto done; if (hr != S_OK) goto done;
/* Create the scripting engine */ /* Create the scripting engine */
...@@ -325,7 +326,7 @@ DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR function ...@@ -325,7 +326,7 @@ DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR function
hr = IActiveScript_QueryInterface(pActiveScript, &IID_IActiveScriptParse, (void **)&pActiveScriptParse); hr = IActiveScript_QueryInterface(pActiveScript, &IID_IActiveScriptParse, (void **)&pActiveScriptParse);
if (FAILED(hr)) goto done; if (FAILED(hr)) goto done;
hr = IActiveScript_SetScriptSite(pActiveScript, (IActiveScriptSite *)pActiveScriptSite); hr = IActiveScript_SetScriptSite(pActiveScript, &scriptsite->IActiveScriptSite_iface);
if (FAILED(hr)) goto done; if (FAILED(hr)) goto done;
hr = IActiveScriptParse_InitNew(pActiveScriptParse); hr = IActiveScriptParse_InitNew(pActiveScriptParse);
...@@ -372,11 +373,11 @@ done: ...@@ -372,11 +373,11 @@ done:
if (pDispatch) IDispatch_Release(pDispatch); if (pDispatch) IDispatch_Release(pDispatch);
if (pActiveScript) IActiveScript_Release(pActiveScript); if (pActiveScript) IActiveScript_Release(pActiveScript);
if (pActiveScriptParse) IActiveScriptParse_Release(pActiveScriptParse); if (pActiveScriptParse) IActiveScriptParse_Release(pActiveScriptParse);
if (pActiveScriptSite) if (scriptsite)
{ {
if (pActiveScriptSite->pSession) IDispatch_Release(pActiveScriptSite->pSession); if (scriptsite->session) IDispatch_Release(scriptsite->session);
if (pActiveScriptSite->pInstaller) IDispatch_Release(pActiveScriptSite->pInstaller); if (scriptsite->installer) IDispatch_Release(scriptsite->installer);
IActiveScriptSite_Release((IActiveScriptSite *)pActiveScriptSite); IActiveScriptSite_Release(&scriptsite->IActiveScriptSite_iface);
} }
CoUninitialize(); /* must call even if CoInitialize failed */ CoUninitialize(); /* must call even if CoInitialize failed */
return ret; return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment