namespace {

    ::MSIHANDLE get ()
    {
        return (::MsiGetLastErrorRecord());
    }

}

namespace w32 { namespace msi {

    ErrorRecord::ErrorRecord ()
        : Object(claim(::get()))
    {
    }

    uint ErrorRecord::fields () const
    {
        const ::UINT result = ::MsiRecordGetFieldCount(handle());
        if ( result == static_cast<::UINT>(-1) ) {
            UNCHECKED_INSTALLER_ERROR(MsiRecordGetFieldCount,result);
        }
        return (result);
    }

    int ErrorRecord::field ( uint index ) const
    {
        return (::MsiRecordGetInteger(handle(),index));
    }

} }
