Commit 808343fb authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Implement MsiSetExternalUIRecord.

parent 90fa4fe1
......@@ -77,7 +77,7 @@ static UINT msi_change_media(MSIPACKAGE *package, MSIMEDIAINFO *mi)
static const WCHAR error_prop[] = {'E','r','r','o','r','D','i','a','l','o','g',0};
if ((msi_get_property_int(package, szUILevel, 0) & INSTALLUILEVEL_MASK) ==
INSTALLUILEVEL_NONE && !gUIHandlerA && !gUIHandlerW)
INSTALLUILEVEL_NONE && !gUIHandlerA && !gUIHandlerW && !gUIHandlerRecord)
return ERROR_SUCCESS;
error = generate_error_string(package, 1302, 1, mi->disk_prompt);
......@@ -98,6 +98,13 @@ static UINT msi_change_media(MSIPACKAGE *package, MSIMEDIAINFO *mi)
gUIHandlerA(gUIContext, MB_RETRYCANCEL | INSTALLMESSAGE_ERROR, msg);
msi_free(msg);
}
else if (gUIHandlerRecord)
{
MSIHANDLE rec = MsiCreateRecord(1);
MsiRecordSetStringW(rec, 0, error);
gUIHandlerRecord(gUIContext, MB_RETRYCANCEL | INSTALLMESSAGE_ERROR, rec);
MsiCloseHandle(rec);
}
}
msi_free(error);
......
......@@ -3595,13 +3595,20 @@ UINT WINAPI MsiIsProductElevatedA( LPCSTR szProduct, BOOL *pfElevated )
/***********************************************************************
* MsiSetExternalUIRecord [MSI.@]
*/
UINT WINAPI MsiSetExternalUIRecord( INSTALLUI_HANDLER_RECORD puiHandler,
DWORD dwMessageFilter, LPVOID pvContext,
PINSTALLUI_HANDLER_RECORD ppuiPrevHandler)
UINT WINAPI MsiSetExternalUIRecord( INSTALLUI_HANDLER_RECORD handler,
DWORD filter, LPVOID context,
PINSTALLUI_HANDLER_RECORD prev )
{
FIXME("%p %08x %p %p\n", puiHandler, dwMessageFilter ,pvContext,
ppuiPrevHandler);
return ERROR_CALL_NOT_IMPLEMENTED;
TRACE("%p %08x %p %p\n", handler, filter, context, prev);
if (prev)
*prev = gUIHandlerRecord;
gUIHandlerRecord = handler;
gUIFilter = filter;
gUIContext = context;
return ERROR_SUCCESS;
}
/***********************************************************************
......
......@@ -37,12 +37,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi);
static LONG dll_count;
/* the UI level */
INSTALLUILEVEL gUILevel = INSTALLUILEVEL_BASIC;
HWND gUIhwnd = 0;
INSTALLUI_HANDLERA gUIHandlerA = NULL;
INSTALLUI_HANDLERW gUIHandlerW = NULL;
DWORD gUIFilter = 0;
LPVOID gUIContext = NULL;
INSTALLUILEVEL gUILevel = INSTALLUILEVEL_BASIC;
HWND gUIhwnd = 0;
INSTALLUI_HANDLERA gUIHandlerA = NULL;
INSTALLUI_HANDLERW gUIHandlerW = NULL;
INSTALLUI_HANDLER_RECORD gUIHandlerRecord = NULL;
DWORD gUIFilter = 0;
LPVOID gUIContext = NULL;
WCHAR gszLogFile[MAX_PATH];
HINSTANCE msi_hInstance;
......
......@@ -843,6 +843,7 @@ extern INSTALLUILEVEL gUILevel;
extern HWND gUIhwnd;
extern INSTALLUI_HANDLERA gUIHandlerA;
extern INSTALLUI_HANDLERW gUIHandlerW;
extern INSTALLUI_HANDLER_RECORD gUIHandlerRecord;
extern DWORD gUIFilter;
extern LPVOID gUIContext;
extern WCHAR gszLogFile[MAX_PATH];
......
......@@ -1203,7 +1203,7 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType,
}
}
TRACE("%p %p %x %x %s\n", gUIHandlerA, gUIHandlerW,
TRACE("%p %p %p %x %x %s\n", gUIHandlerA, gUIHandlerW, gUIHandlerRecord,
gUIFilter, log_type, debugstr_w(message));
/* convert it to ASCII */
......@@ -1219,6 +1219,13 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType,
{
rc = gUIHandlerA( gUIContext, eMessageType, msg );
}
else if (gUIHandlerRecord && (gUIFilter & log_type))
{
MSIHANDLE rec = MsiCreateRecord( 1 );
MsiRecordSetStringW( rec, 0, message );
rc = gUIHandlerRecord( gUIContext, eMessageType, rec );
MsiCloseHandle( rec );
}
if ((!rc) && (gszLogFile[0]) && !((eMessageType & 0xff000000) ==
INSTALLMESSAGE_PROGRESS))
......
......@@ -6873,11 +6873,14 @@ static void test_file_in_use_cab(void)
INT CALLBACK handler_a(LPVOID context, UINT type, LPCSTR msg) { return IDOK; };
INT CALLBACK handler_w(LPVOID context, UINT type, LPCWSTR msg) { return IDOK; };
INT CALLBACK handler_record(LPVOID context, UINT type, MSIHANDLE record) { return IDOK; };
static void test_MsiSetExternalUI(void)
{
INSTALLUI_HANDLERA ret_a;
INSTALLUI_HANDLERW ret_w;
INSTALLUI_HANDLER_RECORD prev;
UINT error;
ret_a = MsiSetExternalUIA(handler_a, INSTALLLOGMODE_ERROR, NULL);
ok(ret_a == NULL, "expected NULL, got %p\n", ret_a);
......@@ -6885,6 +6888,15 @@ static void test_MsiSetExternalUI(void)
ret_a = MsiSetExternalUIA(NULL, 0, NULL);
ok(ret_a == handler_a, "expected %p, got %p\n", handler_a, ret_a);
error = MsiSetExternalUIRecord(handler_record, INSTALLLOGMODE_ERROR, NULL, &prev);
ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
ok(prev == NULL, "expected NULL, got %p\n", prev);
prev = (INSTALLUI_HANDLER_RECORD)0xdeadbeef;
error = MsiSetExternalUIRecord(NULL, INSTALLLOGMODE_ERROR, NULL, &prev);
ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
ok(prev == handler_record, "expected %p, got %p\n", handler_record, prev);
ret_w = MsiSetExternalUIW(handler_w, INSTALLLOGMODE_ERROR, NULL);
ok(ret_w == NULL, "expected NULL, got %p\n", ret_w);
......@@ -6897,11 +6909,27 @@ static void test_MsiSetExternalUI(void)
ret_w = MsiSetExternalUIW(handler_w, INSTALLLOGMODE_ERROR, NULL);
ok(ret_w == NULL, "expected NULL, got %p\n", ret_w);
prev = (INSTALLUI_HANDLER_RECORD)0xdeadbeef;
error = MsiSetExternalUIRecord(handler_record, INSTALLLOGMODE_ERROR, NULL, &prev);
ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
ok(prev == NULL, "expected NULL, got %p\n", prev);
ret_a = MsiSetExternalUIA(NULL, 0, NULL);
ok(ret_a == NULL, "expected NULL, got %p\n", ret_a);
ret_w = MsiSetExternalUIW(NULL, 0, NULL);
ok(ret_w == NULL, "expected NULL, got %p\n", ret_w);
prev = (INSTALLUI_HANDLER_RECORD)0xdeadbeef;
error = MsiSetExternalUIRecord(NULL, 0, NULL, &prev);
ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
ok(prev == handler_record, "expected %p, got %p\n", handler_record, prev);
error = MsiSetExternalUIRecord(handler_record, INSTALLLOGMODE_ERROR, NULL, NULL);
ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
error = MsiSetExternalUIRecord(NULL, 0, NULL, NULL);
ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
}
START_TEST(install)
......
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