From d34b1c23a2b911b5d9ce7a5d83e9a8d471e649e2 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Wed, 21 Sep 2005 10:55:23 +0000 Subject: [PATCH] Implement MsiSequenceA/W. --- dlls/msi/action.c | 34 ++++++++++++++++++++++++++++++++++ dlls/msi/install.c | 33 +++++++++++++++++++++++++++------ dlls/msi/msipriv.h | 1 + 3 files changed, 62 insertions(+), 6 deletions(-) diff --git a/dlls/msi/action.c b/dlls/msi/action.c index 5eec261cd7c..f5c0068dc47 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -690,6 +690,40 @@ static UINT ITERATE_Actions(MSIRECORD *row, LPVOID param) return rc; } +UINT MSI_Sequence( MSIPACKAGE *package, LPCWSTR szTable, INT iSequenceMode ) +{ + MSIQUERY * view; + UINT r; + static const WCHAR query[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', + '`','%','s','`', + ' ','W','H','E','R','E',' ', + '`','S','e','q','u','e','n','c','e','`',' ', + '>',' ','0',' ','O','R','D','E','R',' ','B','Y',' ', + '`','S','e','q','u','e','n','c','e','`',0}; + iterate_action_param iap; + + /* + * FIXME: probably should be checking UILevel in the + * ACTION_PerformUIAction/ACTION_PerformAction + * rather than saving the UI level here. Those + * two functions can be merged too. + */ + iap.package = package; + iap.UI = TRUE; + + TRACE("%p %s %i\n", package, debugstr_w(szTable), iSequenceMode ); + + r = MSI_OpenQuery( package->db, &view, query, szTable ); + if (r == ERROR_SUCCESS) + { + r = MSI_IterateRecords( view, NULL, ITERATE_Actions, &iap ); + msiobj_release(&view->hdr); + } + + return r; +} + static UINT ACTION_ProcessExecSequence(MSIPACKAGE *package, BOOL UIran) { MSIQUERY * view; diff --git a/dlls/msi/install.c b/dlls/msi/install.c index a73e0b347a1..2098cb2fc14 100644 --- a/dlls/msi/install.c +++ b/dlls/msi/install.c @@ -80,19 +80,40 @@ UINT WINAPI MsiDoActionW( MSIHANDLE hInstall, LPCWSTR szAction ) /*********************************************************************** * MsiSequenceA (MSI.@) */ -UINT WINAPI MsiSequenceA( MSIHANDLE hInstall, LPCSTR szAction, INT iSequenceMode ) +UINT WINAPI MsiSequenceA( MSIHANDLE hInstall, LPCSTR szTable, INT iSequenceMode ) { - TRACE("%s\n", debugstr_a(szAction)); - return ERROR_CALL_NOT_IMPLEMENTED; + LPWSTR szwTable; + UINT ret; + + TRACE("%s\n", debugstr_a(szTable)); + + szwTable = strdupAtoW(szTable); + if (szTable && !szwTable) + return ERROR_FUNCTION_FAILED; + + ret = MsiSequenceW( hInstall, szwTable, iSequenceMode ); + msi_free( szwTable ); + return ret; } /*********************************************************************** * MsiSequenceW (MSI.@) */ -UINT WINAPI MsiSequenceW( MSIHANDLE hInstall, LPCWSTR szAction, INT iSequenceMode ) +UINT WINAPI MsiSequenceW( MSIHANDLE hInstall, LPCWSTR szTable, INT iSequenceMode ) { - TRACE("%s\n", debugstr_w(szAction)); - return ERROR_CALL_NOT_IMPLEMENTED; + MSIPACKAGE *package; + UINT ret; + + TRACE("%s\n", debugstr_w(szTable)); + + package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); + if (!package) + return ERROR_INVALID_HANDLE; + + ret = MSI_Sequence( package, szTable, iSequenceMode ); + msiobj_release( &package->hdr ); + + return ret; } static UINT msi_strcpy_to_awstring( LPCWSTR str, awstring *awbuf, DWORD *sz ) diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index 995afe822da..4304ad8f5bc 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -305,6 +305,7 @@ extern UINT read_raw_stream_data( MSIDATABASE*, LPCWSTR stname, extern UINT ACTION_DoTopLevelINSTALL( MSIPACKAGE *, LPCWSTR, LPCWSTR, LPCWSTR ); extern void ACTION_free_package_structures( MSIPACKAGE* ); extern UINT ACTION_DialogBox( MSIPACKAGE*, LPCWSTR); +extern UINT MSI_Sequence( MSIPACKAGE *package, LPCWSTR szTable, INT iSequenceMode ); /* record internals */ extern UINT MSI_RecordSetIStream( MSIRECORD *, unsigned int, IStream *);