MsiCreateRecord function

The MsiCreateRecord function creates a new record object with the specified number of fields. This function returns a handle that should be closed using MsiCloseHandle.


MSIHANDLE MsiCreateRecord(
  UINT cParams



Specifies the number of fields the record will have. The maximum number of fields in a record is limited to 65535.

Return Value

If the function succeeds, the return value is handle to a new record object.

If the function fails, the return value is null.


Field 0 of the record object created by the MsiCreateRecord function is used for format strings and operation codes and is not included in the count specified by cParams. All fields are initialized to null.

Note that it is recommended to use variables of type PMSIHANDLE because the installer closes PMSIHANDLE objects as they go out of scope, whereas you must close MSIHANDLE objects by calling MsiCloseHandle. For more information see Use PMSIHANDLE instead of HANDLE section in the Windows Installer Best Practices.


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

Database Functions

Record Processing Functions