UINT MSI_RecordSetStringW( MSIRECORD *rec, UINT iField, LPCWSTR szValue ) { LPWSTR str; TRACE("%p %d %s\n", rec, iField, debugstr_w(szValue)); if( iField > rec->count ) return ERROR_INVALID_FIELD; MSI_FreeField( &rec->fields[iField] ); if( szValue && szValue[0] ) { str = strdupW( szValue ); rec->fields[iField].type = MSIFIELD_WSTR; rec->fields[iField].u.szwVal = str; } else { rec->fields[iField].type = MSIFIELD_NULL; rec->fields[iField].u.szwVal = NULL; } return 0; }
void MSI_CloseRecord( MSIOBJECTHDR *arg ) { MSIRECORD *rec = (MSIRECORD *) arg; UINT i; for( i=0; i<=rec->count; i++ ) MSI_FreeField( &rec->fields[i] ); }
UINT MSI_RecordSetStream(MSIRECORD *rec, UINT iField, IStream *stream) { if ( (iField == 0) || (iField > rec->count) ) return ERROR_INVALID_PARAMETER; MSI_FreeField( &rec->fields[iField] ); rec->fields[iField].type = MSIFIELD_STREAM; rec->fields[iField].u.stream = stream; return ERROR_SUCCESS; }
UINT MSI_RecordSetInteger( MSIRECORD *rec, UINT iField, int iVal ) { TRACE("%p %u %d\n", rec, iField, 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; return ERROR_SUCCESS; }
UINT MSI_RecordSetIntPtr( MSIRECORD *rec, UINT iField, INT_PTR pVal ) { TRACE("%p %u %ld\n", rec, iField, pVal); if( iField > rec->count ) return ERROR_INVALID_PARAMETER; MSI_FreeField( &rec->fields[iField] ); rec->fields[iField].type = MSIFIELD_INTPTR; rec->fields[iField].u.pVal = pVal; return ERROR_SUCCESS; }
UINT MSI_RecordSetIStream( MSIRECORD *rec, UINT iField, IStream *stm ) { TRACE("%p %d %p\n", rec, iField, stm); if( iField > rec->count ) return ERROR_INVALID_FIELD; MSI_FreeField( &rec->fields[iField] ); rec->fields[iField].type = MSIFIELD_STREAM; rec->fields[iField].u.stream = stm; IStream_AddRef( stm ); return ERROR_SUCCESS; }
UINT msi_record_set_string( MSIRECORD *rec, UINT field, const WCHAR *value, int len ) { if (field > rec->count) return ERROR_INVALID_FIELD; MSI_FreeField( &rec->fields[field] ); if (value && len < 0) len = strlenW( value ); if (value && len) { rec->fields[field].type = MSIFIELD_WSTR; rec->fields[field].u.szwVal = msi_strdupW( value, len ); rec->fields[field].len = len; } else { rec->fields[field].type = MSIFIELD_NULL; rec->fields[field].u.szwVal = NULL; rec->fields[field].len = 0; } return 0; }
UINT WINAPI MsiRecordClearData( MSIHANDLE handle ) { MSIRECORD *rec; UINT i; TRACE("%d\n", handle ); rec = msihandle2msiinfo( handle, MSIHANDLETYPE_RECORD ); if( !rec ) return ERROR_INVALID_HANDLE; msiobj_lock( &rec->hdr ); for( i=0; i<=rec->count; i++) { MSI_FreeField( &rec->fields[i] ); rec->fields[i].type = MSIFIELD_NULL; rec->fields[i].u.iVal = 0; } msiobj_unlock( &rec->hdr ); msiobj_release( &rec->hdr ); return ERROR_SUCCESS; }