From ef1d367bcc5689a96ebab23ef9440171031bfe78 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Tue, 8 Feb 2005 13:44:25 +0000 Subject: [PATCH] Fix MsiModifyView and MsiViewGetColumnInfo to use MSIRECORD* not MSIHANDLE. --- dlls/msi/create.c | 5 ++- dlls/msi/distinct.c | 7 ++-- dlls/msi/insert.c | 4 +- dlls/msi/msipriv.h | 2 +- dlls/msi/msiquery.c | 89 +++++++++++++++++++++++++++++++++------------ dlls/msi/order.c | 7 ++-- dlls/msi/select.c | 7 ++-- dlls/msi/table.c | 5 ++- dlls/msi/update.c | 5 ++- dlls/msi/where.c | 7 ++-- 10 files changed, 93 insertions(+), 45 deletions(-) diff --git a/dlls/msi/create.c b/dlls/msi/create.c index b1ad8c794c0..11500fd27f8 100644 --- a/dlls/msi/create.c +++ b/dlls/msi/create.c @@ -188,11 +188,12 @@ static UINT CREATE_get_column_info( struct tagMSIVIEW *view, 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; } diff --git a/dlls/msi/distinct.c b/dlls/msi/distinct.c index 6fd33d9fde5..64fa5ef9755 100644 --- a/dlls/msi/distinct.c +++ b/dlls/msi/distinct.c @@ -217,16 +217,17 @@ static UINT DISTINCT_get_column_info( struct tagMSIVIEW *view, 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 ) diff --git a/dlls/msi/insert.c b/dlls/msi/insert.c index df5c1d88d3f..a84457f9ccf 100644 --- a/dlls/msi/insert.c +++ b/dlls/msi/insert.c @@ -214,11 +214,11 @@ static UINT INSERT_get_column_info( struct tagMSIVIEW *view, return sv->ops->get_column_info( sv, n, name, type ); } -static UINT INSERT_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIHANDLE hrec) +static UINT INSERT_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *rec) { MSIINSERTVIEW *iv = (MSIINSERTVIEW*)view; - TRACE("%p %d %ld\n", iv, eModifyMode, hrec ); + TRACE("%p %d %p\n", iv, eModifyMode, rec ); return ERROR_FUNCTION_FAILED; } diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index bfa2b8af178..cb20887157e 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -161,7 +161,7 @@ typedef struct tagMSIVIEWOPS /* * modify - not yet implemented properly */ - UINT (*modify)( struct tagMSIVIEW *, MSIMODIFY, MSIHANDLE ); + UINT (*modify)( struct tagMSIVIEW *, MSIMODIFY, MSIRECORD * ); /* * delete - destroys the structure completely diff --git a/dlls/msi/msiquery.c b/dlls/msi/msiquery.c index cdc220e54ec..67ba65d6f85 100644 --- a/dlls/msi/msiquery.c +++ b/dlls/msi/msiquery.c @@ -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(MSIHANDLE hView, MSICOLINFO info, MSIHANDLE *hR 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; iops->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, @@ -540,13 +588,6 @@ UINT WINAPI MsiDatabaseGetPrimaryKeysW(MSIHANDLE hdb, 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; -} - UINT WINAPI MsiDatabaseIsTablePersistentA( MSIHANDLE hDatabase, LPSTR szTableName) { diff --git a/dlls/msi/order.c b/dlls/msi/order.c index ab896dbf3a8..c04d6f94e69 100644 --- a/dlls/msi/order.c +++ b/dlls/msi/order.c @@ -218,16 +218,17 @@ static UINT ORDER_get_column_info( struct tagMSIVIEW *view, 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 ) diff --git a/dlls/msi/select.c b/dlls/msi/select.c index c9b53f8b0cc..6118966d072 100644 --- a/dlls/msi/select.c +++ b/dlls/msi/select.c @@ -168,16 +168,17 @@ static UINT SELECT_get_column_info( struct tagMSIVIEW *view, 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 ) diff --git a/dlls/msi/table.c b/dlls/msi/table.c index 4194da0e18d..8482b8b9028 100644 --- a/dlls/msi/table.c +++ b/dlls/msi/table.c @@ -1284,9 +1284,10 @@ static UINT TABLE_get_column_info( struct tagMSIVIEW *view, 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; } diff --git a/dlls/msi/update.c b/dlls/msi/update.c index 0066256c09c..053069e269c 100644 --- a/dlls/msi/update.c +++ b/dlls/msi/update.c @@ -151,11 +151,12 @@ static UINT UPDATE_get_column_info( struct tagMSIVIEW *view, 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; } diff --git a/dlls/msi/where.c b/dlls/msi/where.c index b58ba876bd4..8b6e1ccff58 100644 --- a/dlls/msi/where.c +++ b/dlls/msi/where.c @@ -307,16 +307,17 @@ static UINT WHERE_get_column_info( struct tagMSIVIEW *view, 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 )