msi: Implement MsiSetMode.
This commit is contained in:
parent
c65a3e81f7
commit
a11882fc0f
|
@ -719,8 +719,52 @@ BOOL WINAPI MsiGetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode)
|
||||||
*/
|
*/
|
||||||
UINT WINAPI MsiSetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode, BOOL fState)
|
UINT WINAPI MsiSetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode, BOOL fState)
|
||||||
{
|
{
|
||||||
FIXME("%d %d %d\n", hInstall, iRunMode, fState);
|
MSIPACKAGE *package;
|
||||||
|
UINT r;
|
||||||
|
|
||||||
|
TRACE("%d %d %d\n", hInstall, iRunMode, 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_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (iRunMode)
|
||||||
|
{
|
||||||
|
case MSIRUNMODE_REBOOTATEND:
|
||||||
|
package->need_reboot = 1;
|
||||||
|
r = ERROR_SUCCESS;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MSIRUNMODE_REBOOTNOW:
|
||||||
|
FIXME("unimplemented run mode\n");
|
||||||
|
r = ERROR_FUNCTION_FAILED;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
r = ERROR_ACCESS_DENIED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
|
|
@ -63,6 +63,7 @@ interface IWineMsiRemotePackage : IUnknown
|
||||||
HRESULT SetTargetPath( [in] BSTR folder, [in] BSTR value );
|
HRESULT SetTargetPath( [in] BSTR folder, [in] BSTR value );
|
||||||
HRESULT GetSourcePath( [in] BSTR folder, [out] BSTR *value, [out] DWORD *size );
|
HRESULT GetSourcePath( [in] BSTR folder, [out] BSTR *value, [out] DWORD *size );
|
||||||
HRESULT GetMode( [in] MSIRUNMODE mode, [out] BOOL *ret );
|
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 GetFeatureState( [in] BSTR feature, [out] INSTALLSTATE *installed, [out] INSTALLSTATE *action );
|
||||||
HRESULT SetFeatureState( [in] BSTR feature, [in] INSTALLSTATE state );
|
HRESULT SetFeatureState( [in] BSTR feature, [in] INSTALLSTATE state );
|
||||||
HRESULT GetComponentState( [in] BSTR component, [out] INSTALLSTATE *installed, [out] INSTALLSTATE *action );
|
HRESULT GetComponentState( [in] BSTR component, [out] INSTALLSTATE *installed, [out] INSTALLSTATE *action );
|
||||||
|
|
|
@ -2104,6 +2104,13 @@ static HRESULT WINAPI mrp_GetMode( IWineMsiRemotePackage *iface, MSIRUNMODE mode
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI mrp_SetMode( IWineMsiRemotePackage *iface, MSIRUNMODE mode, BOOL state )
|
||||||
|
{
|
||||||
|
msi_remote_package_impl* This = mrp_from_IWineMsiRemotePackage( iface );
|
||||||
|
UINT r = MsiSetMode(This->package, mode, state);
|
||||||
|
return HRESULT_FROM_WIN32(r);
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI mrp_GetFeatureState( IWineMsiRemotePackage *iface, BSTR feature,
|
static HRESULT WINAPI mrp_GetFeatureState( IWineMsiRemotePackage *iface, BSTR feature,
|
||||||
INSTALLSTATE *installed, INSTALLSTATE *action )
|
INSTALLSTATE *installed, INSTALLSTATE *action )
|
||||||
{
|
{
|
||||||
|
@ -2196,6 +2203,7 @@ static const IWineMsiRemotePackageVtbl msi_remote_package_vtbl =
|
||||||
mrp_SetTargetPath,
|
mrp_SetTargetPath,
|
||||||
mrp_GetSourcePath,
|
mrp_GetSourcePath,
|
||||||
mrp_GetMode,
|
mrp_GetMode,
|
||||||
|
mrp_SetMode,
|
||||||
mrp_GetFeatureState,
|
mrp_GetFeatureState,
|
||||||
mrp_SetFeatureState,
|
mrp_SetFeatureState,
|
||||||
mrp_GetComponentState,
|
mrp_GetComponentState,
|
||||||
|
|
|
@ -1865,6 +1865,10 @@ static void test_Session(IDispatch *pSession)
|
||||||
ok(hr == S_OK, "Session_ModeGet failed, hresult 0x%08x\n", hr);
|
ok(hr == S_OK, "Session_ModeGet failed, hresult 0x%08x\n", hr);
|
||||||
todo_wine ok(!bool, "Reboot at end session mode is %d\n", bool);
|
todo_wine ok(!bool, "Reboot at end session mode is %d\n", bool);
|
||||||
|
|
||||||
|
hr = Session_ModeGet(pSession, MSIRUNMODE_MAINTENANCE, &bool);
|
||||||
|
ok(hr == S_OK, "Session_ModeGet failed, hresult 0x%08x\n", hr);
|
||||||
|
todo_wine ok(!bool, "Maintenance mode is %d\n", bool);
|
||||||
|
|
||||||
/* Session::Mode, put */
|
/* Session::Mode, put */
|
||||||
hr = Session_ModePut(pSession, MSIRUNMODE_REBOOTATEND, TRUE);
|
hr = Session_ModePut(pSession, MSIRUNMODE_REBOOTATEND, TRUE);
|
||||||
ok(hr == S_OK, "Session_ModePut failed, hresult 0x%08x\n", hr);
|
ok(hr == S_OK, "Session_ModePut failed, hresult 0x%08x\n", hr);
|
||||||
|
@ -1874,6 +1878,17 @@ static void test_Session(IDispatch *pSession)
|
||||||
hr = Session_ModePut(pSession, MSIRUNMODE_REBOOTATEND, FALSE); /* set it again so we don't reboot */
|
hr = Session_ModePut(pSession, MSIRUNMODE_REBOOTATEND, FALSE); /* set it again so we don't reboot */
|
||||||
ok(hr == S_OK, "Session_ModePut failed, hresult 0x%08x\n", hr);
|
ok(hr == S_OK, "Session_ModePut failed, hresult 0x%08x\n", hr);
|
||||||
|
|
||||||
|
hr = Session_ModePut(pSession, MSIRUNMODE_REBOOTNOW, TRUE);
|
||||||
|
todo_wine ok(hr == S_OK, "Session_ModePut failed, hresult 0x%08x\n", hr);
|
||||||
|
hr = Session_ModeGet(pSession, MSIRUNMODE_REBOOTNOW, &bool);
|
||||||
|
ok(hr == S_OK, "Session_ModeGet failed, hresult 0x%08x\n", hr);
|
||||||
|
ok(bool, "Reboot now mode is %d, expected 1\n", bool);
|
||||||
|
hr = Session_ModePut(pSession, MSIRUNMODE_REBOOTNOW, FALSE); /* set it again so we don't reboot */
|
||||||
|
todo_wine ok(hr == S_OK, "Session_ModePut failed, hresult 0x%08x\n", hr);
|
||||||
|
|
||||||
|
hr = Session_ModePut(pSession, MSIRUNMODE_MAINTENANCE, TRUE);
|
||||||
|
ok(hr == DISP_E_EXCEPTION, "Session_ModePut failed, hresult 0x%08x\n", hr);
|
||||||
|
|
||||||
/* Session::Database, get */
|
/* Session::Database, get */
|
||||||
hr = Session_Database(pSession, &pDatabase);
|
hr = Session_Database(pSession, &pDatabase);
|
||||||
ok(hr == S_OK, "Session_Database failed, hresult 0x%08x\n", hr);
|
ok(hr == S_OK, "Session_Database failed, hresult 0x%08x\n", hr);
|
||||||
|
|
Loading…
Reference in New Issue