From 72c4091cef278b10423d151560f330c579e5ee56 Mon Sep 17 00:00:00 2001 From: winesync Date: Sun, 13 Mar 2022 01:19:31 +0100 Subject: [PATCH] [WINESYNC] msi: Return MSIDBSTATE_ERROR when MsiGetDatabaseState() is called from a custom action. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46812 Signed-off-by: Zebediah Figura Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard wine commit id 60b1fd7e8764ab63d79382c1805d4c007a6be332 by Zebediah Figura --- dll/win32/msi/database.c | 12 ++---------- modules/rostests/winetests/msi/custom.c | 4 ++-- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/dll/win32/msi/database.c b/dll/win32/msi/database.c index 8e2d1bcf035..19926619225 100644 --- a/dll/win32/msi/database.c +++ b/dll/win32/msi/database.c @@ -1993,16 +1993,8 @@ MSIDBSTATE WINAPI MsiGetDatabaseState( MSIHANDLE handle ) TRACE("%d\n", handle); - db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE ); - if( !db ) - { - MSIHANDLE remote_database = msi_get_remote(handle); - if ( !remote_database ) - return MSIDBSTATE_ERROR; - - WARN("MsiGetDatabaseState not allowed during a custom action!\n"); - return MSIDBSTATE_READ; - } + if (!(db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE ))) + return MSIDBSTATE_ERROR; if (db->mode != MSIDBOPEN_READONLY ) ret = MSIDBSTATE_WRITE; diff --git a/modules/rostests/winetests/msi/custom.c b/modules/rostests/winetests/msi/custom.c index 6ae5bfc30a9..9e9e2bf938a 100644 --- a/modules/rostests/winetests/msi/custom.c +++ b/modules/rostests/winetests/msi/custom.c @@ -1119,7 +1119,7 @@ static void test_invalid_functions(MSIHANDLE hinst) UINT r; r = MsiGetDatabaseState(hinst); - todo_wine ok(hinst, r == MSIDBSTATE_ERROR, "got %u\n", r); + ok(hinst, r == MSIDBSTATE_ERROR, "got %u\n", r); db = MsiGetActiveDatabase(hinst); ok(hinst, db, "MsiGetActiveDatabase failed\n"); @@ -1147,7 +1147,7 @@ static void test_invalid_functions(MSIHANDLE hinst) ok(hinst, r == ERROR_INVALID_HANDLE, "got %u\n", r); r = MsiGetDatabaseState(db); - todo_wine ok(hinst, r == MSIDBSTATE_ERROR, "got %u\n", r); + ok(hinst, r == MSIDBSTATE_ERROR, "got %u\n", r); r = MsiEnableUIPreview(db, &preview); todo_wine ok(hinst, r == ERROR_INVALID_HANDLE, "got %u\n", r);