https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0d762dcba31c9dce9fc03…
commit 0d762dcba31c9dce9fc035e93b411248f3de80be
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sat Mar 12 16:34:06 2022 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sun Mar 20 19:27:54 2022 +0100
[WINESYNC] msi: Store the current script in the package.
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id 756bbb5bb756d1fcbeea41e10a6fdf2149fa1323 by Zebediah Figura
<z.figura12(a)gmail.com>
---
dll/win32/msi/action.c | 25 +++++++++++++++----------
dll/win32/msi/custom.c | 4 ++--
dll/win32/msi/dialog.c | 2 +-
dll/win32/msi/install.c | 2 +-
dll/win32/msi/msi.c | 6 +++---
dll/win32/msi/msipriv.h | 5 +++--
dll/win32/msi/package.c | 1 +
7 files changed, 26 insertions(+), 19 deletions(-)
diff --git a/dll/win32/msi/action.c b/dll/win32/msi/action.c
index e5633821af0..bca9dbfd66d 100644
--- a/dll/win32/msi/action.c
+++ b/dll/win32/msi/action.c
@@ -517,7 +517,7 @@ static UINT ITERATE_Actions(MSIRECORD *row, LPVOID param)
return ERROR_SUCCESS;
}
- rc = ACTION_PerformAction(package, action, SCRIPT_NONE);
+ rc = ACTION_PerformAction(package, action);
msi_dialog_check_messages( NULL );
@@ -611,7 +611,7 @@ static UINT ACTION_ProcessUISequence(MSIPACKAGE *package)
/********************************************************
* ACTION helper functions and functions that perform the actions
*******************************************************/
-static UINT ACTION_HandleCustomAction(MSIPACKAGE *package, LPCWSTR action, UINT script)
+static UINT ACTION_HandleCustomAction(MSIPACKAGE *package, LPCWSTR action)
{
UINT arc;
INT uirc;
@@ -620,7 +620,7 @@ static UINT ACTION_HandleCustomAction(MSIPACKAGE *package, LPCWSTR
action, UINT
if (uirc == IDCANCEL)
return ERROR_INSTALL_USEREXIT;
ui_actioninfo(package, action, TRUE, 0);
- arc = ACTION_CustomAction( package, action, script );
+ arc = ACTION_CustomAction(package, action);
uirc = !arc;
if (arc == ERROR_FUNCTION_NOT_CALLED && needs_ui_sequence(package))
@@ -1553,11 +1553,13 @@ static UINT execute_script( MSIPACKAGE *package, UINT script )
TRACE("executing script %u\n", script);
+ package->script = script;
+
if (script == SCRIPT_ROLLBACK)
{
for (i = package->script_actions_count[script]; i > 0; i--)
{
- rc = ACTION_PerformAction(package, package->script_actions[script][i-1],
script);
+ rc = ACTION_PerformAction(package, package->script_actions[script][i-1]);
if (rc != ERROR_SUCCESS)
{
ERR("Execution of script %i halted; action %s returned %u\n",
@@ -1570,7 +1572,7 @@ static UINT execute_script( MSIPACKAGE *package, UINT script )
{
for (i = 0; i < package->script_actions_count[script]; i++)
{
- rc = ACTION_PerformAction(package, package->script_actions[script][i],
script);
+ rc = ACTION_PerformAction(package, package->script_actions[script][i]);
if (rc != ERROR_SUCCESS)
{
ERR("Execution of script %i halted; action %s returned %u\n",
@@ -1579,6 +1581,9 @@ static UINT execute_script( MSIPACKAGE *package, UINT script )
}
}
}
+
+ package->script = SCRIPT_NONE;
+
msi_free_action_script(package, script);
return rc;
}
@@ -5686,7 +5691,7 @@ static UINT ACTION_ExecuteAction(MSIPACKAGE *package)
msiobj_release(&uirow->hdr);
}
else
- rc = ACTION_PerformAction(package, action, SCRIPT_NONE);
+ rc = ACTION_PerformAction(package, action);
/* Send all set properties. */
if (!MSI_OpenQuery(package->db, &view, prop_query))
@@ -7937,7 +7942,7 @@ static UINT ACTION_HandleStandardAction(MSIPACKAGE *package, LPCWSTR
action)
return rc;
}
-UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, UINT script)
+UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action)
{
UINT rc;
@@ -7947,7 +7952,7 @@ UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action,
UINT script)
rc = ACTION_HandleStandardAction(package, action);
if (rc == ERROR_FUNCTION_NOT_CALLED)
- rc = ACTION_HandleCustomAction(package, action, script);
+ rc = ACTION_HandleCustomAction(package, action);
if (rc == ERROR_FUNCTION_NOT_CALLED)
WARN("unhandled msi action %s\n", debugstr_w(action));
@@ -8000,7 +8005,7 @@ static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT
seq)
return ERROR_FUNCTION_FAILED;
}
- rc = ACTION_PerformAction(package, action, SCRIPT_NONE);
+ rc = ACTION_PerformAction(package, action);
msiobj_release(&row->hdr);
}
@@ -8128,7 +8133,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR
szPackagePath,
msi_set_property( package->db, szRollbackDisabled, szOne, -1 );
}
- rc = ACTION_PerformAction(package, action, SCRIPT_NONE);
+ rc = ACTION_PerformAction(package, action);
/* process the ending type action */
if (rc == ERROR_SUCCESS)
diff --git a/dll/win32/msi/custom.c b/dll/win32/msi/custom.c
index 3e96aee62c0..6ffc27aa4ba 100644
--- a/dll/win32/msi/custom.c
+++ b/dll/win32/msi/custom.c
@@ -1209,7 +1209,7 @@ static UINT defer_custom_action( MSIPACKAGE *package, const WCHAR
*action, UINT
return ERROR_SUCCESS;
}
-UINT ACTION_CustomAction( MSIPACKAGE *package, LPCWSTR action, UINT script )
+UINT ACTION_CustomAction(MSIPACKAGE *package, const WCHAR *action)
{
static const WCHAR query[] = {
'S','E','L','E','C','T','
','*',' ','F','R','O','M','
',
@@ -1249,7 +1249,7 @@ UINT ACTION_CustomAction( MSIPACKAGE *package, LPCWSTR action, UINT
script )
if (type & msidbCustomActionTypeNoImpersonate)
WARN("msidbCustomActionTypeNoImpersonate not handled\n");
- if (!action_type_matches_script( type, script ))
+ if (!action_type_matches_script(type, package->script))
{
rc = defer_custom_action( package, action, type );
goto end;
diff --git a/dll/win32/msi/dialog.c b/dll/win32/msi/dialog.c
index 32414f1c65b..3f2ddc36d6f 100644
--- a/dll/win32/msi/dialog.c
+++ b/dll/win32/msi/dialog.c
@@ -4380,7 +4380,7 @@ static UINT event_spawn_wait_dialog( msi_dialog *dialog, const WCHAR
*argument )
static UINT event_do_action( msi_dialog *dialog, const WCHAR *argument )
{
- ACTION_PerformAction( dialog->package, argument, SCRIPT_NONE );
+ ACTION_PerformAction(dialog->package, argument);
return ERROR_SUCCESS;
}
diff --git a/dll/win32/msi/install.c b/dll/win32/msi/install.c
index 80e535304ff..5a149d74599 100644
--- a/dll/win32/msi/install.c
+++ b/dll/win32/msi/install.c
@@ -83,7 +83,7 @@ UINT WINAPI MsiDoActionW( MSIHANDLE hInstall, LPCWSTR szAction )
return remote_DoAction(remote, szAction);
}
- ret = ACTION_PerformAction( package, szAction, SCRIPT_NONE );
+ ret = ACTION_PerformAction(package, szAction);
msiobj_release( &package->hdr );
return ret;
diff --git a/dll/win32/msi/msi.c b/dll/win32/msi/msi.c
index b53c2241e43..734246930ce 100644
--- a/dll/win32/msi/msi.c
+++ b/dll/win32/msi/msi.c
@@ -3742,7 +3742,7 @@ UINT WINAPI MsiCollectUserInfoW(LPCWSTR szProduct)
if (!package)
return ERROR_CALL_NOT_IMPLEMENTED;
- rc = ACTION_PerformAction(package, szFirstRun, SCRIPT_NONE);
+ rc = ACTION_PerformAction(package, szFirstRun);
msiobj_release( &package->hdr );
MsiCloseHandle(handle);
@@ -3768,7 +3768,7 @@ UINT WINAPI MsiCollectUserInfoA(LPCSTR szProduct)
if (!package)
return ERROR_CALL_NOT_IMPLEMENTED;
- rc = ACTION_PerformAction(package, szFirstRun, SCRIPT_NONE);
+ rc = ACTION_PerformAction(package, szFirstRun);
msiobj_release( &package->hdr );
MsiCloseHandle(handle);
@@ -3849,7 +3849,7 @@ UINT WINAPI MsiConfigureFeatureW(LPCWSTR szProduct, LPCWSTR
szFeature, INSTALLST
MsiSetInternalUI( INSTALLUILEVEL_BASIC, NULL );
- r = ACTION_PerformAction( package, szCostInitialize, SCRIPT_NONE );
+ r = ACTION_PerformAction(package, szCostInitialize);
if (r != ERROR_SUCCESS)
goto end;
diff --git a/dll/win32/msi/msipriv.h b/dll/win32/msi/msipriv.h
index 95f46d070a6..1f1ebeae680 100644
--- a/dll/win32/msi/msipriv.h
+++ b/dll/win32/msi/msipriv.h
@@ -414,6 +414,7 @@ typedef struct tagMSIPACKAGE
struct list mimes;
struct list appids;
+ enum script script;
LPWSTR *script_actions[SCRIPT_MAX];
int script_actions_count[SCRIPT_MAX];
LPWSTR *unique_actions;
@@ -976,9 +977,9 @@ extern WCHAR *gszLogFile DECLSPEC_HIDDEN;
extern HINSTANCE msi_hInstance DECLSPEC_HIDDEN;
/* action related functions */
-extern UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, UINT script)
DECLSPEC_HIDDEN;
+extern UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action)
DECLSPEC_HIDDEN;
extern void ACTION_FinishCustomActions( const MSIPACKAGE* package) DECLSPEC_HIDDEN;
-extern UINT ACTION_CustomAction(MSIPACKAGE *, const WCHAR *, UINT) DECLSPEC_HIDDEN;
+extern UINT ACTION_CustomAction(MSIPACKAGE *package, const WCHAR *action)
DECLSPEC_HIDDEN;
/* actions in other modules */
extern UINT ACTION_AppSearch(MSIPACKAGE *package) DECLSPEC_HIDDEN;
diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c
index b42158c6c02..858f835e2bb 100644
--- a/dll/win32/msi/package.c
+++ b/dll/win32/msi/package.c
@@ -1119,6 +1119,7 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db )
msi_load_admin_properties( package );
package->log_file = INVALID_HANDLE_VALUE;
+ package->script = SCRIPT_NONE;
}
return package;
}