MSI: Fix MsiModifyView and MsiViewGetColumnInfo to use MSIRECORD* not MSIHANDLE

Mike McCormack mike at codeweavers.com
Sun Feb 6 01:18:55 CST 2005


ChangeLog:
* Fix MsiModifyView and MsiViewGetColumnInfo to use MSIRECORD* not MSIHANDLE
-------------- next part --------------
Index: dlls/msi/create.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/create.c,v
retrieving revision 1.9
diff -u -p -r1.9 create.c
--- dlls/msi/create.c	25 Aug 2004 17:31:39 -0000	1.9
+++ dlls/msi/create.c	6 Feb 2005 07:18:43 -0000
@@ -188,11 +188,12 @@ static UINT CREATE_get_column_info( stru
     return ERROR_FUNCTION_FAILED;
 }
 
-static UINT CREATE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIHANDLE hrec)
+static UINT CREATE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode,
+                MSIRECORD *rec)
 {
     MSICREATEVIEW *cv = (MSICREATEVIEW*)view;
 
-    TRACE("%p %d %ld\n", cv, eModifyMode, hrec );
+    TRACE("%p %d %p\n", cv, eModifyMode, rec );
 
     return ERROR_FUNCTION_FAILED;
 }
Index: dlls/msi/distinct.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/distinct.c,v
retrieving revision 1.8
diff -u -p -r1.8 distinct.c
--- dlls/msi/distinct.c	20 Jan 2005 10:36:35 -0000	1.8
+++ dlls/msi/distinct.c	6 Feb 2005 07:18:43 -0000
@@ -217,16 +217,17 @@ static UINT DISTINCT_get_column_info( st
     return dv->table->ops->get_column_info( dv->table, n, name, type );
 }
 
-static UINT DISTINCT_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIHANDLE hrec)
+static UINT DISTINCT_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode,
+                MSIRECORD *rec )
 {
     MSIDISTINCTVIEW *dv = (MSIDISTINCTVIEW*)view;
 
-    TRACE("%p %d %ld\n", dv, eModifyMode, hrec );
+    TRACE("%p %d %p\n", dv, eModifyMode, rec );
 
     if( !dv->table )
          return ERROR_FUNCTION_FAILED;
 
-    return dv->table->ops->modify( dv->table, eModifyMode, hrec );
+    return dv->table->ops->modify( dv->table, eModifyMode, rec );
 }
 
 static UINT DISTINCT_delete( struct tagMSIVIEW *view )
Index: dlls/msi/msiquery.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/msiquery.c,v
retrieving revision 1.22
diff -u -p -r1.22 msiquery.c
--- dlls/msi/msiquery.c	3 Feb 2005 10:41:59 -0000	1.22
+++ dlls/msi/msiquery.c	6 Feb 2005 07:18:44 -0000
@@ -430,10 +430,10 @@ out:
 
 UINT WINAPI MsiViewGetColumnInfo(MSIHANDLE hView, MSICOLINFO info, MSIHANDLE *hRec)
 {
-    MSIVIEW *view;
-    MSIQUERY *query;
-    MSIHANDLE handle;
-    UINT ret, i, count = 0, type;
+    MSIVIEW *view = NULL;
+    MSIQUERY *query = NULL;
+    MSIRECORD *rec = NULL;
+    UINT r = ERROR_FUNCTION_FAILED, i, count = 0, type;
     LPWSTR name;
 
     TRACE("%ld %d %p\n", hView, info, hRec);
@@ -444,34 +444,82 @@ UINT WINAPI MsiViewGetColumnInfo(MSIHAND
 
     view = query->view;
     if( !view )
-        return ERROR_FUNCTION_FAILED;
+        goto out;
 
     if( !view->ops->get_dimensions )
-        return ERROR_FUNCTION_FAILED;
+        goto out;
 
-    ret = view->ops->get_dimensions( view, NULL, &count );
-    if( ret )
-        return ret;
+    r = view->ops->get_dimensions( view, NULL, &count );
+    if( r )
+        goto out;
     if( !count )
-        return ERROR_INVALID_PARAMETER;
+    {
+        r = ERROR_INVALID_PARAMETER;
+        goto out;
+    }
 
-    handle = MsiCreateRecord( count );
-    if( !handle )
+    rec = MSI_CreateRecord( count );
+    if( !rec )
         return ERROR_FUNCTION_FAILED;
 
     for( i=0; i<count; i++ )
     {
         name = NULL;
-        ret = view->ops->get_column_info( view, i+1, &name, &type );
-        if( ret != ERROR_SUCCESS )
+        r = view->ops->get_column_info( view, i+1, &name, &type );
+        if( r != ERROR_SUCCESS )
             continue;
-        MsiRecordSetStringW( handle, i+1, name );
+        MSI_RecordSetStringW( rec, i+1, name );
         HeapFree( GetProcessHeap(), 0, name );
     }
 
-    *hRec = handle;
+    *hRec = alloc_msihandle( &rec->hdr );
 
-    return ERROR_SUCCESS;
+out:
+    if( query )
+        msiobj_release( &query->hdr );
+    if( rec )
+        msiobj_release( &rec->hdr );
+
+    return r;
+}
+
+UINT WINAPI MsiViewModify( MSIHANDLE hView, MSIMODIFY eModifyMode,
+                MSIHANDLE hRecord)
+{
+    MSIVIEW *view = NULL;
+    MSIQUERY *query = NULL;
+    MSIRECORD *rec = NULL;
+    UINT r = ERROR_FUNCTION_FAILED;
+
+    TRACE("%ld %x %ld\n", hView, eModifyMode, hRecord);
+
+    query = msihandle2msiinfo( hView, MSIHANDLETYPE_VIEW );
+    if( !query )
+        return ERROR_INVALID_HANDLE;
+
+    view = query->view;
+    if( !view )
+        goto out;
+
+    if( !view->ops->modify )
+        goto out;
+
+    rec = msihandle2msiinfo( hRecord, MSIHANDLETYPE_RECORD );
+    if( !rec )
+    {
+        r = ERROR_INVALID_HANDLE;
+        goto out;
+    }
+
+    r = view->ops->modify( view, eModifyMode, rec );
+
+out:
+    if( query )
+        msiobj_release( &query->hdr );
+    if( rec )
+        msiobj_release( &rec->hdr );
+
+    return r;
 }
 
 UINT WINAPI MsiDatabaseApplyTransformA( MSIHANDLE hdb, 
@@ -537,13 +585,6 @@ UINT WINAPI MsiDatabaseGetPrimaryKeysW(M
                     LPCWSTR table, MSIHANDLE* rec)
 {
     FIXME("%ld %s %p\n", hdb, debugstr_w(table), rec);
-    return ERROR_CALL_NOT_IMPLEMENTED;
-}
-
-UINT WINAPI MsiViewModify(MSIHANDLE hView, MSIMODIFY eModifyMode, MSIHANDLE
-hRecord)
-{
-    FIXME("%ld %x %ld\n",hView, eModifyMode, hRecord);
     return ERROR_CALL_NOT_IMPLEMENTED;
 }
 
Index: dlls/msi/order.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/order.c,v
retrieving revision 1.8
diff -u -p -r1.8 order.c
--- dlls/msi/order.c	20 Jan 2005 10:36:35 -0000	1.8
+++ dlls/msi/order.c	6 Feb 2005 07:18:44 -0000
@@ -218,16 +218,17 @@ static UINT ORDER_get_column_info( struc
     return ov->table->ops->get_column_info( ov->table, n, name, type );
 }
 
-static UINT ORDER_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIHANDLE hrec)
+static UINT ORDER_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode,
+                MSIRECORD *rec )
 {
     MSIORDERVIEW *ov = (MSIORDERVIEW*)view;
 
-    TRACE("%p %d %ld\n", ov, eModifyMode, hrec );
+    TRACE("%p %d %p\n", ov, eModifyMode, rec );
 
     if( !ov->table )
          return ERROR_FUNCTION_FAILED;
 
-    return ov->table->ops->modify( ov->table, eModifyMode, hrec );
+    return ov->table->ops->modify( ov->table, eModifyMode, rec );
 }
 
 static UINT ORDER_delete( struct tagMSIVIEW *view )
Index: dlls/msi/select.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/select.c,v
retrieving revision 1.7
diff -u -p -r1.7 select.c
--- dlls/msi/select.c	9 Jul 2004 22:25:34 -0000	1.7
+++ dlls/msi/select.c	6 Feb 2005 07:18:44 -0000
@@ -168,16 +168,17 @@ static UINT SELECT_get_column_info( stru
     return sv->table->ops->get_column_info( sv->table, n, name, type );
 }
 
-static UINT SELECT_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIHANDLE hrec)
+static UINT SELECT_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode,
+                MSIRECORD *rec )
 {
     MSISELECTVIEW *sv = (MSISELECTVIEW*)view;
 
-    TRACE("%p %d %ld\n", sv, eModifyMode, hrec );
+    TRACE("%p %d %p\n", sv, eModifyMode, rec );
 
     if( !sv->table )
          return ERROR_FUNCTION_FAILED;
 
-    return sv->table->ops->modify( sv->table, eModifyMode, hrec );
+    return sv->table->ops->modify( sv->table, eModifyMode, rec );
 }
 
 static UINT SELECT_delete( struct tagMSIVIEW *view )
Index: dlls/msi/table.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/table.c,v
retrieving revision 1.28
diff -u -p -r1.28 table.c
--- dlls/msi/table.c	26 Jan 2005 21:09:05 -0000	1.28
+++ dlls/msi/table.c	6 Feb 2005 07:18:44 -0000
@@ -1284,9 +1284,10 @@ static UINT TABLE_get_column_info( struc
     return ERROR_SUCCESS;
 }
 
-static UINT TABLE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIHANDLE hrec)
+static UINT TABLE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode,
+                MSIRECORD *rec)
 {
-    FIXME("%p %d %ld\n", view, eModifyMode, hrec );
+    FIXME("%p %d %p\n", view, eModifyMode, rec );
     return ERROR_CALL_NOT_IMPLEMENTED;
 }
 
Index: dlls/msi/update.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/update.c,v
retrieving revision 1.4
diff -u -p -r1.4 update.c
--- dlls/msi/update.c	25 Aug 2004 17:31:39 -0000	1.4
+++ dlls/msi/update.c	6 Feb 2005 07:18:44 -0000
@@ -151,11 +151,12 @@ static UINT UPDATE_get_column_info( stru
     return wv->ops->get_column_info( wv, n, name, type );
 }
 
-static UINT UPDATE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIHANDLE hrec)
+static UINT UPDATE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode,
+                MSIRECORD *rec )
 {
     MSIUPDATEVIEW *uv = (MSIUPDATEVIEW*)view;
 
-    TRACE("%p %d %ld\n", uv, eModifyMode, hrec );
+    TRACE("%p %d %p\n", uv, eModifyMode, rec );
 
     return ERROR_FUNCTION_FAILED;
 }
Index: dlls/msi/where.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/where.c,v
retrieving revision 1.15
diff -u -p -r1.15 where.c
--- dlls/msi/where.c	20 Jan 2005 10:36:35 -0000	1.15
+++ dlls/msi/where.c	6 Feb 2005 07:18:44 -0000
@@ -307,16 +307,17 @@ static UINT WHERE_get_column_info( struc
     return wv->table->ops->get_column_info( wv->table, n, name, type );
 }
 
-static UINT WHERE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIHANDLE hrec)
+static UINT WHERE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode,
+                MSIRECORD *rec )
 {
     MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view;
 
-    TRACE("%p %d %ld\n", wv, eModifyMode, hrec );
+    TRACE("%p %d %p\n", wv, eModifyMode, rec );
 
     if( !wv->table )
          return ERROR_FUNCTION_FAILED;
 
-    return wv->table->ops->modify( wv->table, eModifyMode, hrec );
+    return wv->table->ops->modify( wv->table, eModifyMode, rec );
 }
 
 static UINT WHERE_delete( struct tagMSIVIEW *view )


More information about the wine-patches mailing list