MsiRecordSetStreamA function (msiquery.h)

The MsiRecordSetStream function sets a record stream field from a file. Stream data cannot be inserted into temporary fields.


UINT MsiRecordSetStreamA(
  [in] MSIHANDLE hRecord,
  [in] UINT      iField,
  [in] LPCSTR    szFilePath


[in] hRecord

Handle to the record.

[in] iField

Specifies the field of the record to set.

[in] szFilePath

Specifies the path to the file containing the stream.

Return value

The MsiRecordSetStream function returns the following values:


The contents of the file specified in the MsiRecordSetStream function is read into a stream object. The stream persists if the record is inserted into the database and the database is committed.

To reset the stream to its beginning you must pass in a Null pointer for szFilePath. Do not pass a pointer to an empty string, "", to reset the stream.

See also OLE Limitations on Streams.

If the function fails, you can obtain extended error information by using MsiGetLastErrorRecord.


The msiquery.h header defines MsiRecordSetStream as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.


Requirement Value
Minimum supported client Windows Installer 5.0 on Windows Server 2012, Windows 8, Windows Server 2008 R2 or Windows 7. Windows Installer 4.0 or Windows Installer 4.5 on Windows Server 2008 or Windows Vista. Windows Installer on Windows Server 2003 or Windows XP
Target Platform Windows
Header msiquery.h
Library Msi.lib
DLL Msi.dll

See also

Record Processing Functions