Fix the handling of MsiDoAction args (with test case).
This commit is contained in:
parent
79ca56cd6a
commit
e17ef695a2
|
@ -41,24 +41,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi);
|
||||||
UINT WINAPI MsiDoActionA( MSIHANDLE hInstall, LPCSTR szAction )
|
UINT WINAPI MsiDoActionA( MSIHANDLE hInstall, LPCSTR szAction )
|
||||||
{
|
{
|
||||||
LPWSTR szwAction;
|
LPWSTR szwAction;
|
||||||
UINT rc;
|
UINT ret;
|
||||||
|
|
||||||
TRACE(" exteral attempt at action %s\n",szAction);
|
TRACE("%s\n", debugstr_a(szAction));
|
||||||
|
|
||||||
if (!szAction)
|
|
||||||
return ERROR_FUNCTION_FAILED;
|
|
||||||
if (hInstall == 0)
|
|
||||||
return ERROR_FUNCTION_FAILED;
|
|
||||||
|
|
||||||
szwAction = strdupAtoW(szAction);
|
szwAction = strdupAtoW(szAction);
|
||||||
|
if (szAction && !szwAction)
|
||||||
if (!szwAction)
|
|
||||||
return ERROR_FUNCTION_FAILED;
|
return ERROR_FUNCTION_FAILED;
|
||||||
|
|
||||||
|
ret = MsiDoActionW( hInstall, szwAction );
|
||||||
rc = MsiDoActionW(hInstall, szwAction);
|
HeapFree( GetProcessHeap(), 0, szwAction );
|
||||||
HeapFree(GetProcessHeap(),0,szwAction);
|
return ret;
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -67,16 +60,20 @@ UINT WINAPI MsiDoActionA( MSIHANDLE hInstall, LPCSTR szAction )
|
||||||
UINT WINAPI MsiDoActionW( MSIHANDLE hInstall, LPCWSTR szAction )
|
UINT WINAPI MsiDoActionW( MSIHANDLE hInstall, LPCWSTR szAction )
|
||||||
{
|
{
|
||||||
MSIPACKAGE *package;
|
MSIPACKAGE *package;
|
||||||
UINT ret = ERROR_INVALID_HANDLE;
|
UINT ret;
|
||||||
|
|
||||||
TRACE(" external attempt at action %s \n",debugstr_w(szAction));
|
TRACE("%s\n",debugstr_w(szAction));
|
||||||
|
|
||||||
|
if (!szAction)
|
||||||
|
return ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
|
||||||
|
if (!package)
|
||||||
|
return ERROR_INVALID_HANDLE;
|
||||||
|
|
||||||
|
ret = ACTION_PerformUIAction( package, szAction );
|
||||||
|
msiobj_release( &package->hdr );
|
||||||
|
|
||||||
package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
|
|
||||||
if( package )
|
|
||||||
{
|
|
||||||
ret = ACTION_PerformUIAction(package,szAction);
|
|
||||||
msiobj_release( &package->hdr );
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -272,9 +272,33 @@ static void test_getsourcepath( void )
|
||||||
MsiCloseHandle( hpkg );
|
MsiCloseHandle( hpkg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test_doaction( void )
|
||||||
|
{
|
||||||
|
MSIHANDLE hpkg;
|
||||||
|
UINT r;
|
||||||
|
|
||||||
|
r = MsiDoAction( -1, NULL );
|
||||||
|
ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
|
||||||
|
|
||||||
|
hpkg = package_from_db(create_package_db());
|
||||||
|
ok( hpkg, "failed to create package\n");
|
||||||
|
|
||||||
|
r = MsiDoAction(hpkg, NULL);
|
||||||
|
ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
|
||||||
|
|
||||||
|
r = MsiDoAction(0, "boo");
|
||||||
|
ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
|
||||||
|
|
||||||
|
r = MsiDoAction(hpkg, "boo");
|
||||||
|
ok( r == ERROR_FUNCTION_NOT_CALLED, "wrong return val\n");
|
||||||
|
|
||||||
|
MsiCloseHandle( hpkg );
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(package)
|
START_TEST(package)
|
||||||
{
|
{
|
||||||
test_createpackage();
|
test_createpackage();
|
||||||
test_getsourcepath_bad();
|
test_getsourcepath_bad();
|
||||||
test_getsourcepath();
|
test_getsourcepath();
|
||||||
|
test_doaction();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue