Setting a record to an empty string is the same as making it null.
This commit is contained in:
parent
026b786ee9
commit
e495e7e34c
|
@ -455,7 +455,7 @@ UINT MSI_RecordSetStringA( MSIRECORD *rec, unsigned int iField, LPCSTR szValue )
|
||||||
return ERROR_INVALID_FIELD;
|
return ERROR_INVALID_FIELD;
|
||||||
|
|
||||||
MSI_FreeField( &rec->fields[iField] );
|
MSI_FreeField( &rec->fields[iField] );
|
||||||
if( szValue )
|
if( szValue && szValue[0] )
|
||||||
{
|
{
|
||||||
len = MultiByteToWideChar( CP_ACP, 0, szValue, -1, NULL, 0 );
|
len = MultiByteToWideChar( CP_ACP, 0, szValue, -1, NULL, 0 );
|
||||||
str = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
|
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] );
|
MSI_FreeField( &rec->fields[iField] );
|
||||||
|
|
||||||
if( szValue )
|
if( szValue && szValue[0] )
|
||||||
{
|
{
|
||||||
len = lstrlenW(szValue) + 1;
|
len = lstrlenW(szValue) + 1;
|
||||||
str = HeapAlloc( GetProcessHeap(), 0, len*sizeof (WCHAR));
|
str = HeapAlloc( GetProcessHeap(), 0, len*sizeof (WCHAR));
|
||||||
|
|
|
@ -123,6 +123,10 @@ void test_msirecord(void)
|
||||||
ok(r == ERROR_SUCCESS, "Failed to set null string at 0\n");
|
ok(r == ERROR_SUCCESS, "Failed to set null string at 0\n");
|
||||||
r = MsiRecordIsNull(h, 0);
|
r = MsiRecordIsNull(h, 0);
|
||||||
ok(r == TRUE, "null string not null field\n");
|
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);
|
r = MsiRecordSetString(h,0,str);
|
||||||
ok(r == ERROR_SUCCESS, "Failed to set string at 0\n");
|
ok(r == ERROR_SUCCESS, "Failed to set string at 0\n");
|
||||||
r = MsiRecordGetInteger(h, 0);
|
r = MsiRecordGetInteger(h, 0);
|
||||||
|
|
Loading…
Reference in New Issue