Is there a difference between baked and cooked food?

As I know cooked food has to be in fridge within 2 hours after the preparation to avoid creating appropriate condition for the *Bacilus Cereus* spreading, while bread, cake, pie and other baked food we store several days at room temperature.

Does baking destroy Bacilus Cereus and its spores?