msi/tests: Add a test for creating MTA objects from a custom action.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
6dcb3dabd4
commit
77e6bd13b6
|
@ -1,7 +1,7 @@
|
||||||
TESTDLL = msi.dll
|
TESTDLL = msi.dll
|
||||||
IMPORTS = cabinet msi shell32 ole32 oleaut32 user32 advapi32 version
|
IMPORTS = cabinet msi shell32 ole32 oleaut32 user32 advapi32 version
|
||||||
|
|
||||||
custom_IMPORTS = msi
|
custom_IMPORTS = uuid msi ole32
|
||||||
|
|
||||||
SOURCES = \
|
SOURCES = \
|
||||||
action.c \
|
action.c \
|
||||||
|
|
|
@ -23,9 +23,51 @@
|
||||||
|
|
||||||
#include <windef.h>
|
#include <windef.h>
|
||||||
#include <winbase.h>
|
#include <winbase.h>
|
||||||
|
#define COBJMACROS
|
||||||
|
#include <objbase.h>
|
||||||
|
#include <unknwn.h>
|
||||||
#include <msi.h>
|
#include <msi.h>
|
||||||
#include <msiquery.h>
|
#include <msiquery.h>
|
||||||
|
|
||||||
|
static void ok_(MSIHANDLE hinst, int todo, const char *file, int line, int condition, const char *msg, ...)
|
||||||
|
{
|
||||||
|
static char buffer[2000];
|
||||||
|
MSIHANDLE record;
|
||||||
|
va_list valist;
|
||||||
|
|
||||||
|
va_start(valist, msg);
|
||||||
|
vsprintf(buffer, msg, valist);
|
||||||
|
va_end(valist);
|
||||||
|
|
||||||
|
record = MsiCreateRecord(5);
|
||||||
|
MsiRecordSetInteger(record, 1, todo);
|
||||||
|
MsiRecordSetStringA(record, 2, file);
|
||||||
|
MsiRecordSetInteger(record, 3, line);
|
||||||
|
MsiRecordSetInteger(record, 4, condition);
|
||||||
|
MsiRecordSetStringA(record, 5, buffer);
|
||||||
|
MsiProcessMessage(hinst, INSTALLMESSAGE_USER, record);
|
||||||
|
MsiCloseHandle(record);
|
||||||
|
}
|
||||||
|
#define ok(hinst, condition, ...) ok_(hinst, 0, __FILE__, __LINE__, condition, __VA_ARGS__)
|
||||||
|
#define todo_wine_ok(hinst, condition, ...) ok_(hinst, 1, __FILE__, __LINE__, condition, __VA_ARGS__)
|
||||||
|
|
||||||
|
|
||||||
|
/* Main test. Anything that doesn't depend on a specific install configuration
|
||||||
|
* or have undesired side effects should go here. */
|
||||||
|
UINT WINAPI main_test(MSIHANDLE hinst)
|
||||||
|
{
|
||||||
|
IUnknown *unk = NULL;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
/* Test for an MTA apartment */
|
||||||
|
hres = CoCreateInstance(&CLSID_Picture_Metafile, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
|
||||||
|
todo_wine_ok(hinst, hres == S_OK, "CoCreateInstance failed with %08x\n", hres);
|
||||||
|
|
||||||
|
if (unk) IUnknown_Release(unk);
|
||||||
|
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
UINT WINAPI test_retval(MSIHANDLE hinst)
|
UINT WINAPI test_retval(MSIHANDLE hinst)
|
||||||
{
|
{
|
||||||
char prop[10];
|
char prop[10];
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
|
@ stdcall main_test(long)
|
||||||
@ stdcall test_retval(long)
|
@ stdcall test_retval(long)
|
||||||
|
|
|
@ -695,11 +695,13 @@ static const CHAR wrv_component_dat[] = "Component\tComponentId\tDirectory_\tAtt
|
||||||
static const CHAR ca1_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
|
static const CHAR ca1_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
|
||||||
"s72\tS255\tI2\n"
|
"s72\tS255\tI2\n"
|
||||||
"InstallExecuteSequence\tAction\n"
|
"InstallExecuteSequence\tAction\n"
|
||||||
"testretval\t\t710\n";
|
"maintest\tMAIN_TEST\t700\n"
|
||||||
|
"testretval\tTEST_RETVAL\t710\n";
|
||||||
|
|
||||||
static const CHAR ca1_custom_action_dat[] = "Action\tType\tSource\tTarget\n"
|
static const CHAR ca1_custom_action_dat[] = "Action\tType\tSource\tTarget\n"
|
||||||
"s72\ti2\tS64\tS0\n"
|
"s72\ti2\tS64\tS0\n"
|
||||||
"CustomAction\tAction\n"
|
"CustomAction\tAction\n"
|
||||||
|
"maintest\t1\tcustom.dll\tmain_test\n"
|
||||||
"testretval\t1\tcustom.dll\ttest_retval\n";
|
"testretval\t1\tcustom.dll\ttest_retval\n";
|
||||||
|
|
||||||
static const CHAR ca51_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
|
static const CHAR ca51_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
|
||||||
|
@ -4081,6 +4083,27 @@ static void add_custom_dll(void)
|
||||||
MsiCloseHandle(hdb);
|
MsiCloseHandle(hdb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static INT CALLBACK ok_callback(void *context, UINT message_type, MSIHANDLE record)
|
||||||
|
{
|
||||||
|
if (message_type == INSTALLMESSAGE_USER)
|
||||||
|
{
|
||||||
|
char file[200];
|
||||||
|
char msg[2000];
|
||||||
|
DWORD len;
|
||||||
|
|
||||||
|
len = sizeof(file);
|
||||||
|
MsiRecordGetStringA(record, 2, file, &len);
|
||||||
|
len = sizeof(msg);
|
||||||
|
MsiRecordGetStringA(record, 5, msg, &len);
|
||||||
|
|
||||||
|
todo_wine_if(MsiRecordGetInteger(record, 1))
|
||||||
|
ok_(file, MsiRecordGetInteger(record, 3)) (MsiRecordGetInteger(record, 4), "%s", msg);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void test_customaction1(void)
|
static void test_customaction1(void)
|
||||||
{
|
{
|
||||||
UINT r;
|
UINT r;
|
||||||
|
@ -4090,6 +4113,10 @@ static void test_customaction1(void)
|
||||||
|
|
||||||
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
|
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
|
||||||
|
|
||||||
|
r = MsiInstallProductA(msifile, "MAIN_TEST=1");
|
||||||
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
|
||||||
|
|
||||||
|
/* Test return values */
|
||||||
r = MsiInstallProductA(msifile, "TEST_RETVAL=0");
|
r = MsiInstallProductA(msifile, "TEST_RETVAL=0");
|
||||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
|
||||||
|
|
||||||
|
@ -6083,6 +6110,7 @@ START_TEST(install)
|
||||||
MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0);
|
MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0);
|
||||||
|
|
||||||
customdll = load_resource("custom.dll");
|
customdll = load_resource("custom.dll");
|
||||||
|
MsiSetExternalUIRecord(ok_callback, INSTALLLOGMODE_USER, NULL, NULL);
|
||||||
|
|
||||||
if (pSRSetRestorePointA) /* test has side-effects on win2k3 that cause failures in following tests */
|
if (pSRSetRestorePointA) /* test has side-effects on win2k3 that cause failures in following tests */
|
||||||
test_MsiInstallProduct();
|
test_MsiInstallProduct();
|
||||||
|
|
Loading…
Reference in New Issue