msi: Successfully return an empty string when requesting a record index beyond the record's size.
This commit is contained in:
parent
2750ed167f
commit
0d56df214b
|
@ -338,7 +338,13 @@ UINT MSI_RecordGetStringA(MSIRECORD *rec, UINT iField,
|
||||||
TRACE("%p %d %p %p\n", rec, iField, szValue, pcchValue);
|
TRACE("%p %d %p %p\n", rec, iField, szValue, pcchValue);
|
||||||
|
|
||||||
if( iField > rec->count )
|
if( iField > rec->count )
|
||||||
return ERROR_INVALID_PARAMETER;
|
{
|
||||||
|
if ( szValue && *pcchValue > 0 )
|
||||||
|
szValue[0] = 0;
|
||||||
|
|
||||||
|
*pcchValue = 0;
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
ret = ERROR_SUCCESS;
|
ret = ERROR_SUCCESS;
|
||||||
switch( rec->fields[iField].type )
|
switch( rec->fields[iField].type )
|
||||||
|
@ -414,7 +420,13 @@ UINT MSI_RecordGetStringW(MSIRECORD *rec, UINT iField,
|
||||||
TRACE("%p %d %p %p\n", rec, iField, szValue, pcchValue);
|
TRACE("%p %d %p %p\n", rec, iField, szValue, pcchValue);
|
||||||
|
|
||||||
if( iField > rec->count )
|
if( iField > rec->count )
|
||||||
return ERROR_INVALID_PARAMETER;
|
{
|
||||||
|
if ( szValue && *pcchValue > 0 )
|
||||||
|
szValue[0] = 0;
|
||||||
|
|
||||||
|
*pcchValue = 0;
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
ret = ERROR_SUCCESS;
|
ret = ERROR_SUCCESS;
|
||||||
switch( rec->fields[iField].type )
|
switch( rec->fields[iField].type )
|
||||||
|
|
|
@ -351,7 +351,35 @@ static void test_msirecord(void)
|
||||||
DeleteFile(filename); /* Delete it for sure, when everything else is closed. */
|
DeleteFile(filename); /* Delete it for sure, when everything else is closed. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_MsiRecordGetString(void)
|
||||||
|
{
|
||||||
|
MSIHANDLE rec;
|
||||||
|
CHAR buf[MAX_PATH];
|
||||||
|
DWORD sz;
|
||||||
|
UINT r;
|
||||||
|
|
||||||
|
rec = MsiCreateRecord(2);
|
||||||
|
ok(rec != 0, "Expected a valid handle\n");
|
||||||
|
|
||||||
|
sz = MAX_PATH;
|
||||||
|
lstrcpyA(buf, "apple");
|
||||||
|
r = MsiRecordGetString(rec, 1, buf, &sz);
|
||||||
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||||
|
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
|
||||||
|
ok(sz == 0, "Expected 0, got %d\n", sz);
|
||||||
|
|
||||||
|
sz = MAX_PATH;
|
||||||
|
lstrcpyA(buf, "apple");
|
||||||
|
r = MsiRecordGetString(rec, 10, buf, &sz);
|
||||||
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||||
|
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
|
||||||
|
ok(sz == 0, "Expected 0, got %d\n", sz);
|
||||||
|
|
||||||
|
MsiCloseHandle(rec);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(record)
|
START_TEST(record)
|
||||||
{
|
{
|
||||||
test_msirecord();
|
test_msirecord();
|
||||||
|
test_MsiRecordGetString();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue