Commit e17ef695 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

Fix the handling of MsiDoAction args (with test case).

parent 79ca56cd
......@@ -41,24 +41,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi);
UINT WINAPI MsiDoActionA( MSIHANDLE hInstall, LPCSTR szAction )
{
LPWSTR szwAction;
UINT rc;
TRACE(" exteral attempt at action %s\n",szAction);
UINT ret;
if (!szAction)
return ERROR_FUNCTION_FAILED;
if (hInstall == 0)
return ERROR_FUNCTION_FAILED;
TRACE("%s\n", debugstr_a(szAction));
szwAction = strdupAtoW(szAction);
if (!szwAction)
if (szAction && !szwAction)
return ERROR_FUNCTION_FAILED;
rc = MsiDoActionW(hInstall, szwAction);
HeapFree(GetProcessHeap(),0,szwAction);
return rc;
ret = MsiDoActionW( hInstall, szwAction );
HeapFree( GetProcessHeap(), 0, szwAction );
return ret;
}
/***********************************************************************
......@@ -67,16 +60,20 @@ UINT WINAPI MsiDoActionA( MSIHANDLE hInstall, LPCSTR szAction )
UINT WINAPI MsiDoActionW( MSIHANDLE hInstall, LPCWSTR szAction )
{
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;
}
......
......@@ -272,9 +272,33 @@ static void test_getsourcepath( void )
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)
{
test_createpackage();
test_getsourcepath_bad();
test_getsourcepath();
test_doaction();
}
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