From 1a0b23cd7dd940da57d881e158657fbb334ababa Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Mon, 5 Nov 2007 04:50:02 -0500 Subject: [PATCH] msi: Implement the CCPSearch standard action. --- dlls/msi/action.c | 6 ------ dlls/msi/appsearch.c | 48 ++++++++++++++++++++++++++++++++++++++++++++ dlls/msi/msipriv.h | 1 + 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/dlls/msi/action.c b/dlls/msi/action.c index 33d5370b702..aaf8fdfe59d 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -5424,12 +5424,6 @@ static UINT ACTION_UnregisterFonts( MSIPACKAGE *package ) return msi_unimplemented_action_stub( package, "UnregisterFonts", table ); } -static UINT ACTION_CCPSearch( MSIPACKAGE *package ) -{ - static const WCHAR table[] = { 'C','C','P','S','e','a','r','c','h',0 }; - return msi_unimplemented_action_stub( package, "CCPSearch", table ); -} - static UINT ACTION_RMCCPSearch( MSIPACKAGE *package ) { static const WCHAR table[] = { 'C','C','P','S','e','a','r','c','h',0 }; diff --git a/dlls/msi/appsearch.c b/dlls/msi/appsearch.c index 573927539be..14d0ab9a2fc 100644 --- a/dlls/msi/appsearch.c +++ b/dlls/msi/appsearch.c @@ -893,3 +893,51 @@ UINT ACTION_AppSearch(MSIPACKAGE *package) return r; } + +static UINT ITERATE_CCPSearch(MSIRECORD *row, LPVOID param) +{ + MSIPACKAGE *package = param; + LPCWSTR signature; + LPWSTR value = NULL; + MSISIGNATURE sig; + UINT r = ERROR_SUCCESS; + + static const WCHAR success[] = {'C','C','P','_','S','u','c','c','e','s','s',0}; + static const WCHAR one[] = {'1',0}; + + signature = MSI_RecordGetString(row, 1); + + TRACE("%s\n", debugstr_w(signature)); + + ACTION_AppSearchSigName(package, signature, &sig, &value); + if (value) + { + TRACE("Found signature %s\n", debugstr_w(signature)); + MSI_SetPropertyW(package, success, one); + msi_free(value); + r = ERROR_NO_MORE_ITEMS; + } + + ACTION_FreeSignature(&sig); + + return r; +} + +UINT ACTION_CCPSearch(MSIPACKAGE *package) +{ + static const WCHAR query[] = { + 's','e','l','e','c','t',' ','*',' ', + 'f','r','o','m',' ', + 'C','C','P','S','e','a','r','c','h',0}; + MSIQUERY *view = NULL; + UINT r; + + r = MSI_OpenQuery(package->db, &view, query); + if (r != ERROR_SUCCESS) + return ERROR_SUCCESS; + + r = MSI_IterateRecords(view, NULL, ITERATE_CCPSearch, package); + msiobj_release(&view->hdr); + + return r; +} diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index 91249e18d31..83c89d1fd16 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -829,6 +829,7 @@ static inline void msi_component_set_state( MSICOMPONENT *comp, INSTALLSTATE sta /* actions in other modules */ extern UINT ACTION_AppSearch(MSIPACKAGE *package); +extern UINT ACTION_CCPSearch(MSIPACKAGE *package); extern UINT ACTION_FindRelatedProducts(MSIPACKAGE *package); extern UINT ACTION_InstallFiles(MSIPACKAGE *package); extern UINT ACTION_RemoveFiles(MSIPACKAGE *package);