From b5c02815d0326d78df52dd9137f738da9f64c722 Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Wed, 24 Aug 2005 18:13:09 +0000 Subject: [PATCH] Implemented MsiSetComponentState*. --- dlls/msi/install.c | 37 +++++++++++++++++++++++++++++++++---- include/msiquery.h | 3 +++ 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/dlls/msi/install.c b/dlls/msi/install.c index 667c4aebce5..94a7acfff97 100644 --- a/dlls/msi/install.c +++ b/dlls/msi/install.c @@ -529,8 +529,14 @@ piAction); UINT WINAPI MsiSetComponentStateA(MSIHANDLE hInstall, LPCSTR szComponent, INSTALLSTATE iState) { - FIXME("STUB (szComponent=%s,iState=%i)\n",debugstr_a(szComponent),iState); - return ERROR_SUCCESS; + UINT rc; + LPWSTR szwComponent = strdupAtoW(szComponent); + + rc = MsiSetComponentStateW(hInstall, szwComponent, iState); + + HeapFree(GetProcessHeap(), 0, szwComponent); + + return rc; } /*********************************************************************** @@ -551,6 +557,22 @@ UINT WINAPI MsiGetComponentStateA(MSIHANDLE hInstall, LPSTR szComponent, return rc; } +static UINT MSI_SetComponentStateW(MSIPACKAGE *package, LPCWSTR szComponent, + INSTALLSTATE iState) +{ + MSICOMPONENT *comp; + + TRACE("%p %s %d\n", package, debugstr_w(szComponent), iState); + + comp = get_loaded_component(package, szComponent); + if (!comp) + return ERROR_UNKNOWN_COMPONENT; + + comp->Installed = iState; + + return ERROR_SUCCESS; +} + UINT MSI_GetComponentStateW(MSIPACKAGE *package, LPWSTR szComponent, INSTALLSTATE *piInstalled, INSTALLSTATE *piAction) { @@ -580,8 +602,15 @@ UINT MSI_GetComponentStateW(MSIPACKAGE *package, LPWSTR szComponent, UINT WINAPI MsiSetComponentStateW(MSIHANDLE hInstall, LPCWSTR szComponent, INSTALLSTATE iState) { - FIXME("STUB (szComponent=%s,iState=%i)\n",debugstr_w(szComponent),iState); - return ERROR_SUCCESS; + MSIPACKAGE* package; + UINT ret; + + package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); + if (!package) + return ERROR_INVALID_HANDLE; + ret = MSI_SetComponentStateW(package, szComponent, iState); + msiobj_release(&package->hdr); + return ret; } /*********************************************************************** diff --git a/include/msiquery.h b/include/msiquery.h index 5c5fb39952e..14c6c249e28 100644 --- a/include/msiquery.h +++ b/include/msiquery.h @@ -175,6 +175,9 @@ UINT WINAPI MsiDatabaseCommit(MSIHANDLE); UINT WINAPI MsiGetFeatureStateA(MSIHANDLE,LPSTR,INSTALLSTATE*,INSTALLSTATE*); UINT WINAPI MsiGetFeatureStateW(MSIHANDLE,LPWSTR,INSTALLSTATE*,INSTALLSTATE*); #define MsiGetFeatureState WINELIB_NAME_AW(MsiGetFeatureState) +UINT WINAPI MsiSetComponentStateA(MSIHANDLE,LPCSTR,INSTALLSTATE); +UINT WINAPI MsiSetComponentStateW(MSIHANDLE,LPCWSTR,INSTALLSTATE); +#define MsiSetComponentState WINELIB_NAME_AW(MsiSetComponentState) UINT WINAPI MsiGetComponentStateA(MSIHANDLE,LPSTR,INSTALLSTATE*,INSTALLSTATE*); UINT WINAPI MsiGetComponentStateW(MSIHANDLE,LPWSTR,INSTALLSTATE*,INSTALLSTATE*); #define MsiGetComponentState WINELIB_NAME_AW(MsiGetComponentState)