Electronic structure and chemical characterization of ultrathin insulating films