[2/5] msi: Return an error from MsiDatabaseGetPrimaryKeys if the table does not exist.
Hans Leidekker
hans at codeweavers.com
Thu Sep 2 06:20:36 CDT 2010
Fix for http://bugs.winehq.org/show_bug.cgi?id=24199
---
dlls/msi/msiquery.c | 3 +++
dlls/msi/tests/record.c | 3 +++
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/dlls/msi/msiquery.c b/dlls/msi/msiquery.c
index df81a74..c603e6a 100644
--- a/dlls/msi/msiquery.c
+++ b/dlls/msi/msiquery.c
@@ -901,6 +901,9 @@ UINT MSI_DatabaseGetPrimaryKeys( MSIDATABASE *db,
MSIQUERY *query = NULL;
UINT r;
+ if (!TABLE_Exists( db, table ))
+ return ERROR_INVALID_TABLE;
+
r = MSI_OpenQuery( db, &query, sql, table );
if( r != ERROR_SUCCESS )
return r;
diff --git a/dlls/msi/tests/record.c b/dlls/msi/tests/record.c
index 0b80779..2de43cb 100644
--- a/dlls/msi/tests/record.c
+++ b/dlls/msi/tests/record.c
@@ -589,6 +589,9 @@ static void test_fieldzero(void)
MsiCloseHandle(rec);
+ r = MsiDatabaseGetPrimaryKeysA(hdb, "nosuchtable", &rec);
+ ok(r == ERROR_INVALID_TABLE, "Expected ERROR_INVALID_TABLE, got %d\n", r);
+
query = "SELECT * FROM `drone` WHERE `id` = 1";
r = MsiDatabaseOpenView(hdb, query, &hview);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
--
1.7.0.4
More information about the wine-patches
mailing list