[PATCH 1/5] msi/tests: Work around test failures on Windows.
Zebediah Figura
z.figura12 at gmail.com
Wed Jul 5 23:31:51 CDT 2017
These failures seem to be due to bugs in (early versions of) MSI.
They occur even with very simple programs I tested, and the application
these patches work towards supporting seems to explicitly work around
them in much the same way as this patch does.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
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 a46bb20..44d5513 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);
--
2.7.4
More information about the wine-patches
mailing list