Mike McCormack : msi: Create MSI_ViewGetColumnInfo for accessing MsiViewGetColumnInfo internally .

Alexandre Julliard julliard at wine.codeweavers.com
Thu Sep 7 05:07:10 CDT 2006


Module: wine
Branch: master
Commit: a426b18efdcc98617551ccb6c5c5ad27a4a4837c
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=a426b18efdcc98617551ccb6c5c5ad27a4a4837c

Author: Mike McCormack <mike at codeweavers.com>
Date:   Thu Aug 31 19:50:11 2006 +0900

msi: Create MSI_ViewGetColumnInfo for accessing MsiViewGetColumnInfo internally.

---

 dlls/msi/msipriv.h  |    5 ++-
 dlls/msi/msiquery.c |   74 +++++++++++++++++++++++++++------------------------
 2 files changed, 42 insertions(+), 37 deletions(-)

diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index 191c770..8db0074 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -334,8 +334,6 @@ extern const WCHAR *msi_string_lookup_id
 extern UINT msi_string_get_codepage( string_table *st );
 
 
-extern UINT VIEW_find_column( MSIVIEW *view, LPCWSTR name, UINT *n );
-
 extern BOOL TABLE_Exists( MSIDATABASE *db, LPWSTR name );
 
 extern UINT read_raw_stream_data( MSIDATABASE*, LPCWSTR stname,
@@ -393,6 +391,9 @@ extern UINT MSI_DatabaseGetPrimaryKeys( 
 extern UINT MSI_ViewExecute( MSIQUERY*, MSIRECORD * );
 extern UINT MSI_ViewFetch( MSIQUERY*, MSIRECORD ** );
 extern UINT MSI_ViewClose( MSIQUERY* );
+extern UINT MSI_ViewGetColumnInfo(MSIQUERY *, MSICOLINFO, MSIRECORD **);
+extern UINT VIEW_find_column( MSIVIEW *, LPCWSTR, UINT * );
+
 
 /* install internals */
 extern UINT MSI_SetInstallLevel( MSIPACKAGE *package, int iInstallLevel );
diff --git a/dlls/msi/msiquery.c b/dlls/msi/msiquery.c
index 27d93f6..ba7fc1b 100644
--- a/dlls/msi/msiquery.c
+++ b/dlls/msi/msiquery.c
@@ -479,48 +479,28 @@ static UINT msi_set_record_type_string( 
     return MSI_RecordSetStringW( rec, field, szType );
 }
 
-UINT WINAPI MsiViewGetColumnInfo(MSIHANDLE hView, MSICOLINFO info, MSIHANDLE *hRec)
+UINT MSI_ViewGetColumnInfo( MSIQUERY *query, MSICOLINFO info, MSIRECORD **prec )
 {
-    MSIVIEW *view = NULL;
-    MSIQUERY *query = NULL;
-    MSIRECORD *rec = NULL;
     UINT r = ERROR_FUNCTION_FAILED, i, count = 0, type;
+    MSIRECORD *rec;
+    MSIVIEW *view = query->view;
     LPWSTR name;
 
-    TRACE("%ld %d %p\n", hView, info, hRec);
-
-    if( !hRec )
-        return ERROR_INVALID_PARAMETER;
-
-    if( info != MSICOLINFO_NAMES && info != MSICOLINFO_TYPES )
-        return ERROR_INVALID_PARAMETER;
-
-    query = msihandle2msiinfo( hView, MSIHANDLETYPE_VIEW );
-    if( !query )
-        return ERROR_INVALID_HANDLE;
-
-    view = query->view;
     if( !view )
-        goto out;
+        return ERROR_FUNCTION_FAILED;
 
     if( !view->ops->get_dimensions )
-        goto out;
+        return ERROR_FUNCTION_FAILED;
 
     r = view->ops->get_dimensions( view, NULL, &count );
-    if( r )
-        goto out;
+    if( r != ERROR_SUCCESS )
+        return r;
     if( !count )
-    {
-        r = ERROR_INVALID_PARAMETER;
-        goto out;
-    }
+        return ERROR_INVALID_PARAMETER;
 
     rec = MSI_CreateRecord( count );
     if( !rec )
-    {
-        r = ERROR_FUNCTION_FAILED;
-        goto out;
-    }
+        return ERROR_FUNCTION_FAILED;
 
     for( i=0; i<count; i++ )
     {
@@ -535,14 +515,38 @@ UINT WINAPI MsiViewGetColumnInfo(MSIHAND
         msi_free( name );
     }
 
-    *hRec = alloc_msihandle( &rec->hdr );
-    if (! *hRec)
-       r = ERROR_NOT_ENOUGH_MEMORY;
+    *prec = rec;
+    return ERROR_SUCCESS;
+}
 
-out:
-    msiobj_release( &query->hdr );
-    if( rec )
+UINT WINAPI MsiViewGetColumnInfo(MSIHANDLE hView, MSICOLINFO info, MSIHANDLE *hRec)
+{
+    MSIQUERY *query = NULL;
+    MSIRECORD *rec = NULL;
+    UINT r;
+
+    TRACE("%ld %d %p\n", hView, info, hRec);
+
+    if( !hRec )
+        return ERROR_INVALID_PARAMETER;
+
+    if( info != MSICOLINFO_NAMES && info != MSICOLINFO_TYPES )
+        return ERROR_INVALID_PARAMETER;
+
+    query = msihandle2msiinfo( hView, MSIHANDLETYPE_VIEW );
+    if( !query )
+        return ERROR_INVALID_HANDLE;
+
+    r = MSI_ViewGetColumnInfo( query, info, &rec );
+    if ( r == ERROR_SUCCESS )
+    {
+        *hRec = alloc_msihandle( &rec->hdr );
+        if ( !*hRec )
+            r = ERROR_NOT_ENOUGH_MEMORY;
         msiobj_release( &rec->hdr );
+    }
+
+    msiobj_release( &query->hdr );
 
     return r;
 }




More information about the wine-cvs mailing list