MsiViewGetErrorW function (msiquery.h)
The MsiViewGetError function returns the error that occurred in the MsiViewModify function.
Syntax
MSIDBERROR MsiViewGetErrorW(
[in] MSIHANDLE hView,
[out] LPWSTR szColumnNameBuffer,
[in, out] LPDWORD pcchBuf
);
Parameters
[in] hView
Handle to the view.
[out] szColumnNameBuffer
Pointer to the buffer that receives the null-terminated column name. Do not attempt to determine the size of the buffer by passing in a null (value=0) for szColumnName. You can get the size of the buffer by passing in an empty string (for example ""). The function then returns MSIDBERROR_MOREDATA and pcchBuf contains the required buffer size in TCHARs, not including the terminating null character. On return of MSIDBERROR_NOERROR, pcchBuf contains the number of TCHARs written to the buffer, not including the terminating null character. This parameter is an empty string if there are no errors.
[in, out] pcchBuf
Pointer to the variable that specifies the size, in TCHARs, of the buffer pointed to by the variable szColumnNameBuffer. When the function returns MSIDBERROR_NOERROR, this variable contains the size of the data copied to szColumnNameBuffer, not including the terminating null character. If szColumnNameBuffer is not large enough, the function returns MSIDBERROR_MOREDATA and stores the required size, not including the terminating null character, in the variable pointed to by pcchBuf.
Return value
This function returns one of the following values.
Error code | Meaning |
---|---|
|
An argument was invalid. |
|
The buffer was too small to receive data. |
|
The function failed. |
|
The function completed successfully with no errors. |
|
The new record duplicates primary keys of the existing record in a table. |
|
There are no null values allowed; or the column is about to be deleted, but is referenced by another row. |
|
The corresponding record in a foreign table was not found. |
|
The data is greater than the maximum value allowed. |
|
The data is less than the minimum value allowed. |
|
The data is not a member of the values permitted in the set. |
|
An invalid version string was supplied. |
|
The case was invalid. The case must be all uppercase or all lowercase. |
|
An invalid GUID was supplied. |
|
An invalid wildcard file name was supplied, or the use of wildcards was invalid. |
|
An invalid identifier was supplied. |
|
Invalid language IDs were supplied. |
|
An invalid file name was supplied. |
|
An invalid path was supplied. |
|
An invalid conditional statement was supplied. |
|
An invalid format string was supplied. |
|
An invalid template string was supplied. |
|
An invalid string was supplied in the DefaultDir column of the Directory table. |
|
An invalid registry path string was supplied. |
|
An invalid string was supplied in the CustomSource column of the CustomAction table. |
|
An invalid property string was supplied. |
|
The _Validation table is missing a reference to a column. |
|
The category column of the _Validation table for the column is invalid. |
|
An invalid cabinet name was supplied. |
|
The table in the Keytable column of the _Validation table was not found or loaded. |
|
The value in the MaxValue column of the _Validation table is less than the value in the MinValue column. |
|
An invalid shortcut target name was supplied. |
|
The string is too long for the length specified by the column definition. |
|
An invalid localization attribute was supplied. (Primary keys cannot be localized.) |
Note that in low memory situations, this function can raise a STATUS_NO_MEMORY exception.
Remarks
You should only call the MsiViewGetError function when MsiViewModify returns ERROR_INVALID_DATA, indicating that the data is invalid. Errors are only recorded for MSIMODIFY_VALIDATE, MSIMODIFY_VALIDATE_NEW, and MSIMODIFY_VALIDATEFIELD.
If ERROR_MORE_DATA is returned, the parameter that is a pointer gives the size of the buffer required to hold the string. Upon success, it gives the number of characters written to the string buffer. Therefore you can get the required size of the buffer by passing a small buffer (one character minimum) and examining the value at pcchPathBuf when the function returns MSIDBERROR_MOREDATA. Do not attempt to determine the size of the buffer by passing in null as szColumnNameBuffer or a buffer size of 0 in the DWORD referenced by pcchBuf.
Once MSIDBERROR_NOERROR is returned, no more validation errors remain. The MSIDBERROR return value indicates the type of validation error that occurred for the value located in the column identified by the szColumnNameBuffer.
Note
The msiquery.h header defines MsiViewGetError as an alias that 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 is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
Requirements
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 |