case MSIFIELD_WSTR:
len = WideCharToMultiByte( CP_ACP, 0, rec->fields[iField].u.szwVal, -1,
NULL, 0 , NULL, NULL);
- WideCharToMultiByte( CP_ACP, 0, rec->fields[iField].u.szwVal, -1,
- szValue, *pcchValue, NULL, NULL);
+ if (szValue)
+ WideCharToMultiByte( CP_ACP, 0, rec->fields[iField].u.szwVal, -1,
+ szValue, *pcchValue, NULL, NULL);
if( szValue && *pcchValue && len>*pcchValue )
szValue[*pcchValue-1] = 0;
if( len )
len--;
break;
case MSIFIELD_NULL:
- if( *pcchValue > 0 )
+ if( szValue && *pcchValue > 0 )
szValue[0] = 0;
break;
default:
rec = MsiCreateRecord(2);
ok(rec != 0, "Expected a valid handle\n");
+ sz = MAX_PATH;
+ r = MsiRecordGetString(rec, 1, NULL, &sz);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n",r);
+ ok(sz == 0, "Expected 0, got %d\n",sz);
+
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiRecordGetString(rec, 1, buf, &sz);
r = MsiRecordSetInteger(rec, 1, 5);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+ sz = MAX_PATH;
+ r = MsiRecordGetString(rec, 1, NULL, &sz);
+ ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n",r);
+ ok(sz == 1, "Expected 1, got %d\n",sz);
+
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiRecordGetString(rec, 1, buf, &sz);