Effects related with the attenuation and deflection suffered by an electron beam when it passes through a carbon conductive coating and an oxide film layer on the surface of bulk samples are studied by Monte Carlo simulations and energy dispersive spectroscopy with electron excitation. Analytical expressions are provided for the primary beam energy and intensity losses and for the deflection of the incident electrons in both layers, in terms of the incidence energy, the film mass thicknesses, and the atomic number of the oxidized element. From these analytical expressions, suitable corrections are proposed for the models used to describe the X-ray spectrum of the substrate, including also the contribution of the X-rays generated in the oxide and conductive films and the characteristic X-ray absorption occurring in those layers. The corrections are implemented in a software program for spectral analysis based on a routine of parameter refinement, and their influence is studied separately in experimental spectra of single-element standards measured at different excitation energies. Estimates for the layer thicknesses are also obtained from the spectral fitting procedure.