msi: Handle reading from a NULL stream.

This commit is contained in:
James Hawkins 2009-03-02 02:34:32 -08:00 committed by Alexandre Julliard
parent 2f1eacfcad
commit 9540d762ad
2 changed files with 8 additions and 5 deletions

View File

@ -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;

View File

@ -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);