James Hawkins : msi: Handle reading from a NULL stream.
Alexandre Julliard
julliard at winehq.org
Mon Mar 2 09:01:50 CST 2009
Module: wine
Branch: master
Commit: 9540d762ad67cedb0c32510b2da2061bff975758
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9540d762ad67cedb0c32510b2da2061bff975758
Author: James Hawkins <truiken at gmail.com>
Date: Mon Mar 2 02:34:32 2009 -0800
msi: Handle reading from a NULL stream.
---
dlls/msi/record.c | 6 ++++++
dlls/msi/tests/db.c | 7 ++-----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/dlls/msi/record.c b/dlls/msi/record.c
index 2b7131a..d484cb8 100644
--- a/dlls/msi/record.c
+++ b/dlls/msi/record.c
@@ -765,6 +765,12 @@ UINT MSI_RecordReadStream(MSIRECORD *rec, UINT iField, char *buf, LPDWORD sz)
if( iField > rec->count)
return ERROR_INVALID_PARAMETER;
+ if ( rec->fields[iField].type == MSIFIELD_NULL )
+ {
+ *sz = 0;
+ return ERROR_INVALID_DATA;
+ }
+
if( rec->fields[iField].type != MSIFIELD_STREAM )
return ERROR_INVALID_DATATYPE;
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c
index e1e9fb7..b2c7d06 100644
--- a/dlls/msi/tests/db.c
+++ b/dlls/msi/tests/db.c
@@ -6077,12 +6077,9 @@ static void test_storages_table(void)
size = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiRecordReadStream(hrec, 2, buf, &size);
+ ok(r == ERROR_INVALID_DATA, "Expected ERROR_INVALID_DATA, got %d\n", r);
ok(!lstrcmp(buf, "apple"), "Expected buf to be unchanged, got %s\n", buf);
- todo_wine
- {
- ok(r == ERROR_INVALID_DATA, "Expected ERROR_INVALID_DATA, got %d\n", r);
- ok(size == 0, "Expected 0, got %d\n", size);
- }
+ ok(size == 0, "Expected 0, got %d\n", size);
MsiCloseHandle(hrec);
More information about the wine-cvs
mailing list