We derive the effects of dark matter (DM) decays and annihilations on structure formation. We consider moderately massive DM particles ( sterile neutrinos and light DM), as they are expected to give the maximum contribution to heating and reionization. The energy injection from DM decays and annihilations produces both an enhancement in the abundance of coolants (H-2 and HD) and an increase of gas temperature. We find that for all the considered DM models the critical halo mass for collapse, m(crit), is generally higher than in the unperturbed case. However, the variation of mcrit is small. In the most extreme cases, that is, considering light DM annihilations (decays) and haloes virializing at redshift z(vir) > 30 (z(vir) similar to 10)...