Setting a record to an empty string is the same as making it null.

This commit is contained in:
Aric Stewart 2005-01-31 11:30:59 +00:00 committed by Alexandre Julliard
parent 026b786ee9
commit e495e7e34c
2 changed files with 6 additions and 2 deletions

View File

@ -455,7 +455,7 @@ UINT MSI_RecordSetStringA( MSIRECORD *rec, unsigned int iField, LPCSTR szValue )
return ERROR_INVALID_FIELD;
MSI_FreeField( &rec->fields[iField] );
if( szValue )
if( szValue && szValue[0] )
{
len = MultiByteToWideChar( CP_ACP, 0, szValue, -1, NULL, 0 );
str = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
@ -501,7 +501,7 @@ UINT MSI_RecordSetStringW( MSIRECORD *rec, unsigned int iField, LPCWSTR szValue
MSI_FreeField( &rec->fields[iField] );
if( szValue )
if( szValue && szValue[0] )
{
len = lstrlenW(szValue) + 1;
str = HeapAlloc( GetProcessHeap(), 0, len*sizeof (WCHAR));

View File

@ -123,6 +123,10 @@ void test_msirecord(void)
ok(r == ERROR_SUCCESS, "Failed to set null string at 0\n");
r = MsiRecordIsNull(h, 0);
ok(r == TRUE, "null string not null field\n");
r = MsiRecordSetString(h, 0, "");
ok(r == ERROR_SUCCESS, "Failed to set empty string at 0\n");
r = MsiRecordIsNull(h, 0);
ok(r == TRUE, "null string not null field\n");
r = MsiRecordSetString(h,0,str);
ok(r == ERROR_SUCCESS, "Failed to set string at 0\n");
r = MsiRecordGetInteger(h, 0);