Module: wine Branch: master Commit: c83b8e0a16b496144e99266d745db22c67d69ceb URL: http://source.winehq.org/git/wine.git/?a=commit;h=c83b8e0a16b496144e99266d74...
Author: Zebediah Figura z.figura12@gmail.com Date: Wed Jul 5 23:31:51 2017 -0500
msi/tests: Work around test failures on Windows.
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
---
dlls/msi/tests/package.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c index 58e932f..291bcb2 100644 --- a/dlls/msi/tests/package.c +++ b/dlls/msi/tests/package.c @@ -9335,6 +9335,18 @@ static const struct externalui_message closehandle_sequence[] = { {0} };
+static INT CALLBACK externalui_message_string_callback(void *context, UINT message, LPCSTR string) +{ + struct externalui_message msg; + + msg.message = message; + msg.field_count = 0; + strcpy(msg.field[0], string); + add_message(&msg); + + return 1; +} + static INT CALLBACK externalui_message_callback(void *context, UINT message, MSIHANDLE hrecord) { struct externalui_message msg; @@ -9343,12 +9355,19 @@ static INT CALLBACK externalui_message_callback(void *context, UINT message, MSI int i;
msg.message = message; + if (message == INSTALLMESSAGE_TERMINATE) + { + /* trying to access the record seems to hang on some versions of Windows */ + msg.field_count = -1; + add_message(&msg); + return 1; + } msg.field_count = MsiRecordGetFieldCount(hrecord); for (i = 0; i <= msg.field_count; i++) { length = 100; MsiRecordGetStringA(hrecord, i, buffer, &length); - memcpy(msg.field[i], buffer, length+1); + memcpy(msg.field[i], buffer, min(100, length+1)); }
add_message(&msg); @@ -9361,11 +9380,12 @@ static void test_externalui_message(void) /* test that events trigger the correct sequence of messages */
INSTALLUI_HANDLER_RECORD prev; - const struct externalui_message *sequence = NULL; MSIHANDLE hdb, hpkg; UINT r;
- r = pMsiSetExternalUIRecord(externalui_message_callback, 0xffffffff ^ INSTALLLOGMODE_PROGRESS, &sequence, &prev); + /* processing SHOWDIALOG with a record handler causes a crash on XP */ + MsiSetExternalUIA(externalui_message_string_callback, INSTALLLOGMODE_SHOWDIALOG, NULL); + r = pMsiSetExternalUIRecord(externalui_message_callback, 0xffffffff ^ INSTALLLOGMODE_PROGRESS ^ INSTALLLOGMODE_SHOWDIALOG, NULL, &prev);
flush_sequence();
@@ -9401,7 +9421,7 @@ static void test_externalui_message(void) ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok_sequence(doaction_costinitialize_sequence, "MsiDoAction("CostInitialize")", TRUE);
- /* Test a standard action */ + /* Test a custom action */ r = MsiDoActionA(hpkg, "custom"); ok(r == ERROR_FUNCTION_NOT_CALLED, "Expected ERROR_FUNCTION_NOT_CALLED, got %d\n", r); ok_sequence(doaction_custom_sequence, "MsiDoAction("custom")", FALSE);