MSI: MsiSetComponent[AW] implementation

Johan Dahlin jdahlin at async.com.br
Tue Aug 23 21:44:42 CDT 2005


Ignore my earlier patch which adds stubs.

This one implements MsiSetComponent[AW], reusing much code from MsiGetComponent*

Johan


-------------- next part --------------
Index: dlls/msi/install.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/install.c,v
retrieving revision 1.6
diff -u -B -p -r1.6 install.c
--- dlls/msi/install.c	23 Aug 2005 18:15:44 -0000	1.6
+++ dlls/msi/install.c	24 Aug 2005 02:29:41 -0000
@@ -526,6 +526,40 @@ piAction);
 /***********************************************************************
  * MsiGetComponentStateA (MSI.@)
  */
+UINT WINAPI MsiSetComponentStateA(MSIHANDLE hInstall, LPSTR szComponent,
+                                  INSTALLSTATE iState)
+{
+    LPWSTR szwComponent = NULL;
+    UINT rc;
+    
+    szwComponent = strdupAtoW(szComponent);
+    
+    rc = MsiSetComponentStateW(hInstall, szwComponent, iState);
+
+    HeapFree(GetProcessHeap(), 0, szwComponent);
+    
+    return rc;
+}
+
+UINT MSI_SetComponentStateW(MSIPACKAGE *package, LPWSTR 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;
+}
+
+/***********************************************************************
+ * MsiGetComponentStateA (MSI.@)
+ */
 UINT WINAPI MsiGetComponentStateA(MSIHANDLE hInstall, LPSTR szComponent,
                   INSTALLSTATE *piInstalled, INSTALLSTATE *piAction)
 {
@@ -561,6 +595,26 @@ UINT MSI_GetComponentStateW(MSIPACKAGE *
 
     TRACE("states (%i, %i)\n", comp->Installed, comp->Action );
 
+    return ERROR_SUCCESS;
+}
+
+/***********************************************************************
+ * MsiSetComponentStateA (MSI.@)
+ */
+UINT WINAPI MsiSetComponentStateW(MSIHANDLE hInstall, LPWSTR szComponent,
+                                  INSTALLSTATE iState)
+{
+    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 ERROR_SUCCESS;
 }
 
Index: include/msiquery.h
===================================================================
RCS file: /home/wine/wine/include/msiquery.h,v
retrieving revision 1.14
diff -u -B -p -r1.14 msiquery.h
--- include/msiquery.h	10 Jun 2005 19:52:13 -0000	1.14
+++ include/msiquery.h	24 Aug 2005 02:29:42 -0000
@@ -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,LPSTR,INSTALLSTATE);
+UINT WINAPI MsiSetComponentStateW(MSIHANDLE,LPWSTR,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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jdahlin.vcf
Type: text/x-vcard
Size: 414 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20050823/ad80d773/jdahlin.vcf


More information about the wine-patches mailing list