James Hawkins : msi: Make sure the view being updated is the same view the record was fetched from .

Alexandre Julliard julliard at winehq.org
Thu Feb 26 09:04:59 CST 2009


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

Author: James Hawkins <truiken at gmail.com>
Date:   Wed Feb 25 19:44:46 2009 -0800

msi: Make sure the view being updated is the same view the record was fetched from.

---

 dlls/msi/msiquery.c     |    6 ++++++
 dlls/msi/tests/db.c     |    7 +------
 dlls/msi/tests/record.c |   10 ++--------
 3 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/dlls/msi/msiquery.c b/dlls/msi/msiquery.c
index 430ff52..0cfd05e 100644
--- a/dlls/msi/msiquery.c
+++ b/dlls/msi/msiquery.c
@@ -377,7 +377,10 @@ UINT MSI_ViewFetch(MSIQUERY *query, MSIRECORD **prec)
 
     r = msi_view_get_row(query->db, view, query->row, prec);
     if (r == ERROR_SUCCESS)
+    {
         query->row ++;
+        MSI_RecordSetInteger(*prec, 0, (int)query);
+    }
 
     return r;
 }
@@ -597,6 +600,9 @@ UINT MSI_ViewModify( MSIQUERY *query, MSIMODIFY mode, MSIRECORD *rec )
     if ( !view  || !view->ops->modify)
         return ERROR_FUNCTION_FAILED;
 
+    if ( mode == MSIMODIFY_UPDATE && MSI_RecordGetInteger( rec, 0 ) != (int)query )
+        return ERROR_FUNCTION_FAILED;
+
     r = view->ops->modify( view, mode, rec, query->row );
     if (mode == MSIMODIFY_DELETE && r == ERROR_SUCCESS)
         query->row--;
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c
index 7629bc3..bc7e513 100644
--- a/dlls/msi/tests/db.c
+++ b/dlls/msi/tests/db.c
@@ -321,10 +321,8 @@ static void test_msiinsert(void)
     r = MsiRecordGetFieldCount(hrec);
     ok(r == 3, "record count wrong\n");
 
-    todo_wine {
     r = MsiRecordIsNull(hrec, 0);
     ok(r == FALSE, "field 0 not null\n");
-    }
 
     r = MsiRecordGetInteger(hrec, 1);
     ok(r == 1, "field 1 contents wrong\n");
@@ -903,10 +901,7 @@ static void test_viewmodify(void)
     ok(r == ERROR_SUCCESS, "failed to set string\n");
 
     r = MsiViewModify(hview, MSIMODIFY_UPDATE, hrec);
-    todo_wine
-    {
-        ok(r == ERROR_FUNCTION_FAILED, "MsiViewModify failed\n");
-    }
+    ok(r == ERROR_FUNCTION_FAILED, "MsiViewModify failed\n");
 
     r = MsiCloseHandle(hrec);
     ok(r == ERROR_SUCCESS, "failed to close record\n");
diff --git a/dlls/msi/tests/record.c b/dlls/msi/tests/record.c
index 1b88239..8f2b963 100644
--- a/dlls/msi/tests/record.c
+++ b/dlls/msi/tests/record.c
@@ -569,16 +569,10 @@ static void test_fieldzero(void)
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
 
     r = MsiRecordGetInteger(rec, 0);
-    todo_wine
-    {
-        ok(r != MSI_NULL_INTEGER && r != 0, "Expected non-NULL value, got %d\n", r);
-    }
+    ok(r != MSI_NULL_INTEGER && r != 0, "Expected non-NULL value, got %d\n", r);
 
     r = MsiRecordIsNull(rec, 0);
-    todo_wine
-    {
-        ok(r == FALSE, "Expected FALSE, got %d\n", r);
-    }
+    ok(r == FALSE, "Expected FALSE, got %d\n", r);
 
     MsiCloseHandle(hdb);
     DeleteFileA(msifile);




More information about the wine-cvs mailing list