msi: Test MsiRecordGetString on an integer record fields with a NULL output buffer.
This commit is contained in:
parent
99129d20a6
commit
8f20756068
|
@ -273,7 +273,7 @@ UINT MSI_RecordSetInteger( MSIRECORD *rec, unsigned int iField, int iVal )
|
|||
|
||||
if( iField > rec->count )
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
|
||||
MSI_FreeField( &rec->fields[iField] );
|
||||
rec->fields[iField].type = MSIFIELD_INT;
|
||||
rec->fields[iField].u.iVal = iVal;
|
||||
|
@ -346,7 +346,8 @@ UINT MSI_RecordGetStringA(MSIRECORD *rec, unsigned int iField,
|
|||
case MSIFIELD_INT:
|
||||
wsprintfA(buffer, "%d", rec->fields[iField].u.iVal);
|
||||
len = lstrlenA( buffer );
|
||||
lstrcpynA(szValue, buffer, *pcchValue);
|
||||
if (szValue)
|
||||
lstrcpynA(szValue, buffer, *pcchValue);
|
||||
break;
|
||||
case MSIFIELD_WSTR:
|
||||
len = WideCharToMultiByte( CP_ACP, 0, rec->fields[iField].u.szwVal, -1,
|
||||
|
@ -421,11 +422,13 @@ UINT MSI_RecordGetStringW(MSIRECORD *rec, unsigned int iField,
|
|||
case MSIFIELD_INT:
|
||||
wsprintfW(buffer, szFormat, rec->fields[iField].u.iVal);
|
||||
len = lstrlenW( buffer );
|
||||
lstrcpynW(szValue, buffer, *pcchValue);
|
||||
if (szValue)
|
||||
lstrcpynW(szValue, buffer, *pcchValue);
|
||||
break;
|
||||
case MSIFIELD_WSTR:
|
||||
len = lstrlenW( rec->fields[iField].u.szwVal );
|
||||
lstrcpynW(szValue, rec->fields[iField].u.szwVal, *pcchValue);
|
||||
if (szValue)
|
||||
lstrcpynW(szValue, rec->fields[iField].u.szwVal, *pcchValue);
|
||||
break;
|
||||
case MSIFIELD_NULL:
|
||||
len = 1;
|
||||
|
|
|
@ -250,6 +250,10 @@ static void test_msirecord(void)
|
|||
/* same record, try converting integers to strings */
|
||||
r = MsiRecordSetInteger(h, 0, 32);
|
||||
ok(r == ERROR_SUCCESS, "Failed to set integer at 0 to 32\n");
|
||||
sz = 1;
|
||||
r = MsiRecordGetString(h, 0, NULL, &sz);
|
||||
ok(r == ERROR_SUCCESS, "failed to get string from integer\n");
|
||||
ok(sz == 2, "length wrong\n");
|
||||
buf[0]=0;
|
||||
sz = sizeof buf;
|
||||
r = MsiRecordGetString(h, 0, buf, &sz);
|
||||
|
@ -258,10 +262,15 @@ static void test_msirecord(void)
|
|||
r = MsiRecordSetInteger(h, 0, -32);
|
||||
ok(r == ERROR_SUCCESS, "Failed to set integer at 0 to 32\n");
|
||||
buf[0]=0;
|
||||
sz = 1;
|
||||
r = MsiRecordGetString(h, 0, NULL, &sz);
|
||||
ok(r == ERROR_SUCCESS, "failed to get string from integer\n");
|
||||
ok(sz == 3, "length wrong\n");
|
||||
sz = sizeof buf;
|
||||
r = MsiRecordGetString(h, 0, buf, &sz);
|
||||
ok(r == ERROR_SUCCESS, "failed to get string from integer\n");
|
||||
ok(0==strcmp(buf,"-32"), "failed to get string from integer\n");
|
||||
buf[0]=0;
|
||||
|
||||
/* same record, now try streams */
|
||||
r = MsiRecordSetStream(h, 0, NULL);
|
||||
|
|
Loading…
Reference in New Issue