Commit bcc4a047 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

msi: Implement INSTALLMESSAGE_INITIALIZE and INSTALLMESSAGE_TERMINATE.

parent a388906a
...@@ -352,6 +352,7 @@ static void MSI_FreePackage( MSIOBJECTHDR *arg) ...@@ -352,6 +352,7 @@ static void MSI_FreePackage( MSIOBJECTHDR *arg)
if (package->delete_on_close) DeleteFileW( package->localfile ); if (package->delete_on_close) DeleteFileW( package->localfile );
msi_free( package->localfile ); msi_free( package->localfile );
MSI_ProcessMessage(NULL, INSTALLMESSAGE_TERMINATE, 0);
} }
static UINT create_temp_property_table(MSIPACKAGE *package) static UINT create_temp_property_table(MSIPACKAGE *package)
...@@ -1477,6 +1478,8 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage) ...@@ -1477,6 +1478,8 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
TRACE("%s %p\n", debugstr_w(szPackage), pPackage); TRACE("%s %p\n", debugstr_w(szPackage), pPackage);
MSI_ProcessMessage(NULL, INSTALLMESSAGE_INITIALIZE, 0);
localfile[0] = 0; localfile[0] = 0;
if( szPackage[0] == '#' ) if( szPackage[0] == '#' )
{ {
...@@ -1638,6 +1641,8 @@ UINT WINAPI MsiOpenPackageExW(LPCWSTR szPackage, DWORD dwOptions, MSIHANDLE *phP ...@@ -1638,6 +1641,8 @@ UINT WINAPI MsiOpenPackageExW(LPCWSTR szPackage, DWORD dwOptions, MSIHANDLE *phP
ret = ERROR_NOT_ENOUGH_MEMORY; ret = ERROR_NOT_ENOUGH_MEMORY;
msiobj_release( &package->hdr ); msiobj_release( &package->hdr );
} }
else
MSI_ProcessMessage(NULL, INSTALLMESSAGE_TERMINATE, 0);
return ret; return ret;
} }
...@@ -1787,13 +1792,17 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIREC ...@@ -1787,13 +1792,17 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIREC
msi_free(template); msi_free(template);
} }
res = MSI_FormatRecordW(package, record, message, &len); if (!package || !record)
if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) message = NULL;
return res; else {
len++; res = MSI_FormatRecordW(package, record, message, &len);
message = msi_alloc(len * sizeof(WCHAR)); if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA)
if (!message) return ERROR_OUTOFMEMORY; return res;
MSI_FormatRecordW(package, record, message, &len); len++;
message = msi_alloc(len * sizeof(WCHAR));
if (!message) return ERROR_OUTOFMEMORY;
MSI_FormatRecordW(package, record, message, &len);
}
/* convert it to ASCII */ /* convert it to ASCII */
len = WideCharToMultiByte( CP_ACP, 0, message, -1, NULL, 0, NULL, NULL ); len = WideCharToMultiByte( CP_ACP, 0, message, -1, NULL, 0, NULL, NULL );
...@@ -1821,7 +1830,7 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIREC ...@@ -1821,7 +1830,7 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIREC
rc = gUIHandlerA( gUIContext, eMessageType, msg ); rc = gUIHandlerA( gUIContext, eMessageType, msg );
} }
if (!rc && package->log_file != INVALID_HANDLE_VALUE && if (!rc && package && package->log_file != INVALID_HANDLE_VALUE &&
(eMessageType & 0xff000000) != INSTALLMESSAGE_PROGRESS) (eMessageType & 0xff000000) != INSTALLMESSAGE_PROGRESS)
{ {
DWORD written; DWORD written;
...@@ -1883,6 +1892,10 @@ INT WINAPI MsiProcessMessage( MSIHANDLE hInstall, INSTALLMESSAGE eMessageType, ...@@ -1883,6 +1892,10 @@ INT WINAPI MsiProcessMessage( MSIHANDLE hInstall, INSTALLMESSAGE eMessageType,
MSIPACKAGE *package = NULL; MSIPACKAGE *package = NULL;
MSIRECORD *record = NULL; MSIRECORD *record = NULL;
if ((eMessageType & 0xff000000) == INSTALLMESSAGE_INITIALIZE ||
(eMessageType & 0xff000000) == INSTALLMESSAGE_TERMINATE)
return -1;
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
if( !package ) if( !package )
{ {
......
...@@ -2782,6 +2782,9 @@ static void test_processmessage(void) ...@@ -2782,6 +2782,9 @@ static void test_processmessage(void)
todo_wine todo_wine
ok( r == IDOK, "expected IDOK, got %i\n", r); ok( r == IDOK, "expected IDOK, got %i\n", r);
r = MsiProcessMessage(package, INSTALLMESSAGE_INITIALIZE, hrec);
ok( r == -1, "expected -1, got %i\n", r);
MsiCloseHandle(hrec); MsiCloseHandle(hrec);
MsiCloseHandle(package); MsiCloseHandle(package);
......
...@@ -9384,7 +9384,7 @@ static void test_externalui_message(void) ...@@ -9384,7 +9384,7 @@ static void test_externalui_message(void)
r = MsiOpenPackageA("nonexistent", &hpkg); r = MsiOpenPackageA("nonexistent", &hpkg);
ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r); ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
ok_sequence(openpackage_nonexistent_sequence, "MsiOpenPackage with nonexistent db", TRUE); ok_sequence(openpackage_nonexistent_sequence, "MsiOpenPackage with nonexistent db", FALSE);
r = package_from_db(hdb, &hpkg); r = package_from_db(hdb, &hpkg);
if (r == ERROR_INSTALL_PACKAGE_REJECTED) if (r == ERROR_INSTALL_PACKAGE_REJECTED)
...@@ -9408,7 +9408,7 @@ static void test_externalui_message(void) ...@@ -9408,7 +9408,7 @@ static void test_externalui_message(void)
/* close the package */ /* close the package */
MsiCloseHandle(hpkg); MsiCloseHandle(hpkg);
ok_sequence(closehandle_sequence, "MsiCloseHandle()", TRUE); ok_sequence(closehandle_sequence, "MsiCloseHandle()", FALSE);
CoUninitialize(); CoUninitialize();
DeleteFileA(msifile); DeleteFileA(msifile);
......
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