Commit 7d3162e6 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Abstract MSI_RecordSetStream.

parent 2b4bf44b
......@@ -592,8 +592,7 @@ extern UINT MSI_RecordGetStringA( MSIRECORD *, unsigned int, LPSTR, DWORD *);
extern int MSI_RecordGetInteger( MSIRECORD *, unsigned int );
extern UINT MSI_RecordReadStream( MSIRECORD *, unsigned int, char *, DWORD *);
extern unsigned int MSI_RecordGetFieldCount( MSIRECORD *rec );
extern UINT MSI_RecordSetStreamW( MSIRECORD *, unsigned int, LPCWSTR );
extern UINT MSI_RecordSetStreamA( MSIRECORD *, unsigned int, LPCSTR );
extern UINT MSI_RecordSetStream( MSIRECORD *, unsigned int, IStream * );
extern UINT MSI_RecordDataSize( MSIRECORD *, unsigned int );
extern UINT MSI_RecordStreamToFile( MSIRECORD *, unsigned int, LPCWSTR );
extern UINT MSI_RecordCopyField( MSIRECORD *, unsigned int, MSIRECORD *, unsigned int );
......
......@@ -649,7 +649,19 @@ static UINT RECORD_StreamFromFile(LPCWSTR szFile, IStream **pstm)
return ERROR_SUCCESS;
}
UINT MSI_RecordSetStreamW(MSIRECORD *rec, unsigned int iField, LPCWSTR szFilename)
UINT MSI_RecordSetStream(MSIRECORD *rec, unsigned int 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_RecordSetStreamFromFileW(MSIRECORD *rec, unsigned int iField, LPCWSTR szFilename)
{
IStream *stm = NULL;
HRESULT r;
......@@ -683,9 +695,7 @@ UINT MSI_RecordSetStreamW(MSIRECORD *rec, unsigned int iField, LPCWSTR szFilenam
return r;
/* if all's good, store it in the record */
MSI_FreeField( &rec->fields[iField] );
rec->fields[iField].type = MSIFIELD_STREAM;
rec->fields[iField].u.stream = stm;
MSI_RecordSetStream(rec, iField, stm);
}
return ERROR_SUCCESS;
......@@ -722,7 +732,7 @@ UINT WINAPI MsiRecordSetStreamW(MSIHANDLE handle, unsigned int iField, LPCWSTR s
return ERROR_INVALID_HANDLE;
msiobj_lock( &rec->hdr );
ret = MSI_RecordSetStreamW( rec, iField, szFilename );
ret = MSI_RecordSetStreamFromFileW( rec, iField, szFilename );
msiobj_unlock( &rec->hdr );
msiobj_release( &rec->hdr );
return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment